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

Commit 237aab5a authored by Christopher Tate's avatar Christopher Tate
Browse files

Sysconfig takes precedence over update-time autoVerify

autoVerify is re-evaluated whenever an apk is updated, and in the normal
case a verification failure here results in the app being demoted out of
'always' status for handling web link Intents.  However, bundled app
policy for this is supposed to be set statically via sysconfig --
so now we make sure that sysconfig policy takes precedence in this case.

Fixes: 127838380
Test: manual (update bundled sysconfig-cited app and force failure)
Test: atest OsHostTests#testIntentFilterHostValidation
Change-Id: If80511ce47847bb21a48634b191acfacda606331
parent 47119cf9
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -160,9 +160,9 @@ import android.content.pm.InstantAppInfo;
import android.content.pm.InstantAppRequest;
import android.content.pm.InstrumentationInfo;
import android.content.pm.IntentFilterVerificationInfo;
import android.content.pm.PackageBackwardCompatibility;
import android.content.pm.KeySet;
import android.content.pm.ModuleInfo;
import android.content.pm.PackageBackwardCompatibility;
import android.content.pm.PackageInfo;
import android.content.pm.PackageInfoLite;
import android.content.pm.PackageInstaller;
@@ -1127,12 +1127,23 @@ public class PackageManagerService extends IPackageManager.Stub
                    switch (userStatus) {
                        case INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS:
                            if (!verified) {
                                // Don't demote if sysconfig says 'always'
                                SystemConfig systemConfig = SystemConfig.getInstance();
                                ArraySet<String> packages = systemConfig.getLinkedApps();
                                if (!packages.contains(packageName)) {
                                    // updatedStatus is already UNDEFINED
                                    needUpdate = true;
                                    if (DEBUG_DOMAIN_VERIFICATION) {
                                        Slog.d(TAG, "Formerly validated but now failing; demoting");
                                    }
                                } else {
                                    if (DEBUG_DOMAIN_VERIFICATION) {
                                        Slog.d(TAG, "Updating bundled package " + packageName
                                                + " failed autoVerify, but sysconfig supersedes");
                                    }
                                    // leave needUpdate == false here intentionally
                                }
                            }
                            break;