Fix launching of specific settings.

This commit is contained in:
Amith Yamasani
2010-09-27 12:03:59 -07:00
parent 6021a81381
commit 379d9b05cf
2 changed files with 29 additions and 1 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceActivity;
@@ -30,6 +31,32 @@ public class Settings extends PreferenceActivity implements
// TODO: Update Call Settings based on airplane mode state.
/**
* Checks if the component name in the intent is different from the Settings class and
* returns the class name to load as a fragment.
*/
private String getStartingFragmentClass(Intent intent) {
final String intentClass = intent.getComponent().getClassName();
if (intentClass.equals(getClass().getName())) return null;
return intentClass;
}
/**
* Override initial header when an activity-alias is causing Settings to be launched
* for a specific fragment encoded in the android:name parameter.
*/
@Override
public Header onGetInitialHeader() {
String fragmentClass = getStartingFragmentClass(super.getIntent());
if (fragmentClass != null) {
Header header = new Header();
header.fragment = fragmentClass;
return header;
}
return super.onGetInitialHeader();
}
/**
* Populate the activity with the top-level headers.
*/