Redesign the setPreferredNetworkType
Some APPs(like OMA DM) might enable or disable 5G settings, so redesign
the setPreferredNetworkType behavior.
1. Create allowed_network_type in telephonyprovider
2. Create get/set allowed network type API
3. When APPs call setPreferredNetworkType() that will AND with allowed
network type.
Bug: 136730709
Test: By Manual
1. setAllowedNetwork to disable 5G
2. setPreferredNetworkTypeBitmask to set NR_LTE_GSM_WCDMA
3. framework set LTE_GSM_WCDMA to modem
Change-Id: I5902509d79608c7aae697fbb247c7904f8d098a1
diff --git a/src/com/android/providers/telephony/TelephonyProvider.java b/src/com/android/providers/telephony/TelephonyProvider.java
index 2e0b972..dca1da2 100644
--- a/src/com/android/providers/telephony/TelephonyProvider.java
+++ b/src/com/android/providers/telephony/TelephonyProvider.java
@@ -147,7 +147,7 @@
private static final boolean DBG = true;
private static final boolean VDBG = false; // STOPSHIP if true
- private static final int DATABASE_VERSION = 43 << 16;
+ private static final int DATABASE_VERSION = 44 << 16;
private static final int URL_UNKNOWN = 0;
private static final int URL_TELEPHONY = 1;
private static final int URL_CURRENT = 2;
@@ -465,7 +465,8 @@
+ Telephony.SimInfo.GROUP_OWNER + " TEXT,"
+ Telephony.SimInfo.DATA_ENABLED_OVERRIDE_RULES + " TEXT,"
+ Telephony.SimInfo.IMSI + " TEXT,"
- + Telephony.SimInfo.UICC_APPLICATIONS_ENABLED + " INTEGER DEFAULT 1"
+ + Telephony.SimInfo.UICC_APPLICATIONS_ENABLED + " INTEGER DEFAULT 1,"
+ + Telephony.SimInfo.ALLOWED_NETWORK_TYPES + " BIGINT DEFAULT -1 "
+ ");";
}
@@ -1445,6 +1446,20 @@
oldVersion = 43 << 16 | 6;
}
+ if (oldVersion < (44 << 16 | 6)) {
+ try {
+ // Try to update the siminfo table. It might not be there.
+ db.execSQL("ALTER TABLE " + SIMINFO_TABLE + " ADD COLUMN "
+ + Telephony.SimInfo.ALLOWED_NETWORK_TYPES
+ + " BIGINT DEFAULT -1;");
+ } catch (SQLiteException e) {
+ if (DBG) {
+ log("onUpgrade skipping " + SIMINFO_TABLE + " upgrade. " +
+ "The table will get created in onOpen.");
+ }
+ }
+ oldVersion = 44 << 16 | 6;
+ }
if (DBG) {
log("dbh.onUpgrade:- db=" + db + " oldV=" + oldVersion + " newV=" + newVersion);