Skip user restriction check on desktop
The Catalyst user restriction check crashes the Settings app on desktop
device. Skip the check for desktop device for now since this crash
blocks many development/testing work.
Change-Id: I27e3db48ce175381917681fe517d63bf6b4aede2
Bug: b/379130874, b/377600992
Test: verify locally on desktop device, presubmit
Flag: EXEMPT_bug fix
diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java
index 66ccb6f..e5a1284 100644
--- a/src/com/android/settings/SettingsPreferenceFragment.java
+++ b/src/com/android/settings/SettingsPreferenceFragment.java
@@ -17,6 +17,7 @@
package com.android.settings;
import static com.android.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY;
+import static com.android.settingslib.media.PhoneMediaDevice.isDesktop;
import android.app.Activity;
import android.app.Dialog;
@@ -186,6 +187,13 @@
/** Returns if catalyst is enabled on current screen. */
protected final boolean isCatalystEnabled() {
+ // TODO(b/379130874): make Catalyst compatible with desktop device, such as user restriction
+ // check.
+ Context context = getContext();
+ if (context != null && isDesktop(context)) {
+ return false;
+ }
+
return getPreferenceScreenCreator() != null;
}