Merge changes I8604c9d0,I436a3770,If89fd6d2,I6bad3e75 into nyc-mr1-dev

* changes:
  Escalate HeadsUp when dreaming starts
  Overflow number supports RTL layout
  Update contentDescription of the DismissView when locale changes
  Fixes a crash with a renderthread camera animation
This commit is contained in:
TreeHugger Robot
2016-09-13 01:56:33 +00:00
committed by Android (Google) Code Review
9 changed files with 55 additions and 7 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_SERVICE_STATE_CHANGE = 330;
private static final int MSG_SCREEN_TURNED_ON = 331; private static final int MSG_SCREEN_TURNED_ON = 331;
private static final int MSG_SCREEN_TURNED_OFF = 332; private static final int MSG_SCREEN_TURNED_OFF = 332;
private static final int MSG_DREAMING_STATE_CHANGED = 333;
/** Fingerprint state: Not listening to fingerprint. */ /** Fingerprint state: Not listening to fingerprint. */
private static final int FINGERPRINT_STATE_STOPPED = 0; private static final int FINGERPRINT_STATE_STOPPED = 0;
@@ -293,6 +294,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
handleScreenTurnedOff(); handleScreenTurnedOff();
Trace.endSection(); Trace.endSection();
break; 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. * IMPORTANT: Must be called from UI thread.
*/ */
@@ -1736,6 +1751,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
mHandler.sendEmptyMessage(MSG_SCREEN_TURNED_OFF); 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() { public boolean isDeviceInteractive() {
return mDeviceInteractive; return mDeviceInteractive;
} }

View File

@@ -245,4 +245,10 @@ public class KeyguardUpdateMonitorCallback {
* Called when the state whether we have a lockscreen wallpaper has changed. * Called when the state whether we have a lockscreen wallpaper has changed.
*/ */
public void onHasLockscreenWallpaperChanged(boolean hasLockscreenWallpaper) { } 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. * if there is a secure lock pattern.
*/ */
public void onDreamingStarted() { public void onDreamingStarted() {
KeyguardUpdateMonitor.getInstance(mContext).dispatchDreamingStarted();
synchronized (this) { synchronized (this) {
if (mDeviceInteractive if (mDeviceInteractive
&& mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())) { && mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())) {
@@ -976,6 +977,7 @@ public class KeyguardViewMediator extends SystemUI {
* A dream stopped. * A dream stopped.
*/ */
public void onDreamingStopped() { public void onDreamingStopped() {
KeyguardUpdateMonitor.getInstance(mContext).dispatchDreamingStopped();
synchronized (this) { synchronized (this) {
if (mDeviceInteractive) { if (mDeviceInteractive) {
cancelDoKeyguardLaterLocked(); cancelDoKeyguardLaterLocked();

View File

@@ -56,6 +56,8 @@ public class DismissView extends StackScrollerDecorView {
protected void onConfigurationChanged(Configuration newConfig) { protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
mDismissButton.setText(R.string.clear_all_notifications_text); mDismissButton.setText(R.string.clear_all_notifications_text);
mDismissButton.setContentDescription(
mContext.getString(R.string.accessibility_clear_all));
} }
public boolean isButtonVisible() { public boolean isButtonVisible() {

View File

@@ -174,7 +174,10 @@ public class KeyguardAffordanceView extends ImageView {
private void drawBackgroundCircle(Canvas canvas) { private void drawBackgroundCircle(Canvas canvas) {
if (mCircleRadius > 0 || mFinishing) { 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 displayListCanvas = (DisplayListCanvas) canvas;
displayListCanvas.drawCircle(mHwCenterX, mHwCenterY, mHwCircleRadius, displayListCanvas.drawCircle(mHwCenterX, mHwCenterY, mHwCircleRadius,
mHwCirclePaint); mHwCirclePaint);

View File

@@ -205,7 +205,7 @@ public class NotificationContentView extends FrameLayout {
&& MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED) { && MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED) {
singleLineWidthSpec = MeasureSpec.makeMeasureSpec( singleLineWidthSpec = MeasureSpec.makeMeasureSpec(
width - mSingleLineWidthIndention + mSingleLineView.getPaddingEnd(), width - mSingleLineWidthIndention + mSingleLineView.getPaddingEnd(),
MeasureSpec.AT_MOST); MeasureSpec.EXACTLY);
} }
mSingleLineView.measure(singleLineWidthSpec, mSingleLineView.measure(singleLineWidthSpec,
MeasureSpec.makeMeasureSpec(maxSize, MeasureSpec.AT_MOST)); MeasureSpec.makeMeasureSpec(maxSize, MeasureSpec.AT_MOST));

View File

@@ -664,6 +664,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private boolean mNoAnimationOnNextBarModeChange; private boolean mNoAnimationOnNextBarModeChange;
private FalsingManager mFalsingManager; private FalsingManager mFalsingManager;
private KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() {
@Override
public void onDreamingStateChanged(boolean dreaming) {
if (dreaming) {
maybeEscalateHeadsUp();
}
}
};
@Override @Override
public void start() { public void start() {
mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)) mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
@@ -701,8 +710,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mUnlockMethodCache.addListener(this); mUnlockMethodCache.addListener(this);
startKeyguard(); startKeyguard();
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateCallback);
mDozeServiceHost = new DozeServiceHost(); mDozeServiceHost = new DozeServiceHost();
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mDozeServiceHost);
putComponent(DozeHost.class, mDozeServiceHost); putComponent(DozeHost.class, mDozeServiceHost);
putComponent(PhoneStatusBar.class, this); putComponent(PhoneStatusBar.class, this);
@@ -4445,6 +4454,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
} }
if (state == StatusBarState.KEYGUARD) { if (state == StatusBarState.KEYGUARD) {
removeRemoteInputEntriesKeptUntilCollapsed(); removeRemoteInputEntriesKeptUntilCollapsed();
maybeEscalateHeadsUp();
} }
mState = state; mState = state;
mGroupManager.setStatusBarState(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 // 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 // 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 // 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) { public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info) {
if (mIsExpanded) { if (mIsExpanded || mBar.isBouncerShowing()) {
// The touchable region is always the full area when expanded // The touchable region is always the full area when expanded
return; return;
} }

View File

@@ -123,8 +123,10 @@ public class NotificationChildrenContainer extends ViewGroup {
mDividers.get(i).layout(0, 0, getWidth(), mDividerHeight); mDividers.get(i).layout(0, 0, getWidth(), mDividerHeight);
} }
if (mOverflowNumber != null) { if (mOverflowNumber != null) {
mOverflowNumber.layout(getWidth() - mOverflowNumber.getMeasuredWidth(), 0, getWidth(), boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
mOverflowNumber.getMeasuredHeight()); int left = (isRtl ? 0 : getWidth() - mOverflowNumber.getMeasuredWidth());
int right = left + mOverflowNumber.getMeasuredWidth();
mOverflowNumber.layout(left, 0, right, mOverflowNumber.getMeasuredHeight());
} }
if (mNotificationHeader != null) { if (mNotificationHeader != null) {
mNotificationHeader.layout(0, 0, mNotificationHeader.getMeasuredWidth(), mNotificationHeader.layout(0, 0, mNotificationHeader.getMeasuredWidth(),