summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sunny Goyal <sunnygoyal@google.com> 2023-04-17 21:38:57 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-04-17 21:38:57 +0000
commit5cc3ba4e3539c80cfdff20310ba8d5fd304e2dbb (patch)
treed9bd44ca7346645c6ca0988fa9d43bc6919a1ca7
parente6ec5c254d864588b44b34102083b8a3d4a3df09 (diff)
parentb112a18042c50b72e04d70b4017641b7ad23347d (diff)
Merge "Passing back the SurfaceControl as part of InputMonitor" into udc-dev am: d55a7a687c am: b112a18042
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22342742 Change-Id: I60496315f3bd93cd6dc0aad924879c705ff0f3d5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--core/java/android/view/InputMonitor.java27
-rw-r--r--services/core/java/com/android/server/input/InputManagerService.java23
2 files changed, 35 insertions, 15 deletions
diff --git a/core/java/android/view/InputMonitor.java b/core/java/android/view/InputMonitor.java
index 8801fe0b47c8..4996f5a41c82 100644
--- a/core/java/android/view/InputMonitor.java
+++ b/core/java/android/view/InputMonitor.java
@@ -43,7 +43,8 @@ public final class InputMonitor implements Parcelable {
private final InputChannel mInputChannel;
@NonNull
private final IInputMonitorHost mHost;
-
+ @NonNull
+ private final SurfaceControl mSurface;
/**
* Takes all of the current pointer events streams that are currently being sent to this
@@ -70,6 +71,7 @@ public final class InputMonitor implements Parcelable {
*/
public void dispose() {
mInputChannel.dispose();
+ mSurface.release();
try {
mHost.dispose();
} catch (RemoteException e) {
@@ -95,13 +97,17 @@ public final class InputMonitor implements Parcelable {
@DataClass.Generated.Member
public InputMonitor(
@NonNull InputChannel inputChannel,
- @NonNull IInputMonitorHost host) {
+ @NonNull IInputMonitorHost host,
+ @NonNull SurfaceControl surface) {
this.mInputChannel = inputChannel;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mInputChannel);
this.mHost = host;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mHost);
+ this.mSurface = surface;
+ com.android.internal.util.AnnotationValidations.validate(
+ NonNull.class, null, mSurface);
// onConstructed(); // You can define this method to get a callback
}
@@ -116,6 +122,11 @@ public final class InputMonitor implements Parcelable {
return mHost;
}
+ @DataClass.Generated.Member
+ public @NonNull SurfaceControl getSurface() {
+ return mSurface;
+ }
+
@Override
@DataClass.Generated.Member
public String toString() {
@@ -124,7 +135,8 @@ public final class InputMonitor implements Parcelable {
return "InputMonitor { " +
"inputChannel = " + mInputChannel + ", " +
- "host = " + mHost +
+ "host = " + mHost + ", " +
+ "surface = " + mSurface +
" }";
}
@@ -136,6 +148,7 @@ public final class InputMonitor implements Parcelable {
dest.writeTypedObject(mInputChannel, flags);
dest.writeStrongInterface(mHost);
+ dest.writeTypedObject(mSurface, flags);
}
@Override
@@ -151,6 +164,7 @@ public final class InputMonitor implements Parcelable {
InputChannel inputChannel = (InputChannel) in.readTypedObject(InputChannel.CREATOR);
IInputMonitorHost host = IInputMonitorHost.Stub.asInterface(in.readStrongBinder());
+ SurfaceControl surface = (SurfaceControl) in.readTypedObject(SurfaceControl.CREATOR);
this.mInputChannel = inputChannel;
com.android.internal.util.AnnotationValidations.validate(
@@ -158,6 +172,9 @@ public final class InputMonitor implements Parcelable {
this.mHost = host;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mHost);
+ this.mSurface = surface;
+ com.android.internal.util.AnnotationValidations.validate(
+ NonNull.class, null, mSurface);
// onConstructed(); // You can define this method to get a callback
}
@@ -177,10 +194,10 @@ public final class InputMonitor implements Parcelable {
};
@DataClass.Generated(
- time = 1637697281750L,
+ time = 1679692514588L,
codegenVersion = "1.0.23",
sourceFile = "frameworks/base/core/java/android/view/InputMonitor.java",
- inputSignatures = "private static final java.lang.String TAG\nprivate static final boolean DEBUG\nprivate final @android.annotation.NonNull android.view.InputChannel mInputChannel\nprivate final @android.annotation.NonNull android.view.IInputMonitorHost mHost\npublic void pilferPointers()\npublic void dispose()\nclass InputMonitor extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true)")
+ inputSignatures = "private static final java.lang.String TAG\nprivate static final boolean DEBUG\nprivate final @android.annotation.NonNull android.view.InputChannel mInputChannel\nprivate final @android.annotation.NonNull android.view.IInputMonitorHost mHost\nprivate final @android.annotation.NonNull android.view.SurfaceControl mSurface\npublic void pilferPointers()\npublic void dispose()\nclass InputMonitor extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true)")
@Deprecated
private void __metadata() {}
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index d0669e7602ed..5f45f912a87a 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -686,13 +686,7 @@ public class InputManagerService extends IInputManager.Stub
@NonNull
private InputChannel createSpyWindowGestureMonitor(IBinder monitorToken, String name,
- int displayId, int pid, int uid) {
- final SurfaceControl sc = mWindowManagerCallbacks.createSurfaceForGestureMonitor(name,
- displayId);
- if (sc == null) {
- throw new IllegalArgumentException(
- "Could not create gesture monitor surface on display: " + displayId);
- }
+ SurfaceControl sc, int displayId, int pid, int uid) {
final InputChannel channel = createInputChannel(name);
try {
@@ -749,9 +743,18 @@ public class InputManagerService extends IInputManager.Stub
final long ident = Binder.clearCallingIdentity();
try {
- final InputChannel inputChannel =
- createSpyWindowGestureMonitor(monitorToken, name, displayId, pid, uid);
- return new InputMonitor(inputChannel, new InputMonitorHost(inputChannel.getToken()));
+ final SurfaceControl sc = mWindowManagerCallbacks.createSurfaceForGestureMonitor(name,
+ displayId);
+ if (sc == null) {
+ throw new IllegalArgumentException(
+ "Could not create gesture monitor surface on display: " + displayId);
+ }
+
+ final InputChannel inputChannel = createSpyWindowGestureMonitor(
+ monitorToken, name, sc, displayId, pid, uid);
+ return new InputMonitor(inputChannel,
+ new InputMonitorHost(inputChannel.getToken()),
+ new SurfaceControl(sc, "IMS.monitorGestureInput"));
} finally {
Binder.restoreCallingIdentity(ident);
}