diff options
Diffstat (limited to 'packages/SystemUI/src')
24 files changed, 317 insertions, 179 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java index 1e7ee98..445ecb6 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -16,7 +16,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.RemoteException; -import android.os.ServiceManager; import android.os.UserHandle; import android.provider.Settings; import android.util.Log; @@ -28,12 +27,15 @@ import android.view.ViewGroup; import android.view.WindowManager; import android.widget.ImageView; -import com.android.internal.app.IVoiceInteractionManagerService; +import com.android.internal.app.AssistUtils; import com.android.internal.app.IVoiceInteractionSessionShowCallback; import com.android.systemui.R; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.phone.PhoneStatusBar; +import java.io.FileDescriptor; +import java.io.PrintWriter; + /** * Class to manage everything related to assist in SystemUI. */ @@ -55,7 +57,7 @@ public class AssistManager { private final WindowManager mWindowManager; private AssistOrbContainer mView; private final PhoneStatusBar mBar; - private final IVoiceInteractionManagerService mVoiceInteractionManagerService; + private final AssistUtils mAssistUtils; private ComponentName mAssistComponent; @@ -92,8 +94,7 @@ public class AssistManager { mContext = context; mBar = bar; mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); - mVoiceInteractionManagerService = IVoiceInteractionManagerService.Stub.asInterface( - ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE)); + mAssistUtils = new AssistUtils(context); mContext.getContentResolver().registerContentObserver( Settings.Secure.getUriFor(Settings.Secure.ASSISTANT), false, @@ -140,11 +141,7 @@ public class AssistManager { } public void hideAssist() { - try { - mVoiceInteractionManagerService.hideCurrentSession(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call hideCurrentSession", e); - } + mAssistUtils.hideCurrentSession(); } private WindowManager.LayoutParams getLayoutParams() { @@ -216,58 +213,27 @@ public class AssistManager { } private void startVoiceInteractor() { - try { - mVoiceInteractionManagerService.showSessionForActiveService(mShowCallback); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call showSessionForActiveService", e); - } + mAssistUtils.showSessionForActiveService(mShowCallback); } public void launchVoiceAssistFromKeyguard() { - try { - mVoiceInteractionManagerService.launchVoiceAssistFromKeyguard(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call launchVoiceAssistFromKeyguard", e); - } + mAssistUtils.launchVoiceAssistFromKeyguard(); } private boolean getVoiceInteractorSupportsAssistGesture() { - try { - return mVoiceInteractionManagerService != null - && mVoiceInteractionManagerService.activeServiceSupportsAssist(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call activeServiceSupportsAssistGesture", e); - return false; - } + return mAssistUtils.activeServiceSupportsAssistGesture(); } public boolean canVoiceAssistBeLaunchedFromKeyguard() { - try { - return mVoiceInteractionManagerService != null - && mVoiceInteractionManagerService.activeServiceSupportsLaunchFromKeyguard(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call activeServiceSupportsLaunchFromKeyguard", e); - return false; - } + return mAssistUtils.activeServiceSupportsLaunchFromKeyguard(); } public ComponentName getVoiceInteractorComponentName() { - try { - return mVoiceInteractionManagerService.getActiveServiceComponentName(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call getActiveServiceComponentName", e); - return null; - } + return mAssistUtils.getActiveServiceComponentName(); } private boolean isVoiceSessionRunning() { - try { - return mVoiceInteractionManagerService != null - && mVoiceInteractionManagerService.isSessionRunning(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call isSessionRunning", e); - return false; - } + return mAssistUtils.isSessionRunning(); } public void destroy() { @@ -324,26 +290,11 @@ public class AssistManager { } private void updateAssistInfo() { - final String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(), - Settings.Secure.ASSISTANT, UserHandle.USER_CURRENT); - if (setting != null) { - mAssistComponent = ComponentName.unflattenFromString(setting); - return; - } - - // Fallback to keep backward compatible behavior when there is no user setting. - if (getVoiceInteractorSupportsAssistGesture()) { - mAssistComponent = getVoiceInteractorComponentName(); - return; - } - - Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) - .getAssistIntent(mContext, false, UserHandle.USER_CURRENT); - if (intent != null) { - mAssistComponent = intent.getComponent(); - return; - } + mAssistComponent = mAssistUtils.getAssistComponentForUser(UserHandle.USER_CURRENT); + } - mAssistComponent = null; + public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + pw.println("AssistManager state:"); + pw.print(" mAssistComponent="); pw.println(mAssistComponent); } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index f00fed5..c06b34f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -371,7 +371,6 @@ public class KeyguardViewMediator extends SystemUI { @Override public void onDeviceProvisioned() { sendUserPresentBroadcast(); - updateInputRestricted(); } @Override @@ -947,7 +946,7 @@ public class KeyguardViewMediator extends SystemUI { * was suppressed by an app that disabled the keyguard or we haven't been provisioned yet. */ public boolean isInputRestricted() { - return mShowing || mNeedToReshowWhenReenabled || shouldWaitForProvisioning(); + return mShowing || mNeedToReshowWhenReenabled; } private void updateInputRestricted() { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java index 95ac558..25b9105 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java @@ -193,8 +193,6 @@ public class QSDetailItems extends FrameLayout { title.setMaxLines(twoLines ? 1 : 2); summary.setVisibility(twoLines ? VISIBLE : GONE); summary.setText(twoLines ? item.line2 : null); - view.setMinimumHeight(mContext.getResources() .getDimensionPixelSize( - twoLines ? R.dimen.qs_detail_item_height_twoline : R.dimen.qs_detail_item_height)); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { @@ -239,8 +237,8 @@ public class QSDetailItems extends FrameLayout { public static class Item { public int icon; public Drawable overlay; - public String line1; - public String line2; + public CharSequence line1; + public CharSequence line2; public Object tag; public boolean canDisconnect; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index c8212c2..9761cd1 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -242,6 +242,9 @@ public class QSPanel extends ViewGroup { } private void handleSetTileVisibility(View v, int visibility) { + if (visibility == VISIBLE && !mGridContentVisible) { + visibility = INVISIBLE; + } if (visibility == v.getVisibility()) return; v.setVisibility(visibility); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java index f4d6f04..f97f519 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java @@ -38,6 +38,7 @@ import com.android.systemui.volume.ZenModePanel; /** Quick settings tile: Do not disturb **/ public class DndTile extends QSTile<QSTile.BooleanState> { + private static final Intent ZEN_SETTINGS = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS); @@ -47,6 +48,14 @@ public class DndTile extends QSTile<QSTile.BooleanState> { private static final String ACTION_SET_VISIBLE = "com.android.systemui.dndtile.SET_VISIBLE"; private static final String EXTRA_VISIBLE = "visible"; + private static final QSTile.Icon TOTAL_SILENCE = + ResourceIcon.get(R.drawable.ic_qs_dnd_on_total_silence); + + private final AnimationIcon mDisable = + new AnimationIcon(R.drawable.ic_dnd_disable_animation); + private final AnimationIcon mDisableTotalSilence = + new AnimationIcon(R.drawable.ic_dnd_total_silence_disable_animation); + private final ZenModeController mController; private final DndDetailAdapter mDetailAdapter; @@ -89,6 +98,8 @@ public class DndTile extends QSTile<QSTile.BooleanState> { @Override public void handleClick() { + mDisable.setAllowAnimation(true); + mDisableTotalSilence.setAllowAnimation(true); MetricsLogger.action(mContext, getMetricsCategory(), !mState.value); if (mState.value) { mController.setZen(Global.ZEN_MODE_OFF, null, TAG); @@ -114,7 +125,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> { R.string.accessibility_quick_settings_dnd_priority_on); break; case Global.ZEN_MODE_NO_INTERRUPTIONS: - state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_on_total_silence); + state.icon = TOTAL_SILENCE; state.label = mContext.getString(R.string.quick_settings_dnd_none_label); state.contentDescription = mContext.getString( R.string.accessibility_quick_settings_dnd_none_on); @@ -126,7 +137,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> { R.string.accessibility_quick_settings_dnd_alarms_on); break; default: - state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_off); + state.icon = TOTAL_SILENCE.equals(state.icon) ? mDisableTotalSilence : mDisable; state.label = mContext.getString(R.string.quick_settings_dnd_label); state.contentDescription = mContext.getString( R.string.accessibility_quick_settings_dnd_off); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java index 915867b..6d2c8c0 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java @@ -73,8 +73,8 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> { : mController.isRotationLocked(); final boolean userInitiated = arg != null ? ((UserBoolean) arg).userInitiated : false; state.visible = mController.isRotationLockAffordanceVisible(); - if (state.value == rotationLocked) { - // No change, no need to update all the values. + if (state.value == rotationLocked && state.contentDescription != null) { + // No change and initialized, no need to update all the values. return; } state.value = rotationLocked; diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java index 5711cd6..ebfc796 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java @@ -22,10 +22,12 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Rect; +import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; import com.android.systemui.R; import com.android.systemui.recents.Constants; @@ -133,6 +135,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal } } }); + setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); } /** Sets the callbacks */ @@ -350,6 +353,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal mTmpTaskViewMap.clear(); List<TaskView> taskViews = getTaskViews(); int taskViewCount = taskViews.size(); + boolean reaquireAccessibilityFocus = false; for (int i = taskViewCount - 1; i >= 0; i--) { TaskView tv = taskViews.get(i); Task task = tv.getTask(); @@ -358,6 +362,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal mTmpTaskViewMap.put(task, tv); } else { mViewPool.returnViewToPool(tv); + reaquireAccessibilityFocus |= (i == mPrevAccessibilityFocusedIndex); // Hide the dismiss button if the front most task is invisible if (task == mStack.getFrontMostTask()) { @@ -402,14 +407,17 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal // Request accessibility focus on the next view if we removed the task // that previously held accessibility focus - taskViews = getTaskViews(); - taskViewCount = taskViews.size(); - if (taskViewCount > 0 && ssp.isTouchExplorationEnabled()) { - TaskView atv = taskViews.get(taskViewCount - 1); - int indexOfTask = mStack.indexOfTask(atv.getTask()); - if (mPrevAccessibilityFocusedIndex != indexOfTask) { - tv.requestAccessibilityFocus(); - mPrevAccessibilityFocusedIndex = indexOfTask; + if (reaquireAccessibilityFocus) { + taskViews = getTaskViews(); + taskViewCount = taskViews.size(); + if (taskViewCount > 0 && ssp.isTouchExplorationEnabled() && + mPrevAccessibilityFocusedIndex != -1) { + TaskView atv = taskViews.get(taskViewCount - 1); + int indexOfTask = mStack.indexOfTask(atv.getTask()); + if (mPrevAccessibilityFocusedIndex != indexOfTask) { + tv.requestAccessibilityFocus(); + mPrevAccessibilityFocusedIndex = indexOfTask; + } } } } @@ -496,25 +504,20 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal if (0 <= taskIndex && taskIndex < mStack.getTaskCount()) { mFocusedTaskIndex = taskIndex; + mPrevAccessibilityFocusedIndex = taskIndex; // Focus the view if possible, otherwise, focus the view after we scroll into position - Task t = mStack.getTasks().get(taskIndex); - TaskView tv = getChildViewForTask(t); - Runnable postScrollRunnable = null; - if (tv != null) { - tv.setFocusedTask(animateFocusedState); - } else { - postScrollRunnable = new Runnable() { - @Override - public void run() { - Task t = mStack.getTasks().get(mFocusedTaskIndex); - TaskView tv = getChildViewForTask(t); - if (tv != null) { - tv.setFocusedTask(animateFocusedState); - } + final Task t = mStack.getTasks().get(mFocusedTaskIndex); + Runnable postScrollRunnable = new Runnable() { + @Override + public void run() { + TaskView tv = getChildViewForTask(t); + if (tv != null) { + tv.setFocusedTask(animateFocusedState); + tv.requestAccessibilityFocus(); } - }; - } + } + }; // Scroll the view into position (just center it in the curve) if (scrollToNewPosition) { @@ -534,25 +537,30 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal * Ensures that there is a task focused, if nothing is focused, then we will use the task * at the center of the visible stack. */ - public boolean ensureFocusedTask() { + public boolean ensureFocusedTask(boolean findClosestToCenter) { if (mFocusedTaskIndex < 0) { - // If there is no task focused, then find the task that is closes to the center - // of the screen and use that as the currently focused task - int x = mLayoutAlgorithm.mStackVisibleRect.centerX(); - int y = mLayoutAlgorithm.mStackVisibleRect.centerY(); List<TaskView> taskViews = getTaskViews(); int taskViewCount = taskViews.size(); - for (int i = taskViewCount - 1; i >= 0; i--) { - TaskView tv = taskViews.get(i); - tv.getHitRect(mTmpRect); - if (mTmpRect.contains(x, y)) { - mFocusedTaskIndex = mStack.indexOfTask(tv.getTask()); - break; + if (findClosestToCenter) { + // If there is no task focused, then find the task that is closes to the center + // of the screen and use that as the currently focused task + int x = mLayoutAlgorithm.mStackVisibleRect.centerX(); + int y = mLayoutAlgorithm.mStackVisibleRect.centerY(); + for (int i = taskViewCount - 1; i >= 0; i--) { + TaskView tv = taskViews.get(i); + tv.getHitRect(mTmpRect); + if (mTmpRect.contains(x, y)) { + mFocusedTaskIndex = mStack.indexOfTask(tv.getTask()); + mPrevAccessibilityFocusedIndex = mFocusedTaskIndex; + break; + } } } // If we can't find the center task, then use the front most index if (mFocusedTaskIndex < 0 && taskViewCount > 0) { - mFocusedTaskIndex = taskViewCount - 1; + TaskView tv = taskViews.get(taskViewCount - 1); + mFocusedTaskIndex = mStack.indexOfTask(tv.getTask()); + mPrevAccessibilityFocusedIndex = mFocusedTaskIndex; } } return mFocusedTaskIndex >= 0; @@ -600,6 +608,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal } } mFocusedTaskIndex = -1; + mPrevAccessibilityFocusedIndex = -1; } @Override @@ -620,6 +629,53 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal } @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + List<TaskView> taskViews = getTaskViews(); + int taskViewCount = taskViews.size(); + if (taskViewCount > 1 && mPrevAccessibilityFocusedIndex != -1) { + info.setScrollable(true); + if (mPrevAccessibilityFocusedIndex > 0) { + info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); + } + if (mPrevAccessibilityFocusedIndex < mStack.getTaskCount() - 1) { + info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); + } + } + } + + @Override + public CharSequence getAccessibilityClassName() { + return TaskStackView.class.getName(); + } + + @Override + public boolean performAccessibilityAction(int action, Bundle arguments) { + if (super.performAccessibilityAction(action, arguments)) { + return true; + } + if (ensureFocusedTask(false)) { + switch (action) { + case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { + if (mPrevAccessibilityFocusedIndex > 0) { + focusNextTask(true, false); + return true; + } + } + break; + case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: { + if (mPrevAccessibilityFocusedIndex < mStack.getTaskCount() - 1) { + focusNextTask(false, false); + return true; + } + } + break; + } + } + return false; + } + + @Override public boolean onInterceptTouchEvent(MotionEvent ev) { return mTouchHandler.onInterceptTouchEvent(ev); } @@ -724,8 +780,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal if (mDismissAllButton != null) { int taskRectWidth = mLayoutAlgorithm.mTaskRect.width(); mDismissAllButton.measure( - MeasureSpec.makeMeasureSpec(taskRectWidth, MeasureSpec.EXACTLY), - MeasureSpec.makeMeasureSpec(mConfig.dismissAllButtonSizePx, MeasureSpec.EXACTLY)); + MeasureSpec.makeMeasureSpec(taskRectWidth, MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec(mConfig.dismissAllButtonSizePx, MeasureSpec.EXACTLY)); } setMeasuredDimension(width, height); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java index 509560eb..13bdbd2 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java @@ -396,11 +396,11 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback { // Find the front most task and scroll the next task to the front float vScroll = ev.getAxisValue(MotionEvent.AXIS_VSCROLL); if (vScroll > 0) { - if (mSv.ensureFocusedTask()) { + if (mSv.ensureFocusedTask(true)) { mSv.focusNextTask(true, false); } } else { - if (mSv.ensureFocusedTask()) { + if (mSv.ensureFocusedTask(true)) { mSv.focusNextTask(false, false); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/AlphaOptimizedImageView.java b/packages/SystemUI/src/com/android/systemui/statusbar/AlphaOptimizedImageView.java index 858c118..700ea34 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/AlphaOptimizedImageView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/AlphaOptimizedImageView.java @@ -17,34 +17,49 @@ package com.android.systemui.statusbar; import android.content.Context; +import android.content.res.TypedArray; import android.util.AttributeSet; import android.widget.ImageView; +import com.android.systemui.R; + /** - * An ImageView which does not have overlapping rendering commands and therefore does not need a - * layer when alpha is changed. + * An ImageView which supports an attribute specifying whether it has overlapping rendering + * commands and therefore does not need a layer when alpha is changed. */ -public class AlphaOptimizedImageView extends ImageView -{ +public class AlphaOptimizedImageView extends ImageView { + private final boolean mHasOverlappingRendering; + public AlphaOptimizedImageView(Context context) { - super(context); + this(context, null /* attrs */); } public AlphaOptimizedImageView(Context context, AttributeSet attrs) { - super(context, attrs); + this(context, attrs, 0 /* defStyleAttr */); } public AlphaOptimizedImageView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); + this(context, attrs, defStyleAttr, 0 /* defStyleRes */); } public AlphaOptimizedImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); + + TypedArray a = context.getTheme().obtainStyledAttributes(attrs, + R.styleable.AlphaOptimizedImageView, 0, 0); + + try { + // Default to true, which is what View.java defaults to + mHasOverlappingRendering = a.getBoolean( + R.styleable.AlphaOptimizedImageView_hasOverlappingRendering, true); + } finally { + a.recycle(); + } } @Override public boolean hasOverlappingRendering() { - return false; + return mHasOverlappingRendering; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java b/packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java index 9839fe9..90f7c08 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java @@ -25,10 +25,15 @@ import android.widget.ImageView; import android.widget.RemoteViews.RemoteView; @RemoteView -public class AnimatedImageView extends ImageView { +public class AnimatedImageView extends AlphaOptimizedImageView { AnimationDrawable mAnim; boolean mAttached; + // Tracks the last image that was set, so that we don't refresh the image if it is exactly + // the same as the previous one. If this is a resid, we track that. If it's a drawable, we + // track the hashcode of the drawable. + int mDrawableId; + public AnimatedImageView(Context context) { super(context); } @@ -43,7 +48,7 @@ public class AnimatedImageView extends ImageView { mAnim.stop(); } if (drawable instanceof AnimationDrawable) { - mAnim = (AnimationDrawable)drawable; + mAnim = (AnimationDrawable) drawable; if (isShown()) { mAnim.start(); } @@ -54,6 +59,13 @@ public class AnimatedImageView extends ImageView { @Override public void setImageDrawable(Drawable drawable) { + if (drawable != null) { + if (mDrawableId == drawable.hashCode()) return; + + mDrawableId = drawable.hashCode(); + } else { + mDrawableId = 0; + } super.setImageDrawable(drawable); updateAnim(); } @@ -61,6 +73,9 @@ public class AnimatedImageView extends ImageView { @Override @android.view.RemotableViewMethod public void setImageResource(int resid) { + if (mDrawableId == resid) return; + + mDrawableId = resid; super.setImageResource(resid); updateAnim(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 0b49564..79761ec 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1381,7 +1381,6 @@ public abstract class BaseStatusBar extends SystemUI implements R.layout.notification_public_default, contentContainerPublic, false); publicViewLocal.setIsRootNamespace(true); - contentContainerPublic.setContractedChild(publicViewLocal); final TextView title = (TextView) publicViewLocal.findViewById(R.id.title); try { @@ -1447,6 +1446,7 @@ public abstract class BaseStatusBar extends SystemUI implements mContext.getResources().getConfiguration().fontScale); title.setPadding(0, topPadding, 0, 0); + contentContainerPublic.setContractedChild(publicViewLocal); entry.autoRedacted = true; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index 8172a4d..86d7f4f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -311,9 +311,9 @@ public class NotificationContentView extends FrameLayout { } int visibleType = calculateVisibleType(); if (visibleType != mVisibleType || force) { - if (animate && (visibleType == VISIBLE_TYPE_EXPANDED && mExpandedChild != null) + if (animate && ((visibleType == VISIBLE_TYPE_EXPANDED && mExpandedChild != null) || (visibleType == VISIBLE_TYPE_HEADSUP && mHeadsUpChild != null) - || visibleType == VISIBLE_TYPE_CONTRACTED) { + || visibleType == VISIBLE_TYPE_CONTRACTED)) { runSwitchAnimation(visibleType); } else { updateViewVisibilities(visibleType); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java index ff7b37f..5a4acb4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java @@ -114,14 +114,21 @@ public class SignalClusterView return; } ArraySet<String> blockList = StatusBarIconController.getIconBlacklist(newValue); - mBlockAirplane = blockList.contains(SLOT_AIRPLANE); - mBlockMobile = blockList.contains(SLOT_MOBILE); - mBlockWifi = blockList.contains(SLOT_WIFI); - mBlockEthernet = blockList.contains(SLOT_ETHERNET); - - // Re-register to get new callbacks. - mNC.removeSignalCallback(SignalClusterView.this); - mNC.addSignalCallback(SignalClusterView.this); + boolean blockAirplane = blockList.contains(SLOT_AIRPLANE); + boolean blockMobile = blockList.contains(SLOT_MOBILE); + boolean blockWifi = blockList.contains(SLOT_WIFI); + boolean blockEthernet = blockList.contains(SLOT_ETHERNET); + + if (blockAirplane != mBlockAirplane || blockMobile != mBlockMobile + || blockEthernet != mBlockEthernet || blockWifi != mBlockWifi) { + mBlockAirplane = blockAirplane; + mBlockMobile = blockMobile; + mBlockEthernet = blockEthernet; + mBlockWifi = blockWifi; + // Re-register to get new callbacks. + mNC.removeSignalCallback(this); + mNC.addSignalCallback(this); + } } public void setNetworkController(NetworkControllerImpl nc) { @@ -244,6 +251,9 @@ public class SignalClusterView @Override public void setSubs(List<SubscriptionInfo> subs) { + if (hasCorrectSubs(subs)) { + return; + } // Clear out all old subIds. mPhoneStates.clear(); if (mMobileSignalGroup != null) { @@ -258,6 +268,19 @@ public class SignalClusterView } } + private boolean hasCorrectSubs(List<SubscriptionInfo> subs) { + final int N = subs.size(); + if (N != mPhoneStates.size()) { + return false; + } + for (int i = 0; i < N; i++) { + if (mPhoneStates.get(i).mSubId != subs.get(i).getSubscriptionId()) { + return false; + } + } + return true; + } + private PhoneState getOrInflateState(int subId) { for (PhoneState state : mPhoneStates) { if (state.mSubId == subId) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java index f57575d..10c35af 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java @@ -110,6 +110,8 @@ public class HeadsUpTouchHelper implements Gefingerpoken { mInitialTouchX = x; mInitialTouchY = y; int expandedHeight = mPickedChild.getActualHeight(); + mPanel.setPanelScrimMinFraction((float) expandedHeight + / mPanel.getMaxPanelHeight()); mPanel.startExpandMotion(x, y, true /* startTracking */, expandedHeight + mNotificationsTopPadding); mHeadsUpManager.unpinAll(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index a750572..495f0fd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -1180,7 +1180,9 @@ public class NotificationPanelView extends PanelView implements } else if (statusBarState == StatusBarState.KEYGUARD || statusBarState == StatusBarState.SHADE_LOCKED) { mKeyguardBottomArea.animate().cancel(); - mKeyguardBottomArea.setVisibility(View.VISIBLE); + if (!mDozing) { + mKeyguardBottomArea.setVisibility(View.VISIBLE); + } mKeyguardBottomArea.setAlpha(1f); } else { mKeyguardBottomArea.animate().cancel(); @@ -1263,7 +1265,7 @@ public class NotificationPanelView extends PanelView implements setQsExpanded(true); } else if (height <= mQsMinExpansionHeight && mQsExpanded) { setQsExpanded(false); - if (mLastAnnouncementWasQuickSettings && !mTracking) { + if (mLastAnnouncementWasQuickSettings && !mTracking && !isCollapsing()) { announceForAccessibility(getKeyguardOrLockScreenString()); mLastAnnouncementWasQuickSettings = false; } @@ -1717,7 +1719,8 @@ public class NotificationPanelView extends PanelView implements float alphaQsExpansion = 1 - Math.min(1, getQsExpansionFraction() * 2); mKeyguardStatusBar.setAlpha(Math.min(getKeyguardContentsAlpha(), alphaQsExpansion) * mKeyguardStatusBarAnimateAlpha); - mKeyguardStatusBar.setVisibility(mKeyguardStatusBar.getAlpha() != 0f ? VISIBLE : INVISIBLE); + mKeyguardStatusBar.setVisibility(mKeyguardStatusBar.getAlpha() != 0f + && !mDozing ? VISIBLE : INVISIBLE); setQsTranslation(mQsExpansionHeight); } @@ -1764,6 +1767,7 @@ public class NotificationPanelView extends PanelView implements mIsExpansionFromHeadsUp = false; mNotificationStackScroller.setTrackingHeadsUp(false); mExpandingFromHeadsUp = false; + setPanelScrimMinFraction(0.0f); } private void setListening(boolean listening) { @@ -2314,7 +2318,7 @@ public class NotificationPanelView extends PanelView implements } x = Math.min(rightMost, Math.max(leftMost, x)); setVerticalPanelTranslation(x - - (mNotificationStackScroller.getLeft() + mNotificationStackScroller.getWidth()/2)); + (mNotificationStackScroller.getLeft() + mNotificationStackScroller.getWidth() / 2)); } private void resetVerticalPanelPosition() { @@ -2331,4 +2335,8 @@ public class NotificationPanelView extends PanelView implements mNotificationStackScroller.setStackHeight(stackHeight); updateKeyguardBottomAreaAlpha(); } + + public void setPanelScrimMinFraction(float minFraction) { + mBar.panelScrimMinFractionChanged(minFraction); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java index 552a0b2..cf553ec 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java @@ -25,7 +25,7 @@ import android.widget.FrameLayout; import java.util.ArrayList; -public class PanelBar extends FrameLayout { +public abstract class PanelBar extends FrameLayout { public static final boolean DEBUG = false; public static final String TAG = PanelBar.class.getSimpleName(); public static final void LOG(String fmt, Object... args) { @@ -156,6 +156,8 @@ public class PanelBar extends FrameLayout { } } + public abstract void panelScrimMinFractionChanged(float minFraction); + /** * @param panel the panel which changed its expansion state * @param frac the fraction from the expansion in [0, 1] 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 33e8e59..69198ed 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -812,12 +812,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, signalClusterQs.setNetworkController(mNetworkController); final boolean isAPhone = mNetworkController.hasVoiceCallingFeature(); if (isAPhone) { - mNetworkController.addEmergencyListener(new NetworkControllerImpl.EmergencyListener() { - @Override - public void setEmergencyCallsOnly(boolean emergencyOnly) { - mHeader.setShowEmergencyCallsOnly(emergencyOnly); - } - }); + mNetworkController.addEmergencyListener(mHeader); } mFlashlightController = new FlashlightController(mContext); @@ -2692,6 +2687,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, if (mNextAlarmController != null) { mNextAlarmController.dump(fd, pw, args); } + if (mAssistManager != null) { + mAssistManager.dump(fd, pw, args); + } if (mSecurityController != null) { mSecurityController.dump(fd, pw, args); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java index b7e675d..dfd280a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java @@ -40,6 +40,8 @@ public class PhoneStatusBarView extends PanelBar { PanelView mNotificationPanel; private final PhoneStatusBarTransitions mBarTransitions; private ScrimController mScrimController; + private float mMinFraction; + private float mPanelFraction; public PhoneStatusBarView(Context context, AttributeSet attrs) { super(context, attrs); @@ -180,8 +182,22 @@ public class PhoneStatusBarView extends PanelBar { } @Override + public void panelScrimMinFractionChanged(float minFraction) { + if (mMinFraction != minFraction) { + mMinFraction = minFraction; + updateScrimFraction(); + } + } + + @Override public void panelExpansionChanged(PanelView panel, float frac, boolean expanded) { super.panelExpansionChanged(panel, frac, expanded); - mScrimController.setPanelExpansion(frac); + mPanelFraction = frac; + updateScrimFraction(); + } + + private void updateScrimFraction() { + float scrimFraction = Math.max(mPanelFraction - mMinFraction / (1.0f - mMinFraction), 0); + mScrimController.setPanelExpansion(scrimFraction); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java index dfc6924..a81f06e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java @@ -45,6 +45,7 @@ import com.android.systemui.R; import com.android.systemui.qs.QSPanel; import com.android.systemui.qs.QSTile; import com.android.systemui.statusbar.policy.BatteryController; +import com.android.systemui.statusbar.policy.NetworkControllerImpl.EmergencyListener; import com.android.systemui.statusbar.policy.NextAlarmController; import com.android.systemui.statusbar.policy.UserInfoController; @@ -54,7 +55,8 @@ import java.text.NumberFormat; * The view to manage the header area in the expanded status bar. */ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickListener, - BatteryController.BatteryStateChangeCallback, NextAlarmController.NextAlarmChangeCallback { + BatteryController.BatteryStateChangeCallback, NextAlarmController.NextAlarmChangeCallback, + EmergencyListener { private boolean mExpanded; private boolean mListening; @@ -527,7 +529,8 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL return true; } - public void setShowEmergencyCallsOnly(boolean show) { + @Override + public void setEmergencyCallsOnly(boolean show) { boolean changed = show != mShowEmergencyCallsOnly; if (changed) { mShowEmergencyCallsOnly = show; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java index 686e24c..0aa0b4a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -34,6 +34,7 @@ import com.android.internal.telephony.cdma.EriInfo; import com.android.systemui.R; import com.android.systemui.statusbar.policy.NetworkController.IconState; import com.android.systemui.statusbar.policy.NetworkControllerImpl.Config; +import com.android.systemui.statusbar.policy.NetworkControllerImpl.SubscriptionDefaults; import java.io.PrintWriter; import java.util.BitSet; @@ -43,6 +44,7 @@ import java.util.Objects; public class MobileSignalController extends SignalController< MobileSignalController.MobileState, MobileSignalController.MobileIconGroup> { private final TelephonyManager mPhone; + private final SubscriptionDefaults mDefaults; private final String mNetworkNameDefault; private final String mNetworkNameSeparator; @VisibleForTesting @@ -67,13 +69,15 @@ public class MobileSignalController extends SignalController< // need listener lists anymore. public MobileSignalController(Context context, Config config, boolean hasMobileData, TelephonyManager phone, CallbackHandler callbackHandler, - NetworkControllerImpl networkController, SubscriptionInfo info, Looper receiverLooper) { + NetworkControllerImpl networkController, SubscriptionInfo info, + SubscriptionDefaults defaults, Looper receiverLooper) { super("MobileSignalController(" + info.getSubscriptionId() + ")", context, NetworkCapabilities.TRANSPORT_CELLULAR, callbackHandler, networkController); mNetworkToIconLookup = new SparseArray<>(); mConfig = config; mPhone = phone; + mDefaults = defaults; mSubscriptionInfo = info; mPhoneStateListener = new MobilePhoneStateListener(info.getSubscriptionId(), receiverLooper); @@ -290,7 +294,7 @@ public class MobileSignalController extends SignalController< } private void updateDataSim() { - int defaultDataSub = SubscriptionManager.getDefaultDataSubId(); + int defaultDataSub = mDefaults.getDefaultDataSubId(); if (SubscriptionManager.isValidSubscriptionId(defaultDataSub)) { mCurrentState.dataSim = defaultDataSub == mSubscriptionInfo.getSubscriptionId(); } else { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index e8957f9..18b5820 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -71,6 +71,7 @@ public class NetworkControllerImpl extends BroadcastReceiver private final ConnectivityManager mConnectivityManager; private final SubscriptionManager mSubscriptionManager; private final boolean mHasMobileDataFeature; + private final SubscriptionDefaults mSubDefaults; private Config mConfig; // Subcontrollers. @@ -124,7 +125,8 @@ public class NetworkControllerImpl extends BroadcastReceiver SubscriptionManager.from(context), Config.readConfig(context), bgLooper, new CallbackHandler(), new AccessPointControllerImpl(context, bgLooper), - new MobileDataControllerImpl(context)); + new MobileDataControllerImpl(context), + new SubscriptionDefaults()); mReceiverHandler.post(mRegisterListeners); } @@ -134,13 +136,15 @@ public class NetworkControllerImpl extends BroadcastReceiver SubscriptionManager subManager, Config config, Looper bgLooper, CallbackHandler callbackHandler, AccessPointControllerImpl accessPointController, - MobileDataControllerImpl mobileDataController) { + MobileDataControllerImpl mobileDataController, + SubscriptionDefaults defaultsHandler) { mContext = context; mConfig = config; mReceiverHandler = new Handler(bgLooper); mCallbackHandler = callbackHandler; mSubscriptionManager = subManager; + mSubDefaults = defaultsHandler; mConnectivityManager = connectivityManager; mHasMobileDataFeature = mConnectivityManager.isNetworkSupported(ConnectivityManager.TYPE_MOBILE); @@ -233,7 +237,7 @@ public class NetworkControllerImpl extends BroadcastReceiver } private MobileSignalController getDataController() { - int dataSubId = SubscriptionManager.getDefaultDataSubId(); + int dataSubId = mSubDefaults.getDefaultDataSubId(); if (!SubscriptionManager.isValidSubscriptionId(dataSubId)) { if (DEBUG) Log.e(TAG, "No data sim selected"); return mDefaultSignalController; @@ -251,17 +255,19 @@ public class NetworkControllerImpl extends BroadcastReceiver } public boolean isEmergencyOnly() { - int voiceSubId = SubscriptionManager.getDefaultVoiceSubId(); + int voiceSubId = mSubDefaults.getDefaultVoiceSubId(); if (!SubscriptionManager.isValidSubscriptionId(voiceSubId)) { for (MobileSignalController mobileSignalController : mMobileSignalControllers.values()) { - if (!mobileSignalController.isEmergencyOnly()) { + if (!mobileSignalController.getState().isEmergency) { + if (DEBUG) Log.d(TAG, "Found emergency " + mobileSignalController.mTag); return false; } } } if (mMobileSignalControllers.containsKey(voiceSubId)) { - return mMobileSignalControllers.get(voiceSubId).isEmergencyOnly(); + if (DEBUG) Log.d(TAG, "Getting emergency from " + voiceSubId); + return mMobileSignalControllers.get(voiceSubId).getState().isEmergency; } if (DEBUG) Log.e(TAG, "Cannot find controller for voice sub: " + voiceSubId); // Something is wrong, better assume we can't make calls... @@ -375,6 +381,11 @@ public class NetworkControllerImpl extends BroadcastReceiver if (!mListening) { return; } + doUpdateMobileControllers(); + } + + @VisibleForTesting + void doUpdateMobileControllers() { List<SubscriptionInfo> subscriptions = mSubscriptionManager.getActiveSubscriptionInfoList(); if (subscriptions == null) { subscriptions = Collections.emptyList(); @@ -389,6 +400,7 @@ public class NetworkControllerImpl extends BroadcastReceiver } setCurrentSubscriptions(subscriptions); updateNoSims(); + recalculateEmergency(); } @VisibleForTesting @@ -425,7 +437,7 @@ public class NetworkControllerImpl extends BroadcastReceiver } else { MobileSignalController controller = new MobileSignalController(mContext, mConfig, mHasMobileDataFeature, mPhone, mCallbackHandler, - this, subscriptions.get(i), mReceiverHandler.getLooper()); + this, subscriptions.get(i), mSubDefaults, mReceiverHandler.getLooper()); mMobileSignalControllers.put(subId, controller); if (subscriptions.get(i).getSimSlotIndex() == 0) { mDefaultSignalController = controller; @@ -708,7 +720,7 @@ public class NetworkControllerImpl extends BroadcastReceiver null, 0, 0, ""); mMobileSignalControllers.put(id, new MobileSignalController(mContext, mConfig, mHasMobileDataFeature, mPhone, mCallbackHandler, this, info, - mReceiverHandler.getLooper())); + mSubDefaults, mReceiverHandler.getLooper())); return info; } @@ -735,6 +747,16 @@ public class NetworkControllerImpl extends BroadcastReceiver void setEmergencyCallsOnly(boolean emergencyOnly); } + public static class SubscriptionDefaults { + public int getDefaultVoiceSubId() { + return SubscriptionManager.getDefaultVoiceSubId(); + } + + public int getDefaultDataSubId() { + return SubscriptionManager.getDefaultDataSubId(); + } + } + @VisibleForTesting static class Config { boolean showAtLeast3G = false; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java index a70ad43..3768ca4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java @@ -149,9 +149,6 @@ public class StackScrollState { // apply dimming view.setDimmed(state.dimmed, false /* animate */); - // apply dark - view.setDark(state.dark, false /* animate */, 0 /* delay */); - // apply hiding sensitive view.setHideSensitive( state.hideSensitive, false /* animated */, 0 /* delay */, 0 /* duration */); @@ -159,6 +156,9 @@ public class StackScrollState { // apply speed bump state view.setBelowSpeedBump(state.belowSpeedBump); + // apply dark + view.setDark(state.dark, false /* animate */, 0 /* delay */); + // apply clipping float oldClipTopAmount = view.getClipTopAmount(); if (oldClipTopAmount != state.clipTopAmount) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java index c995c8e..17e6e3d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java @@ -243,9 +243,6 @@ public class StackStateAnimator { // start dimmed animation child.setDimmed(viewState.dimmed, mAnimationFilter.animateDimmed); - // start dark animation - child.setDark(viewState.dark, mAnimationFilter.animateDark, delay); - // apply speed bump state child.setBelowSpeedBump(viewState.belowSpeedBump); @@ -253,6 +250,9 @@ public class StackStateAnimator { child.setHideSensitive(viewState.hideSensitive, mAnimationFilter.animateHideSensitive, delay, duration); + // start dark animation + child.setDark(viewState.dark, mAnimationFilter.animateDark, delay); + if (wasAdded) { child.performAddAnimation(delay, mCurrentLength); } diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java index ad21555..d360875 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java @@ -53,6 +53,7 @@ public class StorageNotification extends SystemUI { private static final int MOVE_ID = 0x534d4f56; // SMOV private static final String ACTION_SNOOZE_VOLUME = "com.android.systemui.action.SNOOZE_VOLUME"; + private static final String ACTION_FINISH_WIZARD = "com.android.systemui.action.FINISH_WIZARD"; // TODO: delay some notifications to avoid bumpy fast operations @@ -107,6 +108,15 @@ public class StorageNotification extends SystemUI { } }; + private final BroadcastReceiver mFinishReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + // When finishing the adoption wizard, clean up any notifications + // for moving primary storage + mNotificationManager.cancelAsUser(null, MOVE_ID, UserHandle.ALL); + } + }; + private final MoveCallback mMoveCallback = new MoveCallback() { @Override public void onCreated(int moveId, Bundle extras) { @@ -146,6 +156,8 @@ public class StorageNotification extends SystemUI { mContext.registerReceiver(mSnoozeReceiver, new IntentFilter(ACTION_SNOOZE_VOLUME), android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, null); + mContext.registerReceiver(mFinishReceiver, new IntentFilter(ACTION_FINISH_WIZARD), + android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, null); // Kick current state into place final List<DiskInfo> disks = mStorageManager.getDisks(); @@ -170,8 +182,8 @@ public class StorageNotification extends SystemUI { final String fsUuid = rec.getFsUuid(); final VolumeInfo info = mStorageManager.findVolumeByUuid(fsUuid); - if (info != null && info.isMountedWritable()) { - // Yay, private volume is here! + if ((info != null && info.isMountedWritable()) || rec.isSnoozed()) { + // Yay, private volume is here, or user snoozed mNotificationManager.cancelAsUser(fsUuid, PRIVATE_ID, UserHandle.ALL); } else { @@ -190,7 +202,7 @@ public class StorageNotification extends SystemUI { .setVisibility(Notification.VISIBILITY_PUBLIC) .setLocalOnly(true) .setCategory(Notification.CATEGORY_SYSTEM) - .setOngoing(true) + .setDeleteIntent(buildSnoozeIntent(fsUuid)) .build(); mNotificationManager.notifyAsUser(fsUuid, PRIVATE_ID, notif, UserHandle.ALL); @@ -202,9 +214,9 @@ public class StorageNotification extends SystemUI { if (volumeCount == 0 && disk.size > 0) { // No supported volumes found, give user option to format final CharSequence title = mContext.getString( - R.string.ext_media_unmountable_notification_title, disk.getDescription()); + R.string.ext_media_unsupported_notification_title, disk.getDescription()); final CharSequence text = mContext.getString( - R.string.ext_media_unmountable_notification_message, disk.getDescription()); + R.string.ext_media_unsupported_notification_message, disk.getDescription()); final Notification notif = new Notification.Builder(mContext) .setSmallIcon(getSmallIcon(disk, VolumeInfo.STATE_UNMOUNTABLE)) @@ -324,7 +336,7 @@ public class StorageNotification extends SystemUI { mContext.getString(R.string.ext_media_unmount_action), buildUnmountPendingIntent(vol))) .setContentIntent(initIntent) - .setDeleteIntent(buildSnoozeIntent(vol)) + .setDeleteIntent(buildSnoozeIntent(vol.getFsUuid())) .setCategory(Notification.CATEGORY_SYSTEM) .build(); @@ -342,7 +354,7 @@ public class StorageNotification extends SystemUI { mContext.getString(R.string.ext_media_unmount_action), buildUnmountPendingIntent(vol))) .setContentIntent(browseIntent) - .setDeleteIntent(buildSnoozeIntent(vol)) + .setDeleteIntent(buildSnoozeIntent(vol.getFsUuid())) .setCategory(Notification.CATEGORY_SYSTEM) .setPriority(Notification.PRIORITY_LOW) .build(); @@ -376,7 +388,7 @@ public class StorageNotification extends SystemUI { R.string.ext_media_unmountable_notification_message, disk.getDescription()); return buildNotificationBuilder(vol, title, text) - .setContentIntent(buildVolumeSettingsPendingIntent(vol)) + .setContentIntent(buildInitPendingIntent(vol)) .setCategory(Notification.CATEGORY_ERROR) .build(); } @@ -591,11 +603,11 @@ public class StorageNotification extends SystemUI { PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT); } - private PendingIntent buildSnoozeIntent(VolumeInfo vol) { + private PendingIntent buildSnoozeIntent(String fsUuid) { final Intent intent = new Intent(ACTION_SNOOZE_VOLUME); - intent.putExtra(VolumeRecord.EXTRA_FS_UUID, vol.getFsUuid()); + intent.putExtra(VolumeRecord.EXTRA_FS_UUID, fsUuid); - final int requestKey = vol.getId().hashCode(); + final int requestKey = fsUuid.hashCode(); return PendingIntent.getBroadcastAsUser(mContext, requestKey, intent, PendingIntent.FLAG_CANCEL_CURRENT, UserHandle.CURRENT); } |
