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

Commit b168150b authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Move up activity type method to general container

The method name isHomeOrRecentsRootTask is a bit confusing that
the task may not be root. And other level such as activity can
reuse the same method.

Bug: 218847872
Test: CtsActivityManagerDeviceTestCases
Change-Id: If8fa3db0670bd029c776eb047a7cc0913f9ada88
parent c4e5598c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -544,6 +544,11 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
        return getActivityType() == ACTIVITY_TYPE_RECENTS;
    }

    final boolean isActivityTypeHomeOrRecents() {
        final int activityType = getActivityType();
        return activityType == ACTIVITY_TYPE_HOME || activityType == ACTIVITY_TYPE_RECENTS;
    }

    public boolean isActivityTypeAssistant() {
        return getActivityType() == ACTIVITY_TYPE_ASSISTANT;
    }
+1 −1
Original line number Diff line number Diff line
@@ -4062,7 +4062,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
            final boolean renewImeSurface = mImeScreenshot == null
                    || mImeScreenshot.getWidth() != mInputMethodWindow.getFrame().width()
                    || mImeScreenshot.getHeight() != mInputMethodWindow.getFrame().height();
            if (task != null && !task.isHomeOrRecentsRootTask()) {
            if (task != null && !task.isActivityTypeHomeOrRecents()) {
                SurfaceControl.ScreenshotHardwareBuffer imeBuffer = renewImeSurface
                        ? mWmService.mTaskSnapshotController.snapshotImeFromAttachedTask(task)
                        : null;
+3 −3
Original line number Diff line number Diff line
@@ -529,7 +529,7 @@ class RecentTasks {
     */
    void notifyTaskPersisterLocked(Task task, boolean flush) {
        final Task rootTask = task != null ? task.getRootTask() : null;
        if (rootTask != null && rootTask.isHomeOrRecentsRootTask()) {
        if (rootTask != null && rootTask.isActivityTypeHomeOrRecents()) {
            // Never persist the home or recents task.
            return;
        }
@@ -563,7 +563,7 @@ class RecentTasks {

    private static boolean shouldPersistTaskLocked(Task task) {
        final Task rootTask = task.getRootTask();
        return task.isPersistable && (rootTask == null || !rootTask.isHomeOrRecentsRootTask());
        return task.isPersistable && (rootTask == null || !rootTask.isActivityTypeHomeOrRecents());
    }

    void onSystemReadyLocked() {
@@ -994,7 +994,7 @@ class RecentTasks {
            }
            final Task rootTask = task.getRootTask();
            if ((task.isPersistable || task.inRecents)
                    && (rootTask == null || !rootTask.isHomeOrRecentsRootTask())) {
                    && (rootTask == null || !rootTask.isActivityTypeHomeOrRecents())) {
                if (TaskPersister.DEBUG) Slog.d(TAG, "adding to persistentTaskIds task=" + task);
                persistentTaskIds.add(task.mTaskId);
            } else {
+1 −1
Original line number Diff line number Diff line
@@ -613,7 +613,7 @@ public class RecentsAnimationController implements DeathRecipient {
            final TaskFragment adjacentTask = task.getRootTask().getAdjacentTaskFragment();
            final boolean inSplitScreen = task.getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW
                    && adjacentTask != null;
            if (task.isHomeOrRecentsRootTask()
            if (task.isActivityTypeHomeOrRecents()
                    // Skip if the task is in split screen and in landscape.
                    || (inSplitScreen && isDisplayLandscape)
                    // Skip if the task is the top task in split screen.
+3 −7
Original line number Diff line number Diff line
@@ -2711,7 +2711,7 @@ class Task extends TaskFragment {
        // they extend past their root task and sysui uses the root task surface to control
        // cropping.
        // TODO(b/158242495): get rid of this when drag/drop can use surface bounds.
        if (isActivityTypeHome() || isActivityTypeRecents()) {
        if (isActivityTypeHomeOrRecents()) {
            // Make sure this is the top-most non-organizer root task (if not top-most, it means
            // another translucent task could be above this, so this needs to stay cropped.
            final Task rootTask = getRootTask();
@@ -3306,7 +3306,7 @@ class Task extends TaskFragment {
        if (control != null) {
            // We let the transition to be controlled by RecentsAnimation, and callback task's
            // RemoteAnimationTarget for remote runner to animate.
            if (enter && !isHomeOrRecentsRootTask()) {
            if (enter && !isActivityTypeHomeOrRecents()) {
                ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS,
                        "applyAnimationUnchecked, control: %s, task: %s, transit: %s",
                        control, asTask(), AppTransition.appTransitionOldToString(transit));
@@ -4591,10 +4591,6 @@ class Task extends TaskFragment {
                !PRESERVE_WINDOWS);
    }

    final boolean isHomeOrRecentsRootTask() {
        return isActivityTypeHome() || isActivityTypeRecents();
    }

    final boolean isOnHomeDisplay() {
        return getDisplayId() == DEFAULT_DISPLAY;
    }
@@ -5044,7 +5040,7 @@ class Task extends TaskFragment {

        // The transition animation and starting window are not needed if {@code allowMoveToFront}
        // is false, because the activity won't be visible.
        if ((!isHomeOrRecentsRootTask() || hasActivity()) && allowMoveToFront) {
        if ((!isActivityTypeHomeOrRecents() || hasActivity()) && allowMoveToFront) {
            final DisplayContent dc = mDisplayContent;
            if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION,
                    "Prepare open transition: starting " + r);
Loading