Merge "Remove usage of Telephonymanager from() hidden API"

am: 8e999f22b8

Change-Id: Icee4117f892b09ce3eafeb39668467cc2220f31b
This commit is contained in:
Jayachandran Chinnakkannu
2019-11-18 10:53:53 -08:00
committed by android-build-merger
2 changed files with 3 additions and 2 deletions

View File

@@ -222,7 +222,8 @@ public class DataUsageController {
}
}
return TelephonyManager.from(mContext).createForSubscriptionId(subscriptionId);
return mContext.getSystemService(
TelephonyManager.class).createForSubscriptionId(subscriptionId);
}
public void setMobileDataEnabled(boolean enabled) {

View File

@@ -75,7 +75,7 @@ public class DataUsageControllerTest {
public void setUp() throws RemoteException {
MockitoAnnotations.initMocks(this);
when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager);
when(mContext.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE))
.thenReturn(mSubscriptionManager);
when(mContext.getSystemService(NetworkStatsManager.class)).thenReturn(mNetworkStatsManager);