Revert "Revert "Support highlightable Settings homepage menu for 2-pane""
This reverts commit 096c090b805acbed1ea5a45f584ff5a24bd2fa3b.
Reason for revert: crash is fixed in this change
Bug: 202510128
Test: manual, build
Change-Id: Ifff8d58cfdcf43e123b11dee308665b2617cb4b3
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 634a646..c105238 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -149,9 +149,13 @@
public static final String META_DATA_KEY_FRAGMENT_CLASS =
"com.android.settings.FRAGMENT_CLASS";
+ public static final String META_DATA_KEY_HIGHLIGHT_MENU_KEY =
+ "com.android.settings.HIGHLIGHT_MENU_KEY";
+
private static final String EXTRA_UI_OPTIONS = "settings:ui_options";
private String mFragmentClass;
+ private String mHighlightMenuKey;
private CharSequence mInitialTitle;
private int mInitialTitleResId;
@@ -234,21 +238,19 @@
super.onCreate(savedState);
Log.d(LOG_TAG, "Starting onCreate");
- if (launchHomepageForTwonPaneDeepLink()) {
+ long startTime = System.currentTimeMillis();
+
+ // Should happen before any call to getIntent()
+ getMetaData();
+ final Intent intent = getIntent();
+ if (launchHomepageForTwoPaneDeepLink(intent)) {
finish();
return;
}
- long startTime = System.currentTimeMillis();
-
final FeatureFactory factory = FeatureFactory.getFactory(this);
-
mDashboardFeatureProvider = factory.getDashboardFeatureProvider(this);
- // Should happen before any call to getIntent()
- getMetaData();
-
- final Intent intent = getIntent();
if (intent.hasExtra(EXTRA_UI_OPTIONS)) {
getWindow().setUiOptions(intent.getIntExtra(EXTRA_UI_OPTIONS, 0));
}
@@ -355,8 +357,7 @@
}
/** Returns true if the Activity is started by a deep link intent for large screen devices. */
- private boolean launchHomepageForTwonPaneDeepLink() {
- final Intent intent = getIntent();
+ private boolean launchHomepageForTwoPaneDeepLink(Intent intent) {
if (!shouldShowTwoPaneDeepLink(intent)) {
return false;
}
@@ -368,6 +369,9 @@
trampolineIntent.putExtra(
android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI,
intent.toUri(Intent.URI_INTENT_SCHEME));
+ trampolineIntent.putExtra(
+ android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_HIGHLIGHT_MENU_KEY,
+ mHighlightMenuKey);
trampolineIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
startActivity(trampolineIntent);
@@ -776,6 +780,7 @@
PackageManager.GET_META_DATA);
if (ai == null || ai.metaData == null) return;
mFragmentClass = ai.metaData.getString(META_DATA_KEY_FRAGMENT_CLASS);
+ mHighlightMenuKey = ai.metaData.getString(META_DATA_KEY_HIGHLIGHT_MENU_KEY);
} catch (NameNotFoundException nnfe) {
// No recovery
Log.d(LOG_TAG, "Cannot get Metadata for: " + getComponentName().toString());