Merge "Device do network scan after user rotates NetworkSelection page" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c350919fa4
@@ -241,6 +241,11 @@
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden">
|
||||
<!-- Note: Since the framework does not support the multiple requests of network scan
|
||||
from the UI, this singleTask can protect that there is only one
|
||||
Settings$NetworkSelectActivity which can request the network scan.
|
||||
If removing the "singleTask" in the future, please also modify the
|
||||
Settings$NetworkSelectActivity's structure. -->
|
||||
<intent-filter android:priority="1">
|
||||
<!-- Displays the MobileNetworkActivity and opt-in dialog for capability discovery. -->
|
||||
<action android:name="android.telephony.ims.action.SHOW_CAPABILITY_DISCOVERY_OPT_IN" />
|
||||
@@ -369,6 +374,16 @@
|
||||
android:value="true"/>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="Settings$NetworkSelectActivity"
|
||||
android:label="@string/choose_network_title"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|smallestScreenSize">
|
||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.network.telephony.NetworkSelectSettings" />
|
||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||
android:value="true" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="Settings$WifiDetailsSettingsActivity"
|
||||
android:label="@string/wifi_details_title"
|
||||
|
@@ -223,7 +223,6 @@
|
||||
<Preference
|
||||
android:key="choose_network_key"
|
||||
android:title="@string/choose_network_title"
|
||||
android:fragment="com.android.phone.NetworkSelectSetting"
|
||||
settings:controller="com.android.settings.network.telephony.gsm.OpenNetworkSelectPagePreferenceController"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
|
@@ -90,6 +90,7 @@ public class Settings extends SettingsActivity {
|
||||
public static class PublicVolumeSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class WifiSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class NetworkProviderSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class NetworkSelectActivity extends SettingsActivity { /* empty */ }
|
||||
/** Activity for the Wi-Fi network details settings. */
|
||||
public static class WifiDetailsSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class WifiP2pSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
|
@@ -120,6 +120,7 @@ import com.android.settings.network.NetworkDashboardFragment;
|
||||
import com.android.settings.network.NetworkProviderSettings;
|
||||
import com.android.settings.network.apn.ApnEditor;
|
||||
import com.android.settings.network.apn.ApnSettings;
|
||||
import com.android.settings.network.telephony.NetworkSelectSettings;
|
||||
import com.android.settings.nfc.AndroidBeam;
|
||||
import com.android.settings.nfc.PaymentSettings;
|
||||
import com.android.settings.notification.ConfigureNotificationSettings;
|
||||
@@ -320,6 +321,7 @@ public class SettingsGateway {
|
||||
InteractAcrossProfilesDetails.class.getName(),
|
||||
MediaControlsSettings.class.getName(),
|
||||
NetworkProviderSettings.class.getName(),
|
||||
NetworkSelectSettings.class.getName(),
|
||||
AlarmsAndRemindersDetails.class.getName(),
|
||||
MediaManagementAppsDetails.class.getName()
|
||||
};
|
||||
@@ -343,6 +345,7 @@ public class SettingsGateway {
|
||||
Settings.WifiSettingsActivity.class.getName(),
|
||||
Settings.DataUsageSummaryActivity.class.getName(),
|
||||
Settings.NetworkProviderSettingsActivity.class.getName(),
|
||||
Settings.NetworkSelectActivity.class.getName(),
|
||||
// Home page > Connected devices
|
||||
Settings.BluetoothSettingsActivity.class.getName(),
|
||||
Settings.WifiDisplaySettingsActivity.class.getName(),
|
||||
|
@@ -227,6 +227,7 @@ public class NetworkScanHelper {
|
||||
mExecutor,
|
||||
mInternalNetworkScanCallback);
|
||||
if (mNetworkScanRequester == null) {
|
||||
Log.d(TAG, "mNetworkScanRequester == null");
|
||||
onError(NetworkScan.ERROR_RADIO_INTERFACE_ERROR);
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ package com.android.settings.network.telephony;
|
||||
import android.app.Activity;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@@ -98,7 +99,11 @@ public class NetworkSelectSettings extends DashboardFragment {
|
||||
|
||||
mUseNewApi = getContext().getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_enableNewAutoSelectNetworkUI);
|
||||
mSubId = getArguments().getInt(Settings.EXTRA_SUB_ID);
|
||||
Intent intent = getActivity().getIntent();
|
||||
if (intent != null) {
|
||||
mSubId = intent.getIntExtra(Settings.EXTRA_SUB_ID,
|
||||
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
||||
}
|
||||
|
||||
mPreferenceCategory = findPreference(PREF_KEY_NETWORK_OPERATORS);
|
||||
mStatusMessagePreference = new Preference(getContext());
|
||||
@@ -121,13 +126,12 @@ public class NetworkSelectSettings extends DashboardFragment {
|
||||
mIsAggregationEnabled = getContext().getResources().getBoolean(
|
||||
R.bool.config_network_selection_list_aggregation_enabled);
|
||||
Log.d(TAG, "init: mUseNewApi:" + mUseNewApi
|
||||
+ " ,mIsAggregationEnabled:" + mIsAggregationEnabled);
|
||||
+ " ,mIsAggregationEnabled:" + mIsAggregationEnabled + " ,mSubId:" + mSubId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
final Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
mProgressHeader = setPinnedHeaderView(R.layout.progress_header)
|
||||
|
@@ -20,9 +20,8 @@ import static androidx.lifecycle.Lifecycle.Event.ON_START;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerExecutor;
|
||||
import android.os.Looper;
|
||||
@@ -43,10 +42,8 @@ import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.network.AllowedNetworkTypesListener;
|
||||
import com.android.settings.network.telephony.MobileNetworkUtils;
|
||||
import com.android.settings.network.telephony.NetworkSelectSettings;
|
||||
import com.android.settings.network.telephony.TelephonyTogglePreferenceController;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
|
||||
@@ -151,25 +148,26 @@ public class AutoSelectPreferenceController extends TelephonyTogglePreferenceCon
|
||||
public boolean setChecked(boolean isChecked) {
|
||||
if (isChecked) {
|
||||
setAutomaticSelectionMode();
|
||||
return false;
|
||||
} else {
|
||||
final Bundle bundle = new Bundle();
|
||||
bundle.putInt(Settings.EXTRA_SUB_ID, mSubId);
|
||||
new SubSettingLauncher(mContext)
|
||||
.setDestination(NetworkSelectSettings.class.getName())
|
||||
.setSourceMetricsCategory(SettingsEnums.MOBILE_NETWORK_SELECT)
|
||||
.setTitleRes(R.string.choose_network_title)
|
||||
.setArguments(bundle)
|
||||
.launch();
|
||||
return false;
|
||||
if (mSwitchPreference != null) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings",
|
||||
"com.android.settings.Settings$NetworkSelectActivity");
|
||||
intent.putExtra(Settings.EXTRA_SUB_ID, mSubId);
|
||||
mSwitchPreference.setIntent(intent);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
Future setAutomaticSelectionMode() {
|
||||
final long startMillis = SystemClock.elapsedRealtime();
|
||||
showAutoSelectProgressBar();
|
||||
mSwitchPreference.setEnabled(false);
|
||||
if (mSwitchPreference != null) {
|
||||
mSwitchPreference.setIntent(null);
|
||||
mSwitchPreference.setEnabled(false);
|
||||
}
|
||||
return ThreadUtils.postOnBackgroundThread(() -> {
|
||||
// set network selection mode in background
|
||||
mTelephonyManager.setNetworkSelectionModeAutomatic();
|
||||
|
@@ -19,14 +19,12 @@ package com.android.settings.network.telephony.gsm;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_START;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.content.Intent;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
@@ -35,10 +33,8 @@ import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.network.AllowedNetworkTypesListener;
|
||||
import com.android.settings.network.telephony.MobileNetworkUtils;
|
||||
import com.android.settings.network.telephony.NetworkSelectSettings;
|
||||
import com.android.settings.network.telephony.TelephonyBasePreferenceController;
|
||||
|
||||
/**
|
||||
@@ -102,6 +98,12 @@ public class OpenNetworkSelectPagePreferenceController extends
|
||||
super.updateState(preference);
|
||||
preference.setEnabled(mTelephonyManager.getNetworkSelectionMode()
|
||||
!= TelephonyManager.NETWORK_SELECTION_MODE_AUTO);
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings",
|
||||
"com.android.settings.Settings$NetworkSelectActivity");
|
||||
intent.putExtra(Settings.EXTRA_SUB_ID, mSubId);
|
||||
preference.setIntent(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,23 +116,6 @@ public class OpenNetworkSelectPagePreferenceController extends
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||
if (TextUtils.equals(preference.getKey(), getPreferenceKey())) {
|
||||
final Bundle bundle = new Bundle();
|
||||
bundle.putInt(Settings.EXTRA_SUB_ID, mSubId);
|
||||
new SubSettingLauncher(mContext)
|
||||
.setDestination(NetworkSelectSettings.class.getName())
|
||||
.setSourceMetricsCategory(SettingsEnums.MOBILE_NETWORK_SELECT)
|
||||
.setTitleRes(R.string.choose_network_title)
|
||||
.setArguments(bundle)
|
||||
.launch();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public OpenNetworkSelectPagePreferenceController init(Lifecycle lifecycle, int subId) {
|
||||
mSubId = subId;
|
||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
||||
|
Reference in New Issue
Block a user