• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/base


Commit MetaInfo

修訂35c455959054dc61237d2fe20a5d4ace6103393d (tree)
時間2020-02-07 08:17:35
作者Christopher Tate <ctate@goog...>
CommiterAnis Assi

Log Message

Revoke 'always' web handler status when not autoverifying

If an app has previously used autoVerify to make claims about its status
re handling web navigation intents, but is updated such that it no
longer makes those claims, step down its "official handler" status as
though it had never invoked autoVerify in the first place.

Bug: 146204120
Test: manual: as described in bug; observe policy before/after via

'adb shell dumpsys package d'

Test: atest CtsOsHostTestCases
Change-Id: I58502d1b32d793aba9aa772fa2ad5ac38acca48a
Merged-In: I58502d1b32d793aba9aa772fa2ad5ac38acca48a
(cherry picked from commit ef5220e5b2a4b90d4260eb058475fdcdf30d861d)

Change Summary

差異

--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -19030,35 +19030,47 @@ public class PackageManagerService extends IPackageManager.Stub
1903019030 int count = 0;
1903119031 final String packageName = pkg.packageName;
1903219032
19033+ boolean handlesWebUris = false;
19034+ final boolean alreadyVerified;
1903319035 synchronized (mPackages) {
1903419036 // If this is a new install and we see that we've already run verification for this
1903519037 // package, we have nothing to do: it means the state was restored from backup.
19036- if (!replacing) {
19037- IntentFilterVerificationInfo ivi =
19038- mSettings.getIntentFilterVerificationLPr(packageName);
19039- if (ivi != null) {
19040- if (DEBUG_DOMAIN_VERIFICATION) {
19041- Slog.i(TAG, "Package " + packageName+ " already verified: status="
19042- + ivi.getStatusString());
19043- }
19044- return;
19038+ final IntentFilterVerificationInfo ivi =
19039+ mSettings.getIntentFilterVerificationLPr(packageName);
19040+ alreadyVerified = (ivi != null);
19041+ if (!replacing && alreadyVerified) {
19042+ if (DEBUG_DOMAIN_VERIFICATION) {
19043+ Slog.i(TAG, "Package " + packageName + " already verified: status="
19044+ + ivi.getStatusString());
1904519045 }
19046+ return;
1904619047 }
1904719048
19048- // If any filters need to be verified, then all need to be.
19049+ // If any filters need to be verified, then all need to be. In addition, we need to
19050+ // know whether an updating app has any web navigation intent filters, to re-
19051+ // examine handling policy even if not re-verifying.
1904919052 boolean needToVerify = false;
1905019053 for (PackageParser.Activity a : pkg.activities) {
1905119054 for (ActivityIntentInfo filter : a.intents) {
19055+ if (filter.handlesWebUris(true)) {
19056+ handlesWebUris = true;
19057+ }
1905219058 if (filter.needsVerification() && needsNetworkVerificationLPr(filter)) {
1905319059 if (DEBUG_DOMAIN_VERIFICATION) {
1905419060 Slog.d(TAG, "Intent filter needs verification, so processing all filters");
1905519061 }
1905619062 needToVerify = true;
19063+ // It's safe to break out here because filter.needsVerification()
19064+ // can only be true if filter.handlesWebUris(true) returns true, so
19065+ // we've already noted that.
1905719066 break;
1905819067 }
1905919068 }
1906019069 }
1906119070
19071+ // Note whether this app publishes any web navigation handling support at all,
19072+ // and whether there are any web-nav filters that fit the profile for running
19073+ // a verification pass now.
1906219074 if (needToVerify) {
1906319075 final int verificationId = mIntentFilterVerificationToken++;
1906419076 for (PackageParser.Activity a : pkg.activities) {
@@ -19076,13 +19088,23 @@ public class PackageManagerService extends IPackageManager.Stub
1907619088 }
1907719089
1907819090 if (count > 0) {
19091+ // count > 0 means that we're running a full verification pass
1907919092 if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Starting " + count
1908019093 + " IntentFilter verification" + (count > 1 ? "s" : "")
1908119094 + " for userId:" + userId);
1908219095 mIntentFilterVerifier.startVerifications(userId);
19096+ } else if (alreadyVerified && handlesWebUris) {
19097+ // App used autoVerify in the past, no longer does, but still handles web
19098+ // navigation starts.
19099+ if (DEBUG_DOMAIN_VERIFICATION) {
19100+ Slog.d(TAG, "App changed web filters but no longer verifying - resetting policy");
19101+ }
19102+ synchronized (mPackages) {
19103+ clearIntentFilterVerificationsLPw(packageName, userId);
19104+ }
1908319105 } else {
1908419106 if (DEBUG_DOMAIN_VERIFICATION) {
19085- Slog.d(TAG, "No filters or not all autoVerify for " + packageName);
19107+ Slog.d(TAG, "No web filters or no prior verify policy for " + packageName);
1908619108 }
1908719109 }
1908819110 }
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -1380,6 +1380,7 @@ final class Settings {
13801380 return false;
13811381 }
13821382 ps.clearDomainVerificationStatusForUser(userId);
1383+ ps.setIntentFilterVerificationInfo(null);
13831384 return true;
13841385 }
13851386