Loading policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +21 −0 Original line number Diff line number Diff line Loading @@ -935,6 +935,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { Intent.EXTRA_DOCK_STATE_UNDOCKED); } // register for dream-related broadcasts filter = new IntentFilter(); filter.addAction(Intent.ACTION_DREAMING_STARTED); filter.addAction(Intent.ACTION_DREAMING_STOPPED); context.registerReceiver(mDreamReceiver, filter); // register for multiuser-relevant broadcasts filter = new IntentFilter(Intent.ACTION_USER_SWITCHED); context.registerReceiver(mMultiuserReceiver, filter); Loading Loading @@ -3621,6 +3627,21 @@ public class PhoneWindowManager implements WindowManagerPolicy { } }; BroadcastReceiver mDreamReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (Intent.ACTION_DREAMING_STARTED.equals(intent.getAction())) { if (mKeyguardMediator != null) { mKeyguardMediator.onDreamingStarted(); } } else if (Intent.ACTION_DREAMING_STOPPED.equals(intent.getAction())) { if (mKeyguardMediator != null) { mKeyguardMediator.onDreamingStopped(); } } } }; BroadcastReceiver mMultiuserReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java +76 −45 Original line number Diff line number Diff line Loading @@ -535,6 +535,16 @@ public class KeyguardViewMediator { resetStateLocked(null); } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT || (why == WindowManagerPolicy.OFF_BECAUSE_OF_USER && !lockImmediately)) { doKeyguardLaterLocked(); } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_PROX_SENSOR) { // Do not enable the keyguard if the prox sensor forced the screen off. } else { doKeyguardLocked(); } } } private void doKeyguardLaterLocked() { // if the screen turned off because of timeout or the user hit the power button // and we don't need to lock immediately, set an alarm // to enable it a little bit later (i.e, give the user a chance Loading Loading @@ -579,12 +589,10 @@ public class KeyguardViewMediator { if (DEBUG) Log.d(TAG, "setting alarm to turn off keyguard, seq = " + mDelayedShowingSequence); } } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_PROX_SENSOR) { // Do not enable the keyguard if the prox sensor forced the screen off. } else { doKeyguardLocked(); } } private void cancelDoKeyguardLaterLocked() { mDelayedShowingSequence++; } /** Loading @@ -593,7 +601,7 @@ public class KeyguardViewMediator { public void onScreenTurnedOn(KeyguardViewManager.ShowListener showListener) { synchronized (this) { mScreenOn = true; mDelayedShowingSequence++; cancelDoKeyguardLaterLocked(); if (DEBUG) Log.d(TAG, "onScreenTurnedOn, seq = " + mDelayedShowingSequence); if (showListener != null) { notifyScreenOnLocked(showListener); Loading @@ -612,6 +620,29 @@ public class KeyguardViewMediator { } } /** * A dream started. We should lock after the usual screen-off lock timeout but only * if there is a secure lock pattern. */ public void onDreamingStarted() { synchronized (this) { if (mScreenOn && mLockPatternUtils.isSecure()) { doKeyguardLaterLocked(); } } } /** * A dream stopped. */ public void onDreamingStopped() { synchronized (this) { if (mScreenOn) { cancelDoKeyguardLaterLocked(); } } } /** * Same semantics as {@link WindowManagerPolicy#enableKeyguard}; provide * a way for external stuff to override normal keyguard behavior. For instance Loading Loading
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +21 −0 Original line number Diff line number Diff line Loading @@ -935,6 +935,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { Intent.EXTRA_DOCK_STATE_UNDOCKED); } // register for dream-related broadcasts filter = new IntentFilter(); filter.addAction(Intent.ACTION_DREAMING_STARTED); filter.addAction(Intent.ACTION_DREAMING_STOPPED); context.registerReceiver(mDreamReceiver, filter); // register for multiuser-relevant broadcasts filter = new IntentFilter(Intent.ACTION_USER_SWITCHED); context.registerReceiver(mMultiuserReceiver, filter); Loading Loading @@ -3621,6 +3627,21 @@ public class PhoneWindowManager implements WindowManagerPolicy { } }; BroadcastReceiver mDreamReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (Intent.ACTION_DREAMING_STARTED.equals(intent.getAction())) { if (mKeyguardMediator != null) { mKeyguardMediator.onDreamingStarted(); } } else if (Intent.ACTION_DREAMING_STOPPED.equals(intent.getAction())) { if (mKeyguardMediator != null) { mKeyguardMediator.onDreamingStopped(); } } } }; BroadcastReceiver mMultiuserReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java +76 −45 Original line number Diff line number Diff line Loading @@ -535,6 +535,16 @@ public class KeyguardViewMediator { resetStateLocked(null); } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT || (why == WindowManagerPolicy.OFF_BECAUSE_OF_USER && !lockImmediately)) { doKeyguardLaterLocked(); } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_PROX_SENSOR) { // Do not enable the keyguard if the prox sensor forced the screen off. } else { doKeyguardLocked(); } } } private void doKeyguardLaterLocked() { // if the screen turned off because of timeout or the user hit the power button // and we don't need to lock immediately, set an alarm // to enable it a little bit later (i.e, give the user a chance Loading Loading @@ -579,12 +589,10 @@ public class KeyguardViewMediator { if (DEBUG) Log.d(TAG, "setting alarm to turn off keyguard, seq = " + mDelayedShowingSequence); } } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_PROX_SENSOR) { // Do not enable the keyguard if the prox sensor forced the screen off. } else { doKeyguardLocked(); } } private void cancelDoKeyguardLaterLocked() { mDelayedShowingSequence++; } /** Loading @@ -593,7 +601,7 @@ public class KeyguardViewMediator { public void onScreenTurnedOn(KeyguardViewManager.ShowListener showListener) { synchronized (this) { mScreenOn = true; mDelayedShowingSequence++; cancelDoKeyguardLaterLocked(); if (DEBUG) Log.d(TAG, "onScreenTurnedOn, seq = " + mDelayedShowingSequence); if (showListener != null) { notifyScreenOnLocked(showListener); Loading @@ -612,6 +620,29 @@ public class KeyguardViewMediator { } } /** * A dream started. We should lock after the usual screen-off lock timeout but only * if there is a secure lock pattern. */ public void onDreamingStarted() { synchronized (this) { if (mScreenOn && mLockPatternUtils.isSecure()) { doKeyguardLaterLocked(); } } } /** * A dream stopped. */ public void onDreamingStopped() { synchronized (this) { if (mScreenOn) { cancelDoKeyguardLaterLocked(); } } } /** * Same semantics as {@link WindowManagerPolicy#enableKeyguard}; provide * a way for external stuff to override normal keyguard behavior. For instance Loading