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

This commit is contained in:
Jayachandran Chinnakkannu
2019-11-18 21:00:42 +00:00
committed by Gerrit Code Review
2 changed files with 2 additions and 2 deletions

View File

@@ -445,7 +445,7 @@ class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStatsSync {
if ((updateFlags & BatteryStatsImpl.ExternalStatsSync.UPDATE_RADIO) != 0) { if ((updateFlags & BatteryStatsImpl.ExternalStatsSync.UPDATE_RADIO) != 0) {
// We were asked to fetch Telephony data. // We were asked to fetch Telephony data.
if (mTelephony == null) { if (mTelephony == null) {
mTelephony = TelephonyManager.from(mContext); mTelephony = mContext.getSystemService(TelephonyManager.class);
} }
if (mTelephony != null) { if (mTelephony != null) {

View File

@@ -731,7 +731,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub
public void notePhoneState(int state) { public void notePhoneState(int state) {
enforceCallingPermission(); enforceCallingPermission();
int simState = TelephonyManager.getDefault().getSimState(); int simState = mContext.getSystemService(TelephonyManager.class).getSimState();
synchronized (mStats) { synchronized (mStats) {
mStats.notePhoneStateLocked(state, simState); mStats.notePhoneStateLocked(state, simState);
} }