Merge "Remove usage of Telephonymanager getDefault() and from() hidden APIs" am: 337df70e17

am: 0a86ee3b3e

Change-Id: I2b1be68cd2eea8a4795a882933ed91dbf6ed83ee
This commit is contained in:
Jayachandran C
2019-11-15 22:11:01 -08:00
committed by android-build-merger
4 changed files with 8 additions and 5 deletions

View File

@@ -1296,8 +1296,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;

View File

@@ -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);

View File

@@ -7402,7 +7402,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;

View File

@@ -1939,7 +1939,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
}
TelephonyManager getTelephonyManager() {
return TelephonyManager.from(mContext);
return mContext.getSystemService(TelephonyManager.class);
}
TrustManager getTrustManager() {