• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

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

frameworks/base


コミットメタ情報

リビジョン21b9dc78d6d441f51cc1635563d68cb15afd9e2b (tree)
日時2020-02-12 04:07:13
作者Christopher Tate <ctate@goog...>
コミッターandroid-build-team Robot

ログメッセージ

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 d2a71cc4b8f11688f85f33507b75d00041c14852)

変更サマリ

差分

--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -18094,36 +18094,48 @@ public class PackageManagerService extends IPackageManager.Stub
1809418094 int count = 0;
1809518095 final String packageName = pkg.packageName;
1809618096
18097+ boolean handlesWebUris = false;
18098+ final boolean alreadyVerified;
1809718099 synchronized (mPackages) {
1809818100 // If this is a new install and we see that we've already run verification for this
1809918101 // package, we have nothing to do: it means the state was restored from backup.
18100- if (!replacing) {
18101- IntentFilterVerificationInfo ivi =
18102- mSettings.getIntentFilterVerificationLPr(packageName);
18103- if (ivi != null) {
18104- if (DEBUG_DOMAIN_VERIFICATION) {
18105- Slog.i(TAG, "Package " + packageName+ " already verified: status="
18106- + ivi.getStatusString());
18107- }
18108- return;
18102+ final IntentFilterVerificationInfo ivi =
18103+ mSettings.getIntentFilterVerificationLPr(packageName);
18104+ alreadyVerified = (ivi != null);
18105+ if (!replacing && alreadyVerified) {
18106+ if (DEBUG_DOMAIN_VERIFICATION) {
18107+ Slog.i(TAG, "Package " + packageName + " already verified: status="
18108+ + ivi.getStatusString());
1810918109 }
18110+ return;
1811018111 }
1811118112
18112- // If any filters need to be verified, then all need to be.
18113+ // If any filters need to be verified, then all need to be. In addition, we need to
18114+ // know whether an updating app has any web navigation intent filters, to re-
18115+ // examine handling policy even if not re-verifying.
1811318116 boolean needToVerify = false;
1811418117 for (PackageParser.Activity a : pkg.activities) {
1811518118 for (ActivityIntentInfo filter : a.intents) {
18119+ if (filter.handlesWebUris(true)) {
18120+ handlesWebUris = true;
18121+ }
1811618122 if (filter.needsVerification() && needsNetworkVerificationLPr(filter)) {
1811718123 if (DEBUG_DOMAIN_VERIFICATION) {
1811818124 Slog.d(TAG,
1811918125 "Intent filter needs verification, so processing all filters");
1812018126 }
1812118127 needToVerify = true;
18128+ // It's safe to break out here because filter.needsVerification()
18129+ // can only be true if filter.handlesWebUris(true) returns true, so
18130+ // we've already noted that.
1812218131 break;
1812318132 }
1812418133 }
1812518134 }
1812618135
18136+ // Note whether this app publishes any web navigation handling support at all,
18137+ // and whether there are any web-nav filters that fit the profile for running
18138+ // a verification pass now.
1812718139 if (needToVerify) {
1812818140 final int verificationId = mIntentFilterVerificationToken++;
1812918141 for (PackageParser.Activity a : pkg.activities) {
@@ -18141,13 +18153,23 @@ public class PackageManagerService extends IPackageManager.Stub
1814118153 }
1814218154
1814318155 if (count > 0) {
18156+ // count > 0 means that we're running a full verification pass
1814418157 if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Starting " + count
1814518158 + " IntentFilter verification" + (count > 1 ? "s" : "")
1814618159 + " for userId:" + userId);
1814718160 mIntentFilterVerifier.startVerifications(userId);
18161+ } else if (alreadyVerified && handlesWebUris) {
18162+ // App used autoVerify in the past, no longer does, but still handles web
18163+ // navigation starts.
18164+ if (DEBUG_DOMAIN_VERIFICATION) {
18165+ Slog.d(TAG, "App changed web filters but no longer verifying - resetting policy");
18166+ }
18167+ synchronized (mPackages) {
18168+ clearIntentFilterVerificationsLPw(packageName, userId);
18169+ }
1814818170 } else {
1814918171 if (DEBUG_DOMAIN_VERIFICATION) {
18150- Slog.d(TAG, "No filters or not all autoVerify for " + packageName);
18172+ Slog.d(TAG, "No web filters or no prior verify policy for " + packageName);
1815118173 }
1815218174 }
1815318175 }
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -1252,6 +1252,7 @@ public final class Settings {
12521252 return false;
12531253 }
12541254 ps.clearDomainVerificationStatusForUser(userId);
1255+ ps.setIntentFilterVerificationInfo(null);
12551256 return true;
12561257 }
12571258