When launching internal setting activity from dynamic tiles and hit back
button, it goes back to settings homepage. Instead it should just go
back to the UI where startActivity is called.
This is caused by various activity flags set in manifest. Instead of
using startActivity, internal settings screen will just be launched
using SubSetting, which doesn't have this problem.
For external settings, still use startActivityForResult to maintain
backstack.
Test: manual
Change-Id: I07aa6ed932b9048375629d6ffd6ad1adfaba3fd3
if (tile.icon != null) {
pref.setIcon(tile.icon.loadDrawable(context));
}
- if (tile.intent != null) {
+ final Bundle metadata = tile.metaData;
+ if (metadata != null) {
+ String clsName = metadata.getString(SettingsActivity.META_DATA_KEY_FRAGMENT_CLASS);
+ if (!TextUtils.isEmpty(clsName)) {
+ pref.setFragment(clsName);
+ }
+ } else if (tile.intent != null) {
final Intent intent = new Intent(tile.intent);
pref.setOnPreferenceClickListener(preference -> {
- intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_AS_SUBSETTING, true);
getActivity().startActivityForResult(intent, 0);
return true;
});