Escalate HeadsUp when dreaming starts

am: 994153944e

Change-Id: I3b5c8589278bf0f8bbf53f21dc6ae242a6682fff
This commit is contained in:
Selim Cinek
2016-09-13 02:08:52 +00:00
committed by android-build-merger
5 changed files with 44 additions and 3 deletions

View File

@@ -141,6 +141,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private static final int MSG_SERVICE_STATE_CHANGE = 330;
private static final int MSG_SCREEN_TURNED_ON = 331;
private static final int MSG_SCREEN_TURNED_OFF = 332;
private static final int MSG_DREAMING_STATE_CHANGED = 333;
/** Fingerprint state: Not listening to fingerprint. */
private static final int FINGERPRINT_STATE_STOPPED = 0;
@@ -293,6 +294,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
handleScreenTurnedOff();
Trace.endSection();
break;
case MSG_DREAMING_STATE_CHANGED:
handleDreamingStateChanged(msg.arg1);
break;
}
}
};
@@ -990,6 +994,17 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
}
}
private void handleDreamingStateChanged(int dreamStart) {
final int count = mCallbacks.size();
boolean showingDream = dreamStart == 1;
for (int i = 0; i < count; i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onDreamingStateChanged(showingDream);
}
}
}
/**
* IMPORTANT: Must be called from UI thread.
*/
@@ -1736,6 +1751,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
mHandler.sendEmptyMessage(MSG_SCREEN_TURNED_OFF);
}
public void dispatchDreamingStarted() {
mHandler.sendMessage(mHandler.obtainMessage(MSG_DREAMING_STATE_CHANGED, 1, 0));
}
public void dispatchDreamingStopped() {
mHandler.sendMessage(mHandler.obtainMessage(MSG_DREAMING_STATE_CHANGED, 0, 0));
}
public boolean isDeviceInteractive() {
return mDeviceInteractive;
}

View File

@@ -245,4 +245,10 @@ public class KeyguardUpdateMonitorCallback {
* Called when the state whether we have a lockscreen wallpaper has changed.
*/
public void onHasLockscreenWallpaperChanged(boolean hasLockscreenWallpaper) { }
/**
* Called when the dream's window state is changed.
* @param dreaming true if the dream's window has been created and is visible
*/
public void onDreamingStateChanged(boolean dreaming) { }
}

View File

@@ -964,6 +964,7 @@ public class KeyguardViewMediator extends SystemUI {
* if there is a secure lock pattern.
*/
public void onDreamingStarted() {
KeyguardUpdateMonitor.getInstance(mContext).dispatchDreamingStarted();
synchronized (this) {
if (mDeviceInteractive
&& mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())) {
@@ -976,6 +977,7 @@ public class KeyguardViewMediator extends SystemUI {
* A dream stopped.
*/
public void onDreamingStopped() {
KeyguardUpdateMonitor.getInstance(mContext).dispatchDreamingStopped();
synchronized (this) {
if (mDeviceInteractive) {
cancelDoKeyguardLaterLocked();

View File

@@ -664,6 +664,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private boolean mNoAnimationOnNextBarModeChange;
private FalsingManager mFalsingManager;
private KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() {
@Override
public void onDreamingStateChanged(boolean dreaming) {
if (dreaming) {
maybeEscalateHeadsUp();
}
}
};
@Override
public void start() {
mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
@@ -701,8 +710,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mUnlockMethodCache.addListener(this);
startKeyguard();
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateCallback);
mDozeServiceHost = new DozeServiceHost();
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mDozeServiceHost);
putComponent(DozeHost.class, mDozeServiceHost);
putComponent(PhoneStatusBar.class, this);
@@ -4445,6 +4454,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
if (state == StatusBarState.KEYGUARD) {
removeRemoteInputEntriesKeptUntilCollapsed();
maybeEscalateHeadsUp();
}
mState = state;
mGroupManager.setStatusBarState(state);
@@ -4964,7 +4974,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
}
private final class DozeServiceHost extends KeyguardUpdateMonitorCallback implements DozeHost {
private final class DozeServiceHost implements DozeHost {
// Amount of time to allow to update the time shown on the screen before releasing
// the wakelock. This timeout is design to compensate for the fact that we don't
// currently have a way to know when time display contents have actually been

View File

@@ -381,7 +381,7 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
}
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info) {
if (mIsExpanded) {
if (mIsExpanded || mBar.isBouncerShowing()) {
// The touchable region is always the full area when expanded
return;
}