diff options
Diffstat (limited to 'packages/SystemUI')
28 files changed, 112 insertions, 204 deletions
diff --git a/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml b/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml index 351177b..ef85847 100644 --- a/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml +++ b/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml @@ -64,9 +64,4 @@ /> </LinearLayout> - <com.android.systemui.statusbar.NotificationScrimView - android:id="@+id/scrim_view" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - </com.android.systemui.statusbar.NotificationOverflowContainer> diff --git a/packages/SystemUI/res/layout/status_bar_notification_row.xml b/packages/SystemUI/res/layout/status_bar_notification_row.xml index ef4e27c..6b829e5 100644 --- a/packages/SystemUI/res/layout/status_bar_notification_row.xml +++ b/packages/SystemUI/res/layout/status_bar_notification_row.xml @@ -59,9 +59,4 @@ android:layout_height="match_parent" /> - <com.android.systemui.statusbar.NotificationScrimView - android:id="@+id/scrim_view" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - </com.android.systemui.statusbar.ExpandableNotificationRow> diff --git a/packages/SystemUI/res/layout/super_status_bar.xml b/packages/SystemUI/res/layout/super_status_bar.xml index 09e541f..29fec41 100644 --- a/packages/SystemUI/res/layout/super_status_bar.xml +++ b/packages/SystemUI/res/layout/super_status_bar.xml @@ -26,24 +26,6 @@ android:fitsSystemWindows="true" android:descendantFocusability="afterDescendants"> - <FrameLayout android:id="@+id/brightness_mirror" - android:layout_width="@dimen/notification_panel_width" - android:layout_height="wrap_content" - android:layout_gravity="@integer/notification_panel_layout_gravity" - android:paddingLeft="@dimen/notification_side_padding" - android:paddingRight="@dimen/notification_side_padding" - android:visibility="gone"> - <FrameLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:elevation="2dp" - android:background="@drawable/brightness_mirror_background"> - <include layout="@layout/quick_settings_brightness_dialog" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - </FrameLayout> - </FrameLayout> - <com.android.systemui.statusbar.AlphaOptimizedFrameLayout android:id="@+id/backdrop" android:layout_width="match_parent" @@ -69,6 +51,24 @@ android:layout_width="match_parent" android:layout_height="@dimen/status_bar_height" /> + <FrameLayout android:id="@+id/brightness_mirror" + android:layout_width="@dimen/notification_panel_width" + android:layout_height="wrap_content" + android:layout_gravity="@integer/notification_panel_layout_gravity" + android:paddingLeft="@dimen/notification_side_padding" + android:paddingRight="@dimen/notification_side_padding" + android:visibility="gone"> + <FrameLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:elevation="2dp" + android:background="@drawable/brightness_mirror_background"> + <include layout="@layout/quick_settings_brightness_dialog" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + </FrameLayout> + </FrameLayout> + <com.android.systemui.statusbar.phone.PanelHolder android:id="@+id/panel_holder" android:layout_width="match_parent" diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index 74a98fc..d3b5580 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -46,6 +46,9 @@ <!-- The side padding for the task stack as a percentage of the width. --> <item name="recents_stack_width_padding_percentage" format="float" type="dimen">0.075</item> + <!-- The height of the search bar space. --> + <dimen name="recents_search_bar_space_height">72dp</dimen> + <!-- The fraction of the screen height where the clock on the Keyguard has its center. The max value is used when no notifications are displaying, and the min value is when the highest possible number of notifications are showing. --> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index c7a91af..23d9748 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -756,6 +756,9 @@ <!-- Accessibility label for the button that opens the user switcher. --> <string name="accessibility_multi_user_switch_switcher">Switch user</string> + <!-- Accessibility label for the button that opens the user switcher and announces the current user. --> + <string name="accessibility_multi_user_switch_switcher_with_current">Switch user, current user <xliff:g id="current_user_name" example="John Doe">%s</xliff:g></string> + <!-- Accessibility label for the button that opens the quick contact of the user. --> <string name="accessibility_multi_user_switch_quick_contact">Show profile</string> diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index f8d0d9e..8d35eb0 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1142,7 +1142,6 @@ public class KeyguardViewMediator extends SystemUI { } handleHide(); - sendUserPresentBroadcast(); } private void sendUserPresentBroadcast() { @@ -1313,6 +1312,7 @@ public class KeyguardViewMediator extends SystemUI { mHideAnimationRun = false; updateActivityLockScreenState(); adjustStatusBarLocked(); + sendUserPresentBroadcast(); } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java index 46d8a9b..d1dc5d2 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java @@ -60,7 +60,11 @@ public class LocationTile extends QSTile<QSTile.BooleanState> { @Override protected void handleUpdateState(BooleanState state, Object arg) { final boolean locationEnabled = mController.isLocationEnabled(); - state.visible = !(mKeyguard.isSecure() && mKeyguard.isShowing()); + + // Work around for bug 15916487: don't show location tile on top of lock screen. After the + // bug is fixed, this should be reverted to only hiding it on secure lock screens: + // state.visible = !(mKeyguard.isSecure() && mKeyguard.isShowing()); + state.visible = !mKeyguard.isShowing(); state.value = locationEnabled; if (locationEnabled) { state.iconId = R.drawable.ic_qs_location_on; diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java index 3e2ef94..b7434fd 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java @@ -34,14 +34,12 @@ import android.os.Handler; import android.os.Process; import android.os.RemoteException; import android.os.UserHandle; -import android.os.UserManager; import android.util.Log; import android.view.MotionEvent; import android.view.View; import com.android.systemui.R; import com.android.systemui.recents.misc.SystemServicesProxy; -import com.android.systemui.recents.misc.Utilities; import com.android.systemui.statusbar.phone.PhoneStatusBar; import java.util.ArrayList; @@ -205,8 +203,8 @@ public class RecentTasksLoader implements View.OnTouchListener { Drawable icon = getFullResIcon(td.resolveInfo, pm); if (td.userId != UserHandle.myUserId()) { // Need to badge the icon - final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE); - icon = um.getBadgedDrawableForUser(icon, new UserHandle(td.userId)); + icon = mContext.getPackageManager().getUserBadgedDrawableForDensity(icon, + new UserHandle(td.userId), null, 0); } if (DEBUG) Log.v(TAG, "Loaded bitmap for task " + td + ": " + thumbnail); diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index 082dde6..ec7799a 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -296,7 +296,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView mSearchAppWidgetInfo); Bundle opts = new Bundle(); opts.putInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY, - AppWidgetProviderInfo.WIDGET_CATEGORY_RECENTS); + AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX); mSearchAppWidgetHostView.updateAppWidgetOptions(opts); // Set the padding to 0 for this search widget mSearchAppWidgetHostView.setPadding(0, 0, 0, 0); diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java index e27c0ac..07a42bd 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java @@ -49,7 +49,6 @@ import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.UserHandle; -import android.os.UserManager; import android.provider.Settings; import android.util.Log; import android.util.Pair; @@ -79,7 +78,6 @@ public class SystemServicesProxy { AppWidgetManager mAwm; PackageManager mPm; IPackageManager mIpm; - UserManager mUm; SearchManager mSm; WindowManager mWm; Display mDisplay; @@ -103,7 +101,6 @@ public class SystemServicesProxy { mIam = ActivityManagerNative.getDefault(); mAwm = AppWidgetManager.getInstance(context); mPm = context.getPackageManager(); - mUm = (UserManager) context.getSystemService(Context.USER_SERVICE); mIpm = AppGlobals.getPackageManager(); mSm = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE); mWm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); @@ -343,7 +340,7 @@ public class SystemServicesProxy { * necessary. */ public Drawable getActivityIcon(ActivityInfo info, int userId) { - if (mPm == null || mUm == null) return null; + if (mPm == null) return null; // If we are mocking, then return a mock label if (Constants.DebugFlags.App.EnableSystemServicesProxy) { @@ -359,7 +356,7 @@ public class SystemServicesProxy { */ public Drawable getBadgedIcon(Drawable icon, int userId) { if (userId != UserHandle.myUserId()) { - icon = mUm.getBadgedDrawableForUser(icon, new UserHandle(userId)); + icon = mPm.getUserBadgedDrawableForDensity(icon, new UserHandle(userId), null, 0); } return icon; } @@ -392,7 +389,7 @@ public class SystemServicesProxy { // Find the first Recents widget from the same package as the global assist activity List<AppWidgetProviderInfo> widgets = mAwm.getInstalledProviders( - AppWidgetProviderInfo.WIDGET_CATEGORY_RECENTS); + AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX); for (AppWidgetProviderInfo info : widgets) { if (info.provider.getPackageName().equals(mAssistComponent.getPackageName())) { return info; @@ -418,7 +415,7 @@ public class SystemServicesProxy { int searchWidgetId = host.allocateAppWidgetId(); Bundle opts = new Bundle(); opts.putInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY, - AppWidgetProviderInfo.WIDGET_CATEGORY_RECENTS); + AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX); if (!mAwm.bindAppWidgetIdIfAllowed(searchWidgetId, searchWidgetInfo.provider, opts)) { return null; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java index e6984b2..c869ba4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java @@ -121,7 +121,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView private NotificationBackgroundView mBackgroundNormal; private NotificationBackgroundView mBackgroundDimmed; - private NotificationScrimView mScrimView; private ObjectAnimator mBackgroundAnimator; private RectF mAppearAnimationRect = new RectF(); private PorterDuffColorFilter mAppearAnimationFilter; @@ -173,8 +172,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mBackgroundDimmed.setCustomBackground(R.drawable.notification_material_bg_dim); updateBackground(); updateBackgroundTint(); - mScrimView = (NotificationScrimView) findViewById(R.id.scrim_view); - setScrimAmount(0); } private final Runnable mTapTimeoutRunnable = new Runnable() { @@ -465,7 +462,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView setPivotY(actualHeight / 2); mBackgroundNormal.setActualHeight(actualHeight); mBackgroundDimmed.setActualHeight(actualHeight); - mScrimView.setActualHeight(actualHeight); } @Override @@ -473,7 +469,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView super.setClipTopAmount(clipTopAmount); mBackgroundNormal.setClipTopAmount(clipTopAmount); mBackgroundDimmed.setClipTopAmount(clipTopAmount); - mScrimView.setClipTopAmount(clipTopAmount); } @Override @@ -496,11 +491,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView } } - @Override - public void setScrimAmount(float scrimAmount) { - mScrimView.setAlpha(scrimAmount); - } - private void startAppearAnimation(boolean isAppearing, float translationDirection, long delay, long duration, final Runnable onFinishedRunnable) { if (mAppearAnimator != null) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 2c1d70d..1c4556f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -558,6 +558,8 @@ public abstract class BaseStatusBar extends SystemUI implements // disable lockscreen notifications until user acts on the banner. Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0); + Settings.Secure.putInt(mContext.getContentResolver(), + Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0); final String packageName = mContext.getPackageName(); PendingIntent cancelIntent = PendingIntent.getBroadcast(mContext, 0, @@ -1356,8 +1358,8 @@ public abstract class BaseStatusBar extends SystemUI implements } if (profileBadge != null) { - Drawable profileDrawable - = mUserManager.getBadgeForUser(entry.notification.getUser(), 0); + Drawable profileDrawable = mContext.getPackageManager().getUserBadgeForDensity( + entry.notification.getUser(), 0); if (profileDrawable != null) { profileBadge.setImageDrawable(profileDrawable); profileBadge.setVisibility(View.VISIBLE); @@ -1623,10 +1625,11 @@ public abstract class BaseStatusBar extends SystemUI implements } } boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification); - if (onKeyguard && (visibleNotifications >= maxKeyguardNotifications - || !showOnKeyguard)) { + if ((isLockscreenPublicMode() && !showOnKeyguard) || + (onKeyguard && (visibleNotifications >= maxKeyguardNotifications + || !showOnKeyguard))) { entry.row.setVisibility(View.GONE); - if (showOnKeyguard) { + if (onKeyguard && showOnKeyguard) { mKeyguardIconOverflowContainer.getIconsView().addNotification(entry); } } else { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index e3a0b18..c13593a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -147,6 +147,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mMaxExpandHeight = 0; mWasReset = true; onHeightReset(); + requestLayout(); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index 2838747..c8f756e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -255,8 +255,6 @@ public abstract class ExpandableView extends FrameLayout { public abstract void performAddAnimation(long delay, long duration); - public abstract void setScrimAmount(float scrimAmount); - public void setBelowSpeedBump(boolean below) { } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java index 0905fe7..ca1fbe0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java @@ -100,15 +100,26 @@ public class NotificationData { @Override public int compare(Entry a, Entry b) { - String mediaNotification = mEnvironment.getCurrentMediaNotificationKey(); - // Upsort current media notification. + String mediaNotification = mEnvironment.getCurrentMediaNotificationKey(); boolean aMedia = a.key.equals(mediaNotification); boolean bMedia = b.key.equals(mediaNotification); if (aMedia != bMedia) { return aMedia ? -1 : 1; } + final StatusBarNotification na = a.notification; + final StatusBarNotification nb = b.notification; + + // Upsort PRIORITY_MAX system notifications + boolean aSystemMax = na.getNotification().priority >= Notification.PRIORITY_MAX && + isSystemNotification(na); + boolean bSystemMax = nb.getNotification().priority >= Notification.PRIORITY_MAX && + isSystemNotification(nb); + if (aSystemMax != bSystemMax) { + return aSystemMax ? -1 : 1; + } + // RankingMap as received from NoMan. if (mRankingMap != null) { mRankingMap.getRanking(a.key, mRankingA); @@ -116,8 +127,6 @@ public class NotificationData { return mRankingA.getRank() - mRankingB.getRank(); } - final StatusBarNotification na = a.notification; - final StatusBarNotification nb = b.notification; int d = nb.getScore() - na.getScore(); if (a.interruption != b.interruption) { return a.interruption ? -1 : 1; @@ -305,6 +314,11 @@ public class NotificationData { pw.println(" tickerText=\"" + n.getNotification().tickerText + "\""); } + private static boolean isSystemNotification(StatusBarNotification sbn) { + String sbnPackage = sbn.getPackageName(); + return "android".equals(sbnPackage) || "com.android.systemui".equals(sbnPackage); + } + /** * Provides access to keyguard state and user settings dependent data. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationScrimView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationScrimView.java deleted file mode 100644 index 440b2c1..0000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationScrimView.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package com.android.systemui.statusbar; - -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.PorterDuff; -import android.graphics.drawable.Drawable; -import android.util.AttributeSet; -import android.view.View; - -import com.android.keyguard.R; - -/** - * A view that can be used for both the dimmed and normal background of an notification. - */ -public class NotificationScrimView extends View { - - private Drawable mBackground; - private int mClipTopAmount; - private int mActualHeight; - - public NotificationScrimView(Context context, AttributeSet attrs) { - super(context, attrs); - mBackground = getResources().getDrawable(R.drawable.notification_scrim); - } - - @Override - protected void onDraw(Canvas canvas) { - draw(canvas, mBackground); - } - - private void draw(Canvas canvas, Drawable drawable) { - if (drawable != null) { - drawable.setBounds(0, mClipTopAmount, getWidth(), mActualHeight); - drawable.draw(canvas); - } - } - - @Override - protected boolean verifyDrawable(Drawable who) { - return super.verifyDrawable(who) || who == mBackground; - } - - public void setActualHeight(int actualHeight) { - mActualHeight = actualHeight; - invalidate(); - } - - public int getActualHeight() { - return mActualHeight; - } - - public void setClipTopAmount(int clipTopAmount) { - mClipTopAmount = clipTopAmount; - invalidate(); - } - - @Override - public boolean hasOverlappingRendering() { - - // Prevents this view from creating a layer when alpha is animating. - return false; - } -} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java index 816612b..1fc8744 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java @@ -126,9 +126,4 @@ public class SpeedBumpView extends ExpandableView { // TODO: Use duration performVisibilityAnimation(true, delay); } - - @Override - public void setScrimAmount(float scrimAmount) { - // We don't need to scrim the speedbumps - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StackScrollerDecorView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StackScrollerDecorView.java index 62a492e..c620046 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StackScrollerDecorView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StackScrollerDecorView.java @@ -127,11 +127,6 @@ public abstract class StackScrollerDecorView extends ExpandableView { } @Override - public void setScrimAmount(float scrimAmount) { - // We don't need to scrim the dismissView - } - - @Override public boolean hasOverlappingRendering() { return false; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java index d7144da..dc49118 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java @@ -30,6 +30,7 @@ import android.widget.FrameLayout; import com.android.systemui.R; import com.android.systemui.qs.QSPanel; import com.android.systemui.statusbar.policy.KeyguardUserSwitcher; +import com.android.systemui.statusbar.policy.UserSwitcherController; /** * Container for image of the multi user switcher (tappable). @@ -90,9 +91,21 @@ public class MultiUserSwitch extends FrameLayout implements View.OnClickListener if (isClickable()) { final UserManager um = UserManager.get(getContext()); - String text = mContext.getString(um.isUserSwitcherEnabled() - ? R.string.accessibility_multi_user_switch_switcher - : R.string.accessibility_multi_user_switch_quick_contact); + String text; + if (um.isUserSwitcherEnabled()) { + UserSwitcherController controller = mQsPanel.getHost() + .getUserSwitcherController(); + String currentUser = controller.getCurrentUserName(mContext); + if (TextUtils.isEmpty(currentUser)) { + text = mContext.getString(R.string.accessibility_multi_user_switch_switcher); + } else { + text = mContext.getString( + R.string.accessibility_multi_user_switch_switcher_with_current, + currentUser); + } + } else { + text = mContext.getString(R.string.accessibility_multi_user_switch_quick_contact); + } if (!TextUtils.isEmpty(text)) { event.getText().add(text); } 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 bae1864..cf5aebc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -1047,7 +1047,6 @@ public class NotificationPanelView extends PanelView implements int startDistance = mQsMinExpansionHeight + mNotificationScrimWaitDistance; float progress = (height - startDistance) / (mQsMaxExpansionHeight - startDistance); progress = Math.max(0.0f, Math.min(progress, 1.0f)); - mNotificationStackScroller.setScrimAlpha(progress); } private float getHeaderExpansionFraction() { @@ -1279,7 +1278,7 @@ public class NotificationPanelView extends PanelView implements private void updateNotificationTranslucency() { float alpha = (getNotificationsTopY() + mNotificationStackScroller.getItemHeight()) / (mQsMinExpansionHeight + mNotificationStackScroller.getBottomStackPeekSize() - + mNotificationStackScroller.getCollapseSecondCardPadding()); + - mNotificationStackScroller.getCollapseSecondCardPadding()); alpha = Math.max(0, Math.min(alpha, 1)); alpha = (float) Math.pow(alpha, 0.75); if (alpha != 1f && mNotificationStackScroller.getLayerType() != LAYER_TYPE_HARDWARE) { 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 ddd03d6..861bf4a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1559,8 +1559,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } } - for (View remove : toRemove) { - mNotificationIcons.removeView(remove); + final int toRemoveCount = toRemove.size(); + for (int i = 0; i < toRemoveCount; i++) { + mNotificationIcons.removeView(toRemove.get(i)); } for (int i=0; i<toShow.size(); i++) { @@ -1569,6 +1570,18 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mNotificationIcons.addView(v, i, params); } } + + // Resort notification icons + final int childCount = mNotificationIcons.getChildCount(); + for (int i = 0; i < childCount; i++) { + View actual = mNotificationIcons.getChildAt(i); + StatusBarIconView expected = toShow.get(i); + if (actual == expected) { + continue; + } + mNotificationIcons.removeView(expected); + mNotificationIcons.addView(expected, i); + } } @Override @@ -1730,12 +1743,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, // something old was playing Log.v(TAG, "DEBUG_MEDIA: Disconnecting from old controller: " + mMediaController); - mMediaController.removeCallback(mMediaListener); + mMediaController.unregisterCallback(mMediaListener); } mMediaController = controller; if (mMediaController != null) { - mMediaController.addCallback(mMediaListener); + mMediaController.registerCallback(mMediaListener); mMediaMetadata = mMediaController.getMetadata(); if (DEBUG_MEDIA) { Log.v(TAG, "DEBUG_MEDIA: insert listener, receive metadata: " @@ -3774,7 +3787,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, row = (ExpandableNotificationRow) expandView; row.setUserExpanded(true); } - if (isLockscreenPublicMode() && !userAllowsPrivateNotificationsInPublic(mCurrentUserId)) { + boolean fullShadeNeedsBouncer = !userAllowsPrivateNotificationsInPublic(mCurrentUserId) + || !mShowLockscreenNotifications; + if (isLockscreenPublicMode() && fullShadeNeedsBouncer) { mLeaveOpenOnKeyguardHide = true; showBouncer(); mDraggedDownRow = row; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java index e4b1945..52fa621 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java @@ -334,6 +334,14 @@ public class UserSwitcherController { } } + public String getCurrentUserName(Context context) { + if (mUsers.isEmpty()) return null; + UserRecord item = mUsers.get(0); + if (item == null || item.info == null) return null; + if (item.isGuest) return context.getString(R.string.guest_nickname); + return item.info.name; + } + public static abstract class BaseUserAdapter extends BaseAdapter { final UserSwitcherController mController; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java index ddb5cb8..8e677f1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java @@ -32,7 +32,6 @@ public class AmbientState { private float mOverScrollTopAmount; private float mOverScrollBottomAmount; private int mSpeedBumpIndex = -1; - private float mScrimAmount; private boolean mDark; private boolean mHideSensitive; @@ -105,14 +104,6 @@ public class AmbientState { } } - public void setScrimAmount(float scrimAmount) { - mScrimAmount = scrimAmount; - } - - public float getScrimAmount() { - return mScrimAmount; - } - public float getOverScrollAmount(boolean top) { return top ? mOverScrollTopAmount : mOverScrollBottomAmount; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index fed579c..6f477ef 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -2094,13 +2094,6 @@ public class NotificationStackScrollLayout extends ViewGroup return true; } - public void setScrimAlpha(float progress) { - if (progress != mAmbientState.getScrimAmount()) { - mAmbientState.setScrimAmount(progress); - requestChildrenUpdate(); - } - } - /** * See {@link AmbientState#setDark}. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java index fe855d9..7c4c0e8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java @@ -172,7 +172,6 @@ public class StackScrollAlgorithm { handleDraggedViews(ambientState, resultState, algorithmState); updateDimmedActivatedHideSensitive(ambientState, resultState, algorithmState); updateClipping(resultState, algorithmState); - updateScrimAmount(resultState, algorithmState, ambientState.getScrimAmount()); updateSpeedBumpState(resultState, algorithmState, ambientState.getSpeedBumpIndex()); } @@ -189,16 +188,6 @@ public class StackScrollAlgorithm { } } - private void updateScrimAmount(StackScrollState resultState, - StackScrollAlgorithmState algorithmState, float scrimAmount) { - int childCount = algorithmState.visibleChildren.size(); - for (int i = 0; i < childCount; i++) { - View child = algorithmState.visibleChildren.get(i); - StackScrollState.ViewState childViewState = resultState.getViewStateForView(child); - childViewState.scrimAmount = scrimAmount; - } - } - private void updateClipping(StackScrollState resultState, StackScrollAlgorithmState algorithmState) { float previousNotificationEnd = 0; 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 f7a2824..0967ecd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java @@ -165,9 +165,6 @@ public class StackScrollState { // apply speed bump state child.setBelowSpeedBump(state.belowSpeedBump); - // apply scrimming - child.setScrimAmount(state.scrimAmount); - // apply clipping float oldClipTopAmount = child.getClipTopAmount(); if (oldClipTopAmount != state.clipTopAmount) { @@ -252,12 +249,6 @@ public class StackScrollState { boolean belowSpeedBump; /** - * A value between 0 and 1 indicating how much the view should be scrimmed. - * 1 means that the notifications will be darkened as much as possible. - */ - float scrimAmount; - - /** * The amount which the view should be clipped from the top. This is calculated to * perceive consistent shadows. */ 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 58d5813..ece82a1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java @@ -251,9 +251,6 @@ public class StackStateAnimator { child.setHideSensitive(viewState.hideSensitive, mAnimationFilter.animateHideSensitive && !wasAdded && !noAnimation, delay, duration); - // apply scrimming - child.setScrimAmount(viewState.scrimAmount); - if (wasAdded) { child.performAddAnimation(delay, mCurrentLength); } diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java index 5da8681..ffc10a9 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java @@ -1055,11 +1055,11 @@ public class VolumePanel extends Handler { if (sc != null) { if (streamType == STREAM_REMOTE_MUSIC && controller != sc.controller) { if (sc.controller != null) { - sc.controller.removeCallback(mMediaControllerCb); + sc.controller.unregisterCallback(mMediaControllerCb); } sc.controller = controller; if (controller != null) { - sc.controller.addCallback(mMediaControllerCb); + sc.controller.registerCallback(mMediaControllerCb); } } if (sc.seekbarView.getMax() != max) { @@ -1175,7 +1175,7 @@ public class VolumePanel extends Handler { StreamControl sc = mStreamControls.get(STREAM_REMOTE_MUSIC); if (sc != null) { if (sc.controller != null) { - sc.controller.removeCallback(mMediaControllerCb); + sc.controller.unregisterCallback(mMediaControllerCb); sc.controller = null; } } |