Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 6 additions & 0 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,12 @@ java_defaults {
":platform-properties",

":framework-statslog-gen",

// Long screenshot
"core/java/com/android/internal/custom/longshot/ILongScreenshot.aidl",
"core/java/com/android/internal/custom/longshot/ILongScreenshotCallback.aidl",
"core/java/com/android/internal/custom/longshot/ILongScreenshotListener.aidl",
"core/java/com/android/internal/custom/longshot/ILongScreenshotManager.aidl",
],

aidl: {
Expand Down
Binary file modified cmds/statsd/tools/dogfood/res/drawable-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cmds/statsd/tools/dogfood/res/drawable-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cmds/statsd/tools/dogfood/res/drawable-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cmds/statsd/tools/dogfood/res/drawable-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cmds/statsd/tools/loadtest/res/drawable-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cmds/statsd/tools/loadtest/res/drawable-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cmds/statsd/tools/loadtest/res/drawable-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cmds/statsd/tools/loadtest/res/drawable-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions core/java/android/app/SystemServiceRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
import com.android.internal.app.IBatteryStats;
import com.android.internal.app.ISoundTriggerService;
import com.android.internal.appwidget.IAppWidgetService;
import com.android.internal.custom.longshot.LongScreenshotManager;
import com.android.internal.net.INetworkWatchlistManager;
import com.android.internal.os.IDropBoxManagerService;
import com.android.internal.policy.PhoneLayoutInflater;
Expand Down Expand Up @@ -1294,6 +1295,14 @@ public DynamicSystemManager createService(ContextImpl ctx)
return new DynamicSystemManager(
IDynamicSystemService.Stub.asInterface(b));
}});

registerService(Context.LONGSCREENSHOT_SERVICE, LongScreenshotManager.class,
new CachedServiceFetcher<LongScreenshotManager>() {
@Override
public LongScreenshotManager createService(ContextImpl ctx)
throws ServiceNotFoundException {
return LongScreenshotManager.getInstance();
}});
//CHECKSTYLE:ON IndentationCheck
}

