Fixes AOSP crash when WPP isn't installed.

If there is no installed application with the ability to start an
activity with the SET_WALLPAPER action, we no longer show the
"Shortcuts" entry under the "Display > Lock screen" settings page.

Flag: CUSTOMIZABLE_LOCK_SCREEN_QUICK_AFFORDANCES
Fix: 274075866
Test: expanded unit test
Test: manually verified that, if Intent.resolveActivity returns false,
the shortcuts item isn't present in settings.

Change-Id: I919427d1e71a88a520c762307029a53065a68f46
This commit is contained in:
Alejandro Nijamkin
2023-03-21 13:57:25 -07:00
parent f0c3812123
commit 20e244a964
3 changed files with 57 additions and 7 deletions

View File

@@ -50,7 +50,7 @@ public class CustomizableLockScreenQuickAffordancesPreferenceController extends
final Preference preference = screen.findPreference(getPreferenceKey());
if (preference != null) {
preference.setOnPreferenceClickListener(preference1 -> {
final Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
final Intent intent = CustomizableLockScreenUtils.newIntent();
final String packageName =
mContext.getString(R.string.config_wallpaper_picker_package);
if (!TextUtils.isEmpty(packageName)) {