Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80eadad5 authored by Jayachandran C's avatar Jayachandran C Committed by Jayachandran Chinnakkannu
Browse files

Remove usage of Telephonymanager from() hidden API

This CL changes to use getSystemService(TelephonyManager.class)

Bug: 140768340
Test: atest DataUsageControllerTest
Change-Id: I377973fac09c29e9085c280c89d748e1c79c13e2
parent af357413
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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);