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

Commit 6575de35 authored by Robin Lee's avatar Robin Lee
Browse files

notifyKeyguardFlagsChanged in setShowWhenLocked

This causes a Transition to be executed immediately if something changed
on screen as a result of the client changing Activity.canShowWhenLocked
directly through setShowWhenLocked/setInheritShowWhenLocked.

Bug: 411544184
Test: KeyguardLockedTests#testShowWhenLockedActivity_removeAttr_hideImmediately
Flag: com.android.window.flags.fix_show_when_locked_sync_timeout
Change-Id: Ib55b3b1bc5f0a5189b6456533f56790d69617aad
parent e36a77d3
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -294,6 +294,17 @@ flag {
  is_fixed_read_only: true
}

flag {
  name: "fix_show_when_locked_sync_timeout"
  namespace: "windowing_frontend"
  description: "Prevent sync timeout from setShowWhenLocked(false) by setting the DisplayContent ready"
  bug: "411544184"
  is_fixed_read_only: true
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
    name: "predictive_back_priority_system_navigation_observer"
    namespace: "systemui"
+19 −7
Original line number Diff line number Diff line
@@ -685,7 +685,7 @@ final class ActivityRecord extends WindowToken {
    long mInputDispatchingTimeoutMillis = DEFAULT_DISPATCHING_TIMEOUT_MILLIS;

    private boolean mShowWhenLocked;
    private boolean mInheritShownWhenLocked;
    private boolean mInheritShowWhenLocked;
    private boolean mTurnScreenOn;

    /**
@@ -1880,7 +1880,7 @@ final class ActivityRecord extends WindowToken {
        mRotationAnimationHint = info.rotationAnimation;

        mShowWhenLocked = (aInfo.flags & ActivityInfo.FLAG_SHOW_WHEN_LOCKED) != 0;
        mInheritShownWhenLocked = (aInfo.privateFlags & FLAG_INHERIT_SHOW_WHEN_LOCKED) != 0;
        mInheritShowWhenLocked = (aInfo.privateFlags & FLAG_INHERIT_SHOW_WHEN_LOCKED) != 0;
        mTurnScreenOn = (aInfo.flags & FLAG_TURN_SCREEN_ON) != 0;

        int realTheme = info.getThemeResource();
@@ -4687,13 +4687,25 @@ final class ActivityRecord extends WindowToken {
    }

    void setShowWhenLocked(boolean showWhenLocked) {
        final boolean changed = (mShowWhenLocked != showWhenLocked);
        mShowWhenLocked = showWhenLocked;

        if (!Flags.fixShowWhenLockedSyncTimeout()) {
            mAtmService.mRootWindowContainer.ensureActivitiesVisible();
        } else if (changed) {
            mDisplayContent.notifyKeyguardFlagsChanged();
        }
    }

    void setInheritShowWhenLocked(boolean inheritShowWhenLocked) {
        mInheritShownWhenLocked = inheritShowWhenLocked;
        final boolean changed = (mInheritShowWhenLocked != inheritShowWhenLocked);
        mInheritShowWhenLocked = inheritShowWhenLocked;

        if (!Flags.fixShowWhenLockedSyncTimeout()) {
            mAtmService.mRootWindowContainer.ensureActivitiesVisible();
        } else if (changed) {
            mDisplayContent.notifyKeyguardFlagsChanged();
        }
    }

    /**
@@ -4702,7 +4714,7 @@ final class ActivityRecord extends WindowToken {
     *         contains windows that have {@link LayoutParams#FLAG_SHOW_WHEN_LOCKED} set or if the
     *         activity has set {@link #mShowWhenLocked}, or if its user
     *         is {@link #mIsUserAlwaysVisible always-visible} or b) if the activity has set
     *         {@link #mInheritShownWhenLocked} and the activity behind this satisfies the
     *         {@link #mInheritShowWhenLocked} and the activity behind this satisfies the
     *         conditions a) above.
     *         Multi-windowing mode will be exited if {@code true} is returned.
     */
@@ -4712,7 +4724,7 @@ final class ActivityRecord extends WindowToken {
        }
        if (canShowWhenLockedInner(r)) {
            return true;
        } else if (r.mInheritShownWhenLocked) {
        } else if (r.mInheritShowWhenLocked) {
            final ActivityRecord activity = r.getTaskFragment().getActivityBelow(r);
            return activity != null && canShowWhenLockedInner(activity);
        } else {