summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java')
-rwxr-xr-xpackages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java84
1 files changed, 75 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 06ce8cc..2833759 100755
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -53,6 +53,7 @@ import android.util.EventLog;
import android.util.Log;
import android.util.Slog;
import android.view.IWindowManager;
+import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManagerGlobal;
import android.view.WindowManagerPolicy;
@@ -61,6 +62,7 @@ import android.view.animation.AnimationUtils;
import com.android.systemui.cm.UserContentObserver;
import com.android.systemui.qs.tiles.LockscreenToggleTile;
+import com.android.systemui.statusbar.StatusBarState;
import cyanogenmod.app.Profile;
import cyanogenmod.app.ProfileManager;
@@ -173,6 +175,7 @@ public class KeyguardViewMediator extends SystemUI {
private static final int NOTIFY_SCREEN_TURNED_ON = 22;
private static final int NOTIFY_SCREEN_TURNED_OFF = 23;
private static final int NOTIFY_STARTED_GOING_TO_SLEEP = 24;
+ private static final int NOTIFY_KEYGUARD_PANEL_FOCUS_CHANGED = 25;
/**
* The default amount of time we stay awake (used for all key input)
@@ -254,6 +257,8 @@ public class KeyguardViewMediator extends SystemUI {
// true if the keyguard is hidden by another window
private boolean mOccluded = false;
+ private boolean mKeyguardPanelFocused = false;
+
/**
* Helps remember whether the screen has turned on since the last time
* it turned off due to timeout. see {@link #onScreenTurnedOff(int)}
@@ -351,6 +356,8 @@ public class KeyguardViewMediator extends SystemUI {
private IKeyguardDrawnCallback mDrawnCallback;
private LockscreenEnabledSettingsObserver mSettingsObserver;
+ private PhoneStatusBar mStatusBar;
+
public static class LockscreenEnabledSettingsObserver extends UserContentObserver {
private static final String KEY_ENABLED = "lockscreen_enabled";
@@ -480,21 +487,20 @@ public class KeyguardViewMediator extends SystemUI {
// only force lock screen in case of missing sim if user hasn't
// gone through setup wizard
synchronized (this) {
- if (shouldWaitForProvisioning()) {
- if (!mShowing) {
- if (DEBUG_SIM_STATES) Log.d(TAG, "ICC_ABSENT isn't showing,"
- + " we need to show the keyguard since the "
- + "device isn't provisioned yet.");
- doKeyguardLocked(null);
- } else {
- resetStateLocked();
- }
+ if (shouldWaitForProvisioning() && !mShowing) {
+ if (DEBUG_SIM_STATES) Log.d(TAG, "ICC_ABSENT isn't showing,"
+ + " we need to show the keyguard since the "
+ + "device isn't provisioned yet.");
+ doKeyguardLocked(null);
+ } else {
+ resetStateLocked();
}
}
break;
case PIN_REQUIRED:
case PUK_REQUIRED:
synchronized (this) {
+ mStatusBar.hideHeadsUp();
if (!mShowing) {
if (DEBUG_SIM_STATES) Log.d(TAG,
"INTENT_VALUE_ICC_LOCKED and keygaurd isn't "
@@ -1291,6 +1297,36 @@ public class KeyguardViewMediator extends SystemUI {
mHandler.sendEmptyMessage(DISMISS);
}
+ public void showKeyguard() {
+ // This is to prevent left edge from interfering
+ // with affordances.
+ if (mStatusBar.isAffordanceSwipeInProgress()
+ || mStatusBar.getBarState() == StatusBarState.KEYGUARD) {
+ return;
+ }
+
+ // Disable edge detector once we're back on lockscreen
+ try {
+ WindowManagerGlobal.getWindowManagerService()
+ .setLiveLockscreenEdgeDetector(false);
+ } catch (RemoteException e){
+ Log.e(TAG, e.getMessage());
+ }
+
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ // Hide status bar window to avoid flicker,
+ // slideNotificationPanelIn will make it visible later.
+ mStatusBar.getStatusBarWindow().setVisibility(View.INVISIBLE);
+ // Get the keyguard into the correct state by calling mStatusBar.showKeyguard()
+ mStatusBar.showKeyguard();
+ // Now have the notification panel slid back into view
+ mStatusBar.slideNotificationPanelIn();
+ }
+ });
+ }
+
/**
* Send message to keyguard telling it to reset its state.
* @see #handleReset
@@ -1485,6 +1521,9 @@ public class KeyguardViewMediator extends SystemUI {
case ON_ACTIVITY_DRAWN:
handleOnActivityDrawn();
break;
+ case NOTIFY_KEYGUARD_PANEL_FOCUS_CHANGED:
+ notifyKeyguardPanelFocusChanged(msg.arg1 != 0);
+ break;
}
}
};
@@ -1865,6 +1904,7 @@ public class KeyguardViewMediator extends SystemUI {
FingerprintUnlockController fingerprintUnlockController) {
mStatusBarKeyguardViewManager.registerStatusBar(phoneStatusBar, container,
statusBarWindowManager, scrimController, fingerprintUnlockController);
+ mStatusBar = phoneStatusBar;
return mStatusBarKeyguardViewManager;
}
@@ -1935,6 +1975,31 @@ public class KeyguardViewMediator extends SystemUI {
}
}
+ public void setKeyguardPanelFocused(boolean focused) {
+ if (DEBUG) Log.d(TAG, "setSlideOffset " + focused);
+ mHandler.removeMessages(NOTIFY_KEYGUARD_PANEL_FOCUS_CHANGED);
+ Message msg = mHandler.obtainMessage(NOTIFY_KEYGUARD_PANEL_FOCUS_CHANGED,
+ focused ? 1 : 0, 0);
+ mHandler.sendMessage(msg);
+ }
+
+ public void notifyKeyguardPanelFocusChanged(boolean focused) {
+ if (focused != mKeyguardPanelFocused) {
+ mKeyguardPanelFocused = focused;
+ int size = mKeyguardStateCallbacks.size();
+ for (int i = size - 1; i >= 0; i--) {
+ try {
+ mKeyguardStateCallbacks.get(i).onKeyguardPanelFocusChanged(focused);
+ } catch (RemoteException e) {
+ Slog.w(TAG, "Failed to call onShowingStateChanged", e);
+ if (e instanceof DeadObjectException) {
+ mKeyguardStateCallbacks.remove(i);
+ }
+ }
+ }
+ }
+ }
+
public void addStateMonitorCallback(IKeyguardStateCallback callback) {
synchronized (this) {
mKeyguardStateCallbacks.add(callback);
@@ -1942,6 +2007,7 @@ public class KeyguardViewMediator extends SystemUI {
callback.onSimSecureStateChanged(mUpdateMonitor.isSimPinSecure());
callback.onShowingStateChanged(mShowing);
callback.onInputRestrictedStateChanged(mInputRestricted);
+ callback.onKeyguardPanelFocusChanged(mKeyguardPanelFocused);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to call onShowingStateChanged or onSimSecureStateChanged or onInputRestrictedStateChanged", e);
}