<!-- Dialog title for CDMA subscription [CHAR LIMIT=30] -->
<string name="cdma_subscription_dialogtitle">subscription</string>
- <!-- Mobile network settings screen, Advanced button to show more items when clicked [CHAR LIMIT=50] -->
- <string name="advanced_options_title">Advanced</string>
<!-- Title to register automatically [CHAR LIMIT=NONE] -->
<string name="register_automatically">Automatic registration\u2026</string>
<!-- Mobile network settings screen, dialog message title when user selects the Data roaming check box [CHAR LIMIT=120] -->
See the License for the specific language governing permissions and
limitations under the License.
-->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ settings:initialExpandedChildrenCount="4">
<PreferenceScreen
android:key="cdma_lte_data_service_key"
android:key="data_usage_summary"
android:title="@string/data_usage_title" />
- <com.android.settings.mobilenetwork.AdvancedOptionsPreference
- android:key="advanced_options"/>
-
<SwitchPreference
android:key="enhanced_4g_lte"
android:title="@string/enhanced_4g_lte_mode_title"
+++ /dev/null
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.settings.mobilenetwork;
-
-import android.content.Context;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceViewHolder;
-
-import android.util.AttributeSet;
-import android.widget.TextView;
-
-import com.android.settings.R;
-
-/**
- * Customized preference class representing the "Advanced" button that expands to fields that
- * are hidden by default.
- */
-//TODO(b/114749736): Change it back to normal preference
-public class AdvancedOptionsPreference extends Preference {
- public AdvancedOptionsPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-}
\ No newline at end of file
* initialize which subID it connects to.
*/
public void initialize(int subId) {
- Activity activity = (Activity) getContext();
-
+ final Context context = getContext();
mSubId = subId;
- mTemplate = getNetworkTemplate(activity, subId);
+ mTemplate = getNetworkTemplate(context, subId);
- DataUsageController controller = new DataUsageController(activity);
+ DataUsageController controller = new DataUsageController(context);
DataUsageController.DataUsageInfo usageInfo = controller.getDataUsageInfo(mTemplate);
- setSummary(activity.getString(R.string.data_usage_template,
- Formatter.formatFileSize(activity, usageInfo.usageLevel), usageInfo.period));
+ setSummary(context.getString(R.string.data_usage_template,
+ Formatter.formatFileSize(context, usageInfo.usageLevel), usageInfo.period));
setIntent(getIntent());
}
return intent;
}
- private NetworkTemplate getNetworkTemplate(Activity activity, int subId) {
- TelephonyManager tm = (TelephonyManager) activity
+ private NetworkTemplate getNetworkTemplate(Context context, int subId) {
+ TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
NetworkTemplate mobileAll = NetworkTemplate.buildTemplateMobileAll(
tm.getSubscriberId(subId));
private int mSubId;
//UI objects
- private AdvancedOptionsPreference mAdvancedOptions;
private ListPreference mButtonPreferredNetworkMode;
private ListPreference mButtonEnabledNetworks;
private RestrictedSwitchPreference mButtonDataRoam;
private ImsManager mImsMgr;
private MyHandler mHandler;
private boolean mOkClicked;
- private boolean mExpandAdvancedFields;
//GsmUmts options and Cdma options
GsmUmtsOptions mGsmUmtsOptions;
} else if (preference == mWiFiCallingPref || preference == mVideoCallingPref
|| preference == mMobileDataPref || preference == mDataUsagePref) {
return false;
- } else if (preference == mAdvancedOptions) {
- mExpandAdvancedFields = true;
- updateBody();
- return true;
} else {
// if the button is anything but the simple toggle preference,
// we'll need to disable all preferences to reject all click
}
@Override
- public void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
-
- // If advanced fields are already expanded, we save it and expand it
- // when it's re-created.
- outState.putBoolean(EXPAND_ADVANCED_FIELDS, mExpandAdvancedFields);
- }
-
- @Override
public void onCreate(Bundle icicle) {
Log.i(LOG_TAG, "onCreate:+");
super.onCreate(icicle);
Context.TELEPHONY_SERVICE);
mCarrierConfigManager = new CarrierConfigManager(getContext());
- if (icicle != null) {
- mExpandAdvancedFields = icicle.getBoolean(EXPAND_ADVANCED_FIELDS, false);
- } else if (getIntent().getBooleanExtra(EXPAND_EXTRA, false)) {
- mExpandAdvancedFields = true;
- }
-
mButton4glte = (SwitchPreference)findPreference(BUTTON_4G_LTE_KEY);
mButton4glte.setOnPreferenceChangeListener(this);
BUTTON_PREFERED_NETWORK_MODE);
mButtonEnabledNetworks = (ListPreference) prefSet.findPreference(
BUTTON_ENABLED_NETWORKS_KEY);
- mAdvancedOptions = (AdvancedOptionsPreference) prefSet.findPreference(
- BUTTON_ADVANCED_OPTIONS_KEY);
mButtonDataRoam.setOnPreferenceChangeListener(this);
mLteDataServicePref = prefSet.findPreference(BUTTON_CDMA_LTE_DATA_SERVICE_KEY);
updateBodyBasicFields(activity, prefSet, mSubId, hasActiveSubscriptions);
if (hasActiveSubscriptions) {
- if (mExpandAdvancedFields) {
- updateBodyAdvancedFields(activity, prefSet, mSubId, hasActiveSubscriptions);
- } else {
- prefSet.addPreference(mAdvancedOptions);
- }
+ updateBodyAdvancedFields(activity, prefSet, mSubId, hasActiveSubscriptions);
} else {
// Shows the "Carrier" preference that allows user to add a e-sim profile.
if (MobileNetworkUtils.showEuiccSettings(getContext())) {
// open the list dialog. When a value is chosen, another MetricsEvent is logged with
// new value in onPreferenceChange.
if (preference == mLteDataServicePref || preference == mDataUsagePref
- || preference == mEuiccSettingsPref || preference == mAdvancedOptions
+ || preference == mEuiccSettingsPref
|| preference == mWiFiCallingPref || preference == mButtonPreferredNetworkMode
|| preference == mButtonEnabledNetworks
|| preference == preferenceScreen.findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY)
return MetricsProto.MetricsEvent.ACTION_MOBILE_NETWORK_DATA_USAGE;
} else if (preference == mLteDataServicePref) {
return MetricsProto.MetricsEvent.ACTION_MOBILE_NETWORK_SET_UP_DATA_SERVICE;
- } else if (preference == mAdvancedOptions) {
- return MetricsProto.MetricsEvent.ACTION_MOBILE_NETWORK_EXPAND_ADVANCED_FIELDS;
} else if (preference == mButton4glte) {
return MetricsProto.MetricsEvent.ACTION_MOBILE_ENHANCED_4G_LTE_MODE_TOGGLE;
} else if (preference == mButtonPreferredNetworkMode) {