Launch desired Tether Settings fragment based on feature flag
When feature flag is enabled for AllInOneTetherSettings, implicit intent to TetherSettingsActivity or WifiTetherSettingsActivity should launch AllInOneTetherSettings fragement. The behavior won't change when flag is disabled. Bug: 149590956 Test: make RunSettingsRoboTests ROBOTEST_FILTER=CodeInspectionTest, built and flashed to device. When flag disabled, long clicking on Hotspot Tile will go to TetherSettings fragment. When flag enabled, long clicking on Hotspot Tile will go to AllInOneTetherSettings fragment. Change-Id: Iffdaacde000fb58c7e54406522fac0541cabf7fc
This commit is contained in:
@@ -16,8 +16,12 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.enterprise.EnterprisePrivacySettings;
|
||||
|
||||
/**
|
||||
@@ -33,8 +37,43 @@ public class Settings extends SettingsActivity {
|
||||
public static class CreateShortcutActivity extends SettingsActivity { /* empty */ }
|
||||
public static class FaceSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class FingerprintSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class TetherSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class WifiTetherSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class TetherSettingsActivity extends SettingsActivity {
|
||||
// TODO(b/147675042): Clean the override up when we enable the new Fragment persistently.
|
||||
@Override
|
||||
public Intent getIntent() {
|
||||
return wrapIntentWithAllInOneTetherSettingsIfNeeded(
|
||||
getApplicationContext(), super.getIntent());
|
||||
}
|
||||
}
|
||||
public static class WifiTetherSettingsActivity extends SettingsActivity {
|
||||
// TODO(b/147675042): Clean the override up when we enable the new Fragment persistently.
|
||||
@Override
|
||||
public Intent getIntent() {
|
||||
return wrapIntentWithAllInOneTetherSettingsIfNeeded(
|
||||
getApplicationContext(), super.getIntent());
|
||||
}
|
||||
}
|
||||
|
||||
private static Intent wrapIntentWithAllInOneTetherSettingsIfNeeded(
|
||||
Context context, Intent superIntent) {
|
||||
if (!FeatureFlagUtils.isEnabled(context, FeatureFlags.TETHER_ALL_IN_ONE)) {
|
||||
return superIntent;
|
||||
}
|
||||
|
||||
final Intent modIntent = new Intent(superIntent);
|
||||
modIntent.putExtra(EXTRA_SHOW_FRAGMENT,
|
||||
AllInOneTetherSettings.class.getCanonicalName());
|
||||
Bundle args = superIntent.getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS);
|
||||
if (args != null) {
|
||||
args = new Bundle(args);
|
||||
} else {
|
||||
args = new Bundle();
|
||||
}
|
||||
args.putParcelable("intent", superIntent);
|
||||
modIntent.putExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS, args);
|
||||
return modIntent;
|
||||
}
|
||||
|
||||
public static class VpnSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class DataSaverSummaryActivity extends SettingsActivity{ /* empty */ }
|
||||
public static class DateTimeSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
|
Reference in New Issue
Block a user