diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginInstanceManager.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginInstanceManager.java index d71b6bdafe199..dd1614b50ca68 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginInstanceManager.java +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginInstanceManager.java @@ -51,9 +51,6 @@ public class PluginInstanceManager { private static final String TAG = "PluginInstanceManager"; private static final String PLUGIN_PERMISSION = "com.android.systemui.permission.PLUGIN"; - // must be one of the channels created in NotificationChannels.java - private static final String NOTIFICATION_CHANNEL_ID = "ALR"; - private final Context mContext; private final PluginListener mListener; private final String mAction; @@ -310,14 +307,14 @@ public class PluginInstanceManager { mContext.getPackageName()); final int color = Resources.getSystem().getIdentifier( "system_notification_accent_color", "color", "android"); - final Notification.Builder nb = new Notification.Builder(mContext) - .setStyle(new Notification.BigTextStyle()) - .setSmallIcon(icon) - .setWhen(0) - .setShowWhen(false) - .setChannel(NOTIFICATION_CHANNEL_ID) - .setVisibility(Notification.VISIBILITY_PUBLIC) - .setColor(mContext.getColor(color)); + final Notification.Builder nb = new Notification.Builder(mContext, + PluginManager.NOTIFICATION_CHANNEL_ID) + .setStyle(new Notification.BigTextStyle()) + .setSmallIcon(icon) + .setWhen(0) + .setShowWhen(false) + .setVisibility(Notification.VISIBILITY_PUBLIC) + .setColor(mContext.getColor(color)); String label = cls; try { label = mPm.getServiceInfo(component, 0).loadLabel(mPm).toString(); diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginManager.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginManager.java index 471454749c2fc..b421f923b96be 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginManager.java +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/PluginManager.java @@ -55,6 +55,9 @@ public class PluginManager extends BroadcastReceiver { static final String DISABLE_PLUGIN = "com.android.systemui.action.DISABLE_PLUGIN"; + // must be one of the channels created in NotificationChannels.java + static final String NOTIFICATION_CHANNEL_ID = "ALR"; + private static PluginManager sInstance; private final HandlerThread mBackgroundThread; @@ -191,15 +194,16 @@ public class PluginManager extends BroadcastReceiver { } catch (NameNotFoundException e) { } // Localization not required as this will never ever appear in a user build. - final Notification.Builder nb = new Notification.Builder(mContext) - .setSmallIcon(icon) - .setWhen(0) - .setShowWhen(false) - .setPriority(Notification.PRIORITY_MAX) - .setVisibility(Notification.VISIBILITY_PUBLIC) - .setColor(mContext.getColor(color)) - .setContentTitle("Plugin \"" + label + "\" has updated") - .setContentText("Restart SysUI for changes to take effect."); + final Notification.Builder nb = + new Notification.Builder(mContext, NOTIFICATION_CHANNEL_ID) + .setSmallIcon(icon) + .setWhen(0) + .setShowWhen(false) + .setPriority(Notification.PRIORITY_MAX) + .setVisibility(Notification.VISIBILITY_PUBLIC) + .setColor(mContext.getColor(color)) + .setContentTitle("Plugin \"" + label + "\" has updated") + .setContentText("Restart SysUI for changes to take effect."); Intent i = new Intent("com.android.systemui.action.RESTART").setData( Uri.parse("package://" + pkg)); PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, i, 0); diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index d3e965aedc985..600c0828c0d0c 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1802,10 +1802,8 @@ Alerts Screenshots - - Security - - User status + + General Messages Storage diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java index 82ec69d8cf4e6..09ce2ada11e0e 100644 --- a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java +++ b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java @@ -145,16 +145,16 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { } private void showInvalidChargerNotification() { - final Notification.Builder nb = new Notification.Builder(mContext) - .setSmallIcon(R.drawable.ic_power_low) - .setWhen(0) - .setShowWhen(false) - .setOngoing(true) - .setContentTitle(mContext.getString(R.string.invalid_charger_title)) - .setContentText(mContext.getString(R.string.invalid_charger_text)) - .setChannel(NotificationChannels.ALERTS) - .setColor(mContext.getColor( - com.android.internal.R.color.system_notification_accent_color)); + final Notification.Builder nb = + new Notification.Builder(mContext, NotificationChannels.ALERTS) + .setSmallIcon(R.drawable.ic_power_low) + .setWhen(0) + .setShowWhen(false) + .setOngoing(true) + .setContentTitle(mContext.getString(R.string.invalid_charger_title)) + .setContentText(mContext.getString(R.string.invalid_charger_text)) + .setColor(mContext.getColor( + com.android.internal.R.color.system_notification_accent_color)); SystemUI.overrideNotificationAppName(mContext, nb); final Notification n = nb.build(); mNoMan.cancelAsUser(TAG_BATTERY, SystemMessage.NOTE_POWER_LOW, UserHandle.ALL); @@ -164,19 +164,19 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { private void showWarningNotification() { final int textRes = R.string.battery_low_percent_format; final String percentage = NumberFormat.getPercentInstance().format((double) mBatteryLevel / 100.0); - final Notification.Builder nb = new Notification.Builder(mContext) - .setSmallIcon(R.drawable.ic_power_low) - // Bump the notification when the bucket dropped. - .setWhen(mBucketDroppedNegativeTimeMs) - .setShowWhen(false) - .setContentTitle(mContext.getString(R.string.battery_low_title)) - .setContentText(mContext.getString(textRes, percentage)) - .setOnlyAlertOnce(true) - .setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_WARNING)) - .setChannel(NotificationChannels.ALERTS) - .setVisibility(Notification.VISIBILITY_PUBLIC) - .setColor(mContext.getColor( - com.android.internal.R.color.battery_saver_mode_color)); + final Notification.Builder nb = + new Notification.Builder(mContext, NotificationChannels.ALERTS) + .setSmallIcon(R.drawable.ic_power_low) + // Bump the notification when the bucket dropped. + .setWhen(mBucketDroppedNegativeTimeMs) + .setShowWhen(false) + .setContentTitle(mContext.getString(R.string.battery_low_title)) + .setContentText(mContext.getString(textRes, percentage)) + .setOnlyAlertOnce(true) + .setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_WARNING)) + .setVisibility(Notification.VISIBILITY_PUBLIC) + .setColor(mContext.getColor( + com.android.internal.R.color.battery_saver_mode_color)); if (hasBatterySettings()) { nb.setContentIntent(pendingBroadcast(ACTION_SHOW_BATTERY_SETTINGS)); } @@ -235,18 +235,18 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { return; } mTempWarning = true; - final Notification.Builder nb = new Notification.Builder(mContext) - .setSmallIcon(R.drawable.ic_device_thermostat_24) - .setWhen(0) - .setShowWhen(false) - .setContentTitle(mContext.getString(R.string.high_temp_title)) - .setContentText(mContext.getString(R.string.high_temp_notif_message)) - .setChannel(NotificationChannels.ALERTS) - .setVisibility(Notification.VISIBILITY_PUBLIC) - .setContentIntent(pendingBroadcast(ACTION_CLICKED_TEMP_WARNING)) - .setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_TEMP_WARNING)) - .setColor(mContext.getColor( - com.android.internal.R.color.battery_saver_mode_color)); + final Notification.Builder nb = + new Notification.Builder(mContext, NotificationChannels.ALERTS) + .setSmallIcon(R.drawable.ic_device_thermostat_24) + .setWhen(0) + .setShowWhen(false) + .setContentTitle(mContext.getString(R.string.high_temp_title)) + .setContentText(mContext.getString(R.string.high_temp_notif_message)) + .setVisibility(Notification.VISIBILITY_PUBLIC) + .setContentIntent(pendingBroadcast(ACTION_CLICKED_TEMP_WARNING)) + .setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_TEMP_WARNING)) + .setColor(mContext.getColor( + com.android.internal.R.color.battery_saver_mode_color)); SystemUI.overrideNotificationAppName(mContext, nb); final Notification n = nb.build(); mNoMan.notifyAsUser(TAG_TEMPERATURE, SystemMessage.NOTE_HIGH_TEMP, n, UserHandle.ALL); diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index 7135cafc6bdf2..9a4b45a7b0aba 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -178,20 +178,19 @@ class SaveImageInBackgroundTask extends AsyncTask { .bigPicture(picture.createAshmemBitmap()); // The public notification will show similar info but with the actual screenshot omitted - mPublicNotificationBuilder = new Notification.Builder(context) - .setChannel(NotificationChannels.SCREENSHOTS) - .setContentTitle(r.getString(R.string.screenshot_saving_title)) - .setContentText(r.getString(R.string.screenshot_saving_text)) - .setSmallIcon(R.drawable.stat_notify_image) - .setCategory(Notification.CATEGORY_PROGRESS) - .setWhen(now) - .setShowWhen(true) - .setColor(r.getColor( - com.android.internal.R.color.system_notification_accent_color)); + mPublicNotificationBuilder = + new Notification.Builder(context, NotificationChannels.SCREENSHOTS) + .setContentTitle(r.getString(R.string.screenshot_saving_title)) + .setContentText(r.getString(R.string.screenshot_saving_text)) + .setSmallIcon(R.drawable.stat_notify_image) + .setCategory(Notification.CATEGORY_PROGRESS) + .setWhen(now) + .setShowWhen(true) + .setColor(r.getColor( + com.android.internal.R.color.system_notification_accent_color)); SystemUI.overrideNotificationAppName(context, mPublicNotificationBuilder); - mNotificationBuilder = new Notification.Builder(context) - .setChannel(NotificationChannels.SCREENSHOTS) + mNotificationBuilder = new Notification.Builder(context, NotificationChannels.SCREENSHOTS) .setTicker(r.getString(R.string.screenshot_saving_ticker) + (mTickerAddSpace ? " " : "")) .setContentTitle(r.getString(R.string.screenshot_saving_title)) @@ -335,7 +334,6 @@ class SaveImageInBackgroundTask extends AsyncTask { // Update the text and the icon for the existing notification mPublicNotificationBuilder - .setChannel(NotificationChannels.SCREENSHOTS) .setContentTitle(r.getString(R.string.screenshot_saved_title)) .setContentText(r.getString(R.string.screenshot_saved_text)) .setContentIntent(PendingIntent.getActivity(mParams.context, 0, launchIntent, 0)) @@ -344,7 +342,6 @@ class SaveImageInBackgroundTask extends AsyncTask { .setColor(context.getColor( com.android.internal.R.color.system_notification_accent_color)); mNotificationBuilder - .setChannel(NotificationChannels.SCREENSHOTS) .setContentTitle(r.getString(R.string.screenshot_saved_title)) .setContentText(r.getString(R.string.screenshot_saved_text)) .setContentIntent(PendingIntent.getActivity(mParams.context, 0, launchIntent, 0)) @@ -858,7 +855,7 @@ class GlobalScreenshot { String errorMsg = r.getString(msgResId); // Repurpose the existing notification to notify the user of the error - Notification.Builder b = new Notification.Builder(context) + Notification.Builder b = new Notification.Builder(context, NotificationChannels.ALERTS) .setTicker(r.getString(R.string.screenshot_failed_title)) .setContentTitle(r.getString(R.string.screenshot_failed_title)) .setContentText(errorMsg) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 018d8885842dd..c4fc45e3a2da1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -5776,20 +5776,21 @@ public class StatusBar extends SystemUI implements DemoMode, PendingIntent.FLAG_CANCEL_CURRENT); final int colorRes = com.android.internal.R.color.system_notification_accent_color; - Notification.Builder note = new Notification.Builder(mContext) - .setSmallIcon(R.drawable.ic_android) - .setContentTitle(mContext.getString(R.string.hidden_notifications_title)) - .setContentText(mContext.getString(R.string.hidden_notifications_text)) - .setChannel(NotificationChannels.SECURITY) - .setOngoing(true) - .setColor(mContext.getColor(colorRes)) - .setContentIntent(setupIntent) - .addAction(R.drawable.ic_close, - mContext.getString(R.string.hidden_notifications_cancel), - cancelIntent) - .addAction(R.drawable.ic_settings, - mContext.getString(R.string.hidden_notifications_setup), - setupIntent); + Notification.Builder note = + new Notification.Builder(mContext, NotificationChannels.GENERAL) + .setSmallIcon(R.drawable.ic_android) + .setContentTitle(mContext.getString( + R.string.hidden_notifications_title)) + .setContentText(mContext.getString(R.string.hidden_notifications_text)) + .setOngoing(true) + .setColor(mContext.getColor(colorRes)) + .setContentIntent(setupIntent) + .addAction(R.drawable.ic_close, + mContext.getString(R.string.hidden_notifications_cancel), + cancelIntent) + .addAction(R.drawable.ic_settings, + mContext.getString(R.string.hidden_notifications_setup), + setupIntent); overrideNotificationAppName(mContext, note); NotificationManager noMan = 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 fd71f43ceacfc..7a32bf1c8d869 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java @@ -560,18 +560,20 @@ public class UserSwitcherController { private void showLogoutNotification(int userId) { PendingIntent logoutPI = PendingIntent.getBroadcastAsUser(mContext, 0, new Intent(ACTION_LOGOUT_USER), 0, UserHandle.SYSTEM); - Notification.Builder builder = new Notification.Builder(mContext) - .setVisibility(Notification.VISIBILITY_SECRET) - .setChannel(NotificationChannels.USER) - .setSmallIcon(R.drawable.ic_person) - .setContentTitle(mContext.getString(R.string.user_logout_notification_title)) - .setContentText(mContext.getString(R.string.user_logout_notification_text)) - .setContentIntent(logoutPI) - .setOngoing(true) - .setShowWhen(false) - .addAction(R.drawable.ic_delete, - mContext.getString(R.string.user_logout_notification_action), - logoutPI); + Notification.Builder builder = + new Notification.Builder(mContext, NotificationChannels.GENERAL) + .setVisibility(Notification.VISIBILITY_SECRET) + .setSmallIcon(R.drawable.ic_person) + .setContentTitle(mContext.getString( + R.string.user_logout_notification_title)) + .setContentText(mContext.getString( + R.string.user_logout_notification_text)) + .setContentIntent(logoutPI) + .setOngoing(true) + .setShowWhen(false) + .addAction(R.drawable.ic_delete, + mContext.getString(R.string.user_logout_notification_action), + logoutPI); SystemUI.overrideNotificationAppName(mContext, builder); NotificationManager.from(mContext).notifyAsUser(TAG_LOGOUT_USER, SystemMessage.NOTE_LOGOUT_USER, builder.build(), new UserHandle(userId)); @@ -584,17 +586,17 @@ public class UserSwitcherController { PendingIntent removeGuestPI = canSwitchUsers ? PendingIntent.getBroadcastAsUser(mContext, 0, new Intent(ACTION_REMOVE_GUEST), 0, UserHandle.SYSTEM) : null; - Notification.Builder builder = new Notification.Builder(mContext) - .setVisibility(Notification.VISIBILITY_SECRET) - .setChannel(NotificationChannels.USER) - .setSmallIcon(R.drawable.ic_person) - .setContentTitle(mContext.getString(R.string.guest_notification_title)) - .setContentText(mContext.getString(R.string.guest_notification_text)) - .setContentIntent(removeGuestPI) - .setShowWhen(false) - .addAction(R.drawable.ic_delete, - mContext.getString(R.string.guest_notification_remove_action), - removeGuestPI); + Notification.Builder builder = + new Notification.Builder(mContext, NotificationChannels.GENERAL) + .setVisibility(Notification.VISIBILITY_SECRET) + .setSmallIcon(R.drawable.ic_person) + .setContentTitle(mContext.getString(R.string.guest_notification_title)) + .setContentText(mContext.getString(R.string.guest_notification_text)) + .setContentIntent(removeGuestPI) + .setShowWhen(false) + .addAction(R.drawable.ic_delete, + mContext.getString(R.string.guest_notification_remove_action), + removeGuestPI); SystemUI.overrideNotificationAppName(mContext, builder); NotificationManager.from(mContext).notifyAsUser(TAG_REMOVE_GUEST, SystemMessage.NOTE_REMOVE_GUEST, builder.build(), new UserHandle(guestUserId)); diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java index 9a16d6db4bedc..43727e07c7129 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java @@ -198,18 +198,19 @@ public class StorageNotification extends SystemUI { rec.getNickname()); final CharSequence text = mContext.getString(R.string.ext_media_missing_message); - Notification.Builder builder = new Notification.Builder(mContext) - .setSmallIcon(R.drawable.ic_sd_card_48dp) - .setColor(mContext.getColor(R.color.system_notification_accent_color)) - .setContentTitle(title) - .setContentText(text) - .setContentIntent(buildForgetPendingIntent(rec)) - .setStyle(new Notification.BigTextStyle().bigText(text)) - .setVisibility(Notification.VISIBILITY_PUBLIC) - .setLocalOnly(true) - .setChannel(NotificationChannels.STORAGE) - .setCategory(Notification.CATEGORY_SYSTEM) - .setDeleteIntent(buildSnoozeIntent(fsUuid)); + Notification.Builder builder = + new Notification.Builder(mContext, NotificationChannels.STORAGE) + .setSmallIcon(R.drawable.ic_sd_card_48dp) + .setColor(mContext.getColor( + R.color.system_notification_accent_color)) + .setContentTitle(title) + .setContentText(text) + .setContentIntent(buildForgetPendingIntent(rec)) + .setStyle(new Notification.BigTextStyle().bigText(text)) + .setVisibility(Notification.VISIBILITY_PUBLIC) + .setLocalOnly(true) + .setCategory(Notification.CATEGORY_SYSTEM) + .setDeleteIntent(buildSnoozeIntent(fsUuid)); SystemUI.overrideNotificationAppName(mContext, builder); mNotificationManager.notifyAsUser(fsUuid, SystemMessage.NOTE_STORAGE_PRIVATE, @@ -226,17 +227,17 @@ public class StorageNotification extends SystemUI { final CharSequence text = mContext.getString( R.string.ext_media_unsupported_notification_message, disk.getDescription()); - Notification.Builder builder = new Notification.Builder(mContext) - .setChannel(NotificationChannels.STORAGE) - .setSmallIcon(getSmallIcon(disk, VolumeInfo.STATE_UNMOUNTABLE)) - .setColor(mContext.getColor(R.color.system_notification_accent_color)) - .setContentTitle(title) - .setContentText(text) - .setContentIntent(buildInitPendingIntent(disk)) - .setStyle(new Notification.BigTextStyle().bigText(text)) - .setVisibility(Notification.VISIBILITY_PUBLIC) - .setLocalOnly(true) - .setCategory(Notification.CATEGORY_ERROR); + Notification.Builder builder = + new Notification.Builder(mContext, NotificationChannels.STORAGE) + .setSmallIcon(getSmallIcon(disk, VolumeInfo.STATE_UNMOUNTABLE)) + .setColor(mContext.getColor(R.color.system_notification_accent_color)) + .setContentTitle(title) + .setContentText(text) + .setContentIntent(buildInitPendingIntent(disk)) + .setStyle(new Notification.BigTextStyle().bigText(text)) + .setVisibility(Notification.VISIBILITY_PUBLIC) + .setLocalOnly(true) + .setCategory(Notification.CATEGORY_ERROR); SystemUI.overrideNotificationAppName(mContext, builder); mNotificationManager.notifyAsUser(disk.getId(), SystemMessage.NOTE_STORAGE_DISK, @@ -475,19 +476,19 @@ public class StorageNotification extends SystemUI { intent = buildWizardMigratePendingIntent(move); } - Notification.Builder builder = new Notification.Builder(mContext) - .setSmallIcon(R.drawable.ic_sd_card_48dp) - .setColor(mContext.getColor(R.color.system_notification_accent_color)) - .setContentTitle(title) - .setContentText(text) - .setContentIntent(intent) - .setStyle(new Notification.BigTextStyle().bigText(text)) - .setVisibility(Notification.VISIBILITY_PUBLIC) - .setLocalOnly(true) - .setChannel(NotificationChannels.STORAGE) - .setCategory(Notification.CATEGORY_PROGRESS) - .setProgress(100, status, false) - .setOngoing(true); + Notification.Builder builder = + new Notification.Builder(mContext, NotificationChannels.STORAGE) + .setSmallIcon(R.drawable.ic_sd_card_48dp) + .setColor(mContext.getColor(R.color.system_notification_accent_color)) + .setContentTitle(title) + .setContentText(text) + .setContentIntent(intent) + .setStyle(new Notification.BigTextStyle().bigText(text)) + .setVisibility(Notification.VISIBILITY_PUBLIC) + .setLocalOnly(true) + .setCategory(Notification.CATEGORY_PROGRESS) + .setProgress(100, status, false) + .setOngoing(true); SystemUI.overrideNotificationAppName(mContext, builder); mNotificationManager.notifyAsUser(move.packageName, SystemMessage.NOTE_STORAGE_MOVE, @@ -526,18 +527,18 @@ public class StorageNotification extends SystemUI { intent = null; } - Notification.Builder builder = new Notification.Builder(mContext) - .setSmallIcon(R.drawable.ic_sd_card_48dp) - .setColor(mContext.getColor(R.color.system_notification_accent_color)) - .setContentTitle(title) - .setContentText(text) - .setContentIntent(intent) - .setStyle(new Notification.BigTextStyle().bigText(text)) - .setVisibility(Notification.VISIBILITY_PUBLIC) - .setLocalOnly(true) - .setCategory(Notification.CATEGORY_SYSTEM) - .setChannel(NotificationChannels.STORAGE) - .setAutoCancel(true); + Notification.Builder builder = + new Notification.Builder(mContext, NotificationChannels.STORAGE) + .setSmallIcon(R.drawable.ic_sd_card_48dp) + .setColor(mContext.getColor(R.color.system_notification_accent_color)) + .setContentTitle(title) + .setContentText(text) + .setContentIntent(intent) + .setStyle(new Notification.BigTextStyle().bigText(text)) + .setVisibility(Notification.VISIBILITY_PUBLIC) + .setLocalOnly(true) + .setCategory(Notification.CATEGORY_SYSTEM) + .setAutoCancel(true); SystemUI.overrideNotificationAppName(mContext, builder); mNotificationManager.notifyAsUser(move.packageName, SystemMessage.NOTE_STORAGE_MOVE, @@ -562,15 +563,15 @@ public class StorageNotification extends SystemUI { private Notification.Builder buildNotificationBuilder(VolumeInfo vol, CharSequence title, CharSequence text) { - Notification.Builder builder = new Notification.Builder(mContext) - .setChannel(NotificationChannels.STORAGE) - .setSmallIcon(getSmallIcon(vol.getDisk(), vol.getState())) - .setColor(mContext.getColor(R.color.system_notification_accent_color)) - .setContentTitle(title) - .setContentText(text) - .setStyle(new Notification.BigTextStyle().bigText(text)) - .setVisibility(Notification.VISIBILITY_PUBLIC) - .setLocalOnly(true); + Notification.Builder builder = + new Notification.Builder(mContext, NotificationChannels.STORAGE) + .setSmallIcon(getSmallIcon(vol.getDisk(), vol.getState())) + .setColor(mContext.getColor(R.color.system_notification_accent_color)) + .setContentTitle(title) + .setContentText(text) + .setStyle(new Notification.BigTextStyle().bigText(text)) + .setVisibility(Notification.VISIBILITY_PUBLIC) + .setLocalOnly(true); overrideNotificationAppName(mContext, builder); return builder; } diff --git a/packages/SystemUI/src/com/android/systemui/util/NotificationChannels.java b/packages/SystemUI/src/com/android/systemui/util/NotificationChannels.java index 6bb8aea6c95e2..15ad0ce5b51b8 100644 --- a/packages/SystemUI/src/com/android/systemui/util/NotificationChannels.java +++ b/packages/SystemUI/src/com/android/systemui/util/NotificationChannels.java @@ -27,8 +27,7 @@ import java.util.Arrays; public class NotificationChannels extends SystemUI { public static String ALERTS = "ALR"; public static String SCREENSHOTS = "SCN"; - public static String SECURITY = "SEC"; - public static String USER = "USR"; + public static String GENERAL = "GEN"; public static String STORAGE = "DSK"; @VisibleForTesting @@ -42,14 +41,10 @@ public class NotificationChannels extends SystemUI { new NotificationChannel( SCREENSHOTS, context.getString(R.string.notification_channel_screenshot), - NotificationManager.IMPORTANCE_DEFAULT), + NotificationManager.IMPORTANCE_LOW), new NotificationChannel( - SECURITY, - context.getString(R.string.notification_channel_security), - NotificationManager.IMPORTANCE_HIGH), - new NotificationChannel( - USER, - context.getString(R.string.notification_channel_user_status), + GENERAL, + context.getString(R.string.notification_channel_general), NotificationManager.IMPORTANCE_MIN), new NotificationChannel( STORAGE, diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/ChannelsTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/ChannelsTest.java index 8949598b029ce..f67296d9905a0 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/util/ChannelsTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/util/ChannelsTest.java @@ -55,9 +55,8 @@ public class ChannelsTest extends SysuiTestCase { Set ALL_CHANNELS = new ArraySet<>(Arrays.asList( NotificationChannels.ALERTS, NotificationChannels.SCREENSHOTS, - NotificationChannels.SECURITY, - NotificationChannels.USER, - NotificationChannels.STORAGE + NotificationChannels.STORAGE, + NotificationChannels.GENERAL )); NotificationChannels.createAll(mContext); ArgumentCaptor captor = ArgumentCaptor.forClass(List.class);