Merge "Build AppsFilter cache in background" into rvc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4336e7ca72
@@ -35,6 +35,9 @@ import android.content.pm.parsing.component.ParsedInstrumentation;
|
|||||||
import android.content.pm.parsing.component.ParsedIntentInfo;
|
import android.content.pm.parsing.component.ParsedIntentInfo;
|
||||||
import android.content.pm.parsing.component.ParsedMainComponent;
|
import android.content.pm.parsing.component.ParsedMainComponent;
|
||||||
import android.content.pm.parsing.component.ParsedProvider;
|
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.Process;
|
||||||
import android.os.Trace;
|
import android.os.Trace;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
@@ -48,6 +51,7 @@ import android.util.SparseBooleanArray;
|
|||||||
import android.util.SparseSetArray;
|
import android.util.SparseSetArray;
|
||||||
|
|
||||||
import com.android.internal.R;
|
import com.android.internal.R;
|
||||||
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.util.ArrayUtils;
|
import com.android.internal.util.ArrayUtils;
|
||||||
import com.android.server.FgThread;
|
import com.android.server.FgThread;
|
||||||
@@ -61,6 +65,7 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The entity responsible for filtering visibility between apps based on declarations in their
|
* The entity responsible for filtering visibility between apps based on declarations in their
|
||||||
@@ -95,6 +100,12 @@ public class AppsFilter {
|
|||||||
*/
|
*/
|
||||||
private final SparseSetArray<Integer> mQueriesViaComponent = new SparseSetArray<>();
|
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
|
* 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
|
* protected broadcast. This in turn invalidates all prior additions and require a very
|
||||||
@@ -125,6 +136,8 @@ public class AppsFilter {
|
|||||||
private PackageParser.SigningDetails mSystemSigningDetails;
|
private PackageParser.SigningDetails mSystemSigningDetails;
|
||||||
private Set<String> mProtectedBroadcasts = new ArraySet<>();
|
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
|
* 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
|
* filtered to the second. It's essentially a cache of the
|
||||||
@@ -132,6 +145,7 @@ public class AppsFilter {
|
|||||||
* NOTE: It can only be relied upon after the system is ready to avoid unnecessary update on
|
* 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.
|
* initial scam and is null until {@link #onSystemReady()} is called.
|
||||||
*/
|
*/
|
||||||
|
@GuardedBy("mCacheLock")
|
||||||
private volatile SparseArray<SparseBooleanArray> mShouldFilterCache;
|
private volatile SparseArray<SparseBooleanArray> mShouldFilterCache;
|
||||||
|
|
||||||
@VisibleForTesting(visibility = PRIVATE)
|
@VisibleForTesting(visibility = PRIVATE)
|
||||||
@@ -139,13 +153,15 @@ public class AppsFilter {
|
|||||||
FeatureConfig featureConfig,
|
FeatureConfig featureConfig,
|
||||||
String[] forceQueryableWhitelist,
|
String[] forceQueryableWhitelist,
|
||||||
boolean systemAppsQueryable,
|
boolean systemAppsQueryable,
|
||||||
@Nullable OverlayReferenceMapper.Provider overlayProvider) {
|
@Nullable OverlayReferenceMapper.Provider overlayProvider,
|
||||||
|
Executor backgroundExecutor) {
|
||||||
mFeatureConfig = featureConfig;
|
mFeatureConfig = featureConfig;
|
||||||
mForceQueryableByDevicePackageNames = forceQueryableWhitelist;
|
mForceQueryableByDevicePackageNames = forceQueryableWhitelist;
|
||||||
mSystemAppsQueryable = systemAppsQueryable;
|
mSystemAppsQueryable = systemAppsQueryable;
|
||||||
mOverlayReferenceMapper = new OverlayReferenceMapper(true /*deferRebuild*/,
|
mOverlayReferenceMapper = new OverlayReferenceMapper(true /*deferRebuild*/,
|
||||||
overlayProvider);
|
overlayProvider);
|
||||||
mStateProvider = stateProvider;
|
mStateProvider = stateProvider;
|
||||||
|
mBackgroundExecutor = backgroundExecutor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -337,8 +353,13 @@ public class AppsFilter {
|
|||||||
injector.getUserManagerInternal().getUserInfos());
|
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,
|
AppsFilter appsFilter = new AppsFilter(stateProvider, featureConfig,
|
||||||
forcedQueryablePackageNames, forceSystemAppsQueryable, null);
|
forcedQueryablePackageNames, forceSystemAppsQueryable, null, executor);
|
||||||
featureConfig.setAppsFilter(appsFilter);
|
featureConfig.setAppsFilter(appsFilter);
|
||||||
return appsFilter;
|
return appsFilter;
|
||||||
}
|
}
|
||||||
@@ -470,29 +491,26 @@ public class AppsFilter {
|
|||||||
if (mImplicitlyQueryable.add(recipientUid, visibleUid) && DEBUG_LOGGING) {
|
if (mImplicitlyQueryable.add(recipientUid, visibleUid) && DEBUG_LOGGING) {
|
||||||
Slog.i(TAG, "implicit access granted: " + recipientUid + " -> " + visibleUid);
|
Slog.i(TAG, "implicit access granted: " + recipientUid + " -> " + visibleUid);
|
||||||
}
|
}
|
||||||
if (mShouldFilterCache != null) {
|
synchronized (mCacheLock) {
|
||||||
// update the cache in a one-off manner since we've got all the information we need.
|
if (mShouldFilterCache != null) {
|
||||||
SparseBooleanArray visibleUids = mShouldFilterCache.get(recipientUid);
|
// update the cache in a one-off manner since we've got all the information we
|
||||||
if (visibleUids == null) {
|
// need.
|
||||||
visibleUids = new SparseBooleanArray();
|
SparseBooleanArray visibleUids = mShouldFilterCache.get(recipientUid);
|
||||||
mShouldFilterCache.put(recipientUid, visibleUids);
|
if (visibleUids == null) {
|
||||||
|
visibleUids = new SparseBooleanArray();
|
||||||
|
mShouldFilterCache.put(recipientUid, visibleUids);
|
||||||
|
}
|
||||||
|
visibleUids.put(visibleUid, false);
|
||||||
}
|
}
|
||||||
visibleUids.put(visibleUid, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSystemReady() {
|
public void onSystemReady() {
|
||||||
mStateProvider.runWithState(new StateProvider.CurrentStateCallback() {
|
|
||||||
@Override
|
|
||||||
public void currentState(ArrayMap<String, PackageSetting> settings,
|
|
||||||
UserInfo[] users) {
|
|
||||||
mShouldFilterCache = new SparseArray<>(users.length * settings.size());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mFeatureConfig.onSystemReady();
|
|
||||||
mOverlayReferenceMapper.rebuildIfDeferred();
|
mOverlayReferenceMapper.rebuildIfDeferred();
|
||||||
updateEntireShouldFilterCache();
|
mFeatureConfig.onSystemReady();
|
||||||
|
|
||||||
|
updateEntireShouldFilterCacheAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -510,10 +528,12 @@ public class AppsFilter {
|
|||||||
}
|
}
|
||||||
mStateProvider.runWithState((settings, users) -> {
|
mStateProvider.runWithState((settings, users) -> {
|
||||||
addPackageInternal(newPkgSetting, settings);
|
addPackageInternal(newPkgSetting, settings);
|
||||||
if (mShouldFilterCache != null) {
|
synchronized (mCacheLock) {
|
||||||
updateShouldFilterCacheForPackage(
|
if (mShouldFilterCache != null) {
|
||||||
null, newPkgSetting, settings, users, settings.size());
|
updateShouldFilterCacheForPackage(mShouldFilterCache, null, newPkgSetting,
|
||||||
} // else, rebuild entire cache when system is ready
|
settings, users, settings.size());
|
||||||
|
} // else, rebuild entire cache when system is ready
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
|
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
|
||||||
@@ -607,6 +627,7 @@ public class AppsFilter {
|
|||||||
mFeatureConfig.updatePackageState(newPkgSetting, false /*removed*/);
|
mFeatureConfig.updatePackageState(newPkgSetting, false /*removed*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GuardedBy("mCacheLock")
|
||||||
private void removeAppIdFromVisibilityCache(int appId) {
|
private void removeAppIdFromVisibilityCache(int appId) {
|
||||||
if (mShouldFilterCache == null) {
|
if (mShouldFilterCache == null) {
|
||||||
return;
|
return;
|
||||||
@@ -627,31 +648,95 @@ public class AppsFilter {
|
|||||||
|
|
||||||
private void updateEntireShouldFilterCache() {
|
private void updateEntireShouldFilterCache() {
|
||||||
mStateProvider.runWithState((settings, users) -> {
|
mStateProvider.runWithState((settings, users) -> {
|
||||||
mShouldFilterCache.clear();
|
SparseArray<SparseBooleanArray> cache =
|
||||||
for (int i = settings.size() - 1; i >= 0; i--) {
|
updateEntireShouldFilterCacheInner(settings, users);
|
||||||
updateShouldFilterCacheForPackage(
|
synchronized (mCacheLock) {
|
||||||
null /*skipPackage*/, settings.valueAt(i), settings, users, i);
|
mShouldFilterCache = cache;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private SparseArray<SparseBooleanArray> updateEntireShouldFilterCacheInner(
|
||||||
|
ArrayMap<String, PackageSetting> settings, UserInfo[] users) {
|
||||||
|
SparseArray<SparseBooleanArray> cache =
|
||||||
|
new SparseArray<>(users.length * settings.size());
|
||||||
|
for (int i = settings.size() - 1; i >= 0; i--) {
|
||||||
|
updateShouldFilterCacheForPackage(cache,
|
||||||
|
null /*skipPackage*/, settings.valueAt(i), settings, users, i);
|
||||||
|
}
|
||||||
|
return cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateEntireShouldFilterCacheAsync() {
|
||||||
|
mBackgroundExecutor.execute(() -> {
|
||||||
|
final ArrayMap<String, PackageSetting> settingsCopy = new ArrayMap<>();
|
||||||
|
final ArrayMap<String, AndroidPackage> packagesCache = new ArrayMap<>();
|
||||||
|
final UserInfo[][] usersRef = new UserInfo[1][];
|
||||||
|
mStateProvider.runWithState((settings, users) -> {
|
||||||
|
packagesCache.ensureCapacity(settings.size());
|
||||||
|
settingsCopy.putAll(settings);
|
||||||
|
usersRef[0] = users;
|
||||||
|
// store away the references to the immutable packages, since settings are retained
|
||||||
|
// during updates.
|
||||||
|
for (int i = 0, max = settings.size(); i < max; i++) {
|
||||||
|
final AndroidPackage pkg = settings.valueAt(i).pkg;
|
||||||
|
packagesCache.put(settings.keyAt(i), pkg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
SparseArray<SparseBooleanArray> cache =
|
||||||
|
updateEntireShouldFilterCacheInner(settingsCopy, usersRef[0]);
|
||||||
|
boolean[] changed = new boolean[1];
|
||||||
|
// We have a cache, let's make sure the world hasn't changed out from under us.
|
||||||
|
mStateProvider.runWithState((settings, users) -> {
|
||||||
|
if (settings.size() != settingsCopy.size()) {
|
||||||
|
changed[0] = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 0, max = settings.size(); i < max; i++) {
|
||||||
|
final AndroidPackage pkg = settings.valueAt(i).pkg;
|
||||||
|
if (!Objects.equals(pkg, packagesCache.get(settings.keyAt(i)))) {
|
||||||
|
changed[0] = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (changed[0]) {
|
||||||
|
// Something has changed, just update the cache inline with the lock held
|
||||||
|
updateEntireShouldFilterCache();
|
||||||
|
if (DEBUG_LOGGING) {
|
||||||
|
Slog.i(TAG, "Rebuilding cache with lock due to package change.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
synchronized (mCacheLock) {
|
||||||
|
mShouldFilterCache = cache;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUsersChanged() {
|
public void onUsersChanged() {
|
||||||
if (mShouldFilterCache != null) {
|
synchronized (mCacheLock) {
|
||||||
updateEntireShouldFilterCache();
|
if (mShouldFilterCache != null) {
|
||||||
|
updateEntireShouldFilterCache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateShouldFilterCacheForPackage(String packageName) {
|
private void updateShouldFilterCacheForPackage(String packageName) {
|
||||||
mStateProvider.runWithState((settings, users) -> {
|
synchronized (mCacheLock) {
|
||||||
updateShouldFilterCacheForPackage(null /* skipPackage */, settings.get(packageName),
|
if (mShouldFilterCache != null) {
|
||||||
settings, users, settings.size() /*maxIndex*/);
|
mStateProvider.runWithState((settings, users) -> {
|
||||||
});
|
updateShouldFilterCacheForPackage(mShouldFilterCache, null /* skipPackage */,
|
||||||
|
settings.get(packageName), settings, users,
|
||||||
|
settings.size() /*maxIndex*/);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateShouldFilterCacheForPackage(@Nullable String skipPackageName,
|
private void updateShouldFilterCacheForPackage(SparseArray<SparseBooleanArray> cache,
|
||||||
PackageSetting subjectSetting, ArrayMap<String, PackageSetting> allSettings,
|
@Nullable String skipPackageName, PackageSetting subjectSetting, ArrayMap<String,
|
||||||
UserInfo[] allUsers, int maxIndex) {
|
PackageSetting> allSettings, UserInfo[] allUsers, int maxIndex) {
|
||||||
for (int i = Math.min(maxIndex, allSettings.size() - 1); i >= 0; i--) {
|
for (int i = Math.min(maxIndex, allSettings.size() - 1); i >= 0; i--) {
|
||||||
PackageSetting otherSetting = allSettings.valueAt(i);
|
PackageSetting otherSetting = allSettings.valueAt(i);
|
||||||
if (subjectSetting.appId == otherSetting.appId) {
|
if (subjectSetting.appId == otherSetting.appId) {
|
||||||
@@ -668,17 +753,17 @@ public class AppsFilter {
|
|||||||
for (int ou = 0; ou < userCount; ou++) {
|
for (int ou = 0; ou < userCount; ou++) {
|
||||||
int otherUser = allUsers[ou].id;
|
int otherUser = allUsers[ou].id;
|
||||||
int subjectUid = UserHandle.getUid(subjectUser, subjectSetting.appId);
|
int subjectUid = UserHandle.getUid(subjectUser, subjectSetting.appId);
|
||||||
if (!mShouldFilterCache.contains(subjectUid)) {
|
if (!cache.contains(subjectUid)) {
|
||||||
mShouldFilterCache.put(subjectUid, new SparseBooleanArray(appxUidCount));
|
cache.put(subjectUid, new SparseBooleanArray(appxUidCount));
|
||||||
}
|
}
|
||||||
int otherUid = UserHandle.getUid(otherUser, otherSetting.appId);
|
int otherUid = UserHandle.getUid(otherUser, otherSetting.appId);
|
||||||
if (!mShouldFilterCache.contains(otherUid)) {
|
if (!cache.contains(otherUid)) {
|
||||||
mShouldFilterCache.put(otherUid, new SparseBooleanArray(appxUidCount));
|
cache.put(otherUid, new SparseBooleanArray(appxUidCount));
|
||||||
}
|
}
|
||||||
mShouldFilterCache.get(subjectUid).put(otherUid,
|
cache.get(subjectUid).put(otherUid,
|
||||||
shouldFilterApplicationInternal(
|
shouldFilterApplicationInternal(
|
||||||
subjectUid, subjectSetting, otherSetting, otherUser));
|
subjectUid, subjectSetting, otherSetting, otherUser));
|
||||||
mShouldFilterCache.get(otherUid).put(subjectUid,
|
cache.get(otherUid).put(subjectUid,
|
||||||
shouldFilterApplicationInternal(
|
shouldFilterApplicationInternal(
|
||||||
otherUid, otherSetting, subjectSetting, subjectUser));
|
otherUid, otherSetting, subjectSetting, subjectUser));
|
||||||
}
|
}
|
||||||
@@ -712,7 +797,8 @@ public class AppsFilter {
|
|||||||
* This method recomputes all component / intent-based visibility and is intended to match the
|
* This method recomputes all component / intent-based visibility and is intended to match the
|
||||||
* relevant logic of {@link #addPackageInternal(PackageSetting, ArrayMap)}
|
* relevant logic of {@link #addPackageInternal(PackageSetting, ArrayMap)}
|
||||||
*/
|
*/
|
||||||
private void recomputeComponentVisibility(ArrayMap<String, PackageSetting> existingSettings) {
|
private void recomputeComponentVisibility(
|
||||||
|
ArrayMap<String, PackageSetting> existingSettings) {
|
||||||
mQueriesViaComponent.clear();
|
mQueriesViaComponent.clear();
|
||||||
for (int i = existingSettings.size() - 1; i >= 0; i--) {
|
for (int i = existingSettings.size() - 1; i >= 0; i--) {
|
||||||
PackageSetting setting = existingSettings.valueAt(i);
|
PackageSetting setting = existingSettings.valueAt(i);
|
||||||
@@ -854,15 +940,17 @@ public class AppsFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeAppIdFromVisibilityCache(setting.appId);
|
synchronized (mCacheLock) {
|
||||||
if (mShouldFilterCache != null && setting.sharedUser != null) {
|
removeAppIdFromVisibilityCache(setting.appId);
|
||||||
for (int i = setting.sharedUser.packages.size() - 1; i >= 0; i--) {
|
if (mShouldFilterCache != null && setting.sharedUser != null) {
|
||||||
PackageSetting siblingSetting = setting.sharedUser.packages.valueAt(i);
|
for (int i = setting.sharedUser.packages.size() - 1; i >= 0; i--) {
|
||||||
if (siblingSetting == setting) {
|
PackageSetting siblingSetting = setting.sharedUser.packages.valueAt(i);
|
||||||
continue;
|
if (siblingSetting == setting) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
updateShouldFilterCacheForPackage(mShouldFilterCache, setting.name,
|
||||||
|
siblingSetting, settings, users, settings.size());
|
||||||
}
|
}
|
||||||
updateShouldFilterCacheForPackage(
|
|
||||||
setting.name, siblingSetting, settings, users, settings.size());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -888,26 +976,29 @@ public class AppsFilter {
|
|||||||
|| callingAppId == targetPkgSetting.appId) {
|
|| callingAppId == targetPkgSetting.appId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mShouldFilterCache != null) { // use cache
|
synchronized (mCacheLock) {
|
||||||
SparseBooleanArray shouldFilterTargets = mShouldFilterCache.get(callingUid);
|
if (mShouldFilterCache != null) { // use cache
|
||||||
final int targetUid = UserHandle.getUid(userId, targetPkgSetting.appId);
|
SparseBooleanArray shouldFilterTargets = mShouldFilterCache.get(callingUid);
|
||||||
if (shouldFilterTargets == null) {
|
final int targetUid = UserHandle.getUid(userId, targetPkgSetting.appId);
|
||||||
Slog.wtf(TAG, "Encountered calling uid with no cached rules: " + callingUid);
|
if (shouldFilterTargets == null) {
|
||||||
return true;
|
Slog.wtf(TAG, "Encountered calling uid with no cached rules: "
|
||||||
}
|
+ callingUid);
|
||||||
int indexOfTargetUid = shouldFilterTargets.indexOfKey(targetUid);
|
return true;
|
||||||
if (indexOfTargetUid < 0) {
|
}
|
||||||
Slog.w(TAG, "Encountered calling -> target with no cached rules: "
|
int indexOfTargetUid = shouldFilterTargets.indexOfKey(targetUid);
|
||||||
+ callingUid + " -> " + targetUid);
|
if (indexOfTargetUid < 0) {
|
||||||
return true;
|
Slog.w(TAG, "Encountered calling -> target with no cached rules: "
|
||||||
}
|
+ callingUid + " -> " + targetUid);
|
||||||
if (!shouldFilterTargets.valueAt(indexOfTargetUid)) {
|
return true;
|
||||||
return false;
|
}
|
||||||
}
|
if (!shouldFilterTargets.valueAt(indexOfTargetUid)) {
|
||||||
} else {
|
return false;
|
||||||
if (!shouldFilterApplicationInternal(
|
}
|
||||||
callingUid, callingSetting, targetPkgSetting, userId)) {
|
} else {
|
||||||
return false;
|
if (!shouldFilterApplicationInternal(
|
||||||
|
callingUid, callingSetting, targetPkgSetting, userId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DEBUG_LOGGING || mFeatureConfig.isLoggingEnabled(callingAppId)) {
|
if (DEBUG_LOGGING || mFeatureConfig.isLoggingEnabled(callingAppId)) {
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.IntFunction;
|
import java.util.function.IntFunction;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
@Presubmit
|
@Presubmit
|
||||||
@RunWith(JUnit4.class)
|
@RunWith(JUnit4.class)
|
||||||
@@ -91,6 +92,8 @@ public class AppsFilterTest {
|
|||||||
AppsFilter.FeatureConfig mFeatureConfigMock;
|
AppsFilter.FeatureConfig mFeatureConfigMock;
|
||||||
@Mock
|
@Mock
|
||||||
AppsFilter.StateProvider mStateProvider;
|
AppsFilter.StateProvider mStateProvider;
|
||||||
|
@Mock
|
||||||
|
Executor mMockExecutor;
|
||||||
|
|
||||||
private ArrayMap<String, PackageSetting> mExisting = new ArrayMap<>();
|
private ArrayMap<String, PackageSetting> mExisting = new ArrayMap<>();
|
||||||
|
|
||||||
@@ -187,10 +190,15 @@ public class AppsFilterTest {
|
|||||||
doAnswer(invocation -> {
|
doAnswer(invocation -> {
|
||||||
((AppsFilter.StateProvider.CurrentStateCallback) invocation.getArgument(0))
|
((AppsFilter.StateProvider.CurrentStateCallback) invocation.getArgument(0))
|
||||||
.currentState(mExisting, USER_INFO_LIST);
|
.currentState(mExisting, USER_INFO_LIST);
|
||||||
return null;
|
return new Object();
|
||||||
}).when(mStateProvider)
|
}).when(mStateProvider)
|
||||||
.runWithState(any(AppsFilter.StateProvider.CurrentStateCallback.class));
|
.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.isGloballyEnabled()).thenReturn(true);
|
||||||
when(mFeatureConfigMock.packageIsEnabled(any(AndroidPackage.class))).thenAnswer(
|
when(mFeatureConfigMock.packageIsEnabled(any(AndroidPackage.class))).thenAnswer(
|
||||||
(Answer<Boolean>) invocation ->
|
(Answer<Boolean>) invocation ->
|
||||||
@@ -201,7 +209,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testSystemReadyPropogates() throws Exception {
|
public void testSystemReadyPropogates() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
verify(mFeatureConfigMock).onSystemReady();
|
verify(mFeatureConfigMock).onSystemReady();
|
||||||
}
|
}
|
||||||
@@ -209,7 +218,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testQueriesAction_FilterMatches() throws Exception {
|
public void testQueriesAction_FilterMatches() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -225,7 +235,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testQueriesProtectedAction_FilterDoesNotMatch() throws Exception {
|
public void testQueriesProtectedAction_FilterDoesNotMatch() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
final Signature frameworkSignature = Mockito.mock(Signature.class);
|
final Signature frameworkSignature = Mockito.mock(Signature.class);
|
||||||
final PackageParser.SigningDetails frameworkSigningDetails =
|
final PackageParser.SigningDetails frameworkSigningDetails =
|
||||||
new PackageParser.SigningDetails(new Signature[]{frameworkSignature}, 1);
|
new PackageParser.SigningDetails(new Signature[]{frameworkSignature}, 1);
|
||||||
@@ -263,7 +274,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testQueriesProvider_FilterMatches() throws Exception {
|
public void testQueriesProvider_FilterMatches() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -280,7 +292,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testQueriesDifferentProvider_Filters() throws Exception {
|
public void testQueriesDifferentProvider_Filters() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -297,7 +310,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testQueriesProviderWithSemiColon_FilterMatches() throws Exception {
|
public void testQueriesProviderWithSemiColon_FilterMatches() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -315,7 +329,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testQueriesAction_NoMatchingAction_Filters() throws Exception {
|
public void testQueriesAction_NoMatchingAction_Filters() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -331,7 +346,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testQueriesAction_NoMatchingActionFilterLowSdk_DoesntFilter() throws Exception {
|
public void testQueriesAction_NoMatchingActionFilterLowSdk_DoesntFilter() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -351,7 +367,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testNoQueries_Filters() throws Exception {
|
public void testNoQueries_Filters() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -367,7 +384,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testForceQueryable_SystemDoesntFilter() throws Exception {
|
public void testForceQueryable_SystemDoesntFilter() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -385,7 +403,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testForceQueryable_NonSystemFilters() throws Exception {
|
public void testForceQueryable_NonSystemFilters() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -402,7 +421,7 @@ public class AppsFilterTest {
|
|||||||
public void testForceQueryableByDevice_SystemCaller_DoesntFilter() throws Exception {
|
public void testForceQueryableByDevice_SystemCaller_DoesntFilter() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{"com.some.package"},
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{"com.some.package"},
|
||||||
false, null);
|
false, null, mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -420,7 +439,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testSystemSignedTarget_DoesntFilter() throws CertificateException {
|
public void testSystemSignedTarget_DoesntFilter() throws CertificateException {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
final Signature frameworkSignature = Mockito.mock(Signature.class);
|
final Signature frameworkSignature = Mockito.mock(Signature.class);
|
||||||
@@ -449,7 +469,7 @@ public class AppsFilterTest {
|
|||||||
public void testForceQueryableByDevice_NonSystemCaller_Filters() throws Exception {
|
public void testForceQueryableByDevice_NonSystemCaller_Filters() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{"com.some.package"},
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{"com.some.package"},
|
||||||
false, null);
|
false, null, mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -467,7 +487,7 @@ public class AppsFilterTest {
|
|||||||
public void testSystemQueryable_DoesntFilter() throws Exception {
|
public void testSystemQueryable_DoesntFilter() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{},
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{},
|
||||||
true /* system force queryable */, null);
|
true /* system force queryable */, null, mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -484,7 +504,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testQueriesPackage_DoesntFilter() throws Exception {
|
public void testQueriesPackage_DoesntFilter() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -502,7 +523,8 @@ public class AppsFilterTest {
|
|||||||
when(mFeatureConfigMock.packageIsEnabled(any(AndroidPackage.class)))
|
when(mFeatureConfigMock.packageIsEnabled(any(AndroidPackage.class)))
|
||||||
.thenReturn(false);
|
.thenReturn(false);
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -518,7 +540,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testSystemUid_DoesntFilter() throws Exception {
|
public void testSystemUid_DoesntFilter() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -533,7 +556,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testSystemUidSecondaryUser_DoesntFilter() throws Exception {
|
public void testSystemUidSecondaryUser_DoesntFilter() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -549,7 +573,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testNonSystemUid_NoCallingSetting_Filters() throws Exception {
|
public void testNonSystemUid_NoCallingSetting_Filters() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -563,7 +588,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testNoTargetPackage_filters() throws Exception {
|
public void testNoTargetPackage_filters() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -621,7 +647,8 @@ public class AppsFilterTest {
|
|||||||
}
|
}
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -693,7 +720,8 @@ public class AppsFilterTest {
|
|||||||
}
|
}
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -718,7 +746,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testInitiatingApp_DoesntFilter() throws Exception {
|
public void testInitiatingApp_DoesntFilter() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -734,7 +763,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testUninstalledInitiatingApp_Filters() throws Exception {
|
public void testUninstalledInitiatingApp_Filters() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -750,7 +780,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testOriginatingApp_Filters() throws Exception {
|
public void testOriginatingApp_Filters() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -766,7 +797,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testInstallingApp_DoesntFilter() throws Exception {
|
public void testInstallingApp_DoesntFilter() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -782,7 +814,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testInstrumentation_DoesntFilter() throws Exception {
|
public void testInstrumentation_DoesntFilter() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
@@ -804,7 +837,8 @@ public class AppsFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testWhoCanSee() throws Exception {
|
public void testWhoCanSee() throws Exception {
|
||||||
final AppsFilter appsFilter =
|
final AppsFilter appsFilter =
|
||||||
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null);
|
new AppsFilter(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
|
||||||
|
mMockExecutor);
|
||||||
simulateAddBasicAndroid(appsFilter);
|
simulateAddBasicAndroid(appsFilter);
|
||||||
appsFilter.onSystemReady();
|
appsFilter.onSystemReady();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user