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
This commit is contained in:
Wenyu Zhang
2024-11-18 03:21:28 +00:00
parent ec1017c0bf
commit a28c5e1ca5

View File

@@ -17,6 +17,7 @@
package com.android.settings; package com.android.settings;
import static com.android.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY; 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.Activity;
import android.app.Dialog; import android.app.Dialog;
@@ -186,6 +187,13 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
/** Returns if catalyst is enabled on current screen. */ /** Returns if catalyst is enabled on current screen. */
protected final boolean isCatalystEnabled() { 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; return getPreferenceScreenCreator() != null;
} }