frameworks/base
Révision | c3ad64222b2790b699d75cebccdeba40789c8251 (tree) |
---|---|
l'heure | 2020-09-11 19:04:19 |
Auteur | Chris Tate <ctate@andr...> |
Commiter | Vasyl Gello |
Revert "Revoke 'always' web handler status when not autoverifying"
This reverts commit f697cd3b97b10a283c54b37d8448a011c570e2c6.
Reason for revert: Inadvertently broke link handling stickiness even for well behaved apps
Bug: 146204120
Test: install app that handles web urls; set to 'always' in Settings;
install same apk again. Verify that app is still in 'always' state via
'adb shell dumpsys package d'
Merged-In: If9046cb420961b8ef0333e9f1115eb69fb92242e
Change-Id: I36d9c352e741e88b9fc773b084bef3991b6d96ed
@@ -15565,47 +15565,35 @@ public class PackageManagerService extends IPackageManager.Stub { | ||
15565 | 15565 | int count = 0; |
15566 | 15566 | final String packageName = pkg.packageName; |
15567 | 15567 | |
15568 | - boolean handlesWebUris = false; | |
15569 | - final boolean alreadyVerified; | |
15570 | 15568 | synchronized (mPackages) { |
15571 | 15569 | // If this is a new install and we see that we've already run verification for this |
15572 | 15570 | // package, we have nothing to do: it means the state was restored from backup. |
15573 | - final IntentFilterVerificationInfo ivi = | |
15574 | - mSettings.getIntentFilterVerificationLPr(packageName); | |
15575 | - alreadyVerified = (ivi != null); | |
15576 | - if (!replacing && alreadyVerified) { | |
15577 | - if (DEBUG_DOMAIN_VERIFICATION) { | |
15578 | - Slog.i(TAG, "Package " + packageName + " already verified: status=" | |
15579 | - + ivi.getStatusString()); | |
15571 | + if (!replacing) { | |
15572 | + IntentFilterVerificationInfo ivi = | |
15573 | + mSettings.getIntentFilterVerificationLPr(packageName); | |
15574 | + if (ivi != null) { | |
15575 | + if (DEBUG_DOMAIN_VERIFICATION) { | |
15576 | + Slog.i(TAG, "Package " + packageName+ " already verified: status=" | |
15577 | + + ivi.getStatusString()); | |
15578 | + } | |
15579 | + return; | |
15580 | 15580 | } |
15581 | - return; | |
15582 | 15581 | } |
15583 | 15582 | |
15584 | - // If any filters need to be verified, then all need to be. In addition, we need to | |
15585 | - // know whether an updating app has any web navigation intent filters, to re- | |
15586 | - // examine handling policy even if not re-verifying. | |
15583 | + // If any filters need to be verified, then all need to be. | |
15587 | 15584 | boolean needToVerify = false; |
15588 | 15585 | for (PackageParser.Activity a : pkg.activities) { |
15589 | 15586 | for (ActivityIntentInfo filter : a.intents) { |
15590 | - if (filter.handlesWebUris(true)) { | |
15591 | - handlesWebUris = true; | |
15592 | - } | |
15593 | 15587 | if (filter.needsVerification() && needsNetworkVerificationLPr(filter)) { |
15594 | 15588 | if (DEBUG_DOMAIN_VERIFICATION) { |
15595 | 15589 | Slog.d(TAG, "Intent filter needs verification, so processing all filters"); |
15596 | 15590 | } |
15597 | 15591 | needToVerify = true; |
15598 | - // It's safe to break out here because filter.needsVerification() | |
15599 | - // can only be true if filter.handlesWebUris(true) returns true, so | |
15600 | - // we've already noted that. | |
15601 | 15592 | break; |
15602 | 15593 | } |
15603 | 15594 | } |
15604 | 15595 | } |
15605 | 15596 | |
15606 | - // Note whether this app publishes any web navigation handling support at all, | |
15607 | - // and whether there are any web-nav filters that fit the profile for running | |
15608 | - // a verification pass now. | |
15609 | 15597 | if (needToVerify) { |
15610 | 15598 | final int verificationId = mIntentFilterVerificationToken++; |
15611 | 15599 | for (PackageParser.Activity a : pkg.activities) { |
@@ -15625,23 +15613,13 @@ public class PackageManagerService extends IPackageManager.Stub { | ||
15625 | 15613 | } |
15626 | 15614 | |
15627 | 15615 | if (count > 0) { |
15628 | - // count > 0 means that we're running a full verification pass | |
15629 | 15616 | if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Starting " + count |
15630 | 15617 | + " IntentFilter verification" + (count > 1 ? "s" : "") |
15631 | 15618 | + " for userId:" + userId); |
15632 | 15619 | mIntentFilterVerifier.startVerifications(userId); |
15633 | - } else if (alreadyVerified && handlesWebUris) { | |
15634 | - // App used autoVerify in the past, no longer does, but still handles web | |
15635 | - // navigation starts. | |
15636 | - if (DEBUG_DOMAIN_VERIFICATION) { | |
15637 | - Slog.d(TAG, "App changed web filters but no longer verifying - resetting policy"); | |
15638 | - } | |
15639 | - synchronized (mPackages) { | |
15640 | - clearIntentFilterVerificationsLPw(packageName, userId); | |
15641 | - } | |
15642 | 15620 | } else { |
15643 | 15621 | if (DEBUG_DOMAIN_VERIFICATION) { |
15644 | - Slog.d(TAG, "No web filters or no prior verify policy for " + packageName); | |
15622 | + Slog.d(TAG, "No filters or not all autoVerify for " + packageName); | |
15645 | 15623 | } |
15646 | 15624 | } |
15647 | 15625 | } |
@@ -1331,7 +1331,6 @@ final class Settings { | ||
1331 | 1331 | return false; |
1332 | 1332 | } |
1333 | 1333 | ps.clearDomainVerificationStatusForUser(userId); |
1334 | - ps.setIntentFilterVerificationInfo(null); | |
1335 | 1334 | return true; |
1336 | 1335 | } |
1337 | 1336 |