Remove AdvancedOptionsPreference
This is used to show "Advanced" preference in telephony package. Remove it since we have better way to do it in settings. Bug: 114749736 Test: Manual Change-Id: I3008bf856b8f42ba10ab26cb81d35a9370601c58
This commit is contained in:
@@ -10245,8 +10245,6 @@
|
|||||||
<!-- Dialog title for CDMA subscription [CHAR LIMIT=30] -->
|
<!-- Dialog title for CDMA subscription [CHAR LIMIT=30] -->
|
||||||
<string name="cdma_subscription_dialogtitle">subscription</string>
|
<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] -->
|
<!-- Title to register automatically [CHAR LIMIT=NONE] -->
|
||||||
<string name="register_automatically">Automatic registration\u2026</string>
|
<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] -->
|
<!-- Mobile network settings screen, dialog message title when user selects the Data roaming check box [CHAR LIMIT=120] -->
|
||||||
|
@@ -13,7 +13,10 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
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
|
<PreferenceScreen
|
||||||
android:key="cdma_lte_data_service_key"
|
android:key="cdma_lte_data_service_key"
|
||||||
@@ -36,9 +39,6 @@
|
|||||||
android:key="data_usage_summary"
|
android:key="data_usage_summary"
|
||||||
android:title="@string/data_usage_title" />
|
android:title="@string/data_usage_title" />
|
||||||
|
|
||||||
<com.android.settings.mobilenetwork.AdvancedOptionsPreference
|
|
||||||
android:key="advanced_options"/>
|
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="enhanced_4g_lte"
|
android:key="enhanced_4g_lte"
|
||||||
android:title="@string/enhanced_4g_lte_mode_title"
|
android:title="@string/enhanced_4g_lte_mode_title"
|
||||||
|
@@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -47,16 +47,15 @@ public class DataUsagePreference extends Preference {
|
|||||||
* initialize which subID it connects to.
|
* initialize which subID it connects to.
|
||||||
*/
|
*/
|
||||||
public void initialize(int subId) {
|
public void initialize(int subId) {
|
||||||
Activity activity = (Activity) getContext();
|
final Context context = getContext();
|
||||||
|
|
||||||
mSubId = subId;
|
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);
|
DataUsageController.DataUsageInfo usageInfo = controller.getDataUsageInfo(mTemplate);
|
||||||
setSummary(activity.getString(R.string.data_usage_template,
|
setSummary(context.getString(R.string.data_usage_template,
|
||||||
Formatter.formatFileSize(activity, usageInfo.usageLevel), usageInfo.period));
|
Formatter.formatFileSize(context, usageInfo.usageLevel), usageInfo.period));
|
||||||
setIntent(getIntent());
|
setIntent(getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,8 +69,8 @@ public class DataUsagePreference extends Preference {
|
|||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private NetworkTemplate getNetworkTemplate(Activity activity, int subId) {
|
private NetworkTemplate getNetworkTemplate(Context context, int subId) {
|
||||||
TelephonyManager tm = (TelephonyManager) activity
|
TelephonyManager tm = (TelephonyManager) context
|
||||||
.getSystemService(Context.TELEPHONY_SERVICE);
|
.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
NetworkTemplate mobileAll = NetworkTemplate.buildTemplateMobileAll(
|
NetworkTemplate mobileAll = NetworkTemplate.buildTemplateMobileAll(
|
||||||
tm.getSubscriberId(subId));
|
tm.getSubscriberId(subId));
|
||||||
|
@@ -146,7 +146,6 @@ public class MobileNetworkFragment extends DashboardFragment implements
|
|||||||
private int mSubId;
|
private int mSubId;
|
||||||
|
|
||||||
//UI objects
|
//UI objects
|
||||||
private AdvancedOptionsPreference mAdvancedOptions;
|
|
||||||
private ListPreference mButtonPreferredNetworkMode;
|
private ListPreference mButtonPreferredNetworkMode;
|
||||||
private ListPreference mButtonEnabledNetworks;
|
private ListPreference mButtonEnabledNetworks;
|
||||||
private RestrictedSwitchPreference mButtonDataRoam;
|
private RestrictedSwitchPreference mButtonDataRoam;
|
||||||
@@ -167,7 +166,6 @@ public class MobileNetworkFragment extends DashboardFragment implements
|
|||||||
private ImsManager mImsMgr;
|
private ImsManager mImsMgr;
|
||||||
private MyHandler mHandler;
|
private MyHandler mHandler;
|
||||||
private boolean mOkClicked;
|
private boolean mOkClicked;
|
||||||
private boolean mExpandAdvancedFields;
|
|
||||||
|
|
||||||
//GsmUmts options and Cdma options
|
//GsmUmts options and Cdma options
|
||||||
GsmUmtsOptions mGsmUmtsOptions;
|
GsmUmtsOptions mGsmUmtsOptions;
|
||||||
@@ -302,10 +300,6 @@ public class MobileNetworkFragment extends DashboardFragment implements
|
|||||||
} else if (preference == mWiFiCallingPref || preference == mVideoCallingPref
|
} else if (preference == mWiFiCallingPref || preference == mVideoCallingPref
|
||||||
|| preference == mMobileDataPref || preference == mDataUsagePref) {
|
|| preference == mMobileDataPref || preference == mDataUsagePref) {
|
||||||
return false;
|
return false;
|
||||||
} else if (preference == mAdvancedOptions) {
|
|
||||||
mExpandAdvancedFields = true;
|
|
||||||
updateBody();
|
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
// if the button is anything but the simple toggle preference,
|
// if the button is anything but the simple toggle preference,
|
||||||
// we'll need to disable all preferences to reject all click
|
// we'll need to disable all preferences to reject all click
|
||||||
@@ -389,15 +383,6 @@ public class MobileNetworkFragment extends DashboardFragment implements
|
|||||||
mPhoneStateListener.updateSubscriptionId(mSubId);
|
mPhoneStateListener.updateSubscriptionId(mSubId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
Log.i(LOG_TAG, "onCreate:+");
|
Log.i(LOG_TAG, "onCreate:+");
|
||||||
@@ -416,12 +401,6 @@ public class MobileNetworkFragment extends DashboardFragment implements
|
|||||||
Context.TELEPHONY_SERVICE);
|
Context.TELEPHONY_SERVICE);
|
||||||
mCarrierConfigManager = new CarrierConfigManager(getContext());
|
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 = (SwitchPreference)findPreference(BUTTON_4G_LTE_KEY);
|
||||||
mButton4glte.setOnPreferenceChangeListener(this);
|
mButton4glte.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
@@ -450,8 +429,6 @@ public class MobileNetworkFragment extends DashboardFragment implements
|
|||||||
BUTTON_PREFERED_NETWORK_MODE);
|
BUTTON_PREFERED_NETWORK_MODE);
|
||||||
mButtonEnabledNetworks = (ListPreference) prefSet.findPreference(
|
mButtonEnabledNetworks = (ListPreference) prefSet.findPreference(
|
||||||
BUTTON_ENABLED_NETWORKS_KEY);
|
BUTTON_ENABLED_NETWORKS_KEY);
|
||||||
mAdvancedOptions = (AdvancedOptionsPreference) prefSet.findPreference(
|
|
||||||
BUTTON_ADVANCED_OPTIONS_KEY);
|
|
||||||
mButtonDataRoam.setOnPreferenceChangeListener(this);
|
mButtonDataRoam.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
mLteDataServicePref = prefSet.findPreference(BUTTON_CDMA_LTE_DATA_SERVICE_KEY);
|
mLteDataServicePref = prefSet.findPreference(BUTTON_CDMA_LTE_DATA_SERVICE_KEY);
|
||||||
@@ -637,11 +614,7 @@ public class MobileNetworkFragment extends DashboardFragment implements
|
|||||||
updateBodyBasicFields(activity, prefSet, mSubId, hasActiveSubscriptions);
|
updateBodyBasicFields(activity, prefSet, mSubId, hasActiveSubscriptions);
|
||||||
|
|
||||||
if (hasActiveSubscriptions) {
|
if (hasActiveSubscriptions) {
|
||||||
if (mExpandAdvancedFields) {
|
|
||||||
updateBodyAdvancedFields(activity, prefSet, mSubId, hasActiveSubscriptions);
|
updateBodyAdvancedFields(activity, prefSet, mSubId, hasActiveSubscriptions);
|
||||||
} else {
|
|
||||||
prefSet.addPreference(mAdvancedOptions);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Shows the "Carrier" preference that allows user to add a e-sim profile.
|
// Shows the "Carrier" preference that allows user to add a e-sim profile.
|
||||||
if (MobileNetworkUtils.showEuiccSettings(getContext())) {
|
if (MobileNetworkUtils.showEuiccSettings(getContext())) {
|
||||||
@@ -1740,7 +1713,7 @@ public class MobileNetworkFragment extends DashboardFragment implements
|
|||||||
// open the list dialog. When a value is chosen, another MetricsEvent is logged with
|
// open the list dialog. When a value is chosen, another MetricsEvent is logged with
|
||||||
// new value in onPreferenceChange.
|
// new value in onPreferenceChange.
|
||||||
if (preference == mLteDataServicePref || preference == mDataUsagePref
|
if (preference == mLteDataServicePref || preference == mDataUsagePref
|
||||||
|| preference == mEuiccSettingsPref || preference == mAdvancedOptions
|
|| preference == mEuiccSettingsPref
|
||||||
|| preference == mWiFiCallingPref || preference == mButtonPreferredNetworkMode
|
|| preference == mWiFiCallingPref || preference == mButtonPreferredNetworkMode
|
||||||
|| preference == mButtonEnabledNetworks
|
|| preference == mButtonEnabledNetworks
|
||||||
|| preference == preferenceScreen.findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY)
|
|| preference == preferenceScreen.findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY)
|
||||||
@@ -1786,8 +1759,6 @@ public class MobileNetworkFragment extends DashboardFragment implements
|
|||||||
return MetricsProto.MetricsEvent.ACTION_MOBILE_NETWORK_DATA_USAGE;
|
return MetricsProto.MetricsEvent.ACTION_MOBILE_NETWORK_DATA_USAGE;
|
||||||
} else if (preference == mLteDataServicePref) {
|
} else if (preference == mLteDataServicePref) {
|
||||||
return MetricsProto.MetricsEvent.ACTION_MOBILE_NETWORK_SET_UP_DATA_SERVICE;
|
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) {
|
} else if (preference == mButton4glte) {
|
||||||
return MetricsProto.MetricsEvent.ACTION_MOBILE_ENHANCED_4G_LTE_MODE_TOGGLE;
|
return MetricsProto.MetricsEvent.ACTION_MOBILE_ENHANCED_4G_LTE_MODE_TOGGLE;
|
||||||
} else if (preference == mButtonPreferredNetworkMode) {
|
} else if (preference == mButtonPreferredNetworkMode) {
|
||||||
|
Reference in New Issue
Block a user