Merge "Settings: Add notification channel for SIM selection"

am: c543d5ba26

Change-Id: I72ac5944b8b4dc3eb2ad38c89ec8eb12f83b019d
This commit is contained in:
Bruno Martins
2017-11-15 21:54:16 +00:00
committed by android-build-merger
2 changed files with 14 additions and 1 deletions

View File

@@ -16,6 +16,7 @@
package com.android.settings.sim;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
@@ -40,6 +41,9 @@ public class SimSelectNotification extends BroadcastReceiver {
private static final String TAG = "SimSelectNotification";
private static final int NOTIFICATION_ID = 1;
private static final String SIM_SELECT_NOTIFICATION_CHANNEL =
"sim_select_notification_channel";
@Override
public void onReceive(Context context, Intent intent) {
final TelephonyManager telephonyManager = (TelephonyManager)
@@ -117,8 +121,14 @@ public class SimSelectNotification extends BroadcastReceiver {
private void createNotification(Context context){
final Resources resources = context.getResources();
NotificationChannel notificationChannel = new NotificationChannel(
SIM_SELECT_NOTIFICATION_CHANNEL,
resources.getString(R.string.sim_selection_channel_title),
NotificationManager.IMPORTANCE_LOW);
NotificationCompat.Builder builder =
new NotificationCompat.Builder(context)
new NotificationCompat.Builder(context, SIM_SELECT_NOTIFICATION_CHANNEL)
.setSmallIcon(R.drawable.ic_sim_card_alert_white_48dp)
.setColor(context.getColor(R.color.sim_noitification))
.setContentTitle(resources.getString(R.string.sim_notification_title))
@@ -130,6 +140,7 @@ public class SimSelectNotification extends BroadcastReceiver {
builder.setContentIntent(resultPendingIntent);
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.createNotificationChannel(notificationChannel);
notificationManager.notify(NOTIFICATION_ID, builder.build());
}