summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java24
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java49
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java4
4 files changed, 65 insertions, 18 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java b/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java
index b194de43a718..eff84c6a6ad5 100644
--- a/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java
+++ b/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java
@@ -76,6 +76,12 @@ public interface ViewMediatorCallback {
void playTrustedSound();
/**
+ * When the bouncer is shown or hides
+ * @param shown
+ */
+ void onBouncerVisiblityChanged(boolean shown);
+
+ /**
* @return true if the screen is on
*/
boolean isScreenOn();
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 8fa66e0fa496..c4d9cf501917 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -613,6 +613,13 @@ public class KeyguardViewMediator extends SystemUI {
}
@Override
+ public void onBouncerVisiblityChanged(boolean shown) {
+ synchronized (KeyguardViewMediator.this) {
+ adjustStatusBarLocked(shown);
+ }
+ }
+
+ @Override
public void playTrustedSound() {
KeyguardViewMediator.this.playTrustedSound();
}
@@ -1862,6 +1869,10 @@ public class KeyguardViewMediator extends SystemUI {
}
private void adjustStatusBarLocked() {
+ adjustStatusBarLocked(false /* forceHideHomeRecentsButtons */);
+ }
+
+ private void adjustStatusBarLocked(boolean forceHideHomeRecentsButtons) {
if (mStatusBarManager == null) {
mStatusBarManager = (StatusBarManager)
mContext.getSystemService(Context.STATUS_BAR_SERVICE);
@@ -1872,19 +1883,14 @@ public class KeyguardViewMediator extends SystemUI {
// Disable aspects of the system/status/navigation bars that must not be re-enabled by
// windows that appear on top, ever
int flags = StatusBarManager.DISABLE_NONE;
- if (mShowing) {
- // Permanently disable components not available when keyguard is enabled
- // (like recents). Temporary enable/disable (e.g. the "back" button) are
- // done in KeyguardHostView.
- flags |= StatusBarManager.DISABLE_RECENT;
- }
- if (isShowingAndNotOccluded()) {
- flags |= StatusBarManager.DISABLE_HOME;
+ if (forceHideHomeRecentsButtons || isShowingAndNotOccluded()) {
+ flags |= StatusBarManager.DISABLE_HOME | StatusBarManager.DISABLE_RECENT;
}
if (DEBUG) {
Log.d(TAG, "adjustStatusBarLocked: mShowing=" + mShowing + " mOccluded=" + mOccluded
- + " isSecure=" + isSecure() + " --> flags=0x" + Integer.toHexString(flags));
+ + " isSecure=" + isSecure() + " force=" + forceHideHomeRecentsButtons
+ + " --> flags=0x" + Integer.toHexString(flags));
}
mStatusBarManager.disable(flags);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
index 663f20678299..8359690b4fe3 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
@@ -24,6 +24,8 @@ import static com.android.systemui.statusbar.phone.StatusBar.SYSTEM_DIALOG_REASO
import android.app.ActivityManager;
import android.app.ActivityOptions;
+import android.app.KeyguardManager;
+import android.app.trust.TrustManager;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
@@ -32,6 +34,7 @@ import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
+import android.os.AsyncTask.Status;
import android.os.Handler;
import android.os.SystemClock;
import android.util.ArraySet;
@@ -225,6 +228,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
}
};
+ private TrustManager mTrustManager;
protected Context mContext;
protected Handler mHandler;
TaskStackListenerImpl mTaskStackListener;
@@ -271,6 +275,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
// Initialize the static configuration resources
mDummyStackView = new TaskStackView(mContext);
reloadResources();
+
+ mTrustManager = (TrustManager) mContext.getSystemService(Context.TRUST_SERVICE);
}
public void onBootCompleted() {
@@ -309,8 +315,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
* {@link Recents#onBusEvent(ScreenPinningRequestEvent)}.
*/
public void onStartScreenPinning(Context context, int taskId) {
- SystemUIApplication app = (SystemUIApplication) context;
- StatusBar statusBar = app.getComponent(StatusBar.class);
+ final StatusBar statusBar = getStatusBar();
if (statusBar != null) {
statusBar.showScreenPinningRequest(taskId, false);
}
@@ -350,8 +355,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
if (forceVisible || !ssp.isRecentsActivityVisible(isHomeStackVisible)) {
ActivityManager.RunningTaskInfo runningTask =
ActivityManagerWrapper.getInstance().getRunningTask();
- startRecentsActivity(runningTask, isHomeStackVisible.value || fromHome, animate,
- growTarget);
+ startRecentsActivityAndDismissKeyguardIfNeeded(runningTask,
+ isHomeStackVisible.value || fromHome, animate, growTarget);
}
} catch (ActivityNotFoundException e) {
Log.e(TAG, "Failed to launch RecentsActivity", e);
@@ -442,8 +447,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
// Otherwise, start the recents activity
ActivityManager.RunningTaskInfo runningTask =
ActivityManagerWrapper.getInstance().getRunningTask();
- startRecentsActivity(runningTask, isHomeStackVisible.value, true /* animate */,
- growTarget);
+ startRecentsActivityAndDismissKeyguardIfNeeded(runningTask,
+ isHomeStackVisible.value, true /* animate */, growTarget);
// Only close the other system windows if we are actually showing recents
ActivityManagerWrapper.getInstance().closeSystemWindows(
@@ -462,6 +467,12 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
return;
}
+ // Skip preloading recents when keyguard is showing
+ final StatusBar statusBar = getStatusBar();
+ if (statusBar != null && statusBar.isKeyguardShowing()) {
+ return;
+ }
+
// Preload only the raw task list into a new load plan (which will be consumed by the
// RecentsActivity) only if there is a task to animate to. Post this to ensure that we
// don't block the touch feedback on the nav bar button which triggers this.
@@ -942,9 +953,27 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
}
/**
- * Shows the recents activity
+ * Shows the recents activity after dismissing the keyguard if visible
*/
- protected void startRecentsActivity(ActivityManager.RunningTaskInfo runningTask,
+ protected void startRecentsActivityAndDismissKeyguardIfNeeded(
+ final ActivityManager.RunningTaskInfo runningTask, final boolean isHomeStackVisible,
+ final boolean animate, final int growTarget) {
+ // Preload only if device for current user is unlocked
+ final StatusBar statusBar = getStatusBar();
+ if (statusBar != null && statusBar.isKeyguardShowing()) {
+ statusBar.executeRunnableDismissingKeyguard(() -> {
+ // Flush trustmanager before checking device locked per user when preloading
+ mTrustManager.reportKeyguardShowingChanged();
+ mHandler.post(() -> startRecentsActivity(runningTask, isHomeStackVisible,
+ animate, growTarget));
+ }, null, true /* dismissShade */, false /* afterKeyguardGone */,
+ true /* deferred */);
+ } else {
+ startRecentsActivity(runningTask, isHomeStackVisible, animate, growTarget);
+ }
+ }
+
+ private void startRecentsActivity(ActivityManager.RunningTaskInfo runningTask,
boolean isHomeStackVisible, boolean animate, int growTarget) {
RecentsTaskLoader loader = Recents.getTaskLoader();
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
@@ -1033,6 +1062,10 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
return result;
}
+ private StatusBar getStatusBar() {
+ return ((SystemUIApplication) mContext).getComponent(StatusBar.class);
+ }
+
/**
* Starts the recents activity.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
index c281379fb796..b71ebfdcfb75 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -16,7 +16,6 @@
package com.android.systemui.statusbar.phone;
-import android.app.ActivityManager;
import android.content.Context;
import android.os.Handler;
import android.os.UserHandle;
@@ -122,6 +121,8 @@ public class KeyguardBouncer {
// Split up the work over multiple frames.
DejankUtils.postAfterTraversal(mShowRunnable);
+
+ mCallback.onBouncerVisiblityChanged(true /* shown */);
}
private final Runnable mShowRunnable = new Runnable() {
@@ -182,6 +183,7 @@ public class KeyguardBouncer {
mDismissCallbackRegistry.notifyDismissCancelled();
}
mFalsingManager.onBouncerHidden();
+ mCallback.onBouncerVisiblityChanged(false /* shown */);
cancelShowRunnable();
if (mKeyguardView != null) {
mKeyguardView.cancelDismissAction();