Merge "[Settings] Customizable resource for hiding 3G preferred network type" into udc-dev
This commit is contained in:
@@ -1418,4 +1418,9 @@
|
|||||||
<item>@color/screen_flash_preset_opacity_color_11</item>
|
<item>@color/screen_flash_preset_opacity_color_11</item>
|
||||||
<item>@color/screen_flash_preset_opacity_color_12</item>
|
<item>@color/screen_flash_preset_opacity_color_12</item>
|
||||||
</array>
|
</array>
|
||||||
|
|
||||||
|
<!-- hide 3G option from preferred network type UI -->
|
||||||
|
<integer-array name="network_mode_3g_deprecated_carrier_id" translatable="false">
|
||||||
|
</integer-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -22,6 +22,7 @@ import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.PersistableBundle;
|
import android.os.PersistableBundle;
|
||||||
import android.telephony.CarrierConfigManager;
|
import android.telephony.CarrierConfigManager;
|
||||||
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyCallback;
|
import android.telephony.TelephonyCallback;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
@@ -244,6 +245,24 @@ public class EnabledNetworkModePreferenceController extends
|
|||||||
// TODO: Using the carrier config.
|
// TODO: Using the carrier config.
|
||||||
mDisplay3gOptions = getResourcesForSubId().getBoolean(
|
mDisplay3gOptions = getResourcesForSubId().getBoolean(
|
||||||
R.bool.config_display_network_mode_3g_option);
|
R.bool.config_display_network_mode_3g_option);
|
||||||
|
|
||||||
|
int[] carriersWithout3gMenu = getResourcesForSubId().getIntArray(
|
||||||
|
R.array.network_mode_3g_deprecated_carrier_id);
|
||||||
|
if ((carriersWithout3gMenu != null) && (carriersWithout3gMenu.length > 0)) {
|
||||||
|
SubscriptionManager sm = mContext.getSystemService(SubscriptionManager.class);
|
||||||
|
SubscriptionInfo subInfo = sm.getActiveSubscriptionInfo(mSubId);
|
||||||
|
if (subInfo != null) {
|
||||||
|
int carrierId = subInfo.getCarrierId();
|
||||||
|
|
||||||
|
for (int idx = 0; idx < carriersWithout3gMenu.length; idx++) {
|
||||||
|
if (carrierId == carriersWithout3gMenu[idx]) {
|
||||||
|
mDisplay3gOptions = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mLteEnabled = carrierConfig.getBoolean(CarrierConfigManager.KEY_LTE_ENABLED_BOOL);
|
mLteEnabled = carrierConfig.getBoolean(CarrierConfigManager.KEY_LTE_ENABLED_BOOL);
|
||||||
}
|
}
|
||||||
Log.d(LOG_TAG, "PreferenceEntriesBuilder: subId" + mSubId
|
Log.d(LOG_TAG, "PreferenceEntriesBuilder: subId" + mSubId
|
||||||
|
Reference in New Issue
Block a user