Expand Down
6 changes: 6 additions & 0 deletions core/java/android/content/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -4685,6 +4685,12 @@ public abstract boolean startInstrumentation(@NonNull ComponentName className,
*/
public static final String DYNAMIC_SYSTEM_SERVICE = "dynamic_system";

/**
* Long screenshot
* @hide
*/
public static final String LONGSCREENSHOT_SERVICE = "longshot";

/**
* Determine whether the given permission is allowed for a particular
* process and user ID running in the system.
Expand Down
7 changes: 7 additions & 0 deletions core/java/android/view/IWindowManager.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -638,4 +638,11 @@ interface IWindowManager
* native InputManager before proceeding with tests.
*/
void syncInputTransactions();

/**
* Long screenshot
* @hide
*/
void takeOPScreenshot(int type);
void stopLongshotConnection();
}
7 changes: 7 additions & 0 deletions core/java/android/view/InputDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ public final class InputDevice implements Parcelable {
*/
public static final int SOURCE_CLASS_JOYSTICK = 0x00000010;

/**
* The input source is emulated by Longshot
*
* @hide
*/
public static final int SOURCE_CLASS_LONGSHOT = 0x10000000;

/**
* The input source is unknown.
*/
Expand Down
21 changes: 20 additions & 1 deletion core/java/android/view/View.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
import android.widget.ScrollBarDrawable;

import com.android.internal.R;
import com.android.internal.custom.longshot.injector.ViewInjector;
import com.android.internal.view.TooltipPopup;
import com.android.internal.view.menu.MenuBuilder;
import com.android.internal.widget.ScrollBarUtils;
Expand Down Expand Up @@ -15297,6 +15298,7 @@ public boolean onTouchEvent(MotionEvent event) {
|| (viewFlags & LONG_CLICKABLE) == LONG_CLICKABLE)
|| (viewFlags & CONTEXT_CLICKABLE) == CONTEXT_CLICKABLE;

ViewInjector.View.isInjection = event.isFromSource(InputDevice.SOURCE_CLASS_LONGSHOT);
if ((viewFlags & ENABLED_MASK) == DISABLED) {
if (action == MotionEvent.ACTION_UP && (mPrivateFlags & PFLAG_PRESSED) != 0) {
setPressed(false);
Expand All @@ -15312,6 +15314,22 @@ public boolean onTouchEvent(MotionEvent event) {
}
}

if (action == 0 && isInScrollingContainer() && ViewInjector.View.isInjection) {
ViewParent targetView = getParent();
while (true) {
if (targetView == null || !(targetView instanceof ViewGroup)) {
break;
} else if (((ViewGroup) targetView).shouldDelayChildPressedState()) {
int[] position = new int[2];
((ViewGroup) targetView).getLocationOnScreen(position);
ViewInjector.View.setScrolledViewTop(mContext, position[1]);
break;
} else {
targetView = targetView.getParent();
}
}
}

if (clickable || (viewFlags & TOOLTIP) == TOOLTIP) {
switch (action) {
case MotionEvent.ACTION_UP:
Expand Down Expand Up @@ -17982,7 +18000,7 @@ protected boolean awakenScrollBars(int startDelay) {
protected boolean awakenScrollBars(int startDelay, boolean invalidate) {
final ScrollabilityCache scrollCache = mScrollCache;

if (scrollCache == null || !scrollCache.fadeScrollBars) {
if (ViewInjector.View.onAwakenScrollBars(mContext) || scrollCache == null || !scrollCache.fadeScrollBars) {
return false;
}

Expand Down Expand Up @@ -26371,6 +26389,7 @@ protected boolean overScrollBy(int deltaX, int deltaY,
}

onOverScrolled(newScrollX, newScrollY, clampedX, clampedY);
ViewInjector.View.onOverScrolled(mContext, clampedY);

return clampedX || clampedY;
}
Expand Down
6 changes: 6 additions & 0 deletions core/java/android/view/WindowManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,12 @@ public static class LayoutParams extends ViewGroup.LayoutParams implements Parce
*/
public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38;

/**
* Window type: Long screenshot overlay
* @hide
*/
public static final int TYPE_SYSTEM_LONGSHOT = FIRST_SYSTEM_WINDOW + 39;

/**
* End of types of system windows.
*/
Expand Down
5 changes: 5 additions & 0 deletions core/java/android/widget/ScrollView.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import android.view.inspector.InspectableProperty;

import com.android.internal.R;
import com.android.internal.custom.longshot.injector.ScrollViewInjector;

import java.util.List;

Expand Down Expand Up @@ -727,6 +728,8 @@ public boolean onTouchEvent(MotionEvent ev) {
}
vtev.offsetLocation(0, mNestedYOffset);

ScrollViewInjector.ScrollView.isInjection = ev.isFromSource(InputDevice.SOURCE_CLASS_LONGSHOT);

switch (actionMasked) {
case MotionEvent.ACTION_DOWN: {
if (getChildCount() == 0) {
Expand Down Expand Up @@ -815,12 +818,14 @@ public boolean onTouchEvent(MotionEvent ev) {
if (!mEdgeGlowBottom.isFinished()) {
mEdgeGlowBottom.onRelease();
}
ScrollViewInjector.ScrollView.onOverScrolled(mContext, true);
} else if (pulledToY > range) {
mEdgeGlowBottom.onPull((float) deltaY / getHeight(),
1.f - ev.getX(activePointerIndex) / getWidth());
if (!mEdgeGlowTop.isFinished()) {
mEdgeGlowTop.onRelease();
}
ScrollViewInjector.ScrollView.onOverScrolled(mContext, true);
}
if (shouldDisplayEdgeEffects()
&& (!mEdgeGlowTop.isFinished() || !mEdgeGlowBottom.isFinished())) {
Expand Down
8 changes: 7 additions & 1 deletion core/java/android/widget/Toast.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;

import com.android.internal.custom.longshot.LongScreenshotManagerService;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

Expand Down Expand Up @@ -392,7 +394,11 @@ private static class TN extends ITransientNotification.Stub {
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
params.format = PixelFormat.TRANSLUCENT;
params.windowAnimations = com.android.internal.R.style.Animation_Toast;
params.type = WindowManager.LayoutParams.TYPE_TOAST;
if (LongScreenshotManagerService.PACKAGENAME_LONGSHOT.equals(packageName)) {
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_LONGSHOT;
} else {
params.type = WindowManager.LayoutParams.TYPE_TOAST;
}
params.setTitle("Toast");
params.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright (C) 2019 The PixelExperience Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.android.internal.custom.longshot;

import com.android.internal.custom.longshot.ILongScreenshotCallback;

/** @hide */
interface ILongScreenshot {

boolean isHandleState();

boolean isMoveState();

void notifyScroll(boolean isOverScroll);

void notifyScrollViewTop(int viewTop);

void onUnscrollableView();

void start(in ILongScreenshotCallback callback);

void stopLongshot();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright (C) 2019 The PixelExperience Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.android.internal.custom.longshot;

/** @hide */
interface ILongScreenshotCallback {

void notifyMove();

void stop();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright (C) 2019 The PixelExperience Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.android.internal.custom.longshot;

/** @hide */
interface ILongScreenshotListener {

void onMove();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Copyright (C) 2019 The PixelExperience Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.android.internal.custom.longshot;

import com.android.internal.custom.longshot.ILongScreenshotListener;

/** @hide */
interface ILongScreenshotManager {

boolean isLongshotHandleState();

boolean isLongshotMode();

boolean isLongshotMoveState();

void notifyLongshotScroll(boolean isOverScroll);

void notifyScrollViewTop(int viewTop);

void onUnscrollableView();

void registerLongshotListener(in ILongScreenshotListener listener);

void stopLongshot();

void takeLongshot(boolean statusBarVisible, boolean navBarVisible);

void unregisterLongshotListener(in ILongScreenshotListener listener);
}
Loading