Loading services/core/java/com/android/server/wm/InputMonitor.java +10 −15 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ import static com.android.server.wm.WindowManagerService.LOGTAG_INPUT_FOCUS; import static java.lang.Integer.MAX_VALUE; import android.annotation.Nullable; import android.graphics.Rect; import android.graphics.Region; import android.os.Handler; import android.os.IBinder; Loading Loading @@ -111,7 +110,7 @@ final class InputMonitor { * draw the live-tile above the recents activity, we also need to provide that activity as a * z-layering reference so that we can place the recents input consumer above it. */ private WeakReference<ActivityRecord> mActiveRecentsActivity = null; private WeakReference<Task> mActiveRecentsTask = null; private WeakReference<Task> mActiveRecentsLayerRef = null; private class UpdateInputWindows implements Runnable { Loading Loading @@ -388,13 +387,13 @@ final class InputMonitor { /** * Inform InputMonitor when recents is active so it can enable the recents input consumer. * @param activity The active recents activity. {@code null} means recents is not active. * @param task The active recents task. {@code null} means recents is not active. * @param layer A task whose Z-layer is used as a reference for how to sort the consumer. */ void setActiveRecents(@Nullable ActivityRecord activity, @Nullable Task layer) { final boolean clear = activity == null; final boolean wasActive = mActiveRecentsActivity != null && mActiveRecentsLayerRef != null; mActiveRecentsActivity = clear ? null : new WeakReference<>(activity); void setActiveRecents(@Nullable Task task, @Nullable Task layer) { final boolean clear = task == null; final boolean wasActive = mActiveRecentsTask != null && mActiveRecentsLayerRef != null; mActiveRecentsTask = clear ? null : new WeakReference<>(task); mActiveRecentsLayerRef = clear ? null : new WeakReference<>(layer); if (clear && wasActive) { setUpdateInputWindowsNeededLw(); Loading @@ -415,7 +414,7 @@ final class InputMonitor { if (recentsAnimationInputConsumer != null && focus != null) { // Apply recents input consumer when the focusing window is in recents animation. final boolean shouldApplyRecentsInputConsumer = getWeak(mActiveRecentsActivity) != null && focus.inTransition() getWeak(mActiveRecentsTask) != null && focus.inTransition() // only take focus from the recents activity to avoid intercepting // events before the gesture officially starts. && focus.isActivityTypeHomeOrRecents(); Loading Loading @@ -564,7 +563,6 @@ final class InputMonitor { private boolean mAddRecentsAnimationInputConsumerHandle; private boolean mInDrag; private final Rect mTmpRect = new Rect(); private void updateInputWindows(boolean inDrag) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "updateInputWindows"); Loading @@ -581,18 +579,15 @@ final class InputMonitor { resetInputConsumers(mInputTransaction); // Update recents input consumer layer if active final ActivityRecord activeRecents = getWeak(mActiveRecentsActivity); final Task activeRecents = getWeak(mActiveRecentsTask); if (mAddRecentsAnimationInputConsumerHandle && activeRecents != null && activeRecents.getSurfaceControl() != null) { WindowContainer layer = getWeak(mActiveRecentsLayerRef); layer = layer != null ? layer : activeRecents; // Handle edge-case for SUW where windows don't exist yet if (layer.getSurfaceControl() != null) { final WindowState targetAppMainWindow = activeRecents.findMainWindow(); if (targetAppMainWindow != null) { targetAppMainWindow.getBounds(mTmpRect); mRecentsAnimationInputConsumer.mWindowHandle.touchableRegion.set(mTmpRect); } mRecentsAnimationInputConsumer.mWindowHandle.touchableRegion.set( activeRecents.getBounds()); mRecentsAnimationInputConsumer.show(mInputTransaction, layer); mAddRecentsAnimationInputConsumerHandle = false; } Loading services/core/java/com/android/server/wm/Transition.java +7 −7 Original line number Diff line number Diff line Loading @@ -1453,7 +1453,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { // Clean up input monitors (for recents) final DisplayContent dc = mController.mAtm.mRootWindowContainer.getDisplayContent(mRecentsDisplayId); dc.getInputMonitor().setActiveRecents(null /* activity */, null /* layer */); dc.getInputMonitor().setActiveRecents(null /* task */, null /* layer */); dc.getInputMonitor().updateInputWindowsLw(false /* force */); } if (mTransientLaunches != null) { Loading Loading @@ -2249,7 +2249,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { // Recents has an input-consumer to grab input from the "live tile" app. Set that up here final InputConsumerImpl recentsAnimationInputConsumer = dc.getInputMonitor().getInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION); ActivityRecord recentsActivity = null; Task recentsTask = null; if (recentsAnimationInputConsumer != null) { // Find the top-most going-away task and the recents activity. The top-most // is used as layer reference while the recents is used for registering the consumer Loading @@ -2264,20 +2264,20 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { final int activityType = taskInfo.topActivityType; final boolean isRecents = activityType == ACTIVITY_TYPE_HOME || activityType == ACTIVITY_TYPE_RECENTS; if (isRecents && recentsActivity == null) { recentsActivity = task.getTopVisibleActivity(); if (isRecents && recentsTask == null) { recentsTask = task; } else if (!isRecents && topNonRecentsTask == null) { topNonRecentsTask = task; } } if (recentsActivity != null && topNonRecentsTask != null) { if (recentsTask != null && topNonRecentsTask != null) { recentsAnimationInputConsumer.mWindowHandle.touchableRegion.set( topNonRecentsTask.getBounds()); dc.getInputMonitor().setActiveRecents(recentsActivity, topNonRecentsTask); dc.getInputMonitor().setActiveRecents(recentsTask, topNonRecentsTask); } } if (recentsActivity == null) { if (recentsTask == null) { // No recents activity on `dc`, its probably on a different display. return; } Loading Loading
services/core/java/com/android/server/wm/InputMonitor.java +10 −15 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ import static com.android.server.wm.WindowManagerService.LOGTAG_INPUT_FOCUS; import static java.lang.Integer.MAX_VALUE; import android.annotation.Nullable; import android.graphics.Rect; import android.graphics.Region; import android.os.Handler; import android.os.IBinder; Loading Loading @@ -111,7 +110,7 @@ final class InputMonitor { * draw the live-tile above the recents activity, we also need to provide that activity as a * z-layering reference so that we can place the recents input consumer above it. */ private WeakReference<ActivityRecord> mActiveRecentsActivity = null; private WeakReference<Task> mActiveRecentsTask = null; private WeakReference<Task> mActiveRecentsLayerRef = null; private class UpdateInputWindows implements Runnable { Loading Loading @@ -388,13 +387,13 @@ final class InputMonitor { /** * Inform InputMonitor when recents is active so it can enable the recents input consumer. * @param activity The active recents activity. {@code null} means recents is not active. * @param task The active recents task. {@code null} means recents is not active. * @param layer A task whose Z-layer is used as a reference for how to sort the consumer. */ void setActiveRecents(@Nullable ActivityRecord activity, @Nullable Task layer) { final boolean clear = activity == null; final boolean wasActive = mActiveRecentsActivity != null && mActiveRecentsLayerRef != null; mActiveRecentsActivity = clear ? null : new WeakReference<>(activity); void setActiveRecents(@Nullable Task task, @Nullable Task layer) { final boolean clear = task == null; final boolean wasActive = mActiveRecentsTask != null && mActiveRecentsLayerRef != null; mActiveRecentsTask = clear ? null : new WeakReference<>(task); mActiveRecentsLayerRef = clear ? null : new WeakReference<>(layer); if (clear && wasActive) { setUpdateInputWindowsNeededLw(); Loading @@ -415,7 +414,7 @@ final class InputMonitor { if (recentsAnimationInputConsumer != null && focus != null) { // Apply recents input consumer when the focusing window is in recents animation. final boolean shouldApplyRecentsInputConsumer = getWeak(mActiveRecentsActivity) != null && focus.inTransition() getWeak(mActiveRecentsTask) != null && focus.inTransition() // only take focus from the recents activity to avoid intercepting // events before the gesture officially starts. && focus.isActivityTypeHomeOrRecents(); Loading Loading @@ -564,7 +563,6 @@ final class InputMonitor { private boolean mAddRecentsAnimationInputConsumerHandle; private boolean mInDrag; private final Rect mTmpRect = new Rect(); private void updateInputWindows(boolean inDrag) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "updateInputWindows"); Loading @@ -581,18 +579,15 @@ final class InputMonitor { resetInputConsumers(mInputTransaction); // Update recents input consumer layer if active final ActivityRecord activeRecents = getWeak(mActiveRecentsActivity); final Task activeRecents = getWeak(mActiveRecentsTask); if (mAddRecentsAnimationInputConsumerHandle && activeRecents != null && activeRecents.getSurfaceControl() != null) { WindowContainer layer = getWeak(mActiveRecentsLayerRef); layer = layer != null ? layer : activeRecents; // Handle edge-case for SUW where windows don't exist yet if (layer.getSurfaceControl() != null) { final WindowState targetAppMainWindow = activeRecents.findMainWindow(); if (targetAppMainWindow != null) { targetAppMainWindow.getBounds(mTmpRect); mRecentsAnimationInputConsumer.mWindowHandle.touchableRegion.set(mTmpRect); } mRecentsAnimationInputConsumer.mWindowHandle.touchableRegion.set( activeRecents.getBounds()); mRecentsAnimationInputConsumer.show(mInputTransaction, layer); mAddRecentsAnimationInputConsumerHandle = false; } Loading
services/core/java/com/android/server/wm/Transition.java +7 −7 Original line number Diff line number Diff line Loading @@ -1453,7 +1453,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { // Clean up input monitors (for recents) final DisplayContent dc = mController.mAtm.mRootWindowContainer.getDisplayContent(mRecentsDisplayId); dc.getInputMonitor().setActiveRecents(null /* activity */, null /* layer */); dc.getInputMonitor().setActiveRecents(null /* task */, null /* layer */); dc.getInputMonitor().updateInputWindowsLw(false /* force */); } if (mTransientLaunches != null) { Loading Loading @@ -2249,7 +2249,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { // Recents has an input-consumer to grab input from the "live tile" app. Set that up here final InputConsumerImpl recentsAnimationInputConsumer = dc.getInputMonitor().getInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION); ActivityRecord recentsActivity = null; Task recentsTask = null; if (recentsAnimationInputConsumer != null) { // Find the top-most going-away task and the recents activity. The top-most // is used as layer reference while the recents is used for registering the consumer Loading @@ -2264,20 +2264,20 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { final int activityType = taskInfo.topActivityType; final boolean isRecents = activityType == ACTIVITY_TYPE_HOME || activityType == ACTIVITY_TYPE_RECENTS; if (isRecents && recentsActivity == null) { recentsActivity = task.getTopVisibleActivity(); if (isRecents && recentsTask == null) { recentsTask = task; } else if (!isRecents && topNonRecentsTask == null) { topNonRecentsTask = task; } } if (recentsActivity != null && topNonRecentsTask != null) { if (recentsTask != null && topNonRecentsTask != null) { recentsAnimationInputConsumer.mWindowHandle.touchableRegion.set( topNonRecentsTask.getBounds()); dc.getInputMonitor().setActiveRecents(recentsActivity, topNonRecentsTask); dc.getInputMonitor().setActiveRecents(recentsTask, topNonRecentsTask); } } if (recentsActivity == null) { if (recentsTask == null) { // No recents activity on `dc`, its probably on a different display. return; } Loading