When keyguard is active, only allow the status bar to be opened if it is insecure and covered by another window.
Fixes b/2215112 (When screen wakes to Playback screen, Notification Bar is active)
Change-Id: I43a8574259788d983c30b1a22e5bfc4e95d09bee
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java
index 6b9db60..2e97e14 100644
--- a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -22,6 +22,7 @@
import android.app.ActivityManagerNative;
import android.app.AlarmManager;
import android.app.PendingIntent;
+import android.app.StatusBarManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -135,6 +136,7 @@
private Context mContext;
private AlarmManager mAlarmManager;
+ private StatusBarManager mStatusBarManager;
private boolean mSystemReady;
@@ -446,6 +448,7 @@
if (mHidden != isHidden) {
mHidden = isHidden;
adjustUserActivityLocked();
+ adjustStatusBarLocked();
}
}
}
@@ -899,6 +902,7 @@
mKeyguardViewManager.show();
mShowing = true;
adjustUserActivityLocked();
+ adjustStatusBarLocked();
try {
ActivityManagerNative.getDefault().closeSystemDialogs("lock");
} catch (RemoteException e) {
@@ -922,6 +926,7 @@
mKeyguardViewManager.hide();
mShowing = false;
adjustUserActivityLocked();
+ adjustStatusBarLocked();
}
}
@@ -936,6 +941,23 @@
}
}
+ private void adjustStatusBarLocked() {
+ if (mStatusBarManager == null) {
+ mStatusBarManager = (StatusBarManager)
+ mContext.getSystemService(Context.STATUS_BAR_SERVICE);
+ }
+ if (mStatusBarManager == null) {
+ Log.w(TAG, "Could not get status bar manager");
+ } else {
+ // if the keyguard is shown, allow the status bar to open
+ // only if the keyguard is insecure and is covered by another window
+ boolean enable = !mShowing || (mHidden && !isSecure());
+ mStatusBarManager.disable(enable ?
+ StatusBarManager.DISABLE_NONE :
+ StatusBarManager.DISABLE_EXPAND);
+ }
+ }
+
/**
* Handle message sent by {@link #wakeWhenReadyLocked(int)}
* @param keyCode The key that woke the device.