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

Commit 5b04dc7c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "More improve IME transition during task switch" into sc-v2-dev

parents 6357c1c4 8169ca01
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -88,4 +88,9 @@ oneway interface ITaskOrganizer {
     * user has pressed back on the root activity of a task controlled by the task organizer.
     * user has pressed back on the root activity of a task controlled by the task organizer.
     */
     */
    void onBackPressedOnTaskRoot(in ActivityManager.RunningTaskInfo taskInfo);
    void onBackPressedOnTaskRoot(in ActivityManager.RunningTaskInfo taskInfo);

    /**
     * Called when the IME has drawn on the organized task.
     */
    void onImeDrawnOnTask(int taskId);
}
}
+9 −0
Original line number Original line Diff line number Diff line
@@ -144,6 +144,10 @@ public class TaskOrganizer extends WindowOrganizer {
    @BinderThread
    @BinderThread
    public void onBackPressedOnTaskRoot(@NonNull ActivityManager.RunningTaskInfo taskInfo) {}
    public void onBackPressedOnTaskRoot(@NonNull ActivityManager.RunningTaskInfo taskInfo) {}


    /** @hide */
    @BinderThread
    public void onImeDrawnOnTask(int taskId) {}

    /**
    /**
     * Creates a persistent root task in WM for a particular windowing-mode.
     * Creates a persistent root task in WM for a particular windowing-mode.
     * @param displayId The display to create the root task on.
     * @param displayId The display to create the root task on.
@@ -288,6 +292,11 @@ public class TaskOrganizer extends WindowOrganizer {
        public void onBackPressedOnTaskRoot(ActivityManager.RunningTaskInfo info) {
        public void onBackPressedOnTaskRoot(ActivityManager.RunningTaskInfo info) {
            mExecutor.execute(() -> TaskOrganizer.this.onBackPressedOnTaskRoot(info));
            mExecutor.execute(() -> TaskOrganizer.this.onBackPressedOnTaskRoot(info));
        }
        }

        @Override
        public void onImeDrawnOnTask(int taskId) {
            mExecutor.execute(() -> TaskOrganizer.this.onImeDrawnOnTask(taskId));
        }
    };
    };


    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
+7 −0
Original line number Original line Diff line number Diff line
@@ -339,6 +339,13 @@ public class ShellTaskOrganizer extends TaskOrganizer implements
        }
        }
    }
    }


    @Override
    public void onImeDrawnOnTask(int taskId) {
        if (mStartingWindow != null) {
            mStartingWindow.onImeDrawnOnTask(taskId);
        }
    }

    @Override
    @Override
    public void onTaskAppeared(RunningTaskInfo taskInfo, SurfaceControl leash) {
    public void onTaskAppeared(RunningTaskInfo taskInfo, SurfaceControl leash) {
        synchronized (mLock) {
        synchronized (mLock) {
+12 −2
Original line number Original line Diff line number Diff line
@@ -559,6 +559,15 @@ public class StartingSurfaceDrawer {
        removeWindowSynced(taskId, null, null, false);
        removeWindowSynced(taskId, null, null, false);
    }
    }


    void onImeDrawnOnTask(int taskId) {
        final StartingWindowRecord record = mStartingWindowRecords.get(taskId);
        if (record != null && record.mTaskSnapshotWindow != null
                && record.mTaskSnapshotWindow.hasImeSurface()) {
            record.mTaskSnapshotWindow.removeImmediately();
        }
        mStartingWindowRecords.remove(taskId);
    }

    protected void removeWindowSynced(int taskId, SurfaceControl leash, Rect frame,
    protected void removeWindowSynced(int taskId, SurfaceControl leash, Rect frame,
            boolean playRevealAnimation) {
            boolean playRevealAnimation) {
        final StartingWindowRecord record = mStartingWindowRecords.get(taskId);
        final StartingWindowRecord record = mStartingWindowRecords.get(taskId);
@@ -586,14 +595,15 @@ public class StartingSurfaceDrawer {
                    Slog.e(TAG, "Found empty splash screen, remove!");
                    Slog.e(TAG, "Found empty splash screen, remove!");
                    removeWindowInner(record.mDecorView, false);
                    removeWindowInner(record.mDecorView, false);
                }
                }
                mStartingWindowRecords.remove(taskId);
            }
            }
            if (record.mTaskSnapshotWindow != null) {
            if (record.mTaskSnapshotWindow != null) {
                if (DEBUG_TASK_SNAPSHOT) {
                if (DEBUG_TASK_SNAPSHOT) {
                    Slog.v(TAG, "Removing task snapshot window for " + taskId);
                    Slog.v(TAG, "Removing task snapshot window for " + taskId);
                }
                }
                record.mTaskSnapshotWindow.remove();
                record.mTaskSnapshotWindow.scheduleRemove(
                        () -> mStartingWindowRecords.remove(taskId));
            }
            }
            mStartingWindowRecords.remove(taskId);
        }
        }
    }
    }


+7 −0
Original line number Original line Diff line number Diff line
@@ -176,6 +176,13 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo
                () -> mStartingSurfaceDrawer.onAppSplashScreenViewRemoved(taskId));
                () -> mStartingSurfaceDrawer.onAppSplashScreenViewRemoved(taskId));
    }
    }


    /**
     * Called when the IME has drawn on the organized task.
     */
    public void onImeDrawnOnTask(int taskId) {
        mSplashScreenExecutor.execute(() -> mStartingSurfaceDrawer.onImeDrawnOnTask(taskId));
    }

    /**
    /**
     * Called when the content of a task is ready to show, starting window can be removed.
     * Called when the content of a task is ready to show, starting window can be removed.
     */
     */
Loading