Move android.settings.WIFI_SETTINGS action to Internet Settings

- Starting from S, the WiFi Settings is changed to Internet Settings

- Redirect to WiFi Settings if Provider Model disabled

- Don't use FLAG_ACTIVITY_NEW_TASK to avoid Lock Task Mode impacted

Bug: 199364761
Bug: 198740257
Bug: 203191404
Test: manual verified by TestDPC apk (see b/198740257#comment41)
Change-Id: I3c283ef58b37f4d3fe27045f431932a35af55023
This commit is contained in:
Weng Su
2021-10-26 00:39:01 +08:00
parent f1d527ff0b
commit 3b99a81e78
2 changed files with 20 additions and 5 deletions

View File

@@ -292,10 +292,6 @@
android:icon="@drawable/ic_homepage_network" android:icon="@drawable/ic_homepage_network"
android:exported="true" android:exported="true"
android:configChanges="orientation|keyboardHidden|screenSize"> android:configChanges="orientation|keyboardHidden|screenSize">
<intent-filter android:priority="1">
<action android:name="android.settings.WIFI_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.wifi.WifiSettings" /> android:value="com.android.settings.wifi.WifiSettings" />
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
@@ -312,6 +308,10 @@
<action android:name="android.settings.NETWORK_PROVIDER_SETTINGS" /> <action android:name="android.settings.NETWORK_PROVIDER_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
<intent-filter android:priority="1">
<action android:name="android.settings.WIFI_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter android:priority="1"> <intent-filter android:priority="1">
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="com.android.settings.SHORTCUT" /> <category android:name="com.android.settings.SHORTCUT" />

View File

@@ -19,6 +19,8 @@ package com.android.settings.network;
import static android.net.wifi.WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_ENABLED; import static android.net.wifi.WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_ENABLED;
import static android.os.UserManager.DISALLOW_CONFIG_WIFI; import static android.os.UserManager.DISALLOW_CONFIG_WIFI;
import static com.android.settings.Settings.WifiSettingsActivity;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.app.settings.SettingsEnums; import android.app.settings.SettingsEnums;
@@ -277,6 +279,17 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
super.onCreate(icicle); super.onCreate(icicle);
if (!FeatureFlagUtils.isEnabled(getContext(), FeatureFlagUtils.SETTINGS_PROVIDER_MODEL)) {
final Intent intent = new Intent(getContext(), WifiSettingsActivity.class);
final Bundle extras = getActivity().getIntent().getExtras();
if (extras != null) {
intent.putExtras(extras);
}
getContext().startActivity(intent);
finish();
return;
}
mAirplaneModeEnabler = new AirplaneModeEnabler(getContext(), this); mAirplaneModeEnabler = new AirplaneModeEnabler(getContext(), this);
// TODO(b/37429702): Add animations and preference comparator back after initial screen is // TODO(b/37429702): Add animations and preference comparator back after initial screen is
@@ -464,7 +477,9 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
@Override @Override
public void onDestroy() { public void onDestroy() {
mAirplaneModeEnabler.close(); if (mAirplaneModeEnabler != null) {
mAirplaneModeEnabler.close();
}
super.onDestroy(); super.onDestroy();
} }