Merge "Early exit when target app ID < FIRST_APP_UID" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-06-18 05:38:44 +00:00
committed by Android (Google) Code Review
2 changed files with 3 additions and 1 deletions

View File

@@ -861,6 +861,7 @@ public class AppsFilter {
try {
int callingAppId = UserHandle.getAppId(callingUid);
if (callingAppId < Process.FIRST_APPLICATION_UID
|| targetPkgSetting.appId < Process.FIRST_APPLICATION_UID
|| callingAppId == targetPkgSetting.appId) {
return false;
}

View File

@@ -806,7 +806,8 @@ public class AppsFilterTest {
final SparseArray<int[]> systemFilter =
appsFilter.getVisibilityWhitelist(system, USER_ARRAY, mExisting);
assertThat(toList(systemFilter.get(SYSTEM_USER)), empty());
assertThat(toList(systemFilter.get(SYSTEM_USER)),
contains(seesNothingAppId, hasProviderAppId, queriesProviderAppId));
final SparseArray<int[]> seesNothingFilter =
appsFilter.getVisibilityWhitelist(seesNothing, USER_ARRAY, mExisting);