diff options
7 files changed, 72 insertions, 7 deletions
diff --git a/core/java/com/android/internal/policy/IKeyguardStateCallback.aidl b/core/java/com/android/internal/policy/IKeyguardStateCallback.aidl index db3b40b..3468764 100644 --- a/core/java/com/android/internal/policy/IKeyguardStateCallback.aidl +++ b/core/java/com/android/internal/policy/IKeyguardStateCallback.aidl @@ -19,4 +19,5 @@ interface IKeyguardStateCallback { void onShowingStateChanged(boolean showing); void onSimSecureStateChanged(boolean simSecure); void onInputRestrictedStateChanged(boolean inputRestricted); + void onKeyguardPanelFocusChanged(boolean focused); }
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 7d09c91..2833759 100755 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -175,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) @@ -256,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)} @@ -1518,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; } } }; @@ -1969,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); @@ -1976,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); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LiveLockScreenController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LiveLockScreenController.java index 69720ef..2f290cc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LiveLockScreenController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LiveLockScreenController.java @@ -13,7 +13,10 @@ import android.os.ServiceManager; import android.util.EventLog; import android.view.View; +import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.EventLogTags; +import com.android.systemui.SystemUIApplication; +import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.NotificationPanelView; import com.android.systemui.statusbar.phone.PhoneStatusBar; @@ -46,6 +49,7 @@ public class LiveLockScreenController { private boolean mScreenOnAndInteractive; private String mLlsName; + private KeyguardViewMediator mKeyguardViewMediator; public LiveLockScreenController(Context context, PhoneStatusBar bar, NotificationPanelView panelView) { @@ -57,6 +61,8 @@ public class LiveLockScreenController { mBar = bar; mPanelView = panelView; mPowerManager = context.getSystemService(PowerManager.class); + mKeyguardViewMediator = ((SystemUIApplication) + mContext.getApplicationContext()).getComponent(KeyguardViewMediator.class); registerListener(); try { LiveLockScreenInfo llsInfo = mLLSM.getCurrentLiveLockScreen(); @@ -241,6 +247,7 @@ public class LiveLockScreenController { } public void onLiveLockScreenFocusChanged(boolean hasFocus) { + mKeyguardViewMediator.notifyKeyguardPanelFocusChanged(hasFocus); if (mLiveLockScreenView != null) { // make sure the LLS knows where the notification panel is mLiveLockScreenView.onLockscreenSlideOffsetChanged(hasFocus ? 0f : 1f); diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index f2d44ab..83eb424 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -1765,13 +1765,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { mNavigationBarLeftInLandscape) { requestTransientBars(mNavigationBar); } - boolean focusedWindowIsExternalKeyguard = false; - if (mFocusedWindow != null) { - focusedWindowIsExternalKeyguard = (mFocusedWindow.getAttrs().type - & WindowManager.LayoutParams.TYPE_KEYGUARD_PANEL) != 0; - } if (mShowKeyguardOnLeftSwipe && isKeyguardShowingOrOccluded() - && focusedWindowIsExternalKeyguard) { + && mKeyguardDelegate.isKeyguardPanelFocused()) { // Show keyguard mKeyguardDelegate.showKeyguard(); } @@ -5066,7 +5061,15 @@ public class PhoneWindowManager implements WindowManagerPolicy { if ((attrs.privateFlags & PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT) != 0) { mForceStatusBarTransparent = true; } - } + } else if (attrs.type == TYPE_KEYGUARD_PANEL) { + if (mKeyguardDelegate.isKeyguardPanelFocused()) { + attrs.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; + attrs.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; + } else { + attrs.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; + attrs.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; + } + } boolean appWindow = attrs.type >= FIRST_APPLICATION_WINDOW && attrs.type < FIRST_SYSTEM_WINDOW; diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java index c881984..a223d05 100644 --- a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java +++ b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java @@ -435,4 +435,11 @@ public class KeyguardServiceDelegate { public void showKeyguard() { mKeyguardService.showKeyguard(); } + + public boolean isKeyguardPanelFocused() { + if (mKeyguardService != null) { + return mKeyguardService.isKeyguardPanelFocused(); + } + return false; + } } diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java index ed909f8..31c7a04 100644 --- a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java +++ b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java @@ -253,4 +253,8 @@ public class KeyguardServiceWrapper implements IKeyguardService { Slog.w(TAG, "Remote Exception", e); } } + + public boolean isKeyguardPanelFocused() { + return mKeyguardStateMonitor.isKeyguardPanelFocused(); + } }
\ No newline at end of file diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardStateMonitor.java b/services/core/java/com/android/server/policy/keyguard/KeyguardStateMonitor.java index 30cff03..09f9087 100644 --- a/services/core/java/com/android/server/policy/keyguard/KeyguardStateMonitor.java +++ b/services/core/java/com/android/server/policy/keyguard/KeyguardStateMonitor.java @@ -43,6 +43,7 @@ public class KeyguardStateMonitor extends IKeyguardStateCallback.Stub { private volatile boolean mIsShowing = true; private volatile boolean mSimSecure = true; private volatile boolean mInputRestricted = true; + private volatile boolean mKeyguardPanelFocused = false; private int mCurrentUserId; @@ -70,6 +71,10 @@ public class KeyguardStateMonitor extends IKeyguardStateCallback.Stub { return mInputRestricted; } + public boolean isKeyguardPanelFocused() { + return mKeyguardPanelFocused; + } + @Override // Binder interface public void onShowingStateChanged(boolean showing) { mIsShowing = showing; @@ -80,6 +85,11 @@ public class KeyguardStateMonitor extends IKeyguardStateCallback.Stub { mSimSecure = simSecure; } + @Override // Binder interface + public void onKeyguardPanelFocusChanged(boolean focused) { + mKeyguardPanelFocused = focused; + } + public synchronized void setCurrentUser(int userId) { mCurrentUserId = userId; } @@ -100,5 +110,6 @@ public class KeyguardStateMonitor extends IKeyguardStateCallback.Stub { pw.println(prefix + "mSimSecure=" + mSimSecure); pw.println(prefix + "mInputRestricted=" + mInputRestricted); pw.println(prefix + "mCurrentUserId=" + mCurrentUserId); + pw.println(prefix + "mKeyguardPanelFocused=" + mKeyguardPanelFocused); } }
\ No newline at end of file |