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

Commit 337df70e authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

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

parents c774ff07 16dce22b
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
@@ -7234,7 +7234,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() {