[Catalyst] Provide launch intent

Bug: 373895400
Flag: com.android.settings.flags.catalyst
Test: manual
Change-Id: If7825798c441dc0009fbd91918d4795873b39fa3
This commit is contained in:
Jacky Wang
2024-10-30 17:12:23 +08:00
parent 5cdcc9be3e
commit 9332b06675
4 changed files with 54 additions and 5 deletions

View File

@@ -16,6 +16,8 @@
package com.android.settings;
import static com.android.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY;
import android.app.Activity;
import android.app.Dialog;
import android.app.admin.DevicePolicyManager;
@@ -45,6 +47,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settings.flags.Flags;
import com.android.settings.support.actionbar.HelpResourceProvider;
import com.android.settings.widget.HighlightablePreferenceGroupAdapter;
import com.android.settings.widget.LoadingViewController;
@@ -367,9 +370,13 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
@Override
protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) {
final Bundle arguments = getArguments();
mAdapter = new HighlightablePreferenceGroupAdapter(preferenceScreen,
arguments == null
? null : arguments.getString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY),
String key = arguments == null ? null : arguments.getString(EXTRA_FRAGMENT_ARG_KEY);
if (Flags.catalyst() && key == null) {
Activity activity = getActivity();
Intent intent = activity != null ? activity.getIntent() : null;
key = intent != null ? intent.getStringExtra(EXTRA_FRAGMENT_ARG_KEY) : null;
}
mAdapter = new HighlightablePreferenceGroupAdapter(preferenceScreen, key,
mPreferenceHighlighted);
return mAdapter;
}