diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java index e169c0d072db9..dccb1a9214899 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -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; } diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java index 4a2d356b6ddd6..eb29d9b550e32 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java @@ -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) { } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 4449435dde40f..6103355a568e2 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -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(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DismissView.java b/packages/SystemUI/src/com/android/systemui/statusbar/DismissView.java index 2045ec8dfa2d7..1d7bede962d3f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/DismissView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/DismissView.java @@ -56,6 +56,8 @@ public class DismissView extends StackScrollerDecorView { protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDismissButton.setText(R.string.clear_all_notifications_text); + mDismissButton.setContentDescription( + mContext.getString(R.string.accessibility_clear_all)); } public boolean isButtonVisible() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java index 88f37a320926c..8b4225a8ab0b9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java @@ -174,7 +174,10 @@ public class KeyguardAffordanceView extends ImageView { private void drawBackgroundCircle(Canvas canvas) { if (mCircleRadius > 0 || mFinishing) { - if (mFinishing && mSupportHardware) { + if (mFinishing && mSupportHardware && mHwCenterX != null) { + // Our hardware drawing proparties can be null if the finishing started but we have + // never drawn before. In that case we are not doing a render thread animation + // anyway, so we need to use the normal drawing. DisplayListCanvas displayListCanvas = (DisplayListCanvas) canvas; displayListCanvas.drawCircle(mHwCenterX, mHwCenterY, mHwCircleRadius, mHwCirclePaint); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index 9fd09d92162cb..78e56c04ce9bd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -205,7 +205,7 @@ public class NotificationContentView extends FrameLayout { && MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED) { singleLineWidthSpec = MeasureSpec.makeMeasureSpec( width - mSingleLineWidthIndention + mSingleLineView.getPaddingEnd(), - MeasureSpec.AT_MOST); + MeasureSpec.EXACTLY); } mSingleLineView.measure(singleLineWidthSpec, MeasureSpec.makeMeasureSpec(maxSize, MeasureSpec.AT_MOST)); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index b1bea0287ddb4..9251f32099a7c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -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 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java index d3ae54984e994..f6c0942d7ed00 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java @@ -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; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java index 3c9373bd46a27..d7920a9b1e7b3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java @@ -123,8 +123,10 @@ public class NotificationChildrenContainer extends ViewGroup { mDividers.get(i).layout(0, 0, getWidth(), mDividerHeight); } if (mOverflowNumber != null) { - mOverflowNumber.layout(getWidth() - mOverflowNumber.getMeasuredWidth(), 0, getWidth(), - mOverflowNumber.getMeasuredHeight()); + boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL; + int left = (isRtl ? 0 : getWidth() - mOverflowNumber.getMeasuredWidth()); + int right = left + mOverflowNumber.getMeasuredWidth(); + mOverflowNumber.layout(left, 0, right, mOverflowNumber.getMeasuredHeight()); } if (mNotificationHeader != null) { mNotificationHeader.layout(0, 0, mNotificationHeader.getMeasuredWidth(),