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

Commit eaf6e716 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "RESTRICT AUTOMERGE Defer remove splash screen while device is locked" into tm-dev

parents 013d4318 99563107
Loading
Loading
Loading
Loading
+29 −3
Original line number Diff line number Diff line
@@ -2688,6 +2688,19 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        });
    }

    /**
     * If the device is locked and the app does not request showWhenLocked,
     * defer removing the starting window until the transition is complete.
     * This prevents briefly appearing the app context and causing secure concern.
     */
    void deferStartingWindowRemovalForKeyguardUnoccluding() {
        if (mStartingData != null && !mStartingData.mRemoveAfterTransition
                && isKeyguardLocked() && !canShowWhenLockedInner(this) && !isVisibleRequested()
                && isAnimating(PARENTS | CHILDREN, ANIMATION_TYPE_APP_TRANSITION)) {
            mStartingData.mRemoveAfterTransition = true;
        }
    }

    void removeStartingWindow() {
        boolean prevEligibleForLetterboxEducation = isEligibleForLetterboxEducation();

@@ -2727,6 +2740,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        final StartingSurfaceController.StartingSurface surface;
        final StartingData startingData = mStartingData;
        if (mStartingData != null) {
            if (mStartingData.mRemoveAfterTransition) {
                return;
            }
            surface = mStartingSurface;
            mStartingData = null;
            mStartingSurface = null;
@@ -4309,6 +4325,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                tStartingWindow.mToken = this;
                tStartingWindow.mActivityRecord = this;

                mStartingData.mRemoveAfterTransition = false;
                ProtoLog.v(WM_DEBUG_ADD_REMOVE,
                        "Removing starting %s from %s", tStartingWindow, fromActivity);
                mTransitionController.collect(tStartingWindow);
@@ -4464,17 +4481,22 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        if (r == null || r.getTaskFragment() == null) {
            return false;
        }
        if (!r.inPinnedWindowingMode() && (r.mShowWhenLocked || r.containsShowWhenLockedWindow())) {
        if (canShowWhenLockedInner(r)) {
            return true;
        } else if (r.mInheritShownWhenLocked) {
            final ActivityRecord activity = r.getTaskFragment().getActivityBelow(r);
            return activity != null && !activity.inPinnedWindowingMode()
                    && (activity.mShowWhenLocked || activity.containsShowWhenLockedWindow());
            return activity != null && canShowWhenLockedInner(activity);
        } else {
            return false;
        }
    }

    /** @see #canShowWhenLocked(ActivityRecord) */
    private static boolean canShowWhenLockedInner(@NonNull ActivityRecord r) {
        return !r.inPinnedWindowingMode() &&
                (r.mShowWhenLocked || r.containsShowWhenLockedWindow());
    }

    /**
     *  Determines if the activity can show while lock-screen is displayed. System displays
     *  activities while lock-screen is displayed only if all activities
@@ -7372,6 +7394,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            mThumbnail = null;
        }

        if (mStartingData != null && mStartingData.mRemoveAfterTransition) {
            mStartingData.mRemoveAfterTransition = false;
            removeStartingWindowAnimation(false /* prepareAnimation */);
        }
        // WindowState.onExitAnimationDone might modify the children list, so make a copy and then
        // traverse the copy.
        final ArrayList<WindowState> children = new ArrayList<>(mChildren);
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ public abstract class StartingData {
     * when the parent activity of starting window may be put in a partial area of the task.
     */
    Task mAssociatedTask;
    boolean mRemoveAfterTransition;

    protected StartingData(WindowManagerService service, int typeParams) {
        mService = service;
+13 −0
Original line number Diff line number Diff line
@@ -2023,6 +2023,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        }
        final ActivityRecord atoken = mActivityRecord;
        if (atoken != null) {
            if (atoken.mStartingData != null && mAttrs.type != TYPE_APPLICATION_STARTING
                    && atoken.mStartingData.mRemoveAfterTransition) {
                // Preventing app window from visible during un-occluding animation playing due to
                // alpha blending.
                return false;
            }
            return ((!isParentWindowHidden() && atoken.isVisible())
                    || isAnimating(TRANSITION | PARENTS));
        }
@@ -3097,7 +3103,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            final int mask = FLAG_SHOW_WHEN_LOCKED | FLAG_DISMISS_KEYGUARD
                    | FLAG_ALLOW_LOCK_WHILE_SCREEN_ON;
            WindowManager.LayoutParams sa = mActivityRecord.mStartingWindow.mAttrs;
            final boolean wasShowWhenLocked = (sa.flags & FLAG_SHOW_WHEN_LOCKED) != 0;
            final boolean removeShowWhenLocked = (mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) == 0;
            sa.flags = (sa.flags & ~mask) | (mAttrs.flags & mask);
            if (wasShowWhenLocked && removeShowWhenLocked) {
                // Trigger unoccluding animation if needed.
                mActivityRecord.checkKeyguardFlagsChanged();
                mActivityRecord.deferStartingWindowRemovalForKeyguardUnoccluding();
            }
        }
    }