diff options
author | Roman Birg <roman@cyngn.com> | 2016-09-01 14:09:58 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-09-08 12:46:30 -0700 |
commit | 633a906504d89d3d85084d2e3088f65cfc635a80 (patch) | |
tree | 1399af5c53bab7fec187609a13b6d26c597595dc /packages/SystemUI/src | |
parent | e0f87f165ecf0f44be98c5101ade78d746f3322c (diff) | |
download | frameworks_base-633a906504d89d3d85084d2e3088f65cfc635a80.zip frameworks_base-633a906504d89d3d85084d2e3088f65cfc635a80.tar.gz frameworks_base-633a906504d89d3d85084d2e3088f65cfc635a80.tar.bz2 |
PhoneWindowManager: set focus flags on keyguard panels
Ticket: CYNGNOS-3251
Change-Id: I394514335bdaeafdc7b89918ece1fe3d2794647f
Signed-off-by: Roman Birg <roman@cyngn.com>
Diffstat (limited to 'packages/SystemUI/src')
-rwxr-xr-x | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java | 32 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/LiveLockScreenController.java | 7 |
2 files changed, 39 insertions, 0 deletions
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); |