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

Commit c7bacab2 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

More encryption-aware triaging.

Most of these callers are okay having results omitted when a package
is uninstalled or encryption unaware.  For example, jobs and
notifications can only be enqueued by already running apps.

When clearing zen rules, keep around rules inserted by apps on
ejected external storage devices.

Make ServiceWatcher stricter by requiring that the matching package
be in the system image.

Bug: 26471205, 27105254
Change-Id: Ie41ea8042ac1a54e9cbe0c35cec89e70521e9bed
parent 58482c55
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -447,7 +447,8 @@ public final class LoadedApk {
        IPackageManager pm = ActivityThread.getPackageManager();
        android.content.pm.PackageInfo pi;
        try {
            pi = pm.getPackageInfo(mPackageName, 0, UserHandle.myUserId());
            pi = pm.getPackageInfo(mPackageName, PackageManager.MATCH_DEBUG_TRIAGED_MISSING,
                    UserHandle.myUserId());
        } catch (RemoteException e) {
            throw new IllegalStateException("Unable to get package info for "
                    + mPackageName + "; is system dying?", e);
+2 −1
Original line number Diff line number Diff line
@@ -363,7 +363,8 @@ public final class SearchableInfo implements Parcelable {
        String suggestProviderPackage = null;
        if (mSuggestAuthority != null) {
            PackageManager pm = activityContext.getPackageManager();
            ProviderInfo pi = pm.resolveContentProvider(mSuggestAuthority, 0);
            ProviderInfo pi = pm.resolveContentProvider(mSuggestAuthority,
                    PackageManager.MATCH_DEBUG_TRIAGED_MISSING);
            if (pi != null) {
                suggestProviderPackage = pi.packageName;
            }
+2 −3
Original line number Diff line number Diff line
@@ -92,8 +92,7 @@ public class ServiceWatcher implements ServiceConnection {
            String pkg = initialPackageNames.get(i);
            try {
                HashSet<Signature> set = new HashSet<Signature>();
                Signature[] sigs = pm.getPackageInfo(pkg,
                        PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE
                Signature[] sigs = pm.getPackageInfo(pkg, PackageManager.MATCH_SYSTEM_ONLY
                        | PackageManager.GET_SIGNATURES).signatures;
                set.addAll(Arrays.asList(sigs));
                sigSets.add(set);
+7 −2
Original line number Diff line number Diff line
@@ -10722,6 +10722,12 @@ public final class ActivityManagerService extends ActivityManagerNative
            return;
        }
        // We're only interested in providers that are encryption unaware, and
        // we don't care about uninstalled apps, since there's no way they're
        // running at this point.
        final int matchFlags = GET_PROVIDERS | MATCH_ENCRYPTION_UNAWARE
                | MATCH_DEBUG_TRIAGED_MISSING;
        synchronized (this) {
            final int NP = mProcessNames.getMap().size();
            for (int ip = 0; ip < NP; ip++) {
@@ -10736,8 +10742,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                        try {
                            final String pkgName = app.pkgList.keyAt(ig);
                            final PackageInfo pkgInfo = AppGlobals.getPackageManager()
                                    .getPackageInfo(pkgName,
                                            GET_PROVIDERS | MATCH_ENCRYPTION_UNAWARE, userId);
                                    .getPackageInfo(pkgName, matchFlags, userId);
                            if (pkgInfo != null && !ArrayUtils.isEmpty(pkgInfo.providers)) {
                                for (ProviderInfo provInfo : pkgInfo.providers) {
                                    Log.v(TAG, "Installing " + provInfo);
+2 −1
Original line number Diff line number Diff line
@@ -1024,7 +1024,8 @@ public class JobSchedulerService extends com.android.server.SystemService
            final IPackageManager pm = AppGlobals.getPackageManager();
            final ComponentName service = job.getService();
            try {
                ServiceInfo si = pm.getServiceInfo(service, 0, UserHandle.getUserId(uid));
                ServiceInfo si = pm.getServiceInfo(service,
                        PackageManager.MATCH_DEBUG_TRIAGED_MISSING, UserHandle.getUserId(uid));
                if (si == null) {
                    throw new IllegalArgumentException("No such service " + service);
                }
Loading