SystemUI: Override notification app name
Overrides the notification app name for all SystemUI notifications.
Change-Id: Ic7676069aa03d5b83f0fbe0e8c3ad9820453118a
Fixes: 26517701
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index 36dd727..97d5e10 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -198,7 +198,7 @@
rec.getNickname());
final CharSequence text = mContext.getString(R.string.ext_media_missing_message);
- final Notification notif = new Notification.Builder(mContext)
+ 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)
@@ -208,10 +208,11 @@
.setVisibility(Notification.VISIBILITY_PUBLIC)
.setLocalOnly(true)
.setCategory(Notification.CATEGORY_SYSTEM)
- .setDeleteIntent(buildSnoozeIntent(fsUuid))
- .build();
+ .setDeleteIntent(buildSnoozeIntent(fsUuid));
+ SystemUI.overrideNotificationAppName(mContext, builder);
- mNotificationManager.notifyAsUser(fsUuid, PRIVATE_ID, notif, UserHandle.ALL);
+ mNotificationManager.notifyAsUser(fsUuid, PRIVATE_ID, builder
+ .build(), UserHandle.ALL);
}
}
}
@@ -224,7 +225,7 @@
final CharSequence text = mContext.getString(
R.string.ext_media_unsupported_notification_message, disk.getDescription());
- final Notification notif = new Notification.Builder(mContext)
+ Notification.Builder builder = new Notification.Builder(mContext)
.setSmallIcon(getSmallIcon(disk, VolumeInfo.STATE_UNMOUNTABLE))
.setColor(mContext.getColor(R.color.system_notification_accent_color))
.setContentTitle(title)
@@ -233,10 +234,11 @@
.setStyle(new Notification.BigTextStyle().bigText(text))
.setVisibility(Notification.VISIBILITY_PUBLIC)
.setLocalOnly(true)
- .setCategory(Notification.CATEGORY_ERROR)
- .build();
+ .setCategory(Notification.CATEGORY_ERROR);
+ SystemUI.overrideNotificationAppName(mContext, builder);
- mNotificationManager.notifyAsUser(disk.getId(), DISK_ID, notif, UserHandle.ALL);
+ mNotificationManager.notifyAsUser(disk.getId(), DISK_ID, builder.build(),
+ UserHandle.ALL);
} else {
// Yay, we have volumes!
@@ -471,7 +473,7 @@
intent = buildWizardMigratePendingIntent(move);
}
- final Notification notif = new Notification.Builder(mContext)
+ 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)
@@ -483,10 +485,11 @@
.setCategory(Notification.CATEGORY_PROGRESS)
.setPriority(Notification.PRIORITY_LOW)
.setProgress(100, status, false)
- .setOngoing(true)
- .build();
+ .setOngoing(true);
+ SystemUI.overrideNotificationAppName(mContext, builder);
- mNotificationManager.notifyAsUser(move.packageName, MOVE_ID, notif, UserHandle.ALL);
+ mNotificationManager.notifyAsUser(move.packageName, MOVE_ID,
+ builder.build(), UserHandle.ALL);
}
private void onMoveFinished(MoveInfo move, int status) {
@@ -520,7 +523,7 @@
intent = null;
}
- final Notification notif = new Notification.Builder(mContext)
+ 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)
@@ -531,10 +534,11 @@
.setLocalOnly(true)
.setCategory(Notification.CATEGORY_SYSTEM)
.setPriority(Notification.PRIORITY_LOW)
- .setAutoCancel(true)
- .build();
+ .setAutoCancel(true);
+ SystemUI.overrideNotificationAppName(mContext, builder);
- mNotificationManager.notifyAsUser(move.packageName, MOVE_ID, notif, UserHandle.ALL);
+ mNotificationManager.notifyAsUser(move.packageName, MOVE_ID, builder.build(),
+ UserHandle.ALL);
}
private int getSmallIcon(DiskInfo disk, int state) {
@@ -555,7 +559,7 @@
private Notification.Builder buildNotificationBuilder(VolumeInfo vol, CharSequence title,
CharSequence text) {
- return new Notification.Builder(mContext)
+ Notification.Builder builder = new Notification.Builder(mContext)
.setSmallIcon(getSmallIcon(vol.getDisk(), vol.getState()))
.setColor(mContext.getColor(R.color.system_notification_accent_color))
.setContentTitle(title)
@@ -563,6 +567,8 @@
.setStyle(new Notification.BigTextStyle().bigText(text))
.setVisibility(Notification.VISIBILITY_PUBLIC)
.setLocalOnly(true);
+ overrideNotificationAppName(mContext, builder);
+ return builder;
}
private PendingIntent buildInitPendingIntent(DiskInfo disk) {