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

Commit 0a86ee3b authored by Jayachandran C's avatar Jayachandran C Committed by android-build-merger
Browse files

Merge "Remove usage of Telephonymanager getDefault() and from() hidden APIs"

am: 337df70e

Change-Id: Iba519e0e11af591d93f9bca5e09aab6191240b39
parents 134df464 337df70e
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1295,8 +1295,11 @@ public class UserManager {
                mContext.getContentResolver(),
                Settings.Global.ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED, 0) != 0;
        boolean isSystemUserUnlocked = isUserUnlocked(UserHandle.SYSTEM);
        boolean inCall = TelephonyManager.getDefault().getCallState()
                != TelephonyManager.CALL_STATE_IDLE;
        boolean inCall = false;
        TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
        if (telephonyManager != null) {
            inCall = telephonyManager.getCallState() != TelephonyManager.CALL_STATE_IDLE;
        }
        boolean isUserSwitchDisallowed = hasUserRestriction(DISALLOW_USER_SWITCH);
        return (allowUserSwitchingWhenSystemUserLocked || isSystemUserUnlocked) && !inCall
                && !isUserSwitchDisallowed;
+1 −1
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ public class LocaleStore {
    private static Set<String> getSimCountries(Context context) {
        Set<String> result = new HashSet<>();

        TelephonyManager tm = TelephonyManager.from(context);
        TelephonyManager tm = context.getSystemService(TelephonyManager.class);

        if (tm != null) {
            String iso = tm.getSimCountryIso().toUpperCase(Locale.US);
+1 −1
Original line number Diff line number Diff line
@@ -7379,7 +7379,7 @@ public class NotificationManagerService extends SystemService {
    }

    private void listenForCallState() {
        TelephonyManager.from(getContext()).listen(new PhoneStateListener() {
        getContext().getSystemService(TelephonyManager.class).listen(new PhoneStateListener() {
            @Override
            public void onCallStateChanged(int state, String incomingNumber) {
                if (mCallState == state) return;
+1 −1
Original line number Diff line number Diff line
@@ -1939,7 +1939,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        }
        TelephonyManager getTelephonyManager() {
            return TelephonyManager.from(mContext);
            return mContext.getSystemService(TelephonyManager.class);
        }
        TrustManager getTrustManager() {