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

Commit 633f1998 authored by Todd Kennedy's avatar Todd Kennedy
Browse files

Verfiy global apps with device owner

Applications installed for a specific user must be verfied as that user. However,
apps that are installed globally [i.e. UserHandle.ALL] should not be verified by
every user on the device. Instead, they should be verified by the device owner.

Bug: 21901423
Change-Id: I5fd3f690d08e7e911a3c86f09bbfcd4eb635b418
parent 6a401410
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -10621,6 +10621,12 @@ public class PackageManagerService extends IPackageManager.Stub {
                    final List<ComponentName> sufficientVerifiers = matchVerifiers(pkgLite,
                            receivers, verificationState);
                    // Apps installed for "all" users use the device owner to verify the app
                    UserHandle verifierUser = getUser();
                    if (verifierUser == UserHandle.ALL) {
                        verifierUser = UserHandle.OWNER;
                    }
                    /*
                     * If any sufficient verifiers were listed in the package
                     * manifest, attempt to ask them.
@@ -10636,8 +10642,7 @@ public class PackageManagerService extends IPackageManager.Stub {
                                final Intent sufficientIntent = new Intent(verification);
                                sufficientIntent.setComponent(verifierComponent);
                                mContext.sendBroadcastAsUser(sufficientIntent, getUser());
                                mContext.sendBroadcastAsUser(sufficientIntent, verifierUser);
                            }
                        }
                    }
@@ -10652,7 +10657,7 @@ public class PackageManagerService extends IPackageManager.Stub {
                         * target BroadcastReceivers have run.
                         */
                        verification.setComponent(requiredVerifierComponent);
                        mContext.sendOrderedBroadcastAsUser(verification, getUser(),
                        mContext.sendOrderedBroadcastAsUser(verification, verifierUser,
                                android.Manifest.permission.PACKAGE_VERIFICATION_AGENT,
                                new BroadcastReceiver() {
                                    @Override