Pre-fixup for nav up button
- Remove SettingsDrawerActivity.EXTRA_SHOW_MENU and force up nav button
to always show. The button doesn't do anything yet. It just finishes
current activity.
- Remove dead code about suggestions
Change-Id: I61fa9fefbaa9bced841a05969544b1c824c564ce
Bug: 72337421
Test: rebuild
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 01818e9..7328c76 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -82,8 +82,6 @@
// Constants for state save/restore
private static final String SAVE_KEY_CATEGORIES = ":settings:categories";
- @VisibleForTesting
- static final String SAVE_KEY_SHOW_HOME_AS_UP = ":settings:show_home_as_up";
/**
* When starting this activity, the invoking Intent can contain this extra
@@ -146,12 +144,10 @@
public static final String EXTRA_HIDE_DRAWER = ":settings:hide_drawer";
public static final String META_DATA_KEY_FRAGMENT_CLASS =
- "com.android.settings.FRAGMENT_CLASS";
+ "com.android.settings.FRAGMENT_CLASS";
private static final String EXTRA_UI_OPTIONS = "settings:ui_options";
- private static final int REQUEST_SUGGESTION = 42;
-
private String mFragmentClass;
private CharSequence mInitialTitle;
@@ -183,9 +179,6 @@
private Button mNextButton;
- @VisibleForTesting
- boolean mDisplayHomeAsUpEnabled;
-
private boolean mIsShowingDashboard;
private boolean mIsShortcut;
@@ -197,7 +190,6 @@
private ArrayList<DashboardCategory> mCategories = new ArrayList<>();
private DashboardFeatureProvider mDashboardFeatureProvider;
- private ComponentName mCurrentSuggestion;
public SwitchBar getSwitchBar() {
return mSwitchBar;
@@ -310,9 +302,6 @@
mCategories.addAll(categories);
setTitleFromBackStack();
}
-
- mDisplayHomeAsUpEnabled = savedState.getBoolean(SAVE_KEY_SHOW_HOME_AS_UP);
-
} else {
launchSettingFragment(initialFragmentName, isSubSettings, intent);
}
@@ -337,8 +326,8 @@
ActionBar actionBar = getActionBar();
if (actionBar != null) {
- actionBar.setDisplayHomeAsUpEnabled(mDisplayHomeAsUpEnabled);
- actionBar.setHomeButtonEnabled(mDisplayHomeAsUpEnabled);
+ actionBar.setDisplayHomeAsUpEnabled(true);
+ actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayShowTitleEnabled(!mIsShowingDashboard);
}
mSwitchBar = findViewById(R.id.switch_bar);
@@ -353,21 +342,21 @@
if (buttonBar != null) {
buttonBar.setVisibility(View.VISIBLE);
- Button backButton = (Button)findViewById(R.id.back_button);
+ Button backButton = (Button) findViewById(R.id.back_button);
backButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
setResult(RESULT_CANCELED, null);
finish();
}
});
- Button skipButton = (Button)findViewById(R.id.skip_button);
+ Button skipButton = (Button) findViewById(R.id.skip_button);
skipButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
setResult(RESULT_OK, null);
finish();
}
});
- mNextButton = (Button)findViewById(R.id.next_button);
+ mNextButton = (Button) findViewById(R.id.next_button);
mNextButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
setResult(RESULT_OK, null);
@@ -380,8 +369,7 @@
String buttonText = intent.getStringExtra(EXTRA_PREFS_SET_NEXT_TEXT);
if (TextUtils.isEmpty(buttonText)) {
mNextButton.setVisibility(View.GONE);
- }
- else {
+ } else {
mNextButton.setText(buttonText);
}
}
@@ -389,8 +377,7 @@
String buttonText = intent.getStringExtra(EXTRA_PREFS_SET_BACK_TEXT);
if (TextUtils.isEmpty(buttonText)) {
backButton.setVisibility(View.GONE);
- }
- else {
+ } else {
backButton.setText(buttonText);
}
}
@@ -408,26 +395,17 @@
@VisibleForTesting
void launchSettingFragment(String initialFragmentName, boolean isSubSettings, Intent intent) {
if (!mIsShowingDashboard && initialFragmentName != null) {
- // UP will be shown only if it is a sub settings
- if (mIsShortcut) {
- mDisplayHomeAsUpEnabled = isSubSettings;
- } else if (isSubSettings) {
- mDisplayHomeAsUpEnabled = true;
- } else {
- mDisplayHomeAsUpEnabled = false;
- }
setTitleFromIntent(intent);
Bundle initialArguments = intent.getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS);
switchToFragment(initialFragmentName, initialArguments, true, false,
- mInitialTitleResId, mInitialTitle, false);
+ mInitialTitleResId, mInitialTitle, false);
} else {
// Show search icon as up affordance if we are displaying the main Dashboard
- mDisplayHomeAsUpEnabled = true;
mInitialTitleResId = R.string.dashboard_title;
switchToFragment(DashboardSummary.class.getName(), null /* args */, false, false,
- mInitialTitleResId, mInitialTitle, false);
+ mInitialTitleResId, mInitialTitle, false);
}
}
@@ -509,15 +487,6 @@
if (mCategories.size() > 0) {
outState.putParcelableArrayList(SAVE_KEY_CATEGORIES, mCategories);
}
-
- outState.putBoolean(SAVE_KEY_SHOW_HOME_AS_UP, mDisplayHomeAsUpEnabled);
- }
-
- @Override
- protected void onRestoreInstanceState(Bundle savedInstanceState) {
- super.onRestoreInstanceState(savedInstanceState);
-
- mDisplayHomeAsUpEnabled = savedInstanceState.getBoolean(SAVE_KEY_SHOW_HOME_AS_UP);
}
@Override
@@ -610,17 +579,17 @@
* single-pane mode, a new activity will be launched in which to show the
* fragment.
*
- * @param fragmentClass Full name of the class implementing the fragment.
- * @param args Any desired arguments to supply to the fragment.
- * @param titleRes Optional resource identifier of the title of this
- * fragment.
- * @param titleText Optional text of the title of this fragment.
- * @param resultTo Optional fragment that result data should be sent to.
- * If non-null, resultTo.onActivityResult() will be called when this
- * preference panel is done. The launched panel must use
- * {@link #finishPreferencePanel(Fragment, int, Intent)} when done.
+ * @param fragmentClass Full name of the class implementing the fragment.
+ * @param args Any desired arguments to supply to the fragment.
+ * @param titleRes Optional resource identifier of the title of this
+ * fragment.
+ * @param titleText Optional text of the title of this fragment.
+ * @param resultTo Optional fragment that result data should be sent to.
+ * If non-null, resultTo.onActivityResult() will be called when this
+ * preference panel is done. The launched panel must use
+ * {@link #finishPreferencePanel(Fragment, int, Intent)} when done.
* @param resultRequestCode If resultTo is non-null, this is the caller's
- * request code to be received with the result.
+ * request code to be received with the result.
*/
public void startPreferencePanel(Fragment caller, String fragmentClass, Bundle args,
int titleRes, CharSequence titleText, Fragment resultTo, int resultRequestCode) {
@@ -639,10 +608,10 @@
* activity will be launched in which to show the fragment.
*
* @param fragmentClass Full name of the class implementing the fragment.
- * @param args Any desired arguments to supply to the fragment.
- * @param titleRes Optional resource identifier of the title of this fragment.
- * @param titleText Optional text of the title of this fragment.
- * @param userHandle The user for which the panel has to be started.
+ * @param args Any desired arguments to supply to the fragment.
+ * @param titleRes Optional resource identifier of the title of this fragment.
+ * @param titleText Optional text of the title of this fragment.
+ * @param userHandle The user for which the panel has to be started.
*/
public void startPreferencePanelAsUser(Fragment caller, String fragmentClass,
Bundle args, int titleRes, CharSequence titleText, UserHandle userHandle) {
@@ -676,11 +645,11 @@
/**
* Called by a preference panel fragment to finish itself.
*
- * @param caller The fragment that is asking to be finished.
+ * @param caller The fragment that is asking to be finished.
* @param resultCode Optional result code to send back to the original
- * launching fragment.
+ * launching fragment.
* @param resultData Optional result data to send back to the original
- * launching fragment.
+ * launching fragment.
*/
public void finishPreferencePanel(Fragment caller, int resultCode, Intent resultData) {
setResult(resultCode, resultData);
@@ -691,8 +660,8 @@
* Start a new fragment.
*
* @param fragment The fragment to start
- * @param push If true, the current fragment will be pushed onto the back stack. If false,
- * the current fragment will be replaced.
+ * @param push If true, the current fragment will be pushed onto the back stack. If false,
+ * the current fragment will be replaced.
*/
public void startPreferenceFragment(Fragment fragment, boolean push) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
@@ -940,29 +909,6 @@
return mNextButton;
}
- @Override
- public boolean shouldUpRecreateTask(Intent targetIntent) {
- return super.shouldUpRecreateTask(new Intent(this, SettingsActivity.class));
- }
-
- public void startSuggestion(Intent intent) {
- if (intent == null || ActivityManager.isUserAMonkey()) {
- return;
- }
- mCurrentSuggestion = intent.getComponent();
- startActivityForResult(intent, REQUEST_SUGGESTION);
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode == REQUEST_SUGGESTION && mCurrentSuggestion != null
- && resultCode != RESULT_CANCELED) {
- getPackageManager().setComponentEnabledSetting(mCurrentSuggestion,
- PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
- }
- super.onActivityResult(requestCode, resultCode, data);
- }
-
@VisibleForTesting
Bitmap getBitmapFromXmlResource(int drawableRes) {
Drawable drawable = getResources().getDrawable(drawableRes, getTheme());
diff --git a/src/com/android/settings/backup/BackupSettingsHelper.java b/src/com/android/settings/backup/BackupSettingsHelper.java
index b0d6cf8..d0a029c 100644
--- a/src/com/android/settings/backup/BackupSettingsHelper.java
+++ b/src/com/android/settings/backup/BackupSettingsHelper.java
@@ -24,13 +24,12 @@
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
-import android.util.Log;
-
import android.support.annotation.VisibleForTesting;
+import android.util.Log;
import com.android.settings.R;
import com.android.settings.Settings.PrivacySettingsActivity;
-import com.android.settingslib.drawer.SettingsDrawerActivity;
+
import java.net.URISyntaxException;
/**
@@ -153,8 +152,7 @@
private Intent getIntentForDefaultBackupSettings() {
// Extra needed by {@link SettingsDrawerActivity} to show the back button navigation.
- return new Intent(mContext, PrivacySettingsActivity.class)
- .putExtra(SettingsDrawerActivity.EXTRA_SHOW_MENU, true);
+ return new Intent(mContext, PrivacySettingsActivity.class);
}
/**
diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
index 086a131..3ed76d8 100644
--- a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
+++ b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
@@ -33,21 +33,18 @@
import android.support.v7.preference.Preference;
import android.text.TextUtils;
import android.util.ArrayMap;
-import android.util.FeatureFlagUtils;
import android.util.Log;
import android.util.Pair;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.core.instrumentation.VisibilityLoggerMixin;
import com.android.settingslib.drawer.CategoryManager;
import com.android.settingslib.drawer.DashboardCategory;
import com.android.settingslib.drawer.ProfileSelectDialog;
-import com.android.settingslib.drawer.SettingsDrawerActivity;
import com.android.settingslib.drawer.Tile;
import com.android.settingslib.drawer.TileUtils;
import com.android.settingslib.utils.ThreadUtils;
@@ -212,7 +209,6 @@
final Intent intent = new Intent(tile.intent)
.putExtra(VisibilityLoggerMixin.EXTRA_SOURCE_METRICS_CATEGORY,
MetricsEvent.DASHBOARD_SUMMARY)
- .putExtra(SettingsDrawerActivity.EXTRA_SHOW_MENU, true)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
launchIntentOrSelectProfile(activity, tile, intent, MetricsEvent.DASHBOARD_SUMMARY);
}
diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java
index efcf03d..2093469 100644
--- a/src/com/android/settings/deviceinfo/StorageSettings.java
+++ b/src/com/android/settings/deviceinfo/StorageSettings.java
@@ -236,7 +236,6 @@
Intent intent = Utils.onBuildStartFragmentIntent(getActivity(),
StorageDashboardFragment.class.getName(), args, null,
R.string.storage_settings, null, false, getMetricsCategory());
- intent.putExtra(SettingsDrawerActivity.EXTRA_SHOW_MENU, true);
getActivity().startActivity(intent);
finish();
}
diff --git a/src/com/android/settings/deviceinfo/storage/UserProfileController.java b/src/com/android/settings/deviceinfo/storage/UserProfileController.java
index 4870e7e..c9fe54e 100644
--- a/src/com/android/settings/deviceinfo/storage/UserProfileController.java
+++ b/src/com/android/settings/deviceinfo/storage/UserProfileController.java
@@ -85,7 +85,6 @@
Intent intent = Utils.onBuildStartFragmentIntent(mContext,
StorageProfileFragment.class.getName(), args, null, 0,
mUser.name, false, MetricsProto.MetricsEvent.DEVICEINFO_STORAGE);
- intent.putExtra(SettingsDrawerActivity.EXTRA_SHOW_MENU, true);
mContext.startActivity(intent);
return true;
}