Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3be1ba6e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Launch desired Tether Settings fragment based on feature flag"

parents 9ab1bd25 aaf5fe5a
Loading
Loading
Loading
Loading
+41 −2
Original line number Diff line number Diff line
@@ -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 */ }
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.settings.core.gateway;

import com.android.settings.AllInOneTetherSettings;
import com.android.settings.DisplaySettings;
import com.android.settings.IccLockSettings;
import com.android.settings.MasterClear;
@@ -169,6 +170,7 @@ public class SettingsGateway {
            ConfigureWifiSettings.class.getName(),
            SavedAccessPointsWifiSettings.class.getName(),
            SavedAccessPointsWifiSettings2.class.getName(),
            AllInOneTetherSettings.class.getName(),
            TetherSettings.class.getName(),
            WifiP2pSettings.class.getName(),
            WifiTetherSettings.class.getName(),