Apply power mode when unlocking
The order of startActivity and keyguardGoingAway from keyguard is not always the same. If keyguardGoingAway is called first, then it is fine that the later startActivity can resume the target activity normally. But if startActivity is called first, it is unable to predict whether keyguard will hide, so the activity will be invisible and cancel launch power mode in a short time. E.g. click a notification item on lockscreen to hot launch an activity (no show-when-locked) from background. The activity will be set to invisible from ActivityStarter#recycleTask > resumeTargetRootTaskIfNeeded > TaskFragment#resumeTopActivity > RWC#ensureVisibilityAndConfig > EnsureActivitiesVisibleHelper#setActivityVisibilityState > ActivityRecord#makeInvisible > addToStopping > scheduleIdle > activityIdleInternal > allResumedActivitiesIdle finish power mode because no activity is resumed. Because the keyguard state is still showing. Instead of trying to guess what the action keyguard will perform (and distinguish whether the startActivity is from keyguard), just apply power mode when keyguard requests to be going away, then it can still cover most of app launch operation. Though the power mode period may become 2 parts, the first short part is startActivity (end in a short time), and then the longer part is keyguardGoingAway ~ app reports idle (after first frame drawn). This could also benefit general unlock without launching activity. Bug: 332221147 Flag: EXEMPT bugfix Test: Hot launch app from notification on lockscreen. Check trace StartModeLaunch ~ EndModeLaunch. The duration can cover most of "launching: $pkgName". Change-Id: I2383eaacdef9830a9b6fe638b2953f6a069f8d32
Loading
Please register or sign in to comment