Loading packages/SystemUI/src/com/android/systemui/CoreStartable.java +0 −14 Original line number Diff line number Diff line Loading @@ -16,10 +16,8 @@ package com.android.systemui; import android.app.Notification; import android.content.Context; import android.content.res.Configuration; import android.os.Bundle; import androidx.annotation.NonNull; Loading Loading @@ -54,16 +52,4 @@ public abstract class CoreStartable implements Dumpable { @VisibleForTesting protected void onBootCompleted() { } /** TODO(b/205725937): Move this. SystemUIApplication? */ public static void overrideNotificationAppName(Context context, Notification.Builder n, boolean system) { final Bundle extras = new Bundle(); String appName = system ? context.getString(com.android.internal.R.string.notification_app_name_system) : context.getString(com.android.internal.R.string.notification_app_name_settings); extras.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME, appName); n.addExtras(extras); } } packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +13 −0 Original line number Diff line number Diff line Loading @@ -18,12 +18,14 @@ package com.android.systemui; import android.app.ActivityThread; import android.app.Application; import android.app.Notification; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ApplicationInfo; import android.content.res.Configuration; import android.os.Bundle; import android.os.Process; import android.os.SystemProperties; import android.os.Trace; Loading Loading @@ -275,4 +277,15 @@ public class SystemUIApplication extends Application implements mContextAvailableCallback = callback; } /** Update a notifications application name. */ public static void overrideNotificationAppName(Context context, Notification.Builder n, boolean system) { final Bundle extras = new Bundle(); String appName = system ? context.getString(com.android.internal.R.string.notification_app_name_system) : context.getString(com.android.internal.R.string.notification_app_name_settings); extras.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME, appName); n.addExtras(extras); } } packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java +6 −6 Original line number Diff line number Diff line Loading @@ -58,9 +58,9 @@ import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; import com.android.settingslib.Utils; import com.android.settingslib.fuelgauge.BatterySaverUtils; import com.android.settingslib.utils.PowerUtil; import com.android.systemui.CoreStartable; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.SystemUIApplication; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.statusbar.phone.SystemUIDialog; Loading Loading @@ -247,7 +247,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { .setContentText(mContext.getString(R.string.invalid_charger_text)) .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)); CoreStartable.overrideNotificationAppName(mContext, nb, false); SystemUIApplication.overrideNotificationAppName(mContext, nb, false); final Notification n = nb.build(); mNoMan.cancelAsUser(TAG_BATTERY, SystemMessage.NOTE_POWER_LOW, UserHandle.ALL); mNoMan.notifyAsUser(TAG_BATTERY, SystemMessage.NOTE_BAD_CHARGER, n, UserHandle.ALL); Loading Loading @@ -298,7 +298,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { } nb.setOnlyAlertOnce(!mPlaySound); mPlaySound = false; CoreStartable.overrideNotificationAppName(mContext, nb, false); SystemUIApplication.overrideNotificationAppName(mContext, nb, false); final Notification n = nb.build(); mNoMan.cancelAsUser(TAG_BATTERY, SystemMessage.NOTE_BAD_CHARGER, UserHandle.ALL); mNoMan.notifyAsUser(TAG_BATTERY, SystemMessage.NOTE_POWER_LOW, n, UserHandle.ALL); Loading @@ -320,7 +320,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { mContext.getString(R.string.no_auto_saver_action), pendingBroadcast(ACTION_AUTO_SAVER_NO_THANKS)); CoreStartable.overrideNotificationAppName(mContext, nb, false); SystemUIApplication.overrideNotificationAppName(mContext, nb, false); final Notification n = nb.build(); mNoMan.notifyAsUser( Loading Loading @@ -397,7 +397,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { .setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_TEMP_WARNING)) .setColor(Utils.getColorAttrDefaultColor(mContext, android.R.attr.colorError)); CoreStartable.overrideNotificationAppName(mContext, nb, false); SystemUIApplication.overrideNotificationAppName(mContext, nb, false); final Notification n = nb.build(); mNoMan.notifyAsUser(TAG_TEMPERATURE, SystemMessage.NOTE_HIGH_TEMP, n, UserHandle.ALL); } Loading Loading @@ -484,7 +484,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { pendingBroadcast(ACTION_DISMISSED_THERMAL_SHUTDOWN_WARNING)) .setColor(Utils.getColorAttrDefaultColor(mContext, android.R.attr.colorError)); CoreStartable.overrideNotificationAppName(mContext, nb, false); SystemUIApplication.overrideNotificationAppName(mContext, nb, false); final Notification n = nb.build(); mNoMan.notifyAsUser( TAG_TEMPERATURE, SystemMessage.NOTE_THERMAL_SHUTDOWN, n, UserHandle.ALL); Loading packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotNotificationsController.java +2 −2 Original line number Diff line number Diff line Loading @@ -30,8 +30,8 @@ import android.util.DisplayMetrics; import android.view.WindowManager; import com.android.internal.messages.nano.SystemMessageProto; import com.android.systemui.CoreStartable; import com.android.systemui.R; import com.android.systemui.SystemUIApplication; import com.android.systemui.util.NotificationChannels; import javax.inject.Inject; Loading Loading @@ -86,7 +86,7 @@ public class ScreenshotNotificationsController { b.setContentIntent(pendingIntent); } CoreStartable.overrideNotificationAppName(mContext, b, true); SystemUIApplication.overrideNotificationAppName(mContext, b, true); Notification n = new Notification.BigTextStyle(b) .bigText(errorMsg) Loading packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +6 −5 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.util.SparseArray; import com.android.internal.R; import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; import com.android.systemui.CoreStartable; import com.android.systemui.SystemUIApplication; import com.android.systemui.util.NotificationChannels; import java.util.List; Loading Loading @@ -224,7 +225,7 @@ public class StorageNotification extends CoreStartable { .setCategory(Notification.CATEGORY_SYSTEM) .setDeleteIntent(buildSnoozeIntent(fsUuid)) .extend(new Notification.TvExtender()); CoreStartable.overrideNotificationAppName(mContext, builder, false); SystemUIApplication.overrideNotificationAppName(mContext, builder, false); mNotificationManager.notifyAsUser(fsUuid, SystemMessage.NOTE_STORAGE_PRIVATE, builder.build(), UserHandle.ALL); Loading Loading @@ -252,7 +253,7 @@ public class StorageNotification extends CoreStartable { .setLocalOnly(true) .setCategory(Notification.CATEGORY_ERROR) .extend(new Notification.TvExtender()); CoreStartable.overrideNotificationAppName(mContext, builder, false); SystemUIApplication.overrideNotificationAppName(mContext, builder, false); mNotificationManager.notifyAsUser(disk.getId(), SystemMessage.NOTE_STORAGE_DISK, builder.build(), UserHandle.ALL); Loading Loading @@ -527,7 +528,7 @@ public class StorageNotification extends CoreStartable { .setCategory(Notification.CATEGORY_PROGRESS) .setProgress(100, status, false) .setOngoing(true); CoreStartable.overrideNotificationAppName(mContext, builder, false); SystemUIApplication.overrideNotificationAppName(mContext, builder, false); mNotificationManager.notifyAsUser(move.packageName, SystemMessage.NOTE_STORAGE_MOVE, builder.build(), UserHandle.ALL); Loading Loading @@ -577,7 +578,7 @@ public class StorageNotification extends CoreStartable { .setLocalOnly(true) .setCategory(Notification.CATEGORY_SYSTEM) .setAutoCancel(true); CoreStartable.overrideNotificationAppName(mContext, builder, false); SystemUIApplication.overrideNotificationAppName(mContext, builder, false); mNotificationManager.notifyAsUser(move.packageName, SystemMessage.NOTE_STORAGE_MOVE, builder.build(), UserHandle.ALL); Loading Loading @@ -611,7 +612,7 @@ public class StorageNotification extends CoreStartable { .setVisibility(Notification.VISIBILITY_PUBLIC) .setLocalOnly(true) .extend(new Notification.TvExtender()); overrideNotificationAppName(mContext, builder, false); SystemUIApplication.overrideNotificationAppName(mContext, builder, false); return builder; } Loading Loading
packages/SystemUI/src/com/android/systemui/CoreStartable.java +0 −14 Original line number Diff line number Diff line Loading @@ -16,10 +16,8 @@ package com.android.systemui; import android.app.Notification; import android.content.Context; import android.content.res.Configuration; import android.os.Bundle; import androidx.annotation.NonNull; Loading Loading @@ -54,16 +52,4 @@ public abstract class CoreStartable implements Dumpable { @VisibleForTesting protected void onBootCompleted() { } /** TODO(b/205725937): Move this. SystemUIApplication? */ public static void overrideNotificationAppName(Context context, Notification.Builder n, boolean system) { final Bundle extras = new Bundle(); String appName = system ? context.getString(com.android.internal.R.string.notification_app_name_system) : context.getString(com.android.internal.R.string.notification_app_name_settings); extras.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME, appName); n.addExtras(extras); } }
packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +13 −0 Original line number Diff line number Diff line Loading @@ -18,12 +18,14 @@ package com.android.systemui; import android.app.ActivityThread; import android.app.Application; import android.app.Notification; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ApplicationInfo; import android.content.res.Configuration; import android.os.Bundle; import android.os.Process; import android.os.SystemProperties; import android.os.Trace; Loading Loading @@ -275,4 +277,15 @@ public class SystemUIApplication extends Application implements mContextAvailableCallback = callback; } /** Update a notifications application name. */ public static void overrideNotificationAppName(Context context, Notification.Builder n, boolean system) { final Bundle extras = new Bundle(); String appName = system ? context.getString(com.android.internal.R.string.notification_app_name_system) : context.getString(com.android.internal.R.string.notification_app_name_settings); extras.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME, appName); n.addExtras(extras); } }
packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java +6 −6 Original line number Diff line number Diff line Loading @@ -58,9 +58,9 @@ import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; import com.android.settingslib.Utils; import com.android.settingslib.fuelgauge.BatterySaverUtils; import com.android.settingslib.utils.PowerUtil; import com.android.systemui.CoreStartable; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.SystemUIApplication; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.statusbar.phone.SystemUIDialog; Loading Loading @@ -247,7 +247,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { .setContentText(mContext.getString(R.string.invalid_charger_text)) .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)); CoreStartable.overrideNotificationAppName(mContext, nb, false); SystemUIApplication.overrideNotificationAppName(mContext, nb, false); final Notification n = nb.build(); mNoMan.cancelAsUser(TAG_BATTERY, SystemMessage.NOTE_POWER_LOW, UserHandle.ALL); mNoMan.notifyAsUser(TAG_BATTERY, SystemMessage.NOTE_BAD_CHARGER, n, UserHandle.ALL); Loading Loading @@ -298,7 +298,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { } nb.setOnlyAlertOnce(!mPlaySound); mPlaySound = false; CoreStartable.overrideNotificationAppName(mContext, nb, false); SystemUIApplication.overrideNotificationAppName(mContext, nb, false); final Notification n = nb.build(); mNoMan.cancelAsUser(TAG_BATTERY, SystemMessage.NOTE_BAD_CHARGER, UserHandle.ALL); mNoMan.notifyAsUser(TAG_BATTERY, SystemMessage.NOTE_POWER_LOW, n, UserHandle.ALL); Loading @@ -320,7 +320,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { mContext.getString(R.string.no_auto_saver_action), pendingBroadcast(ACTION_AUTO_SAVER_NO_THANKS)); CoreStartable.overrideNotificationAppName(mContext, nb, false); SystemUIApplication.overrideNotificationAppName(mContext, nb, false); final Notification n = nb.build(); mNoMan.notifyAsUser( Loading Loading @@ -397,7 +397,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { .setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_TEMP_WARNING)) .setColor(Utils.getColorAttrDefaultColor(mContext, android.R.attr.colorError)); CoreStartable.overrideNotificationAppName(mContext, nb, false); SystemUIApplication.overrideNotificationAppName(mContext, nb, false); final Notification n = nb.build(); mNoMan.notifyAsUser(TAG_TEMPERATURE, SystemMessage.NOTE_HIGH_TEMP, n, UserHandle.ALL); } Loading Loading @@ -484,7 +484,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { pendingBroadcast(ACTION_DISMISSED_THERMAL_SHUTDOWN_WARNING)) .setColor(Utils.getColorAttrDefaultColor(mContext, android.R.attr.colorError)); CoreStartable.overrideNotificationAppName(mContext, nb, false); SystemUIApplication.overrideNotificationAppName(mContext, nb, false); final Notification n = nb.build(); mNoMan.notifyAsUser( TAG_TEMPERATURE, SystemMessage.NOTE_THERMAL_SHUTDOWN, n, UserHandle.ALL); Loading
packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotNotificationsController.java +2 −2 Original line number Diff line number Diff line Loading @@ -30,8 +30,8 @@ import android.util.DisplayMetrics; import android.view.WindowManager; import com.android.internal.messages.nano.SystemMessageProto; import com.android.systemui.CoreStartable; import com.android.systemui.R; import com.android.systemui.SystemUIApplication; import com.android.systemui.util.NotificationChannels; import javax.inject.Inject; Loading Loading @@ -86,7 +86,7 @@ public class ScreenshotNotificationsController { b.setContentIntent(pendingIntent); } CoreStartable.overrideNotificationAppName(mContext, b, true); SystemUIApplication.overrideNotificationAppName(mContext, b, true); Notification n = new Notification.BigTextStyle(b) .bigText(errorMsg) Loading
packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +6 −5 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.util.SparseArray; import com.android.internal.R; import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; import com.android.systemui.CoreStartable; import com.android.systemui.SystemUIApplication; import com.android.systemui.util.NotificationChannels; import java.util.List; Loading Loading @@ -224,7 +225,7 @@ public class StorageNotification extends CoreStartable { .setCategory(Notification.CATEGORY_SYSTEM) .setDeleteIntent(buildSnoozeIntent(fsUuid)) .extend(new Notification.TvExtender()); CoreStartable.overrideNotificationAppName(mContext, builder, false); SystemUIApplication.overrideNotificationAppName(mContext, builder, false); mNotificationManager.notifyAsUser(fsUuid, SystemMessage.NOTE_STORAGE_PRIVATE, builder.build(), UserHandle.ALL); Loading Loading @@ -252,7 +253,7 @@ public class StorageNotification extends CoreStartable { .setLocalOnly(true) .setCategory(Notification.CATEGORY_ERROR) .extend(new Notification.TvExtender()); CoreStartable.overrideNotificationAppName(mContext, builder, false); SystemUIApplication.overrideNotificationAppName(mContext, builder, false); mNotificationManager.notifyAsUser(disk.getId(), SystemMessage.NOTE_STORAGE_DISK, builder.build(), UserHandle.ALL); Loading Loading @@ -527,7 +528,7 @@ public class StorageNotification extends CoreStartable { .setCategory(Notification.CATEGORY_PROGRESS) .setProgress(100, status, false) .setOngoing(true); CoreStartable.overrideNotificationAppName(mContext, builder, false); SystemUIApplication.overrideNotificationAppName(mContext, builder, false); mNotificationManager.notifyAsUser(move.packageName, SystemMessage.NOTE_STORAGE_MOVE, builder.build(), UserHandle.ALL); Loading Loading @@ -577,7 +578,7 @@ public class StorageNotification extends CoreStartable { .setLocalOnly(true) .setCategory(Notification.CATEGORY_SYSTEM) .setAutoCancel(true); CoreStartable.overrideNotificationAppName(mContext, builder, false); SystemUIApplication.overrideNotificationAppName(mContext, builder, false); mNotificationManager.notifyAsUser(move.packageName, SystemMessage.NOTE_STORAGE_MOVE, builder.build(), UserHandle.ALL); Loading Loading @@ -611,7 +612,7 @@ public class StorageNotification extends CoreStartable { .setVisibility(Notification.VISIBILITY_PUBLIC) .setLocalOnly(true) .extend(new Notification.TvExtender()); overrideNotificationAppName(mContext, builder, false); SystemUIApplication.overrideNotificationAppName(mContext, builder, false); return builder; } Loading