Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7a526b9 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Use task as reference layer for recents input consumer" into main

parents d4ed94e3 863e696e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ final class InputMonitor {
     * z-layering reference so that we can place the recents input consumer above it.
     */
    private WeakReference<ActivityRecord> mActiveRecentsActivity = null;
    private WeakReference<ActivityRecord> mActiveRecentsLayerRef = null;
    private WeakReference<Task> mActiveRecentsLayerRef = null;

    private class UpdateInputWindows implements Runnable {
        @Override
@@ -389,9 +389,9 @@ 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 layer An activity whose Z-layer is used as a reference for how to sort the consumer.
     * @param layer A task whose Z-layer is used as a reference for how to sort the consumer.
     */
    void setActiveRecents(@Nullable ActivityRecord activity, @Nullable ActivityRecord layer) {
    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);
+18 −17
Original line number Diff line number Diff line
@@ -1933,29 +1933,29 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
                dc.getInputMonitor().getInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION);
        ActivityRecord recentsActivity = null;
        if (recentsAnimationInputConsumer != null) {
            // find the top-most going-away activity and the recents activity. The top-most
            // 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
            // override.
            ActivityRecord topActivity = null;
            Task topNonRecentsTask = null;
            for (int i = 0; i < info.getChanges().size(); ++i) {
                final TransitionInfo.Change change = info.getChanges().get(i);
                if (change.getTaskInfo() == null) continue;
                final Task task = Task.fromWindowContainerToken(
                        info.getChanges().get(i).getTaskInfo().token);
                final ActivityManager.RunningTaskInfo taskInfo =
                        info.getChanges().get(i).getTaskInfo();
                if (taskInfo == null) continue;
                final Task task = Task.fromWindowContainerToken(taskInfo.token);
                if (task == null) continue;
                final int activityType = change.getTaskInfo().topActivityType;
                final int activityType = taskInfo.topActivityType;
                final boolean isRecents = activityType == ACTIVITY_TYPE_HOME
                        || activityType == ACTIVITY_TYPE_RECENTS;
                if (isRecents && recentsActivity == null) {
                    recentsActivity = task.getTopVisibleActivity();
                } else if (!isRecents && topActivity == null) {
                    topActivity = task.getTopNonFinishingActivity();
                } else if (!isRecents && topNonRecentsTask == null) {
                    topNonRecentsTask = task;
                }
            }
            if (recentsActivity != null && topActivity != null) {
            if (recentsActivity != null && topNonRecentsTask != null) {
                recentsAnimationInputConsumer.mWindowHandle.touchableRegion.set(
                        topActivity.getBounds());
                dc.getInputMonitor().setActiveRecents(recentsActivity, topActivity);
                        topNonRecentsTask.getBounds());
                dc.getInputMonitor().setActiveRecents(recentsActivity, topNonRecentsTask);
            }
        }

@@ -2020,16 +2020,17 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        }
        mController.mNavigationBarAttachedToApp = false;

        if (mRecentsDisplayId == INVALID_DISPLAY) {
            Slog.e(TAG, "Reparented navigation bar without a valid display");
            mRecentsDisplayId = DEFAULT_DISPLAY;
        int recentsDisplayId = mRecentsDisplayId;
        if (recentsDisplayId == INVALID_DISPLAY) {
            Slog.i(TAG, "Restore parent surface of navigation bar by another transition");
            recentsDisplayId = DEFAULT_DISPLAY;
        }

        final DisplayContent dc =
                mController.mAtm.mRootWindowContainer.getDisplayContent(mRecentsDisplayId);
                mController.mAtm.mRootWindowContainer.getDisplayContent(recentsDisplayId);
        final StatusBarManagerInternal bar = dc.getDisplayPolicy().getStatusBarManagerInternal();
        if (bar != null) {
            bar.setNavigationBarLumaSamplingEnabled(mRecentsDisplayId, true);
            bar.setNavigationBarLumaSamplingEnabled(recentsDisplayId, true);
        }
        final WindowState navWindow = dc.getDisplayPolicy().getNavigationBar();
        if (navWindow == null) return;