Remove singleTop, as it's causing serious problems on the phone. And...

Fix fragment launching from another app - pass along the fragment class name
and bundle from the original intent.

Bug: 3064432
Bug: 3059311 (partial fix)
This commit is contained in:
Amith Yamasani
2010-10-05 11:49:51 -07:00
parent 4e6466f5ef
commit e0e4fc208b
2 changed files with 14 additions and 3 deletions

View File

@@ -52,7 +52,7 @@
android:label="@string/settings_label_launcher" android:label="@string/settings_label_launcher"
android:taskAffinity="com.android.settings" android:taskAffinity="com.android.settings"
android:theme="@android:style/Theme.Holo" android:theme="@android:style/Theme.Holo"
android:launchMode="singleTop"> >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<action android:name="android.settings.SETTINGS" /> <action android:name="android.settings.SETTINGS" />

View File

@@ -16,9 +16,7 @@
package com.android.settings; package com.android.settings;
import android.app.Fragment;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import java.util.List; import java.util.List;
@@ -30,6 +28,18 @@ public class Settings extends PreferenceActivity {
// TODO: Update Call Settings based on airplane mode state. // TODO: Update Call Settings based on airplane mode state.
@Override
public Intent getIntent() {
String startingFragment = getStartingFragmentClass(super.getIntent());
if (startingFragment != null && !onIsMultiPane()) {
Intent modIntent = new Intent(super.getIntent());
modIntent.putExtra(EXTRA_SHOW_FRAGMENT, startingFragment);
modIntent.putExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS, super.getIntent().getExtras());
return modIntent;
}
return super.getIntent();
}
/** /**
* Checks if the component name in the intent is different from the Settings class and * Checks if the component name in the intent is different from the Settings class and
* returns the class name to load as a fragment. * returns the class name to load as a fragment.
@@ -51,6 +61,7 @@ public class Settings extends PreferenceActivity {
if (fragmentClass != null) { if (fragmentClass != null) {
Header header = new Header(); Header header = new Header();
header.fragment = fragmentClass; header.fragment = fragmentClass;
header.fragmentArguments = getIntent().getExtras();
return header; return header;
} }
return super.onGetInitialHeader(); return super.onGetInitialHeader();