Merge "RESTRICT AUTOMERGE Revert "Construct AppsFilter cache on background thread"" into rvc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a918ea54cc
@@ -35,9 +35,6 @@ import android.content.pm.parsing.component.ParsedInstrumentation;
|
||||
import android.content.pm.parsing.component.ParsedIntentInfo;
|
||||
import android.content.pm.parsing.component.ParsedMainComponent;
|
||||
import android.content.pm.parsing.component.ParsedProvider;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerExecutor;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.Process;
|
||||
import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
@@ -51,7 +48,6 @@ import android.util.SparseBooleanArray;
|
||||
import android.util.SparseSetArray;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
import com.android.server.FgThread;
|
||||
@@ -65,7 +61,6 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
* The entity responsible for filtering visibility between apps based on declarations in their
|
||||
@@ -100,12 +95,6 @@ public class AppsFilter {
|
||||
*/
|
||||
private final SparseSetArray<Integer> mQueriesViaComponent = new SparseSetArray<>();
|
||||
|
||||
/**
|
||||
* Executor for running reasonably short background tasks such as building the initial
|
||||
* visibility cache.
|
||||
*/
|
||||
private final Executor mBackgroundExecutor;
|
||||
|
||||
/**
|
||||
* Pending full recompute of mQueriesViaComponent. Occurs when a package adds a new set of
|
||||
* protected broadcast. This in turn invalidates all prior additions and require a very
|
||||
@@ -136,8 +125,6 @@ public class AppsFilter {
|
||||
private PackageParser.SigningDetails mSystemSigningDetails;
|
||||
private Set<String> mProtectedBroadcasts = new ArraySet<>();
|
||||
|
||||
private final Object mCacheLock = new Object();
|
||||
|
||||
/**
|
||||
* This structure maps uid -> uid and indicates whether access from the first should be
|
||||
* filtered to the second. It's essentially a cache of the
|
||||
@@ -145,7 +132,6 @@ public class AppsFilter {
|
||||
* NOTE: It can only be relied upon after the system is ready to avoid unnecessary update on
|
||||
* initial scam and is null until {@link #onSystemReady()} is called.
|
||||
*/
|
||||
@GuardedBy("mCacheLock")
|
||||
private volatile SparseArray<SparseBooleanArray> mShouldFilterCache;
|
||||
|
||||
@VisibleForTesting(visibility = PRIVATE)
|
||||
@@ -153,15 +139,13 @@ public class AppsFilter {
|
||||
FeatureConfig featureConfig,
|
||||
String[] forceQueryableWhitelist,
|
||||
boolean systemAppsQueryable,
|
||||
@Nullable OverlayReferenceMapper.Provider overlayProvider,
|
||||
Executor backgroundExecutor) {
|
||||
@Nullable OverlayReferenceMapper.Provider overlayProvider) {
|
||||
mFeatureConfig = featureConfig;
|
||||
mForceQueryableByDevicePackageNames = forceQueryableWhitelist;
|
||||
mSystemAppsQueryable = systemAppsQueryable;
|
||||
mOverlayReferenceMapper = new OverlayReferenceMapper(true /*deferRebuild*/,
|
||||
overlayProvider);
|
||||
mStateProvider = stateProvider;
|
||||
mBackgroundExecutor = backgroundExecutor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -353,13 +337,8 @@ public class AppsFilter {
|
||||
injector.getUserManagerInternal().getUserInfos());
|
||||
}
|
||||
};
|
||||
HandlerThread appsFilterThread = new HandlerThread("appsFilter");
|
||||
appsFilterThread.start();
|
||||
Handler appsFilterHandler = new Handler(appsFilterThread.getLooper());
|
||||
Executor executor = new HandlerExecutor(appsFilterHandler);
|
||||
|
||||
AppsFilter appsFilter = new AppsFilter(stateProvider, featureConfig,
|
||||
forcedQueryablePackageNames, forceSystemAppsQueryable, null, executor);
|
||||
forcedQueryablePackageNames, forceSystemAppsQueryable, null);
|
||||
featureConfig.setAppsFilter(appsFilter);
|
||||
return appsFilter;
|
||||
}
|
||||
@@ -491,26 +470,29 @@ public class AppsFilter {
|
||||
if (mImplicitlyQueryable.add(recipientUid, visibleUid) && DEBUG_LOGGING) {
|
||||
Slog.i(TAG, "implicit access granted: " + recipientUid + " -> " + visibleUid);
|
||||
}
|
||||
synchronized (mCacheLock) {
|
||||
if (mShouldFilterCache != null) {
|
||||
// update the cache in a one-off manner since we've got all the information we
|
||||
// need.
|
||||
SparseBooleanArray visibleUids = mShouldFilterCache.get(recipientUid);
|
||||
if (visibleUids == null) {
|
||||
visibleUids = new SparseBooleanArray();
|
||||
mShouldFilterCache.put(recipientUid, visibleUids);
|
||||
}
|
||||
visibleUids.put(visibleUid, false);
|
||||
if (mShouldFilterCache != null) {
|
||||
// update the cache in a one-off manner since we've got all the information we need.
|
||||
SparseBooleanArray visibleUids = mShouldFilterCache.get(recipientUid);
|
||||
if (visibleUids == null) {
|
||||
visibleUids = new SparseBooleanArray();
|
||||
mShouldFilterCache.put(recipientUid, visibleUids);
|
||||
}
|
||||
visibleUids.put(visibleUid, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onSystemReady() {
|
||||
mOverlayReferenceMapper.rebuildIfDeferred();
|
||||
mStateProvider.runWithState(new StateProvider.CurrentStateCallback() {
|
||||
@Override
|
||||
public void currentState(ArrayMap<String, PackageSetting> settings,
|
||||
UserInfo[] users) {
|
||||
mShouldFilterCache = new SparseArray<>(users.length * settings.size());
|
||||
}
|
||||
});
|
||||
mFeatureConfig.onSystemReady();
|
||||
|
||||
updateEntireShouldFilterCacheAsync();
|
||||
mOverlayReferenceMapper.rebuildIfDeferred();
|
||||
updateEntireShouldFilterCache();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -528,12 +510,10 @@ public class AppsFilter {
|
||||
}
|
||||
mStateProvider.runWithState((settings, users) -> {
|
||||
addPackageInternal(newPkgSetting, settings);
|
||||
synchronized (mCacheLock) {
|
||||
if (mShouldFilterCache != null) {
|
||||
updateShouldFilterCacheForPackage(mShouldFilterCache, null, newPkgSetting,
|
||||
settings, users, settings.size());
|
||||
} // else, rebuild entire cache when system is ready
|
||||
}
|
||||
if (mShouldFilterCache != null) {
|
||||
updateShouldFilterCacheForPackage(
|
||||
null, newPkgSetting, settings, users, settings.size());
|
||||
} // else, rebuild entire cache when system is ready
|
||||
});
|
||||
} finally {
|
||||
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
|
||||
@@ -627,7 +607,6 @@ public class AppsFilter {
|
||||
mFeatureConfig.updatePackageState(newPkgSetting, false /*removed*/);
|
||||
}
|
||||
|
||||
@GuardedBy("mCacheLock")
|
||||
private void removeAppIdFromVisibilityCache(int appId) {
|
||||
if (mShouldFilterCache == null) {
|
||||
return;
|
||||
@@ -646,47 +625,33 @@ public class AppsFilter {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateEntireShouldFilterCacheAsync() {
|
||||
mBackgroundExecutor.execute(this::updateEntireShouldFilterCache);
|
||||
}
|
||||
|
||||
private void updateEntireShouldFilterCache() {
|
||||
mStateProvider.runWithState((settings, users) -> {
|
||||
SparseArray<SparseBooleanArray> cache =
|
||||
new SparseArray<>(users.length * settings.size());
|
||||
mShouldFilterCache.clear();
|
||||
for (int i = settings.size() - 1; i >= 0; i--) {
|
||||
updateShouldFilterCacheForPackage(cache,
|
||||
updateShouldFilterCacheForPackage(
|
||||
null /*skipPackage*/, settings.valueAt(i), settings, users, i);
|
||||
}
|
||||
synchronized (mCacheLock) {
|
||||
mShouldFilterCache = cache;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onUsersChanged() {
|
||||
synchronized (mCacheLock) {
|
||||
if (mShouldFilterCache != null) {
|
||||
updateEntireShouldFilterCache();
|
||||
}
|
||||
if (mShouldFilterCache != null) {
|
||||
updateEntireShouldFilterCache();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateShouldFilterCacheForPackage(String packageName) {
|
||||
synchronized (mCacheLock) {
|
||||
if (mShouldFilterCache != null) {
|
||||
mStateProvider.runWithState((settings, users) -> {
|
||||
updateShouldFilterCacheForPackage(mShouldFilterCache, null /* skipPackage */,
|
||||
settings.get(packageName), settings, users,
|
||||
settings.size() /*maxIndex*/);
|
||||
});
|
||||
}
|
||||
}
|
||||
mStateProvider.runWithState((settings, users) -> {
|
||||
updateShouldFilterCacheForPackage(null /* skipPackage */, settings.get(packageName),
|
||||
settings, users, settings.size() /*maxIndex*/);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void updateShouldFilterCacheForPackage(SparseArray<SparseBooleanArray> cache,
|
||||
@Nullable String skipPackageName, PackageSetting subjectSetting, ArrayMap<String,
|
||||
PackageSetting> allSettings, UserInfo[] allUsers, int maxIndex) {
|
||||
private void updateShouldFilterCacheForPackage(@Nullable String skipPackageName,
|
||||
PackageSetting subjectSetting, ArrayMap<String, PackageSetting> allSettings,
|
||||
UserInfo[] allUsers, int maxIndex) {
|
||||
for (int i = Math.min(maxIndex, allSettings.size() - 1); i >= 0; i--) {
|
||||
PackageSetting otherSetting = allSettings.valueAt(i);
|
||||
if (subjectSetting.appId == otherSetting.appId) {
|
||||
@@ -703,17 +668,17 @@ public class AppsFilter {
|
||||
for (int ou = 0; ou < userCount; ou++) {
|
||||
int otherUser = allUsers[ou].id;
|
||||
int subjectUid = UserHandle.getUid(subjectUser, subjectSetting.appId);
|
||||
if (!cache.contains(subjectUid)) {
|
||||
cache.put(subjectUid, new SparseBooleanArray(appxUidCount));
|
||||
if (!mShouldFilterCache.contains(subjectUid)) {
|
||||
mShouldFilterCache.put(subjectUid, new SparseBooleanArray(appxUidCount));
|
||||
}
|
||||
int otherUid = UserHandle.getUid(otherUser, otherSetting.appId);
|
||||
if (!cache.contains(otherUid)) {
|
||||
cache.put(otherUid, new SparseBooleanArray(appxUidCount));
|
||||
if (!mShouldFilterCache.contains(otherUid)) {
|
||||
mShouldFilterCache.put(otherUid, new SparseBooleanArray(appxUidCount));
|
||||
}
|
||||
cache.get(subjectUid).put(otherUid,
|
||||
mShouldFilterCache.get(subjectUid).put(otherUid,
|
||||
shouldFilterApplicationInternal(
|
||||
subjectUid, subjectSetting, otherSetting, otherUser));
|
||||
cache.get(otherUid).put(subjectUid,
|
||||
mShouldFilterCache.get(otherUid).put(subjectUid,
|
||||
shouldFilterApplicationInternal(
|
||||
otherUid, otherSetting, subjectSetting, subjectUser));
|
||||
}
|
||||
@@ -747,8 +712,7 @@ public class AppsFilter {
|
||||
* This method recomputes all component / intent-based visibility and is intended to match the
|
||||
* relevant logic of {@link #addPackageInternal(PackageSetting, ArrayMap)}
|
||||
*/
|
||||
private void recomputeComponentVisibility(
|
||||
ArrayMap<String, PackageSetting> existingSettings) {
|
||||
private void recomputeComponentVisibility(ArrayMap<String, PackageSetting> existingSettings) {
|
||||
mQueriesViaComponent.clear();
|
||||
for (int i = existingSettings.size() - 1; i >= 0; i--) {
|
||||
PackageSetting setting = existingSettings.valueAt(i);
|
||||
@@ -890,17 +854,15 @@ public class AppsFilter {
|
||||
}
|
||||
}
|
||||
|
||||
synchronized (mCacheLock) {
|
||||
removeAppIdFromVisibilityCache(setting.appId);
|
||||
if (mShouldFilterCache != null && setting.sharedUser != null) {
|
||||
for (int i = setting.sharedUser.packages.size() - 1; i >= 0; i--) {
|
||||
PackageSetting siblingSetting = setting.sharedUser.packages.valueAt(i);
|
||||
if (siblingSetting == setting) {
|
||||
continue;
|
||||
}
|
||||
updateShouldFilterCacheForPackage(mShouldFilterCache, setting.name,
|
||||
siblingSetting, settings, users, settings.size());
|
||||
removeAppIdFromVisibilityCache(setting.appId);
|
||||
if (mShouldFilterCache != null && setting.sharedUser != null) {
|
||||
for (int i = setting.sharedUser.packages.size() - 1; i >= 0; i--) {
|
||||
PackageSetting siblingSetting = setting.sharedUser.packages.valueAt(i);
|
||||
if (siblingSetting == setting) {
|
||||
continue;
|
||||
}
|
||||
updateShouldFilterCacheForPackage(
|
||||
setting.name, siblingSetting, settings, users, settings.size());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -926,29 +888,26 @@ public class AppsFilter {
|
||||
|| callingAppId == targetPkgSetting.appId) {
|
||||
return false;
|
||||
}
|
||||
synchronized (mCacheLock) {
|
||||
if (mShouldFilterCache != null) { // use cache
|
||||
SparseBooleanArray shouldFilterTargets = mShouldFilterCache.get(callingUid);
|
||||
final int targetUid = UserHandle.getUid(userId, targetPkgSetting.appId);
|
||||
if (shouldFilterTargets == null) {
|
||||
Slog.wtf(TAG, "Encountered calling uid with no cached rules: "
|
||||
+ callingUid);
|
||||
return true;
|
||||
}
|
||||
int indexOfTargetUid = shouldFilterTargets.indexOfKey(targetUid);
|
||||
if (indexOfTargetUid < 0) {
|
||||
Slog.w(TAG, "Encountered calling -> target with no cached rules: "
|
||||
+ callingUid + " -> " + targetUid);
|
||||
return true;
|
||||
}
|
||||
if (!shouldFilterTargets.valueAt(indexOfTargetUid)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!shouldFilterApplicationInternal(
|
||||
callingUid, callingSetting, targetPkgSetting, userId)) {
|
||||
return false;
|
||||
}
|
||||
if (mShouldFilterCache != null) { // use cache
|
||||
SparseBooleanArray shouldFilterTargets = mShouldFilterCache.get(callingUid);
|
||||
final int targetUid = UserHandle.getUid(userId, targetPkgSetting.appId);
|
||||
if (shouldFilterTargets == null) {
|
||||
Slog.wtf(TAG, "Encountered calling uid with no cached rules: " + callingUid);
|
||||
return true;
|
||||
}
|
||||
int indexOfTargetUid = shouldFilterTargets.indexOfKey(targetUid);
|
||||
if (indexOfTargetUid < 0) {
|
||||
Slog.w(TAG, "Encountered calling -> target with no cached rules: "
|
||||
+ callingUid + " -> " + targetUid);
|
||||
return true;
|
||||
}
|
||||
if (!shouldFilterTargets.valueAt(indexOfTargetUid)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!shouldFilterApplicationInternal(
|
||||
callingUid, callingSetting, targetPkgSetting, userId)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (DEBUG_LOGGING || mFeatureConfig.isLoggingEnabled(callingAppId)) {
|
||||
|
||||
@@ -21446,6 +21446,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
.getUriFor(Secure.INSTANT_APPS_ENABLED), false, co, UserHandle.USER_ALL);
|
||||
co.onChange(true);
|
||||
|
||||
mAppsFilter.onSystemReady();
|
||||
|
||||
// Disable any carrier apps. We do this very early in boot to prevent the apps from being
|
||||
// disabled after already being started.
|
||||
CarrierAppUtils.disableCarrierAppsUntilPrivileged(
|
||||
@@ -21594,8 +21596,6 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
mInstallerService.restoreAndApplyStagedSessionIfNeeded();
|
||||
|
||||
mExistingPackages = null;
|
||||
|
||||
mAppsFilter.onSystemReady();
|
||||
}
|
||||
|
||||
public void waitForAppDataPrepared() {
|
||||
|
||||
@@ -72,7 +72,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.IntFunction;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
@Presubmit
|
||||
@RunWith(JUnit4.class)
|
||||
@@ -92,8 +91,6 @@ public class AppsFilterTest {
|
||||
AppsFilter.FeatureConfig mFeatureConfigMock;
|
||||
@Mock
|
||||
AppsFilter.StateProvider mStateProvider;
|
||||
@Mock
|
||||
Executor mMockExecutor;
|
||||
|
||||
private ArrayMap<String, PackageSetting> mExisting = new ArrayMap<>();
|
||||
|
||||
@@ -190,15 +187,10 @@ public class AppsFilterTest {
|
||||
doAnswer(invocation -> {
|
||||
((AppsFilter.StateProvider.CurrentStateCallback) invocation.getArgument(0))
|
||||
.currentState(mExisting, USER_INFO_LIST);
|
||||
return new Object();
|
||||
return null;
|
||||
}).when(mStateProvider)
|
||||
.runWithState(any(AppsFilter.StateProvider.CurrentStateCallback.class));
|
||||
|
||||
doAnswer(invocation -> {
|
||||
((Runnable) invocation.getArgument(0)).run();
|
||||
return new Object();
|
||||
}).when(mMockExecutor).execute(any(Runnable.class));
|
||||
|
||||
when(mFeatureConfigMock.isGloballyEnabled()).thenReturn(true);
|
||||
when(mFeatureConfigMock.packageIsEnabled(any(AndroidPackage.class))).thenAnswer(
|
||||
(Answer<Boolean>) invocation ->
|
||||
@@ -209,8 +201,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testSystemReadyPropogates() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
appsFilter.onSystemReady();
|
||||
verify(mFeatureConfigMock).onSystemReady();
|
||||
}
|
||||
@@ -218,8 +209,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testQueriesAction_FilterMatches() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -235,8 +225,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testQueriesProtectedAction_FilterDoesNotMatch() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
final Signature frameworkSignature = Mockito.mock(Signature.class);
|
||||
final PackageParser.SigningDetails frameworkSigningDetails =
|
||||
new PackageParser.SigningDetails(new Signature[]{frameworkSignature}, 1);
|
||||
@@ -274,8 +263,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testQueriesProvider_FilterMatches() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -292,8 +280,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testQueriesDifferentProvider_Filters() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -310,8 +297,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testQueriesProviderWithSemiColon_FilterMatches() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -329,8 +315,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testQueriesAction_NoMatchingAction_Filters() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -346,8 +331,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testQueriesAction_NoMatchingActionFilterLowSdk_DoesntFilter() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -367,8 +351,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testNoQueries_Filters() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -384,8 +367,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testForceQueryable_DoesntFilter() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -402,7 +384,7 @@ public class AppsFilterTest {
|
||||
public void testForceQueryableByDevice_SystemCaller_DoesntFilter() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{"com.some.package"},
|
||||
false, null, mMockExecutor);
|
||||
false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -420,8 +402,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testSystemSignedTarget_DoesntFilter() throws CertificateException {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
final Signature frameworkSignature = Mockito.mock(Signature.class);
|
||||
@@ -450,7 +431,7 @@ public class AppsFilterTest {
|
||||
public void testForceQueryableByDevice_NonSystemCaller_Filters() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{"com.some.package"},
|
||||
false, null, mMockExecutor);
|
||||
false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -468,7 +449,7 @@ public class AppsFilterTest {
|
||||
public void testSystemQueryable_DoesntFilter() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{},
|
||||
true /* system force queryable */, null, mMockExecutor);
|
||||
true /* system force queryable */, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -485,8 +466,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testQueriesPackage_DoesntFilter() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -504,8 +484,7 @@ public class AppsFilterTest {
|
||||
when(mFeatureConfigMock.packageIsEnabled(any(AndroidPackage.class)))
|
||||
.thenReturn(false);
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -521,8 +500,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testSystemUid_DoesntFilter() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -537,8 +515,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testSystemUidSecondaryUser_DoesntFilter() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -554,8 +531,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testNonSystemUid_NoCallingSetting_Filters() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -569,8 +545,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testNoTargetPackage_filters() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -628,8 +603,7 @@ public class AppsFilterTest {
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
},
|
||||
mMockExecutor);
|
||||
});
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -701,8 +675,7 @@ public class AppsFilterTest {
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
},
|
||||
mMockExecutor);
|
||||
});
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -727,8 +700,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testInitiatingApp_DoesntFilter() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -744,8 +716,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testUninstalledInitiatingApp_Filters() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -761,8 +732,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testOriginatingApp_Filters() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -778,8 +748,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testInstallingApp_DoesntFilter() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -795,8 +764,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testInstrumentation_DoesntFilter() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
@@ -818,8 +786,7 @@ public class AppsFilterTest {
|
||||
@Test
|
||||
public void testWhoCanSee() throws Exception {
|
||||
final AppsFilter appsFilter =
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||
mMockExecutor);
|
||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
||||
simulateAddBasicAndroid(appsFilter);
|
||||
appsFilter.onSystemReady();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user