Revert "[Settings] Convert to getSystemService(Class<T>)"

Revert submission 1645152-getSystemService(Class<T>)

Reason for revert: Fix JUnit test failure
Reverted Changes:
I1b4812044:[Settings] Convert to getSystemService(Class<T>)
I278951c24:[Settings] Support getSystemService(Class<T>)

Change-Id: I864a40f82ba9cb4170900ac0c1d77f781b17341f
This commit is contained in:
Bonian Chen
2021-03-31 09:37:03 +00:00
parent 13fb77c652
commit d6f54ed90b
64 changed files with 103 additions and 103 deletions

View File

@@ -104,8 +104,8 @@ public class SimSelectNotification extends BroadcastReceiver {
subId = SubscriptionManager.getDefaultSmsSubscriptionId();
}
SubscriptionManager subscriptionManager = (context.getSystemService(
SubscriptionManager.class));
SubscriptionManager subscriptionManager = ((SubscriptionManager) context.getSystemService(
Context.TELEPHONY_SUBSCRIPTION_SERVICE));
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 = (context.getSystemService(
TelephonyManager.class)).createForSubscriptionId(subId);
TelephonyManager tm = ((TelephonyManager) context.getSystemService(
Context.TELEPHONY_SERVICE)).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 =
context.getSystemService(NotificationManager.class);
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.createNotificationChannel(notificationChannel);
notificationManager.notify(SIM_SELECT_NOTIFICATION_ID, builder.build());
}
public static void cancelSimSelectNotification(Context context) {
NotificationManager notificationManager =
context.getSystemService(NotificationManager.class);
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(SIM_SELECT_NOTIFICATION_ID);
}
@@ -269,14 +269,14 @@ public class SimSelectNotification extends BroadcastReceiver {
// Notify the notification.
NotificationManager notificationManager =
context.getSystemService(NotificationManager.class);
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.createNotificationChannel(notificationChannel);
notificationManager.notify(ENABLE_MMS_NOTIFICATION_ID, builder.build());
}
private void cancelEnableMmsNotification(Context context) {
NotificationManager notificationManager =
context.getSystemService(NotificationManager.class);
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(ENABLE_MMS_NOTIFICATION_ID);
}