[Settings] Convert to getSystemService(Class<T>)
Change to getSystemService(Class<T>) to align the capability with framework part. Bug: 179640862 Test: local Change-Id: I1b4812044fc4876bec6645570049a60f9470dbbd
This commit is contained in:
@@ -104,8 +104,8 @@ public class SimSelectNotification extends BroadcastReceiver {
|
||||
subId = SubscriptionManager.getDefaultSmsSubscriptionId();
|
||||
}
|
||||
|
||||
SubscriptionManager subscriptionManager = ((SubscriptionManager) context.getSystemService(
|
||||
Context.TELEPHONY_SUBSCRIPTION_SERVICE));
|
||||
SubscriptionManager subscriptionManager = (context.getSystemService(
|
||||
SubscriptionManager.class));
|
||||
if (!subscriptionManager.isActiveSubscriptionId(subId)) {
|
||||
Log.w(TAG, "onEnableMmsDataRequest invalid sub ID " + subId);
|
||||
return;
|
||||
@@ -130,8 +130,8 @@ public class SimSelectNotification extends BroadcastReceiver {
|
||||
return;
|
||||
}
|
||||
|
||||
TelephonyManager tm = ((TelephonyManager) context.getSystemService(
|
||||
Context.TELEPHONY_SERVICE)).createForSubscriptionId(subId);
|
||||
TelephonyManager tm = (context.getSystemService(
|
||||
TelephonyManager.class)).createForSubscriptionId(subId);
|
||||
|
||||
if (tm.isDataEnabledForApn(TYPE_MMS)) {
|
||||
Log.w(TAG, "onEnableMmsDataRequest MMS data already enabled on sub ID " + subId);
|
||||
@@ -229,14 +229,14 @@ public class SimSelectNotification extends BroadcastReceiver {
|
||||
PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
builder.setContentIntent(resultPendingIntent);
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
context.getSystemService(NotificationManager.class);
|
||||
notificationManager.createNotificationChannel(notificationChannel);
|
||||
notificationManager.notify(SIM_SELECT_NOTIFICATION_ID, builder.build());
|
||||
}
|
||||
|
||||
public static void cancelSimSelectNotification(Context context) {
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
context.getSystemService(NotificationManager.class);
|
||||
notificationManager.cancel(SIM_SELECT_NOTIFICATION_ID);
|
||||
}
|
||||
|
||||
@@ -269,14 +269,14 @@ public class SimSelectNotification extends BroadcastReceiver {
|
||||
|
||||
// Notify the notification.
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
context.getSystemService(NotificationManager.class);
|
||||
notificationManager.createNotificationChannel(notificationChannel);
|
||||
notificationManager.notify(ENABLE_MMS_NOTIFICATION_ID, builder.build());
|
||||
}
|
||||
|
||||
private void cancelEnableMmsNotification(Context context) {
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
context.getSystemService(NotificationManager.class);
|
||||
notificationManager.cancel(ENABLE_MMS_NOTIFICATION_ID);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user