Fix settings crash when interact uninstalled app

Set the AdvancedAppInfoPreferenceController preference to disabled when
the app is uninstalled for the current user. This results in every
preference under the advanced section to be greyed out, avoiding the
null pointer exception.

Bug: 238839849
Test: Unit tests && Manual test on multiple apps
Change-Id: I5cdf47575da96f53915f5b552213bf0176f9d1d7
This commit is contained in:
João Victor Mendes Freire
2022-10-19 12:58:49 +00:00
parent 4c96ab379b
commit a713f28bc5
3 changed files with 98 additions and 3 deletions

View File

@@ -218,9 +218,11 @@ public class AppInfoDashboardFragment extends DashboardFragment
alarmsAndReminders.setPackageName(packageName);
alarmsAndReminders.setParentFragment(this);
use(AdvancedAppInfoPreferenceCategoryController.class).setChildren(Arrays.asList(
writeSystemSettings, drawOverlay, pip, externalSource, acrossProfiles,
alarmsAndReminders));
final AdvancedAppInfoPreferenceCategoryController advancedAppInfo =
use(AdvancedAppInfoPreferenceCategoryController.class);
advancedAppInfo.setChildren(Arrays.asList(writeSystemSettings, drawOverlay, pip,
externalSource, acrossProfiles, alarmsAndReminders));
advancedAppInfo.setAppEntry(mAppEntry);
final AppLocalePreferenceController appLocale =
use(AppLocalePreferenceController.class);