Add logging when launch fragment name is null.
Change-Id: I118c22a46eb794b21f9808978a68afd86b596e4e Fix: 35203478 Test: Manual
This commit is contained in:
@@ -236,6 +236,7 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
private DashboardFeatureProvider mDashboardFeatureProvider;
|
||||
private Intent mResultIntentData;
|
||||
private ComponentName mCurrentSuggestion;
|
||||
private final StringBuffer mDebugData = new StringBuffer();
|
||||
|
||||
@VisibleForTesting
|
||||
String mSearchQuery;
|
||||
@@ -436,6 +437,9 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
|
||||
} else {
|
||||
if (!mIsShowingDashboard) {
|
||||
if (initialFragmentName == null) {
|
||||
logFragmentData(intent, className, isSubSettings);
|
||||
}
|
||||
mDisplaySearch = false;
|
||||
// UP will be shown only if it is a sub settings
|
||||
if (mIsShortcut) {
|
||||
@@ -701,6 +705,7 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
String startingFragment = getStartingFragmentClass(superIntent);
|
||||
// This is called from super.onCreate, isMultiPane() is not yet reliable
|
||||
// Do not use onIsHidingHeaders either, which relies itself on this method
|
||||
log("getIntent() startingFragment", startingFragment);
|
||||
if (startingFragment != null) {
|
||||
Intent modIntent = new Intent(superIntent);
|
||||
modIntent.putExtra(EXTRA_SHOW_FRAGMENT, startingFragment);
|
||||
@@ -722,9 +727,11 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
* returns the class name to load as a fragment.
|
||||
*/
|
||||
private String getStartingFragmentClass(Intent intent) {
|
||||
log("getStartingFragmentClass() mFragmentClass", mFragmentClass);
|
||||
if (mFragmentClass != null) return mFragmentClass;
|
||||
|
||||
String intentClass = intent.getComponent().getClassName();
|
||||
log("getStartingFragmentClass() intentClass", intentClass);
|
||||
if (intentClass.equals(getClass().getName())) return null;
|
||||
|
||||
if ("com.android.settings.ManageApplications".equals(intentClass)
|
||||
@@ -1154,4 +1161,37 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
private void logFragmentData(Intent intent, String className, boolean isSubSettings) {
|
||||
if (intent != null) {
|
||||
logBundleData(intent.getExtras(), "Intent extra");
|
||||
logBundleData(intent.getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS), "Fragment args");
|
||||
} else {
|
||||
log("Intent data", "NULL");
|
||||
}
|
||||
log("Fragment", mFragmentClass);
|
||||
log("Shortcut", mIsShortcut);
|
||||
log("Class Name", className);
|
||||
log("Show dashboard", mIsShowingDashboard);
|
||||
log("Sub setting", isSubSettings);
|
||||
log("Title", mInitialTitle);
|
||||
Log.d(LOG_TAG, mDebugData.toString());
|
||||
mDebugData.delete(0, mDebugData.length());
|
||||
}
|
||||
|
||||
private void logBundleData(Bundle data, String name) {
|
||||
if (data != null) {
|
||||
final Set<String> keys = data.keySet();
|
||||
mDebugData.append(name).append(": ");
|
||||
for (String key : keys) {
|
||||
log(key, data.get(key));
|
||||
}
|
||||
} else {
|
||||
log(name, "NULL");
|
||||
}
|
||||
}
|
||||
|
||||
private void log(String key, Object data) {
|
||||
mDebugData.append(key).append("=").append(data).append(", ");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user