Avoid potential ActivityNotFoundException
Bug: 332202168 Flag: com.android.settings.flags.catalyst Test: Manual Change-Id: I74d7bbc9eb34e0f8d04cfb663b04393a3432e784
This commit is contained in:
@@ -249,6 +249,15 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(Preference preference) {
|
||||
if (isCatalystEnabled()) {
|
||||
Intent intent = preference.getIntent();
|
||||
if (intent != null && preference.getContext().getPackageManager().queryIntentActivities(
|
||||
intent, 0).isEmpty()) {
|
||||
Log.w(TAG, "No activity to start for " + intent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
final Collection<List<AbstractPreferenceController>> controllers =
|
||||
mPreferenceControllers.values();
|
||||
for (List<AbstractPreferenceController> controllerList : controllers) {
|
||||
|
Reference in New Issue
Block a user