Remove usage of Telephonymanager getDefault() hidden API

This CL replaces with getSystemService(TelephonyManager.class)

Bug: 140768340
Test: Build
Change-Id: Ifb7b53af787b86b1d6c2f91a96a330bde57271d7
This commit is contained in:
Jayachandran C
2019-11-15 16:33:32 -08:00
committed by Jayachandran Chinnakkannu
parent 3a6d75b315
commit 917199a316

View File

@@ -2563,8 +2563,12 @@ class DatabaseHelper extends SQLiteOpenHelper {
// value defined in system property
StringBuilder val = new StringBuilder();
List<Integer> defaultNetworks = TelephonyProperties.default_network();
for (int phoneId = 0;
phoneId < TelephonyManager.getDefault().getPhoneCount(); phoneId++) {
int phoneCount = 1;
TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
if (telephonyManager != null) {
phoneCount = telephonyManager.getSupportedModemCount();
}
for (int phoneId = 0; phoneId < phoneCount; phoneId++) {
int mode = defaultNetworks.size() <= phoneId
|| defaultNetworks.get(phoneId) == null
? RILConstants.PREFERRED_NETWORK_MODE : defaultNetworks.get(phoneId);