Loading core/java/android/view/WindowInfo.java +7 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import android.app.ActivityTaskManager; import android.graphics.Region; import android.os.IBinder; import android.os.Parcel; Loading Loading @@ -51,6 +52,7 @@ public class WindowInfo implements Parcelable { public boolean inPictureInPicture; public boolean hasFlagWatchOutsideTouch; public int displayId = Display.INVALID_DISPLAY; public int taskId = ActivityTaskManager.INVALID_TASK_ID; private WindowInfo() { /* do nothing - hide constructor */ Loading @@ -67,6 +69,7 @@ public class WindowInfo implements Parcelable { public static WindowInfo obtain(WindowInfo other) { WindowInfo window = obtain(); window.displayId = other.displayId; window.taskId = other.taskId; window.type = other.type; window.layer = other.layer; window.token = other.token; Loading Loading @@ -103,6 +106,7 @@ public class WindowInfo implements Parcelable { @Override public void writeToParcel(Parcel parcel, int flags) { parcel.writeInt(displayId); parcel.writeInt(taskId); parcel.writeInt(type); parcel.writeInt(layer); parcel.writeStrongBinder(token); Loading @@ -129,6 +133,7 @@ public class WindowInfo implements Parcelable { builder.append("WindowInfo["); builder.append("title=").append(title); builder.append(", displayId=").append(displayId); builder.append(", taskId=").append(taskId); builder.append(", type=").append(type); builder.append(", layer=").append(layer); builder.append(", token=").append(token); Loading @@ -146,6 +151,7 @@ public class WindowInfo implements Parcelable { private void initFromParcel(Parcel parcel) { displayId = parcel.readInt(); taskId = parcel.readInt(); type = parcel.readInt(); layer = parcel.readInt(); token = parcel.readStrongBinder(); Loading @@ -169,6 +175,7 @@ public class WindowInfo implements Parcelable { private void clear() { displayId = Display.INVALID_DISPLAY; taskId = ActivityTaskManager.INVALID_TASK_ID; type = 0; layer = 0; token = null; Loading core/java/android/view/accessibility/AccessibilityWindowInfo.java +29 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.view.accessibility; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.TestApi; import android.app.ActivityTaskManager; import android.graphics.Rect; import android.graphics.Region; import android.os.Parcel; Loading Loading @@ -114,6 +115,7 @@ public final class AccessibilityWindowInfo implements Parcelable { private int mBooleanProperties; private int mId = UNDEFINED_WINDOW_ID; private int mParentId = UNDEFINED_WINDOW_ID; private int mTaskId = ActivityTaskManager.INVALID_TASK_ID; private Region mRegionInScreen = new Region(); private LongArray mChildIds; private CharSequence mTitle; Loading Loading @@ -306,6 +308,28 @@ public final class AccessibilityWindowInfo implements Parcelable { mId = id; } /** * Gets the task ID. * * @return The task ID. * * @hide */ public int getTaskId() { return mTaskId; } /** * Sets the task ID. * * @param taskId The task ID. * * @hide */ public void setTaskId(int taskId) { mTaskId = taskId; } /** * Sets the unique id of the IAccessibilityServiceConnection over which * this instance can send requests to the system. Loading Loading @@ -578,6 +602,7 @@ public final class AccessibilityWindowInfo implements Parcelable { parcel.writeInt(mBooleanProperties); parcel.writeInt(mId); parcel.writeInt(mParentId); parcel.writeInt(mTaskId); mRegionInScreen.writeToParcel(parcel, flags); parcel.writeCharSequence(mTitle); parcel.writeLong(mAnchorId); Loading Loading @@ -608,6 +633,7 @@ public final class AccessibilityWindowInfo implements Parcelable { mBooleanProperties = other.mBooleanProperties; mId = other.mId; mParentId = other.mParentId; mTaskId = other.mTaskId; mRegionInScreen.set(other.mRegionInScreen); mTitle = other.mTitle; mAnchorId = other.mAnchorId; Loading @@ -631,6 +657,7 @@ public final class AccessibilityWindowInfo implements Parcelable { mBooleanProperties = parcel.readInt(); mId = parcel.readInt(); mParentId = parcel.readInt(); mTaskId = parcel.readInt(); mRegionInScreen = Region.CREATOR.createFromParcel(parcel); mTitle = parcel.readCharSequence(); mAnchorId = parcel.readLong(); Loading Loading @@ -676,6 +703,7 @@ public final class AccessibilityWindowInfo implements Parcelable { builder.append("title=").append(mTitle); builder.append(", displayId=").append(mDisplayId); builder.append(", id=").append(mId); builder.append(", taskId=").append(mTaskId); builder.append(", type=").append(typeToString(mType)); builder.append(", layer=").append(mLayer); builder.append(", region=").append(mRegionInScreen); Loading Loading @@ -719,6 +747,7 @@ public final class AccessibilityWindowInfo implements Parcelable { mBooleanProperties = 0; mId = UNDEFINED_WINDOW_ID; mParentId = UNDEFINED_WINDOW_ID; mTaskId = ActivityTaskManager.INVALID_TASK_ID; mRegionInScreen.setEmpty(); mChildIds = null; mConnectionId = UNDEFINED_WINDOW_ID; Loading core/tests/coretests/src/android/view/WindowInfoTest.java +3 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import android.app.ActivityTaskManager; import android.os.IBinder; import android.os.Parcel; import android.platform.test.annotations.Presubmit; Loading Loading @@ -83,6 +84,7 @@ public class WindowInfoTest { assertEquals(0, w.layer); assertEquals(AccessibilityNodeInfo.UNDEFINED_NODE_ID, w.accessibilityIdOfAnchor); assertEquals(Display.INVALID_DISPLAY, w.displayId); assertEquals(ActivityTaskManager.INVALID_TASK_ID, w.taskId); assertNull(w.title); assertNull(w.token); assertNull(w.childTokens); Loading Loading @@ -123,6 +125,7 @@ public class WindowInfoTest { windowInfo.displayId = 2; windowInfo.layer = 3; windowInfo.accessibilityIdOfAnchor = 4L; windowInfo.taskId = 5; windowInfo.title = "title"; windowInfo.token = mock(IBinder.class); windowInfo.childTokens = new ArrayList<>(); Loading services/accessibility/java/com/android/server/accessibility/AccessibilityWindowManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -499,6 +499,9 @@ public class AccessibilityWindowManager { if (oldWindow.displayId != newWindow.displayId) { return true; } if (oldWindow.taskId != newWindow.taskId) { return true; } return false; } Loading Loading @@ -699,6 +702,7 @@ public class AccessibilityWindowManager { reportedWindow.setAnchorId(window.accessibilityIdOfAnchor); reportedWindow.setPictureInPicture(window.inPictureInPicture); reportedWindow.setDisplayId(window.displayId); reportedWindow.setTaskId(window.taskId); final int parentId = findWindowIdLocked(userId, window.parentToken); if (parentId >= 0) { Loading services/core/java/com/android/server/wm/WindowState.java +2 −0 Original line number Diff line number Diff line Loading @@ -193,6 +193,7 @@ import static com.android.server.wm.WindowStateProto.WINDOW_FRAMES; import android.annotation.CallSuper; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityTaskManager; import android.app.AppOpsManager; import android.app.admin.DevicePolicyCache; import android.app.compat.CompatChanges; Loading Loading @@ -4824,6 +4825,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP windowInfo.focused = isFocused(); Task task = getTask(); windowInfo.inPictureInPicture = (task != null) && task.inPinnedWindowingMode(); windowInfo.taskId = task == null ? ActivityTaskManager.INVALID_TASK_ID : task.mTaskId; windowInfo.hasFlagWatchOutsideTouch = (mAttrs.flags & WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH) != 0; Loading Loading
core/java/android/view/WindowInfo.java +7 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import android.app.ActivityTaskManager; import android.graphics.Region; import android.os.IBinder; import android.os.Parcel; Loading Loading @@ -51,6 +52,7 @@ public class WindowInfo implements Parcelable { public boolean inPictureInPicture; public boolean hasFlagWatchOutsideTouch; public int displayId = Display.INVALID_DISPLAY; public int taskId = ActivityTaskManager.INVALID_TASK_ID; private WindowInfo() { /* do nothing - hide constructor */ Loading @@ -67,6 +69,7 @@ public class WindowInfo implements Parcelable { public static WindowInfo obtain(WindowInfo other) { WindowInfo window = obtain(); window.displayId = other.displayId; window.taskId = other.taskId; window.type = other.type; window.layer = other.layer; window.token = other.token; Loading Loading @@ -103,6 +106,7 @@ public class WindowInfo implements Parcelable { @Override public void writeToParcel(Parcel parcel, int flags) { parcel.writeInt(displayId); parcel.writeInt(taskId); parcel.writeInt(type); parcel.writeInt(layer); parcel.writeStrongBinder(token); Loading @@ -129,6 +133,7 @@ public class WindowInfo implements Parcelable { builder.append("WindowInfo["); builder.append("title=").append(title); builder.append(", displayId=").append(displayId); builder.append(", taskId=").append(taskId); builder.append(", type=").append(type); builder.append(", layer=").append(layer); builder.append(", token=").append(token); Loading @@ -146,6 +151,7 @@ public class WindowInfo implements Parcelable { private void initFromParcel(Parcel parcel) { displayId = parcel.readInt(); taskId = parcel.readInt(); type = parcel.readInt(); layer = parcel.readInt(); token = parcel.readStrongBinder(); Loading @@ -169,6 +175,7 @@ public class WindowInfo implements Parcelable { private void clear() { displayId = Display.INVALID_DISPLAY; taskId = ActivityTaskManager.INVALID_TASK_ID; type = 0; layer = 0; token = null; Loading
core/java/android/view/accessibility/AccessibilityWindowInfo.java +29 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.view.accessibility; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.TestApi; import android.app.ActivityTaskManager; import android.graphics.Rect; import android.graphics.Region; import android.os.Parcel; Loading Loading @@ -114,6 +115,7 @@ public final class AccessibilityWindowInfo implements Parcelable { private int mBooleanProperties; private int mId = UNDEFINED_WINDOW_ID; private int mParentId = UNDEFINED_WINDOW_ID; private int mTaskId = ActivityTaskManager.INVALID_TASK_ID; private Region mRegionInScreen = new Region(); private LongArray mChildIds; private CharSequence mTitle; Loading Loading @@ -306,6 +308,28 @@ public final class AccessibilityWindowInfo implements Parcelable { mId = id; } /** * Gets the task ID. * * @return The task ID. * * @hide */ public int getTaskId() { return mTaskId; } /** * Sets the task ID. * * @param taskId The task ID. * * @hide */ public void setTaskId(int taskId) { mTaskId = taskId; } /** * Sets the unique id of the IAccessibilityServiceConnection over which * this instance can send requests to the system. Loading Loading @@ -578,6 +602,7 @@ public final class AccessibilityWindowInfo implements Parcelable { parcel.writeInt(mBooleanProperties); parcel.writeInt(mId); parcel.writeInt(mParentId); parcel.writeInt(mTaskId); mRegionInScreen.writeToParcel(parcel, flags); parcel.writeCharSequence(mTitle); parcel.writeLong(mAnchorId); Loading Loading @@ -608,6 +633,7 @@ public final class AccessibilityWindowInfo implements Parcelable { mBooleanProperties = other.mBooleanProperties; mId = other.mId; mParentId = other.mParentId; mTaskId = other.mTaskId; mRegionInScreen.set(other.mRegionInScreen); mTitle = other.mTitle; mAnchorId = other.mAnchorId; Loading @@ -631,6 +657,7 @@ public final class AccessibilityWindowInfo implements Parcelable { mBooleanProperties = parcel.readInt(); mId = parcel.readInt(); mParentId = parcel.readInt(); mTaskId = parcel.readInt(); mRegionInScreen = Region.CREATOR.createFromParcel(parcel); mTitle = parcel.readCharSequence(); mAnchorId = parcel.readLong(); Loading Loading @@ -676,6 +703,7 @@ public final class AccessibilityWindowInfo implements Parcelable { builder.append("title=").append(mTitle); builder.append(", displayId=").append(mDisplayId); builder.append(", id=").append(mId); builder.append(", taskId=").append(mTaskId); builder.append(", type=").append(typeToString(mType)); builder.append(", layer=").append(mLayer); builder.append(", region=").append(mRegionInScreen); Loading Loading @@ -719,6 +747,7 @@ public final class AccessibilityWindowInfo implements Parcelable { mBooleanProperties = 0; mId = UNDEFINED_WINDOW_ID; mParentId = UNDEFINED_WINDOW_ID; mTaskId = ActivityTaskManager.INVALID_TASK_ID; mRegionInScreen.setEmpty(); mChildIds = null; mConnectionId = UNDEFINED_WINDOW_ID; Loading
core/tests/coretests/src/android/view/WindowInfoTest.java +3 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import android.app.ActivityTaskManager; import android.os.IBinder; import android.os.Parcel; import android.platform.test.annotations.Presubmit; Loading Loading @@ -83,6 +84,7 @@ public class WindowInfoTest { assertEquals(0, w.layer); assertEquals(AccessibilityNodeInfo.UNDEFINED_NODE_ID, w.accessibilityIdOfAnchor); assertEquals(Display.INVALID_DISPLAY, w.displayId); assertEquals(ActivityTaskManager.INVALID_TASK_ID, w.taskId); assertNull(w.title); assertNull(w.token); assertNull(w.childTokens); Loading Loading @@ -123,6 +125,7 @@ public class WindowInfoTest { windowInfo.displayId = 2; windowInfo.layer = 3; windowInfo.accessibilityIdOfAnchor = 4L; windowInfo.taskId = 5; windowInfo.title = "title"; windowInfo.token = mock(IBinder.class); windowInfo.childTokens = new ArrayList<>(); Loading
services/accessibility/java/com/android/server/accessibility/AccessibilityWindowManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -499,6 +499,9 @@ public class AccessibilityWindowManager { if (oldWindow.displayId != newWindow.displayId) { return true; } if (oldWindow.taskId != newWindow.taskId) { return true; } return false; } Loading Loading @@ -699,6 +702,7 @@ public class AccessibilityWindowManager { reportedWindow.setAnchorId(window.accessibilityIdOfAnchor); reportedWindow.setPictureInPicture(window.inPictureInPicture); reportedWindow.setDisplayId(window.displayId); reportedWindow.setTaskId(window.taskId); final int parentId = findWindowIdLocked(userId, window.parentToken); if (parentId >= 0) { Loading
services/core/java/com/android/server/wm/WindowState.java +2 −0 Original line number Diff line number Diff line Loading @@ -193,6 +193,7 @@ import static com.android.server.wm.WindowStateProto.WINDOW_FRAMES; import android.annotation.CallSuper; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityTaskManager; import android.app.AppOpsManager; import android.app.admin.DevicePolicyCache; import android.app.compat.CompatChanges; Loading Loading @@ -4824,6 +4825,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP windowInfo.focused = isFocused(); Task task = getTask(); windowInfo.inPictureInPicture = (task != null) && task.inPinnedWindowingMode(); windowInfo.taskId = task == null ? ActivityTaskManager.INVALID_TASK_ID : task.mTaskId; windowInfo.hasFlagWatchOutsideTouch = (mAttrs.flags & WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH) != 0; Loading