Controls UI - Blank activity when launched on lock screen

When the user only has swipe security or no security setup, long
pressing on activity would show a blank dialog. Need to dismiss the
keyguard first before taking action. Also make sure controls show
correctly on the lock screen when the device is unlocked.

Fixes: 159895513
Test: manual, PIN lock, swipe lock, no lock, face auth

Change-Id: Iae24e4bd8bb36b0a48fb8a8125c5182fe1f7b4d6
This commit is contained in:
Matt Pietal
2020-06-26 07:48:08 -04:00
parent 3bc3fcfff0
commit 8dad3df933
2 changed files with 16 additions and 9 deletions

View File

@@ -128,15 +128,22 @@ class ControlActionCoordinatorImpl @Inject constructor(
}
private fun bouncerOrRun(action: Action) {
if (!keyguardStateController.isUnlocked()) {
context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS))
if (keyguardStateController.isShowing()) {
var closeGlobalActions = !keyguardStateController.isUnlocked()
if (closeGlobalActions) {
context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS))
// pending actions will only run after the control state has been refreshed
pendingAction = action
// pending actions will only run after the control state has been refreshed
pendingAction = action
}
activityStarter.dismissKeyguardThenExecute({
Log.d(ControlsUiController.TAG, "Device unlocked, invoking controls action")
globalActionsComponent.handleShowGlobalActionsMenu()
if (closeGlobalActions) {
globalActionsComponent.handleShowGlobalActionsMenu()
} else {
action.invoke()
}
true
}, { pendingAction = null }, true /* afterKeyguardGone */)
} else {

View File

@@ -2637,10 +2637,10 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
}
private boolean shouldShowControls() {
return (mKeyguardStateController.isUnlocked() || mShowLockScreenCardsAndControls)
&& controlsAvailable()
&& mLockPatternUtils.getStrongAuthForUser(getCurrentUser().id)
!= STRONG_AUTH_REQUIRED_AFTER_BOOT;
boolean showOnLockScreen = mShowLockScreenCardsAndControls && mLockPatternUtils
.getStrongAuthForUser(getCurrentUser().id) != STRONG_AUTH_REQUIRED_AFTER_BOOT;
return controlsAvailable()
&& (mKeyguardStateController.isUnlocked() || showOnLockScreen);
}
private boolean controlsAvailable() {