Merge "Remove usage of Telephonymanager from() hidden API" am: 8e999f22b8

am: fc8b731e33

Change-Id: I196f28a694fc0c8ec35256938a53d2d093e263c1
This commit is contained in:
Jayachandran Chinnakkannu
2019-11-18 10:57:56 -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);