am 4ed2e2d4: am 6b72e9b3: When keyguard is active, only allow the status bar to be opened if it is insecure and covered by another window.
Merge commit '4ed2e2d4cb592aa49fce46b035e85aa14f1f989e'
* commit '4ed2e2d4cb592aa49fce46b035e85aa14f1f989e':
When keyguard is active, only allow the status bar to be opened if it is insecure and covered by another window.
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.