diff options
Diffstat (limited to 'packages')
18 files changed, 392 insertions, 31 deletions
diff --git a/packages/CarSystemUI/Android.bp b/packages/CarSystemUI/Android.bp index f244f9f88684..74d6605a1ffb 100644 --- a/packages/CarSystemUI/Android.bp +++ b/packages/CarSystemUI/Android.bp @@ -26,6 +26,7 @@ android_app { ], static_libs: [ + "CarNotificationLib", "SystemUI-core", "SystemUIPluginLib", "SystemUISharedLib", diff --git a/packages/CarSystemUI/res/values/config.xml b/packages/CarSystemUI/res/values/config.xml index 452d61df5322..572737f92370 100644 --- a/packages/CarSystemUI/res/values/config.xml +++ b/packages/CarSystemUI/res/values/config.xml @@ -28,4 +28,31 @@ <bool name="config_enableRightNavigationBar">false</bool> <bool name="config_enableBottomNavigationBar">true</bool> + <!-- SystemUI Services: The classes of the stuff to start. This is duplicated from core + SystemUi b/c it can't be overlayed at this level for now + --> + <string-array name="config_systemUIServiceComponents" translatable="false"> + <item>com.android.systemui.Dependency</item> + <item>com.android.systemui.util.NotificationChannels</item> + <item>com.android.systemui.statusbar.CommandQueue$CommandQueueStart</item> + <item>com.android.systemui.keyguard.KeyguardViewMediator</item> + <item>com.android.systemui.recents.Recents</item> + <item>com.android.systemui.volume.VolumeUI</item> + <item>com.android.systemui.stackdivider.Divider</item> + <item>com.android.systemui.SystemBars</item> + <item>com.android.systemui.usb.StorageNotification</item> + <item>com.android.systemui.power.PowerUI</item> + <item>com.android.systemui.media.RingtonePlayer</item> + <item>com.android.systemui.keyboard.KeyboardUI</item> + <item>com.android.systemui.pip.PipUI</item> + <item>com.android.systemui.shortcut.ShortcutKeyDispatcher</item> + <item>@string/config_systemUIVendorServiceComponent</item> + <item>com.android.systemui.util.leak.GarbageMonitor$Service</item> + <item>com.android.systemui.LatencyTester</item> + <item>com.android.systemui.globalactions.GlobalActionsComponent</item> + <item>com.android.systemui.ScreenDecorations</item> + <item>com.android.systemui.fingerprint.FingerprintDialogImpl</item> + <item>com.android.systemui.SliceBroadcastRelayHandler</item> + <item>com.android.systemui.notifications.NotificationsUI</item> + </string-array> </resources> diff --git a/packages/CarSystemUI/src/com/android/systemui/notifications/NotificationsUI.java b/packages/CarSystemUI/src/com/android/systemui/notifications/NotificationsUI.java new file mode 100644 index 000000000000..cb92c4259504 --- /dev/null +++ b/packages/CarSystemUI/src/com/android/systemui/notifications/NotificationsUI.java @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2018 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.notifications; + +import android.car.Car; +import android.car.CarNotConnectedException; +import android.car.drivingstate.CarUxRestrictionsManager; +import android.content.ComponentName; +import android.content.Context; +import android.content.ServiceConnection; +import android.graphics.PixelFormat; +import android.os.IBinder; +import android.util.Log; +import android.view.View; +import android.view.ViewGroup; +import android.view.WindowManager; + +import com.android.car.notification.CarNotificationListener; +import com.android.car.notification.CarUxRestrictionManagerWrapper; +import com.android.car.notification.NotificationViewController; +import com.android.car.notification.PreprocessingManager; +import com.android.systemui.R; +import com.android.systemui.SystemUI; + +/** + * Standalone SystemUI for displaying Notifications that have been designed to be used in the car + */ +public class NotificationsUI extends SystemUI { + + private static final String TAG = "NotificationsUI"; + private CarNotificationListener mCarNotificationListener; + private CarUxRestrictionsManager mCarUxRestrictionsManager; + private Car mCar; + private ViewGroup mCarNotificationWindow; + private NotificationViewController mNotificationViewController; + private boolean mIsShowing; + private CarUxRestrictionManagerWrapper mCarUxRestrictionManagerWrapper = + new CarUxRestrictionManagerWrapper(); + + /** + * Inits the window that hosts the notifications and establishes the connections + * to the car related services. + */ + @Override + public void start() { + WindowManager windowManager = + (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); + mCarNotificationListener = new CarNotificationListener(); + mCarNotificationListener.registerAsSystemService(mContext, mCarUxRestrictionManagerWrapper); + mCar = Car.createCar(mContext, mCarConnectionListener); + mCar.connect(); + + + mCarNotificationWindow = (ViewGroup) View.inflate(mContext, + R.layout.navigation_bar_window, null); + View.inflate(mContext, + com.android.car.notification.R.layout.notification_center_activity, + mCarNotificationWindow); + mCarNotificationWindow.findViewById( + com.android.car.notification.R.id.exit_button_container) + .setOnClickListener(v -> toggleShowingCarNotifications()); + + WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, + WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY, + WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE + | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL + | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH + | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, + PixelFormat.TRANSLUCENT); + layoutParams.setTitle("Car Notification Window"); + // start in the hidden state + mCarNotificationWindow.setVisibility(View.GONE); + windowManager.addView(mCarNotificationWindow, layoutParams); + mNotificationViewController = new NotificationViewController( + mCarNotificationWindow + .findViewById(com.android.car.notification.R.id.notification_view), + PreprocessingManager.getInstance(mContext), + mCarNotificationListener, + mCarUxRestrictionManagerWrapper + ); + // Add to the SystemUI component registry + putComponent(NotificationsUI.class, this); + } + + /** + * Connection callback to establish UX Restrictions + */ + private ServiceConnection mCarConnectionListener = new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + try { + mCarUxRestrictionsManager = (CarUxRestrictionsManager) mCar.getCarManager( + Car.CAR_UX_RESTRICTION_SERVICE); + mCarUxRestrictionManagerWrapper + .setCarUxRestrictionsManager(mCarUxRestrictionsManager); + PreprocessingManager preprocessingManager = PreprocessingManager.getInstance( + mContext); + preprocessingManager + .setCarUxRestrictionManagerWrapper(mCarUxRestrictionManagerWrapper); + } catch (CarNotConnectedException e) { + Log.e(TAG, "Car not connected in CarConnectionListener", e); + } + } + + @Override + public void onServiceDisconnected(ComponentName name) { + Log.e(TAG, "Car service disconnected unexpectedly"); + } + }; + + /** + * Toggles the visiblity of the notifications + */ + public void toggleShowingCarNotifications() { + if (mCarNotificationWindow.getVisibility() == View.VISIBLE) { + closeCarNotifications(); + return; + } + openCarNotifications(); + } + + /** + * Hides the notifications + */ + public void closeCarNotifications() { + mCarNotificationWindow.setVisibility(View.GONE); + mNotificationViewController.disable(); + mIsShowing = false; + } + + /** + * Sets the notifications to visible + */ + public void openCarNotifications() { + mCarNotificationWindow.setVisibility(View.VISIBLE); + mNotificationViewController.enable(); + mIsShowing = true; + } + + /** + * Returns {@code true} if notifications are currently on the screen + */ + public boolean isShowing() { + return mIsShowing; + } +} diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java index 81f7846b357d..0cba351a8a9c 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java @@ -21,7 +21,6 @@ import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; -import com.android.keyguard.AlphaOptimizedImageButton; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.statusbar.phone.StatusBarIconController; @@ -34,7 +33,7 @@ import com.android.systemui.statusbar.phone.StatusBarIconController; */ class CarNavigationBarView extends LinearLayout { private View mNavButtons; - private AlphaOptimizedImageButton mNotificationsButton; + private CarFacetButton mNotificationsButton; private CarStatusBar mCarStatusBar; private Context mContext; private View mLockScreenButtons; @@ -71,7 +70,7 @@ class CarNavigationBarView extends LinearLayout { } protected void onNotificationsClick(View v) { - mCarStatusBar.togglePanel(); + mCarStatusBar.toggleCarNotifications(); } /** diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java index 2d90f8f0afd9..5da236ceb211 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java @@ -35,6 +35,7 @@ import com.android.systemui.R; import com.android.systemui.classifier.FalsingLog; import com.android.systemui.classifier.FalsingManager; import com.android.systemui.fragments.FragmentHostManager; +import com.android.systemui.notifications.NotificationsUI; import com.android.systemui.plugins.qs.QS; import com.android.systemui.qs.car.CarQSFragment; import com.android.systemui.shared.system.ActivityManagerWrapper; @@ -587,4 +588,9 @@ public class CarStatusBar extends StatusBar implements private Drawable getDefaultWallpaper() { return mContext.getDrawable(com.android.internal.R.drawable.default_wallpaper); } + + public void toggleCarNotifications() { + getComponent(NotificationsUI.class).toggleShowingCarNotifications(); + } + } diff --git a/packages/ExtServices/AndroidManifest.xml b/packages/ExtServices/AndroidManifest.xml index ff70e9712bcc..010a810cd791 100644 --- a/packages/ExtServices/AndroidManifest.xml +++ b/packages/ExtServices/AndroidManifest.xml @@ -63,6 +63,13 @@ android:resource="@array/autofill_field_classification_available_algorithms" /> </service> + <service android:name=".sms.FinancialSmsServiceImpl" + android:permission="android.permission.BIND_FINANCIAL_SMS_SERVICE"> + <intent-filter> + <action android:name="android.service.sms.action.FINANCIAL_SERVICE_INTENT" /> + </intent-filter> + </service> + <library android:name="android.ext.services"/> </application> diff --git a/packages/ExtServices/src/android/ext/services/sms/FinancialSmsServiceImpl.java b/packages/ExtServices/src/android/ext/services/sms/FinancialSmsServiceImpl.java new file mode 100644 index 000000000000..ab71802102ae --- /dev/null +++ b/packages/ExtServices/src/android/ext/services/sms/FinancialSmsServiceImpl.java @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2018 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 android.ext.services.sms; + +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.database.Cursor; +import android.database.CursorWindow; +import android.net.Uri; +import android.os.Bundle; +import android.service.sms.FinancialSmsService; +import android.util.Log; + +import java.util.ArrayList; +/** + * Service to provide financial apps access to sms messages. + */ +public class FinancialSmsServiceImpl extends FinancialSmsService { + + private static final String TAG = "FinancialSmsServiceImpl"; + private static final String KEY_COLUMN_NAMES = "column_names"; + + @Nullable + @Override + public CursorWindow onGetSmsMessages(@NonNull Bundle params) { + ArrayList<String> columnNames = params.getStringArrayList(KEY_COLUMN_NAMES); + if (columnNames == null || columnNames.size() <= 0) { + return null; + } + + Uri inbox = Uri.parse("content://sms/inbox"); + + try (Cursor cursor = getContentResolver().query(inbox, null, null, null, null); + CursorWindow window = new CursorWindow("FinancialSmsMessages")) { + int messageCount = cursor.getCount(); + if (messageCount > 0 && cursor.moveToFirst()) { + window.setNumColumns(columnNames.size()); + for (int row = 0; row < messageCount; row++) { + if (!window.allocRow()) { + Log.e(TAG, "CursorWindow ran out of memory."); + return null; + } + for (int col = 0; col < columnNames.size(); col++) { + String columnName = columnNames.get(col); + int inboxColumnIndex = cursor.getColumnIndexOrThrow(columnName); + String inboxColumnValue = cursor.getString(inboxColumnIndex); + boolean addedToCursorWindow = window.putString(inboxColumnValue, row, col); + if (!addedToCursorWindow) { + Log.e(TAG, "Failed to add:" + + inboxColumnValue + + ";column:" + + columnName); + return null; + } + } + cursor.moveToNext(); + } + } else { + Log.w(TAG, "No sms messages."); + } + return window; + } catch (Exception e) { + Log.e(TAG, "Failed to get sms messages."); + return null; + } + } +} diff --git a/packages/ExtServices/tests/src/android/ext/services/sms/FinancialSmsServiceImplTest.java b/packages/ExtServices/tests/src/android/ext/services/sms/FinancialSmsServiceImplTest.java new file mode 100644 index 000000000000..12575a63d0ad --- /dev/null +++ b/packages/ExtServices/tests/src/android/ext/services/sms/FinancialSmsServiceImplTest.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2018 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 android.ext.services.sms; + +import static com.google.common.truth.Truth.assertThat; + +import android.os.Bundle; + +import org.junit.Test; + +/** + * Contains the base tests for FinancialSmsServiceImpl. + */ +public class FinancialSmsServiceImplTest { + + private final FinancialSmsServiceImpl mService = new FinancialSmsServiceImpl(); + + @Test + public void testOnGetSmsMessages_nullWithNoParamData() { + assertThat(mService.onGetSmsMessages(new Bundle())).isNull(); + } +} diff --git a/packages/SystemUI/res/layout/qs_detail.xml b/packages/SystemUI/res/layout/qs_detail.xml index 0b9a7b226105..294bd50fcf8b 100644 --- a/packages/SystemUI/res/layout/qs_detail.xml +++ b/packages/SystemUI/res/layout/qs_detail.xml @@ -24,7 +24,8 @@ android:orientation="vertical" android:paddingBottom="8dp" android:visibility="invisible" - android:elevation="4dp" > + android:elevation="4dp" + android:importantForAccessibility="no" > <include android:id="@+id/qs_detail_header" diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 3851190fdeec..6037dfc5154d 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -24,7 +24,7 @@ <!-- Minimum swipe distance to catch the swipe gestures to invoke assist or switch tasks. --> <dimen name="navigation_bar_min_swipe_distance">48dp</dimen> <!-- The distance from a side of device of the navigation bar to start an edge swipe --> - <dimen name="navigation_bar_edge_swipe_threshold">60dp</dimen> + <dimen name="navigation_bar_edge_swipe_threshold">48dp</dimen> <!-- thickness (height) of the dead zone at the top of the navigation bar, reducing false presses on navbar buttons; approx 2mm --> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index fede934d7369..87155c4d41a2 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -144,7 +144,7 @@ <item name="android:textSize">@dimen/qs_time_expanded_size</item> <item name="android:textStyle">normal</item> <item name="android:textColor">?android:attr/textColorPrimary</item> - <item name="android:fontFamily">sans-serif</item> + <item name="android:fontFamily">@*android:string/config_bodyFontFamily</item> </style> <style name="TextAppearance.StatusBar.Expanded.AboveDateTime"> @@ -171,12 +171,12 @@ <style name="TextAppearance.QS"> <item name="android:textStyle">normal</item> <item name="android:textColor">?android:attr/textColorPrimary</item> - <item name="android:fontFamily">sans-serif</item> + <item name="android:fontFamily">@*android:string/config_bodyFontFamily</item> </style> <style name="TextAppearance.QS.DetailHeader"> <item name="android:textSize">@dimen/qs_detail_header_text_size</item> - <item name="android:fontFamily">sans-serif-medium</item> + <item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item> </style> <style name="TextAppearance.QS.DetailItemPrimary"> @@ -202,7 +202,7 @@ <item name="android:textSize">@dimen/qs_detail_button_text_size</item> <item name="android:textColor">?android:attr/textColorSecondary</item> <item name="android:textAllCaps">true</item> - <item name="android:fontFamily">sans-serif-medium</item> + <item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item> <item name="android:gravity">center</item> </style> @@ -222,7 +222,7 @@ <style name="TextAppearance.QS.SegmentedButton"> <item name="android:textSize">16sp</item> - <item name="android:fontFamily">sans-serif-medium</item> + <item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item> </style> <style name="TextAppearance.QS.DataUsage"> @@ -245,7 +245,7 @@ <style name="TextAppearance.QS.TileLabel.Secondary"> <item name="android:textSize">@dimen/qs_tile_text_size</item> - <item name="android:fontFamily">sans-serif</item> + <item name="android:fontFamily">@*android:string/config_bodyFontFamily</item> </style> <style name="TextAppearance.QS.CarrierInfo"> @@ -262,7 +262,7 @@ <style name="TextAppearance.AppOpsDialog.Item"> <item name="android:textSize">@dimen/ongoing_appops_dialog_item_size</item> - <item name="android:fontFamily">sans-serif</item> + <item name="android:fontFamily">@*android:string/config_bodyFontFamily</item> </style> <style name="BaseBrightnessDialogContainer" parent="@style/Theme.SystemUI"> @@ -391,7 +391,7 @@ <style name="TextAppearance.Volume"> <item name="android:textStyle">normal</item> <item name="android:textColor">?android:attr/textColorPrimary</item> - <item name="android:fontFamily">sans-serif</item> + <item name="android:fontFamily">@*android:string/config_bodyFontFamily</item> </style> <style name="TextAppearance.Volume.Header"> @@ -435,7 +435,7 @@ </style> <style name="TextAppearance.NotificationInfo"> - <item name="android:fontFamily">sans-serif</item> + <item name="android:fontFamily">@*android:string/config_bodyFontFamily</item> <item name="android:textColor">@color/notification_primary_text_color</item> </style> @@ -463,7 +463,7 @@ </style> <style name="TextAppearance.NotificationInfo.Button"> - <item name="android:fontFamily">sans-serif-medium</item> + <item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item> <item name="android:textSize">14sp</item> <item name="android:textColor">?android:attr/colorAccent</item> <item name="android:background">@drawable/btn_borderless_rect</item> diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java index 32fd2dcedd0e..bfcf0214dd05 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java @@ -19,6 +19,7 @@ import android.animation.ValueAnimator; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.TypedArray; +import android.graphics.Color; import android.graphics.Path; import android.graphics.drawable.AdaptiveIconDrawable; import android.graphics.drawable.Drawable; @@ -88,6 +89,7 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { float pathSize = AdaptiveIconDrawable.MASK_SIZE; PathShape p = new PathShape(path, pathSize, pathSize); ShapeDrawable d = new ShapeDrawable(p); + d.setTintList(ColorStateList.valueOf(Color.TRANSPARENT)); int bgSize = context.getResources().getDimensionPixelSize(R.dimen.qs_tile_background_size); d.setIntrinsicHeight(bgSize); d.setIntrinsicWidth(bgSize); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index 6cec36a81e5a..91b34fc875bf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -916,6 +916,10 @@ public class NotificationShelf extends ActivatableNotificationView implements updateRelativeOffset(); } + public void onUiModeChanged() { + updateBackgroundColors(); + } + private class ShelfState extends ExpandableViewState { private float openedAmount; private boolean hasItemsInStableShelf; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java index 7876b24112e0..1d79152bb1cc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java @@ -225,7 +225,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView initDimens(); } - public void onUiModeChanged() { + protected void updateBackgroundColors() { updateColors(); initBackground(); updateBackgroundTint(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index 8bed3663cf49..383446c00d37 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -121,6 +121,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView private static final int MENU_VIEW_INDEX = 0; private static final String TAG = "ExpandableNotifRow"; public static final float DEFAULT_HEADER_VISIBLE_AMOUNT = 1.0f; + private boolean mUpdateBackgroundOnUpdate; /** * Listener for when {@link ExpandableNotificationRow} is laid out. @@ -587,6 +588,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView updateIconVisibilities(); updateShelfIconColor(); updateRippleAllowed(); + if (mUpdateBackgroundOnUpdate) { + mUpdateBackgroundOnUpdate = false; + updateBackgroundColors(); + } } /** Called when the notification's ranking was changed (but nothing else changed). */ @@ -1212,9 +1217,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } } - @Override public void onUiModeChanged() { - super.onUiModeChanged(); + mUpdateBackgroundOnUpdate = true; reInflateViews(); if (mChildrenContainer != null) { for (ExpandableNotificationRow child : mChildrenContainer.getNotificationChildren()) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index eca1a1411212..dbe6e8ec764d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -641,15 +641,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd public void onUiModeChanged() { mBgColor = mContext.getColor(R.color.notification_shade_background_color); updateBackgroundDimming(); - - // Re-inflate all notification views - int childCount = getChildCount(); - for (int i = 0; i < childCount; i++) { - View child = getChildAt(i); - if (child instanceof ActivatableNotificationView) { - ((ActivatableNotificationView) child).onUiModeChanged(); - } - } + mShelf.onUiModeChanged(); } @ShadeViewRefactor(RefactorComponent.DECORATOR) 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 a2a11bbfd650..c7e4d340b7d8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -105,10 +105,22 @@ public class NotificationPanelView extends PanelView implements private static final boolean DEBUG = false; - private static final boolean EXPAND_ON_WAKE_UP = SystemProperties.getBoolean( + /** + * If passive interrupts expand the NSSL or not + */ + private static final boolean EXPAND_ON_PASSIVE_INTERRUPT = SystemProperties.getBoolean( "persist.sysui.expand_shade_on_wake_up", true); + /** + * If the notification panel should remain collapsed when the phone wakes up, even if the user + * presses power. + */ + private static final boolean NEVER_EXPAND_WHEN_WAKING_UP = SystemProperties.getBoolean( + "persist.sysui.defer_notifications_on_lock_screen", false); + /** + * If waking up the phone should take you to SHADE_LOCKED instead of KEYGUARD + */ private static final boolean WAKE_UP_TO_SHADE = SystemProperties.getBoolean( - "persist.sysui.go_to_shade_on_wake_up", true); + "persist.sysui.go_to_shade_on_wake_up", false); /** * Fling expanding QS. @@ -2774,10 +2786,12 @@ public class NotificationPanelView extends PanelView implements } public void setDozing(boolean dozing, boolean animate, PointF wakeUpTouchLocation, - boolean passiveInterrupted) { + boolean passivelyInterrupted) { if (dozing == mDozing) return; mDozing = dozing; - mSemiAwake = !EXPAND_ON_WAKE_UP && !mDozing && passiveInterrupted; + boolean doNotExpand = (!EXPAND_ON_PASSIVE_INTERRUPT && passivelyInterrupted) + || NEVER_EXPAND_WHEN_WAKING_UP; + mSemiAwake = doNotExpand && !mDozing; if (!mSemiAwake) { mNotificationStackScroller.setDark(mDozing, animate, wakeUpTouchLocation); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java index acdd5e995322..261f117b58b4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java @@ -67,6 +67,8 @@ import com.android.systemui.statusbar.notification.stack.NotificationListContain import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardMonitor; +import java.util.ArrayList; + public class StatusBarNotificationPresenter implements NotificationPresenter, ConfigurationController.ConfigurationListener { @@ -105,6 +107,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter, private final int mMaxAllowedKeyguardNotifications; private final IStatusBarService mBarService; private boolean mReinflateNotificationsOnUserSwitched; + private boolean mDispatchUiModeChangeOnUserSwitched; private final UnlockMethodCache mUnlockMethodCache; private TextView mNotificationPanelDebugText; @@ -187,6 +190,27 @@ public class StatusBarNotificationPresenter implements NotificationPresenter, } @Override + public void onUiModeChanged() { + if (!KeyguardUpdateMonitor.getInstance(mContext).isSwitchingUser()) { + updateNotificationOnUiModeChanged(); + } else { + mDispatchUiModeChangeOnUserSwitched = true; + } + } + + private void updateNotificationOnUiModeChanged() { + ArrayList<Entry> userNotifications + = mEntryManager.getNotificationData().getNotificationsForCurrentUser(); + for (int i = 0; i < userNotifications.size(); i++) { + Entry entry = userNotifications.get(i); + ExpandableNotificationRow row = entry.getRow(); + if (row != null) { + row.onUiModeChanged(); + } + } + } + + @Override public boolean isCollapsing() { return mNotificationPanel.isCollapsing() || mActivityLaunchAnimator.isAnimationPending() @@ -301,6 +325,10 @@ public class StatusBarNotificationPresenter implements NotificationPresenter, mEntryManager.updateNotificationsOnDensityOrFontScaleChanged(); mReinflateNotificationsOnUserSwitched = false; } + if (mDispatchUiModeChangeOnUserSwitched) { + updateNotificationOnUiModeChanged(); + mDispatchUiModeChangeOnUserSwitched = false; + } updateNotificationViews(); mMediaManager.clearCurrentMediaNotification(); mShadeController.setLockscreenUser(newUserId); |