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

Commit 3e45f122 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Allow starting activity from visible home if app switch stopped

After returning to home, stopAppSwitches will be called to set
APP_SWITCH_DISALLOW for 500ms. Then it falls to the condition
mCallingUidHasNonAppVisibleWindow because home has a visible
Taskbar window. But it will be logged as wtf event for
BAL_ALLOW_NON_APP_VISIBLE_WINDOW, which is noisy.

This aligns the same condition as
checkBackgroundActivityStartAllowedByRealCallerInForeground.

Bug: 291794451
Flag: EXEMPT bugfix
Test: Swipe to home and launch an app within in a short time.
      There should not have a wtf log for home.
Change-Id: I6ba31b324dc9a3dfe7f205946b9bdb8d7bd5d41b
parent 32521fd2
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1036,8 +1036,10 @@ public class BackgroundActivityStartController {

        // Normal apps with visible app window will be allowed to start activity if app switching
        // is allowed, or apps like live wallpaper with non app visible window will be allowed.
        // The home app can start apps even if app switches are usually disallowed.
        final boolean appSwitchAllowedOrFg = state.mAppSwitchState == APP_SWITCH_ALLOW
                || state.mAppSwitchState == APP_SWITCH_FG_ONLY;
                || state.mAppSwitchState == APP_SWITCH_FG_ONLY
                || isHomeApp(state.mCallingUid, state.mCallingPackage);
        if (appSwitchAllowedOrFg && state.mCallingUidHasVisibleActivity) {
            return new BalVerdict(BAL_ALLOW_VISIBLE_WINDOW,
                    /*background*/ false, "callingUid has visible window");