Skip to content
Snippets Groups Projects
Commit 79a4f575 authored by Alan Stokes's avatar Alan Stokes
Browse files

Ignore access from a different user

This shouldn't happen, but if it does we should just ignore it rather
than crashing system server.

Modify the tests to match.

Bug: 323665257
Bug: 326190135
Test: atest PackageDynamicCodeLoadingTests
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:1aea0e915748d661e2bdf251e34bdc32d22ce0e9)
Merged-In: I2ae7f506b15133f45f00c24e909f49d56fc23e66
Change-Id: I2ae7f506b15133f45f00c24e909f49d56fc23e66
parent 33ec6c0f
No related branches found
No related tags found
No related merge requests found
......@@ -538,9 +538,10 @@ class PackageDynamicCodeLoading extends AbstractStatsBase<Void> {
} else {
if (fileInfo.mUserId != userId) {
// This should be impossible: private app files are always user-specific and
// can't be accessed from different users.
throw new IllegalArgumentException("Cannot change userId for '" + path
+ "' from " + fileInfo.mUserId + " to " + userId);
// can't be accessed from different users. But it does very occasionally happen
// (b/323665257). Ignore such cases - we shouldn't record data from a different
// user.
return false;
}
// Changing file type (i.e. loading the same file in different ways is possible if
// unlikely. We allow it but ignore it.
......
......@@ -106,13 +106,13 @@ public class PackageDynamicCodeLoadingTests {
}
@Test
public void testRecord_changeUserForFile_throws() {
public void testRecord_changeUserForFile_ignored() {
Entry entry1 = new Entry("owning.package1", "/path/file1", 'D', 10, "loading.package1");
Entry entry2 = new Entry("owning.package1", "/path/file1", 'D', 20, "loading.package1");
PackageDynamicCodeLoading info = makePackageDcl(entry1);
assertThrows(() -> record(info, entry2));
assertThat(record(info, entry2)).isFalse();
assertHasEntries(info, entry1);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment