support locale change for notification channel
Bug: 37911731
Test: Manual
Change-Id: I8b6f6aa679801a7804dc5f246e166cf725b4d075
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index 1c1b33a..0033662 100755
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -576,6 +576,8 @@
for (int slot = PhoneConstants.SIM_ID_1; slot < mSimCount; slot++) {
checkForSetupEvent(LANGUAGE_SELECTION_EVENT, (Bundle) msg.obj, slot);
}
+ // rename all registered notification channels on locale change
+ createAllChannels();
break;
case OP_ALPHA_NOTIFY:
handleAlphaNotify((Bundle) msg.obj);
@@ -1572,15 +1574,7 @@
CatLog.d(LOG_TAG, "Add IdleMode text");
PendingIntent pendingIntent = PendingIntent.getService(mContext, 0,
new Intent(mContext, StkAppService.class), 0);
- /* Creates the notification channel and registers it with NotificationManager.
- * If a channel with the same ID is already registered, NotificationManager will
- * ignore this call.
- */
- mNotificationManager.createNotificationChannel(new NotificationChannel(
- STK_NOTIFICATION_CHANNEL_ID,
- getResources().getString(R.string.stk_channel_name),
- NotificationManager.IMPORTANCE_MIN));
-
+ createAllChannels();
final Notification.Builder notificationBuilder = new Notification.Builder(
StkAppService.this, STK_NOTIFICATION_CHANNEL_ID);
if (mStkContext[slotId].mMainCmd != null &&
@@ -1613,6 +1607,17 @@
}
}
+ /** Creates the notification channel and registers it with NotificationManager.
+ * If a channel with the same ID is already registered, NotificationManager will
+ * ignore this call.
+ */
+ private void createAllChannels() {
+ mNotificationManager.createNotificationChannel(new NotificationChannel(
+ STK_NOTIFICATION_CHANNEL_ID,
+ getResources().getString(R.string.stk_channel_name),
+ NotificationManager.IMPORTANCE_MIN));
+ }
+
private void launchToneDialog(int slotId) {
Intent newIntent = new Intent(this, ToneDialog.class);
String uriString = STK_TONE_URI + slotId;