Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e3fa9cb authored by Lars Greiss's avatar Lars Greiss Committed by Gerrit Code Review
Browse files

Frameworks: privacy guard fix possible NPE

If the user flash a data app over recovery on clean flash
(like a lot themed apps or gapps packages are doing)
the user will get into a bootloop because of an NPE
due an unknown state of the user due that
installedUser == null

To fix it
Check if installUser exists if yes then
call the provider settings value for the current
user

PatchSet 2+3: message update
	      fix for real now

Change-Id: Ie5f94a0d0a11ae24fdfdc8372c0433b26793b66e
parent ab5d5e7d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -444,10 +444,13 @@ final class Settings {
                            final boolean installed = installUser == null
                                    || installUser.getIdentifier() == UserHandle.USER_ALL
                                    || installUser.getIdentifier() == user.id;
                            final boolean privacyGuard = android.provider.Settings.Secure.getIntForUser(
                            boolean privacyGuard = false;
                            if (installUser != null) {
                                privacyGuard = android.provider.Settings.Secure.getIntForUser(
                                    mContext.getContentResolver(),
                                    android.provider.Settings.Secure.PRIVACY_GUARD_DEFAULT,
                                    0, user.id) == 1;
                            }
                            p.setUserState(user.id, COMPONENT_ENABLED_STATE_DEFAULT,
                                    installed,
                                    true, // stopped,