frameworks/base
Revision | b0405c5c1fdd2f24701bc53f54ff7811c4ec22fa (tree) |
---|---|
Time | 2020-02-12 04:07:54 |
Author | android-build-team Robot <android-build-team-robot@goog...> |
Commiter | android-build-team Robot |
Merge cherrypicks of [10297641, 10298303, 10298494, 10298514, 10297196, 10298164, 10297642, 10297643, 10296046, 10296047, 10298245, 10298246, 10297197, 10297198, 10298495, 10298496] into qt-qpr2-release
Change-Id: I1f8470eec0bf64e28290002664f6e5a6c8d733dc
@@ -1157,8 +1157,11 @@ public final class AssetManager implements AutoCloseable { | ||
1157 | 1157 | } |
1158 | 1158 | } |
1159 | 1159 | |
1160 | - if (mObject != 0) { | |
1161 | - nativeDestroy(mObject); | |
1160 | + synchronized (this) { | |
1161 | + if (mObject != 0) { | |
1162 | + nativeDestroy(mObject); | |
1163 | + mObject = 0; | |
1164 | + } | |
1162 | 1165 | } |
1163 | 1166 | } |
1164 | 1167 |
@@ -157,7 +157,6 @@ public class ExternalVibration implements Parcelable { | ||
157 | 157 | out.writeInt(mUid); |
158 | 158 | out.writeString(mPkg); |
159 | 159 | writeAudioAttributes(mAttrs, out, flags); |
160 | - out.writeParcelable(mAttrs, flags); | |
161 | 160 | out.writeStrongBinder(mController.asBinder()); |
162 | 161 | out.writeStrongBinder(mToken); |
163 | 162 | } |
@@ -0,0 +1,47 @@ | ||
1 | +/* | |
2 | + * Copyright (C) 2020 The Android Open Source Project | |
3 | + * | |
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | + * you may not use this file except in compliance with the License. | |
6 | + * You may obtain a copy of the License at | |
7 | + * | |
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + * | |
10 | + * Unless required by applicable law or agreed to in writing, software | |
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | + * See the License for the specific language governing permissions and | |
14 | + * limitations under the License. | |
15 | + */ | |
16 | + | |
17 | +package android.os; | |
18 | + | |
19 | +import static junit.framework.Assert.assertEquals; | |
20 | + | |
21 | +import static org.mockito.Mockito.mock; | |
22 | + | |
23 | +import android.media.AudioAttributes; | |
24 | + | |
25 | +import org.junit.Test; | |
26 | +import org.junit.runner.RunWith; | |
27 | +import org.mockito.junit.MockitoJUnitRunner; | |
28 | + | |
29 | +@RunWith(MockitoJUnitRunner.class) | |
30 | +public class ExternalVibrationTest { | |
31 | + @Test | |
32 | + public void testSerialization() { | |
33 | + AudioAttributes audio = new AudioAttributes.Builder().build(); | |
34 | + IExternalVibrationController controller = mock(IExternalVibrationController.class); | |
35 | + ExternalVibration original = new ExternalVibration( | |
36 | + 123, // uid | |
37 | + "pkg", | |
38 | + audio, | |
39 | + controller); | |
40 | + Parcel p = Parcel.obtain(); | |
41 | + original.writeToParcel(p, 0); | |
42 | + p.setDataPosition(0); | |
43 | + ExternalVibration restored = ExternalVibration.CREATOR.createFromParcel(p); | |
44 | + assertEquals(original, restored); | |
45 | + } | |
46 | +} | |
47 | + |
@@ -195,20 +195,32 @@ public class AppOpsControllerImpl implements AppOpsController, | ||
195 | 195 | mNotedItems.remove(item); |
196 | 196 | if (DEBUG) Log.w(TAG, "Removed item: " + item.toString()); |
197 | 197 | } |
198 | - notifySuscribers(code, uid, packageName, false); | |
198 | + boolean active; | |
199 | + // Check if the item is also active | |
200 | + synchronized (mActiveItems) { | |
201 | + active = getAppOpItem(mActiveItems, code, uid, packageName) != null; | |
202 | + } | |
203 | + if (!active) { | |
204 | + notifySuscribers(code, uid, packageName, false); | |
205 | + } | |
199 | 206 | } |
200 | 207 | |
201 | - private void addNoted(int code, int uid, String packageName) { | |
208 | + private boolean addNoted(int code, int uid, String packageName) { | |
202 | 209 | AppOpItem item; |
210 | + boolean createdNew = false; | |
203 | 211 | synchronized (mNotedItems) { |
204 | 212 | item = getAppOpItem(mNotedItems, code, uid, packageName); |
205 | 213 | if (item == null) { |
206 | 214 | item = new AppOpItem(code, uid, packageName, System.currentTimeMillis()); |
207 | 215 | mNotedItems.add(item); |
208 | 216 | if (DEBUG) Log.w(TAG, "Added item: " + item.toString()); |
217 | + createdNew = true; | |
209 | 218 | } |
210 | 219 | } |
220 | + // We should keep this so we make sure it cannot time out. | |
221 | + mBGHandler.removeCallbacksAndMessages(item); | |
211 | 222 | mBGHandler.scheduleRemoval(item, NOTED_OP_TIME_DELAY_MS); |
223 | + return createdNew; | |
212 | 224 | } |
213 | 225 | |
214 | 226 | /** |
@@ -255,23 +267,46 @@ public class AppOpsControllerImpl implements AppOpsController, | ||
255 | 267 | |
256 | 268 | @Override |
257 | 269 | public void onOpActiveChanged(int code, int uid, String packageName, boolean active) { |
258 | - if (updateActives(code, uid, packageName, active)) { | |
259 | - notifySuscribers(code, uid, packageName, active); | |
270 | + if (DEBUG) { | |
271 | + Log.w(TAG, String.format("onActiveChanged(%d,%d,%s,%s", code, uid, packageName, | |
272 | + Boolean.toString(active))); | |
273 | + } | |
274 | + boolean activeChanged = updateActives(code, uid, packageName, active); | |
275 | + if (!activeChanged) return; // early return | |
276 | + // Check if the item is also noted, in that case, there's no update. | |
277 | + boolean alsoNoted; | |
278 | + synchronized (mNotedItems) { | |
279 | + alsoNoted = getAppOpItem(mNotedItems, code, uid, packageName) != null; | |
280 | + } | |
281 | + // If active is true, we only send the update if the op is not actively noted (already true) | |
282 | + // If active is false, we only send the update if the op is not actively noted (prevent | |
283 | + // early removal) | |
284 | + if (!alsoNoted) { | |
285 | + mBGHandler.post(() -> notifySuscribers(code, uid, packageName, active)); | |
260 | 286 | } |
261 | 287 | } |
262 | 288 | |
263 | 289 | @Override |
264 | 290 | public void onOpNoted(int code, int uid, String packageName, int result) { |
265 | 291 | if (DEBUG) { |
266 | - Log.w(TAG, "Op: " + code + " with result " + AppOpsManager.MODE_NAMES[result]); | |
292 | + Log.w(TAG, "Noted op: " + code + " with result " | |
293 | + + AppOpsManager.MODE_NAMES[result] + " for package " + packageName); | |
267 | 294 | } |
268 | 295 | if (result != AppOpsManager.MODE_ALLOWED) return; |
269 | - addNoted(code, uid, packageName); | |
270 | - notifySuscribers(code, uid, packageName, true); | |
296 | + boolean notedAdded = addNoted(code, uid, packageName); | |
297 | + if (!notedAdded) return; // early return | |
298 | + boolean alsoActive; | |
299 | + synchronized (mActiveItems) { | |
300 | + alsoActive = getAppOpItem(mActiveItems, code, uid, packageName) != null; | |
301 | + } | |
302 | + if (!alsoActive) { | |
303 | + mBGHandler.post(() -> notifySuscribers(code, uid, packageName, true)); | |
304 | + } | |
271 | 305 | } |
272 | 306 | |
273 | 307 | private void notifySuscribers(int code, int uid, String packageName, boolean active) { |
274 | 308 | if (mCallbacksByCode.containsKey(code)) { |
309 | + if (DEBUG) Log.d(TAG, "Notifying of change in package " + packageName); | |
275 | 310 | for (Callback cb: mCallbacksByCode.get(code)) { |
276 | 311 | cb.onActiveStateChanged(code, uid, packageName, active); |
277 | 312 | } |
@@ -295,7 +330,7 @@ public class AppOpsControllerImpl implements AppOpsController, | ||
295 | 330 | |
296 | 331 | } |
297 | 332 | |
298 | - protected final class H extends Handler { | |
333 | + protected class H extends Handler { | |
299 | 334 | H(Looper looper) { |
300 | 335 | super(looper); |
301 | 336 | } |
@@ -28,6 +28,8 @@ import static org.mockito.Mockito.never; | ||
28 | 28 | import static org.mockito.Mockito.times; |
29 | 29 | import static org.mockito.Mockito.verify; |
30 | 30 | |
31 | +import static java.lang.Thread.sleep; | |
32 | + | |
31 | 33 | import android.app.AppOpsManager; |
32 | 34 | import android.content.pm.PackageManager; |
33 | 35 | import android.os.UserHandle; |
@@ -36,7 +38,6 @@ import android.testing.TestableLooper; | ||
36 | 38 | |
37 | 39 | import androidx.test.filters.SmallTest; |
38 | 40 | |
39 | -import com.android.systemui.Dependency; | |
40 | 41 | import com.android.systemui.SysuiTestCase; |
41 | 42 | |
42 | 43 | import org.junit.Before; |
@@ -45,6 +46,8 @@ import org.junit.runner.RunWith; | ||
45 | 46 | import org.mockito.Mock; |
46 | 47 | import org.mockito.MockitoAnnotations; |
47 | 48 | |
49 | +import java.util.List; | |
50 | + | |
48 | 51 | @SmallTest |
49 | 52 | @RunWith(AndroidTestingRunner.class) |
50 | 53 | @TestableLooper.RunWithLooper |
@@ -63,14 +66,16 @@ public class AppOpsControllerTest extends SysuiTestCase { | ||
63 | 66 | private AppOpsControllerImpl.H mMockHandler; |
64 | 67 | |
65 | 68 | private AppOpsControllerImpl mController; |
69 | + private TestableLooper mTestableLooper; | |
66 | 70 | |
67 | 71 | @Before |
68 | 72 | public void setUp() { |
69 | 73 | MockitoAnnotations.initMocks(this); |
74 | + mTestableLooper = TestableLooper.get(this); | |
70 | 75 | |
71 | 76 | getContext().addMockSystemService(AppOpsManager.class, mAppOpsManager); |
72 | 77 | |
73 | - mController = new AppOpsControllerImpl(mContext, Dependency.get(Dependency.BG_LOOPER)); | |
78 | + mController = new AppOpsControllerImpl(mContext, mTestableLooper.getLooper()); | |
74 | 79 | } |
75 | 80 | |
76 | 81 | @Test |
@@ -94,6 +99,7 @@ public class AppOpsControllerTest extends SysuiTestCase { | ||
94 | 99 | AppOpsManager.OP_RECORD_AUDIO, TEST_UID, TEST_PACKAGE_NAME, true); |
95 | 100 | mController.onOpNoted(AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, |
96 | 101 | AppOpsManager.MODE_ALLOWED); |
102 | + mTestableLooper.processAllMessages(); | |
97 | 103 | verify(mCallback).onActiveStateChanged(AppOpsManager.OP_RECORD_AUDIO, |
98 | 104 | TEST_UID, TEST_PACKAGE_NAME, true); |
99 | 105 | } |
@@ -103,6 +109,7 @@ public class AppOpsControllerTest extends SysuiTestCase { | ||
103 | 109 | mController.addCallback(new int[]{AppOpsManager.OP_FINE_LOCATION}, mCallback); |
104 | 110 | mController.onOpActiveChanged( |
105 | 111 | AppOpsManager.OP_RECORD_AUDIO, TEST_UID, TEST_PACKAGE_NAME, true); |
112 | + mTestableLooper.processAllMessages(); | |
106 | 113 | verify(mCallback, never()).onActiveStateChanged( |
107 | 114 | anyInt(), anyInt(), anyString(), anyBoolean()); |
108 | 115 | } |
@@ -113,6 +120,7 @@ public class AppOpsControllerTest extends SysuiTestCase { | ||
113 | 120 | mController.removeCallback(new int[]{AppOpsManager.OP_RECORD_AUDIO}, mCallback); |
114 | 121 | mController.onOpActiveChanged( |
115 | 122 | AppOpsManager.OP_RECORD_AUDIO, TEST_UID, TEST_PACKAGE_NAME, true); |
123 | + mTestableLooper.processAllMessages(); | |
116 | 124 | verify(mCallback, never()).onActiveStateChanged( |
117 | 125 | anyInt(), anyInt(), anyString(), anyBoolean()); |
118 | 126 | } |
@@ -123,6 +131,7 @@ public class AppOpsControllerTest extends SysuiTestCase { | ||
123 | 131 | mController.removeCallback(new int[]{AppOpsManager.OP_CAMERA}, mCallback); |
124 | 132 | mController.onOpActiveChanged( |
125 | 133 | AppOpsManager.OP_RECORD_AUDIO, TEST_UID, TEST_PACKAGE_NAME, true); |
134 | + mTestableLooper.processAllMessages(); | |
126 | 135 | verify(mCallback).onActiveStateChanged(AppOpsManager.OP_RECORD_AUDIO, |
127 | 136 | TEST_UID, TEST_PACKAGE_NAME, true); |
128 | 137 | } |
@@ -185,4 +194,129 @@ public class AppOpsControllerTest extends SysuiTestCase { | ||
185 | 194 | verify(mMockHandler).removeCallbacksAndMessages(null); |
186 | 195 | assertTrue(mController.getActiveAppOps().isEmpty()); |
187 | 196 | } |
197 | + | |
198 | + @Test | |
199 | + public void noDoubleUpdateOnOpNoted() { | |
200 | + mController.setBGHandler(mMockHandler); | |
201 | + | |
202 | + mController.onOpNoted(AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, | |
203 | + AppOpsManager.MODE_ALLOWED); | |
204 | + mController.onOpNoted(AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, | |
205 | + AppOpsManager.MODE_ALLOWED); | |
206 | + | |
207 | + // Only one post to notify subscribers | |
208 | + verify(mMockHandler, times(1)).post(any()); | |
209 | + | |
210 | + List<AppOpItem> list = mController.getActiveAppOps(); | |
211 | + assertEquals(1, list.size()); | |
212 | + } | |
213 | + | |
214 | + @Test | |
215 | + public void onDoubleOPNoted_scheduleTwiceForRemoval() { | |
216 | + mController.setBGHandler(mMockHandler); | |
217 | + | |
218 | + mController.onOpNoted(AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, | |
219 | + AppOpsManager.MODE_ALLOWED); | |
220 | + mController.onOpNoted(AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, | |
221 | + AppOpsManager.MODE_ALLOWED); | |
222 | + | |
223 | + // Only one post to notify subscribers | |
224 | + verify(mMockHandler, times(2)).scheduleRemoval(any(), anyLong()); | |
225 | + } | |
226 | + | |
227 | + @Test | |
228 | + public void testActiveOpNotRemovedAfterNoted() throws InterruptedException { | |
229 | + // Replaces the timeout delay with 5 ms | |
230 | + AppOpsControllerImpl.H testHandler = mController.new H(mTestableLooper.getLooper()) { | |
231 | + @Override | |
232 | + public void scheduleRemoval(AppOpItem item, long timeToRemoval) { | |
233 | + super.scheduleRemoval(item, 5L); | |
234 | + } | |
235 | + }; | |
236 | + | |
237 | + mController.addCallback(new int[]{AppOpsManager.OP_FINE_LOCATION}, mCallback); | |
238 | + mController.setBGHandler(testHandler); | |
239 | + | |
240 | + mController.onOpActiveChanged( | |
241 | + AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, true); | |
242 | + | |
243 | + mController.onOpNoted(AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, | |
244 | + AppOpsManager.MODE_ALLOWED); | |
245 | + | |
246 | + mTestableLooper.processAllMessages(); | |
247 | + List<AppOpItem> list = mController.getActiveAppOps(); | |
248 | + verify(mCallback).onActiveStateChanged( | |
249 | + AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, true); | |
250 | + | |
251 | + // Duplicates are not removed between active and noted | |
252 | + assertEquals(2, list.size()); | |
253 | + | |
254 | + sleep(10L); | |
255 | + | |
256 | + mTestableLooper.processAllMessages(); | |
257 | + | |
258 | + verify(mCallback, never()).onActiveStateChanged( | |
259 | + AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, false); | |
260 | + list = mController.getActiveAppOps(); | |
261 | + assertEquals(1, list.size()); | |
262 | + } | |
263 | + | |
264 | + @Test | |
265 | + public void testNotedNotRemovedAfterActive() { | |
266 | + mController.addCallback(new int[]{AppOpsManager.OP_FINE_LOCATION}, mCallback); | |
267 | + | |
268 | + mController.onOpNoted(AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, | |
269 | + AppOpsManager.MODE_ALLOWED); | |
270 | + | |
271 | + mController.onOpActiveChanged( | |
272 | + AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, true); | |
273 | + | |
274 | + mTestableLooper.processAllMessages(); | |
275 | + List<AppOpItem> list = mController.getActiveAppOps(); | |
276 | + verify(mCallback).onActiveStateChanged( | |
277 | + AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, true); | |
278 | + | |
279 | + // Duplicates are not removed between active and noted | |
280 | + assertEquals(2, list.size()); | |
281 | + | |
282 | + mController.onOpActiveChanged( | |
283 | + AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, false); | |
284 | + | |
285 | + mTestableLooper.processAllMessages(); | |
286 | + | |
287 | + verify(mCallback, never()).onActiveStateChanged( | |
288 | + AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, false); | |
289 | + list = mController.getActiveAppOps(); | |
290 | + assertEquals(1, list.size()); | |
291 | + } | |
292 | + | |
293 | + @Test | |
294 | + public void testNotedAndActiveOnlyOneCall() { | |
295 | + mController.addCallback(new int[]{AppOpsManager.OP_FINE_LOCATION}, mCallback); | |
296 | + | |
297 | + mController.onOpNoted(AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, | |
298 | + AppOpsManager.MODE_ALLOWED); | |
299 | + | |
300 | + mController.onOpActiveChanged( | |
301 | + AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, true); | |
302 | + | |
303 | + mTestableLooper.processAllMessages(); | |
304 | + verify(mCallback).onActiveStateChanged( | |
305 | + AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, true); | |
306 | + } | |
307 | + | |
308 | + @Test | |
309 | + public void testActiveAndNotedOnlyOneCall() { | |
310 | + mController.addCallback(new int[]{AppOpsManager.OP_FINE_LOCATION}, mCallback); | |
311 | + | |
312 | + mController.onOpActiveChanged( | |
313 | + AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, true); | |
314 | + | |
315 | + mController.onOpNoted(AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, | |
316 | + AppOpsManager.MODE_ALLOWED); | |
317 | + | |
318 | + mTestableLooper.processAllMessages(); | |
319 | + verify(mCallback).onActiveStateChanged( | |
320 | + AppOpsManager.OP_FINE_LOCATION, TEST_UID, TEST_PACKAGE_NAME, true); | |
321 | + } | |
188 | 322 | } |
@@ -18094,36 +18094,48 @@ public class PackageManagerService extends IPackageManager.Stub | ||
18094 | 18094 | int count = 0; |
18095 | 18095 | final String packageName = pkg.packageName; |
18096 | 18096 | |
18097 | + boolean handlesWebUris = false; | |
18098 | + final boolean alreadyVerified; | |
18097 | 18099 | synchronized (mPackages) { |
18098 | 18100 | // If this is a new install and we see that we've already run verification for this |
18099 | 18101 | // 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()); | |
18109 | 18109 | } |
18110 | + return; | |
18110 | 18111 | } |
18111 | 18112 | |
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. | |
18113 | 18116 | boolean needToVerify = false; |
18114 | 18117 | for (PackageParser.Activity a : pkg.activities) { |
18115 | 18118 | for (ActivityIntentInfo filter : a.intents) { |
18119 | + if (filter.handlesWebUris(true)) { | |
18120 | + handlesWebUris = true; | |
18121 | + } | |
18116 | 18122 | if (filter.needsVerification() && needsNetworkVerificationLPr(filter)) { |
18117 | 18123 | if (DEBUG_DOMAIN_VERIFICATION) { |
18118 | 18124 | Slog.d(TAG, |
18119 | 18125 | "Intent filter needs verification, so processing all filters"); |
18120 | 18126 | } |
18121 | 18127 | 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. | |
18122 | 18131 | break; |
18123 | 18132 | } |
18124 | 18133 | } |
18125 | 18134 | } |
18126 | 18135 | |
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. | |
18127 | 18139 | if (needToVerify) { |
18128 | 18140 | final int verificationId = mIntentFilterVerificationToken++; |
18129 | 18141 | for (PackageParser.Activity a : pkg.activities) { |
@@ -18141,13 +18153,23 @@ public class PackageManagerService extends IPackageManager.Stub | ||
18141 | 18153 | } |
18142 | 18154 | |
18143 | 18155 | if (count > 0) { |
18156 | + // count > 0 means that we're running a full verification pass | |
18144 | 18157 | if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Starting " + count |
18145 | 18158 | + " IntentFilter verification" + (count > 1 ? "s" : "") |
18146 | 18159 | + " for userId:" + userId); |
18147 | 18160 | 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 | + } | |
18148 | 18170 | } else { |
18149 | 18171 | 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); | |
18151 | 18173 | } |
18152 | 18174 | } |
18153 | 18175 | } |
@@ -1252,6 +1252,7 @@ public final class Settings { | ||
1252 | 1252 | return false; |
1253 | 1253 | } |
1254 | 1254 | ps.clearDomainVerificationStatusForUser(userId); |
1255 | + ps.setIntentFilterVerificationInfo(null); | |
1255 | 1256 | return true; |
1256 | 1257 | } |
1257 | 1258 |