[automerge] Fix NPE in AppsFilter 2p: dd2636a4f8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17668627

Bug: 226668722
Change-Id: I0c6a461e08b2a230140a0966983696f50f0e4da7
This commit is contained in:
Presubmit Automerger Backend
2022-04-12 00:20:22 +00:00
2 changed files with 94 additions and 84 deletions

View File

@@ -76,6 +76,7 @@ import com.android.server.utils.Watcher;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
@@ -173,7 +174,6 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
private final FeatureConfig mFeatureConfig; private final FeatureConfig mFeatureConfig;
private final OverlayReferenceMapper mOverlayReferenceMapper; private final OverlayReferenceMapper mOverlayReferenceMapper;
private final StateProvider mStateProvider; private final StateProvider mStateProvider;
private final PackageManagerInternal mPmInternal;
private SigningDetails mSystemSigningDetails; private SigningDetails mSystemSigningDetails;
@Watched @Watched
@@ -284,15 +284,13 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
String[] forceQueryableList, String[] forceQueryableList,
boolean systemAppsQueryable, boolean systemAppsQueryable,
@Nullable OverlayReferenceMapper.Provider overlayProvider, @Nullable OverlayReferenceMapper.Provider overlayProvider,
Executor backgroundExecutor, Executor backgroundExecutor) {
PackageManagerInternal pmInternal) {
mFeatureConfig = featureConfig; mFeatureConfig = featureConfig;
mForceQueryableByDevicePackageNames = forceQueryableList; mForceQueryableByDevicePackageNames = forceQueryableList;
mSystemAppsQueryable = systemAppsQueryable; mSystemAppsQueryable = systemAppsQueryable;
mOverlayReferenceMapper = new OverlayReferenceMapper(true /*deferRebuild*/, mOverlayReferenceMapper = new OverlayReferenceMapper(true /*deferRebuild*/,
overlayProvider); overlayProvider);
mStateProvider = stateProvider; mStateProvider = stateProvider;
mPmInternal = pmInternal;
mBackgroundExecutor = backgroundExecutor; mBackgroundExecutor = backgroundExecutor;
mShouldFilterCache = new WatchedSparseBooleanMatrix(); mShouldFilterCache = new WatchedSparseBooleanMatrix();
mShouldFilterCacheSnapshot = new SnapshotCache.Auto<>( mShouldFilterCacheSnapshot = new SnapshotCache.Auto<>(
@@ -359,7 +357,6 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
} }
mBackgroundExecutor = null; mBackgroundExecutor = null;
mPmInternal = null;
mSnapshot = new SnapshotCache.Sealed<>(); mSnapshot = new SnapshotCache.Sealed<>();
mSystemReady = true; mSystemReady = true;
} }
@@ -397,6 +394,7 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
interface CurrentStateCallback { interface CurrentStateCallback {
void currentState(ArrayMap<String, ? extends PackageStateInternal> settings, void currentState(ArrayMap<String, ? extends PackageStateInternal> settings,
Collection<SharedUserSetting> sharedUserSettings,
UserInfo[] users); UserInfo[] users);
} }
} }
@@ -588,12 +586,13 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
final StateProvider stateProvider = command -> { final StateProvider stateProvider = command -> {
synchronized (injector.getLock()) { synchronized (injector.getLock()) {
command.currentState(injector.getSettings().getPackagesLocked().untrackedStorage(), command.currentState(injector.getSettings().getPackagesLocked().untrackedStorage(),
injector.getSettings().getAllSharedUsersLPw(),
injector.getUserManagerInternal().getUserInfos()); injector.getUserManagerInternal().getUserInfos());
} }
}; };
AppsFilterImpl appsFilter = new AppsFilterImpl(stateProvider, featureConfig, AppsFilterImpl appsFilter = new AppsFilterImpl(stateProvider, featureConfig,
forcedQueryablePackageNames, forceSystemAppsQueryable, null, forcedQueryablePackageNames, forceSystemAppsQueryable, null,
injector.getBackgroundExecutor(), pmInt); injector.getBackgroundExecutor());
featureConfig.setAppsFilter(appsFilter); featureConfig.setAppsFilter(appsFilter);
return appsFilter; return appsFilter;
} }
@@ -788,7 +787,7 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
// let's first remove any prior rules for this package // let's first remove any prior rules for this package
removePackage(newPkgSetting, true /*isReplace*/); removePackage(newPkgSetting, true /*isReplace*/);
} }
mStateProvider.runWithState((settings, users) -> { mStateProvider.runWithState((settings, sharedUserSettings, users) -> {
ArraySet<String> additionalChangedPackages = ArraySet<String> additionalChangedPackages =
addPackageInternal(newPkgSetting, settings); addPackageInternal(newPkgSetting, settings);
if (mSystemReady) { if (mSystemReady) {
@@ -806,9 +805,8 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
continue; continue;
} }
updateShouldFilterCacheForPackage(null, updateShouldFilterCacheForPackage(null, changedPkgSetting,
changedPkgSetting, settings, users, USER_ALL, settings, users, USER_ALL, settings.size());
settings.size());
} }
} }
} // else, rebuild entire cache when system is ready } // else, rebuild entire cache when system is ready
@@ -954,7 +952,7 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
} }
private void updateEntireShouldFilterCache(int subjectUserId) { private void updateEntireShouldFilterCache(int subjectUserId) {
mStateProvider.runWithState((settings, users) -> { mStateProvider.runWithState((settings, sharedUserSettings, users) -> {
int userId = USER_NULL; int userId = USER_NULL;
for (int u = 0; u < users.length; u++) { for (int u = 0; u < users.length; u++) {
if (subjectUserId == users[u].id) { if (subjectUserId == users[u].id) {
@@ -972,7 +970,8 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
} }
private void updateEntireShouldFilterCacheInner( private void updateEntireShouldFilterCacheInner(
ArrayMap<String, ? extends PackageStateInternal> settings, UserInfo[] users, ArrayMap<String, ? extends PackageStateInternal> settings,
UserInfo[] users,
int subjectUserId) { int subjectUserId) {
synchronized (mCacheLock) { synchronized (mCacheLock) {
if (subjectUserId == USER_ALL) { if (subjectUserId == USER_ALL) {
@@ -982,16 +981,19 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
} }
for (int i = settings.size() - 1; i >= 0; i--) { for (int i = settings.size() - 1; i >= 0; i--) {
updateShouldFilterCacheForPackage( updateShouldFilterCacheForPackage(
null /*skipPackage*/, settings.valueAt(i), settings, users, subjectUserId, i); null /*skipPackage*/, settings.valueAt(i), settings, users,
subjectUserId, i);
} }
} }
private void updateEntireShouldFilterCacheAsync() { private void updateEntireShouldFilterCacheAsync() {
mBackgroundExecutor.execute(() -> { mBackgroundExecutor.execute(() -> {
final ArrayMap<String, PackageStateInternal> settingsCopy = new ArrayMap<>(); final ArrayMap<String, PackageStateInternal> settingsCopy = new ArrayMap<>();
final Collection<SharedUserSetting> sharedUserSettingsCopy =
new ArraySet<SharedUserSetting>();
final ArrayMap<String, AndroidPackage> packagesCache = new ArrayMap<>(); final ArrayMap<String, AndroidPackage> packagesCache = new ArrayMap<>();
final UserInfo[][] usersRef = new UserInfo[1][]; final UserInfo[][] usersRef = new UserInfo[1][];
mStateProvider.runWithState((settings, users) -> { mStateProvider.runWithState((settings, sharedUserSettings, users) -> {
packagesCache.ensureCapacity(settings.size()); packagesCache.ensureCapacity(settings.size());
settingsCopy.putAll(settings); settingsCopy.putAll(settings);
usersRef[0] = users; usersRef[0] = users;
@@ -1001,11 +1003,12 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
final AndroidPackage pkg = settings.valueAt(i).getPkg(); final AndroidPackage pkg = settings.valueAt(i).getPkg();
packagesCache.put(settings.keyAt(i), pkg); packagesCache.put(settings.keyAt(i), pkg);
} }
sharedUserSettingsCopy.addAll(sharedUserSettings);
}); });
boolean[] changed = new boolean[1]; boolean[] changed = new boolean[1];
// We have a cache, let's make sure the world hasn't changed out from under us. // We have a cache, let's make sure the world hasn't changed out from under us.
mStateProvider.runWithState((settings, users) -> { mStateProvider.runWithState((settings, sharedUserSettings, users) -> {
if (settings.size() != settingsCopy.size()) { if (settings.size() != settingsCopy.size()) {
changed[0] = true; changed[0] = true;
return; return;
@@ -1025,7 +1028,8 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
Slog.i(TAG, "Rebuilding cache with lock due to package change."); Slog.i(TAG, "Rebuilding cache with lock due to package change.");
} }
} else { } else {
updateEntireShouldFilterCacheInner(settingsCopy, usersRef[0], USER_ALL); updateEntireShouldFilterCacheInner(settingsCopy,
usersRef[0], USER_ALL);
} }
}); });
} }
@@ -1047,7 +1051,7 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
} }
private void updateShouldFilterCacheForPackage(String packageName) { private void updateShouldFilterCacheForPackage(String packageName) {
mStateProvider.runWithState((settings, users) -> { mStateProvider.runWithState((settings, sharedUserSettings, users) -> {
if (!mSystemReady) { if (!mSystemReady) {
return; return;
} }
@@ -1249,7 +1253,7 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
* @param isReplace if the package is being replaced. * @param isReplace if the package is being replaced.
*/ */
public void removePackage(PackageStateInternal setting, boolean isReplace) { public void removePackage(PackageStateInternal setting, boolean isReplace) {
mStateProvider.runWithState((settings, users) -> { mStateProvider.runWithState((settings, sharedUserSettings, users) -> {
final ArraySet<String> additionalChangedPackages; final ArraySet<String> additionalChangedPackages;
final int userCount = users.length; final int userCount = users.length;
for (int u = 0; u < userCount; u++) { for (int u = 0; u < userCount; u++) {
@@ -1314,8 +1318,8 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
// update the // update the
// cache // cache
if (setting.hasSharedUser()) { if (setting.hasSharedUser()) {
final ArraySet<PackageStateInternal> sharedUserPackages = final ArraySet<? extends PackageStateInternal> sharedUserPackages =
mPmInternal.getSharedUserPackages(setting.getSharedUserAppId()); getSharedUserPackages(setting.getSharedUserAppId(), sharedUserSettings);
for (int i = sharedUserPackages.size() - 1; i >= 0; i--) { for (int i = sharedUserPackages.size() - 1; i >= 0; i--) {
if (sharedUserPackages.valueAt(i) == setting) { if (sharedUserPackages.valueAt(i) == setting) {
continue; continue;
@@ -1327,8 +1331,8 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
removeAppIdFromVisibilityCache(setting.getAppId()); removeAppIdFromVisibilityCache(setting.getAppId());
if (mSystemReady && setting.hasSharedUser()) { if (mSystemReady && setting.hasSharedUser()) {
final ArraySet<PackageStateInternal> sharedUserPackages = final ArraySet<? extends PackageStateInternal> sharedUserPackages =
mPmInternal.getSharedUserPackages(setting.getSharedUserAppId()); getSharedUserPackages(setting.getSharedUserAppId(), sharedUserSettings);
for (int i = sharedUserPackages.size() - 1; i >= 0; i--) { for (int i = sharedUserPackages.size() - 1; i >= 0; i--) {
PackageStateInternal siblingSetting = PackageStateInternal siblingSetting =
sharedUserPackages.valueAt(i); sharedUserPackages.valueAt(i);
@@ -1336,8 +1340,8 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
continue; continue;
} }
updateShouldFilterCacheForPackage( updateShouldFilterCacheForPackage(
setting.getPackageName(), siblingSetting, settings, users, setting.getPackageName(), siblingSetting, settings,
USER_ALL, settings.size()); users, USER_ALL, settings.size());
} }
} }
@@ -1353,8 +1357,8 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
continue; continue;
} }
updateShouldFilterCacheForPackage(null, updateShouldFilterCacheForPackage(null, changedPkgSetting,
changedPkgSetting, settings, users, USER_ALL, settings.size()); settings, users, USER_ALL, settings.size());
} }
} }
} }
@@ -1363,6 +1367,17 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
}); });
} }
private ArraySet<? extends PackageStateInternal> getSharedUserPackages(int sharedUserAppId,
Collection<SharedUserSetting> sharedUserSettings) {
for (SharedUserSetting setting : sharedUserSettings) {
if (setting.mAppId != sharedUserAppId) {
continue;
}
return setting.getPackageStates();
}
return new ArraySet<>();
}
/** /**
* See * See
* {@link AppsFilterSnapshot#shouldFilterApplication(int, Object, PackageStateInternal, * {@link AppsFilterSnapshot#shouldFilterApplication(int, Object, PackageStateInternal,
@@ -1441,23 +1456,25 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
return true; return true;
} }
final PackageStateInternal callingPkgSetting; final PackageStateInternal callingPkgSetting;
final ArraySet<? extends PackageStateInternal> callingSharedPkgSettings;
if (DEBUG_TRACING) { if (DEBUG_TRACING) {
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "callingSetting instanceof"); Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "callingSetting instanceof");
} }
final ArraySet<PackageStateInternal> callingSharedPkgSettings = new ArraySet<>();
if (callingSetting instanceof PackageStateInternal) { if (callingSetting instanceof PackageStateInternal) {
final PackageStateInternal packageState = (PackageStateInternal) callingSetting; final PackageStateInternal packageState = (PackageStateInternal) callingSetting;
if (packageState.hasSharedUser()) { if (packageState.hasSharedUser()) {
callingPkgSetting = null; callingPkgSetting = null;
callingSharedPkgSettings = mPmInternal.getSharedUserPackages( mStateProvider.runWithState((settings, sharedUserSettings, users) ->
packageState.getSharedUserAppId()); callingSharedPkgSettings.addAll(getSharedUserPackages(
packageState.getSharedUserAppId(), sharedUserSettings)));
} else { } else {
callingPkgSetting = packageState; callingPkgSetting = packageState;
callingSharedPkgSettings = null;
} }
} else { } else {
callingPkgSetting = null; callingPkgSetting = null;
callingSharedPkgSettings = ((SharedUserSetting) callingSetting).getPackageStates(); callingSharedPkgSettings.addAll(
((SharedUserSetting) callingSetting).getPackageStates());
} }
if (DEBUG_TRACING) { if (DEBUG_TRACING) {
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
@@ -1576,7 +1593,7 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "mQueriesViaComponent"); Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "mQueriesViaComponent");
} }
if (mQueriesViaComponentRequireRecompute) { if (mQueriesViaComponentRequireRecompute) {
mStateProvider.runWithState((settings, users) -> { mStateProvider.runWithState((settings, sharedUserSettings, users) -> {
recomputeComponentVisibility(settings); recomputeComponentVisibility(settings);
}); });
} }
@@ -1632,7 +1649,7 @@ public class AppsFilterImpl implements AppsFilterSnapshot, Watchable, Snappable
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "mOverlayReferenceMapper"); Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "mOverlayReferenceMapper");
} }
final String targetName = targetPkg.getPackageName(); final String targetName = targetPkg.getPackageName();
if (callingSharedPkgSettings != null) { if (!callingSharedPkgSettings.isEmpty()) {
int size = callingSharedPkgSettings.size(); int size = callingSharedPkgSettings.size();
for (int index = 0; index < size; index++) { for (int index = 0; index < size; index++) {
PackageStateInternal pkgSetting = callingSharedPkgSettings.valueAt(index); PackageStateInternal pkgSetting = callingSharedPkgSettings.valueAt(index);

View File

@@ -30,7 +30,6 @@ import android.annotation.Nullable;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManagerInternal;
import android.content.pm.Signature; import android.content.pm.Signature;
import android.content.pm.SigningDetails; import android.content.pm.SigningDetails;
import android.content.pm.UserInfo; import android.content.pm.UserInfo;
@@ -48,7 +47,6 @@ import com.android.server.om.OverlayReferenceMapper;
import com.android.server.pm.parsing.pkg.AndroidPackage; import com.android.server.pm.parsing.pkg.AndroidPackage;
import com.android.server.pm.parsing.pkg.PackageImpl; import com.android.server.pm.parsing.pkg.PackageImpl;
import com.android.server.pm.parsing.pkg.ParsedPackage; import com.android.server.pm.parsing.pkg.ParsedPackage;
import com.android.server.pm.pkg.PackageStateInternal;
import com.android.server.pm.pkg.component.ParsedActivity; import com.android.server.pm.pkg.component.ParsedActivity;
import com.android.server.pm.pkg.component.ParsedActivityImpl; import com.android.server.pm.pkg.component.ParsedActivityImpl;
import com.android.server.pm.pkg.component.ParsedInstrumentationImpl; import com.android.server.pm.pkg.component.ParsedInstrumentationImpl;
@@ -69,6 +67,7 @@ import org.mockito.stubbing.Answer;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -103,10 +102,9 @@ public class AppsFilterImplTest {
AppsFilterImpl.StateProvider mStateProvider; AppsFilterImpl.StateProvider mStateProvider;
@Mock @Mock
Executor mMockExecutor; Executor mMockExecutor;
@Mock
PackageManagerInternal mMockPmInternal;
private ArrayMap<String, PackageSetting> mExisting = new ArrayMap<>(); private ArrayMap<String, PackageSetting> mExisting = new ArrayMap<>();
private Collection<SharedUserSetting> mSharedUserSettings = new ArraySet<>();
private static ParsingPackage pkg(String packageName) { private static ParsingPackage pkg(String packageName) {
return PackageImpl.forTesting(packageName) return PackageImpl.forTesting(packageName)
@@ -205,7 +203,7 @@ public class AppsFilterImplTest {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
doAnswer(invocation -> { doAnswer(invocation -> {
((AppsFilterImpl.StateProvider.CurrentStateCallback) invocation.getArgument(0)) ((AppsFilterImpl.StateProvider.CurrentStateCallback) invocation.getArgument(0))
.currentState(mExisting, USER_INFO_LIST); .currentState(mExisting, mSharedUserSettings, USER_INFO_LIST);
return new Object(); return new Object();
}).when(mStateProvider) }).when(mStateProvider)
.runWithState(any(AppsFilterImpl.StateProvider.CurrentStateCallback.class)); .runWithState(any(AppsFilterImpl.StateProvider.CurrentStateCallback.class));
@@ -226,7 +224,7 @@ public class AppsFilterImplTest {
public void testSystemReadyPropogates() throws Exception { public void testSystemReadyPropogates() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
final WatchableTester watcher = new WatchableTester(appsFilter, "onChange"); final WatchableTester watcher = new WatchableTester(appsFilter, "onChange");
watcher.register(); watcher.register();
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -238,7 +236,7 @@ public class AppsFilterImplTest {
public void testQueriesAction_FilterMatches() throws Exception { public void testQueriesAction_FilterMatches() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
final WatchableTester watcher = new WatchableTester(appsFilter, "onChange"); final WatchableTester watcher = new WatchableTester(appsFilter, "onChange");
watcher.register(); watcher.register();
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
@@ -261,7 +259,7 @@ public class AppsFilterImplTest {
public void testQueriesProtectedAction_FilterDoesNotMatch() throws Exception { public void testQueriesProtectedAction_FilterDoesNotMatch() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
final WatchableTester watcher = new WatchableTester(appsFilter, "onChange"); final WatchableTester watcher = new WatchableTester(appsFilter, "onChange");
watcher.register(); watcher.register();
final Signature frameworkSignature = Mockito.mock(Signature.class); final Signature frameworkSignature = Mockito.mock(Signature.class);
@@ -310,7 +308,7 @@ public class AppsFilterImplTest {
public void testQueriesProvider_FilterMatches() throws Exception { public void testQueriesProvider_FilterMatches() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
final WatchableTester watcher = new WatchableTester(appsFilter, "onChange"); final WatchableTester watcher = new WatchableTester(appsFilter, "onChange");
watcher.register(); watcher.register();
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
@@ -335,7 +333,7 @@ public class AppsFilterImplTest {
public void testOnUserUpdated_FilterMatches() throws Exception { public void testOnUserUpdated_FilterMatches() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -357,7 +355,7 @@ public class AppsFilterImplTest {
// adds new user // adds new user
doAnswer(invocation -> { doAnswer(invocation -> {
((AppsFilterImpl.StateProvider.CurrentStateCallback) invocation.getArgument(0)) ((AppsFilterImpl.StateProvider.CurrentStateCallback) invocation.getArgument(0))
.currentState(mExisting, USER_INFO_LIST_WITH_ADDED); .currentState(mExisting, mSharedUserSettings, USER_INFO_LIST_WITH_ADDED);
return new Object(); return new Object();
}).when(mStateProvider) }).when(mStateProvider)
.runWithState(any(AppsFilterImpl.StateProvider.CurrentStateCallback.class)); .runWithState(any(AppsFilterImpl.StateProvider.CurrentStateCallback.class));
@@ -374,7 +372,7 @@ public class AppsFilterImplTest {
// delete user // delete user
doAnswer(invocation -> { doAnswer(invocation -> {
((AppsFilterImpl.StateProvider.CurrentStateCallback) invocation.getArgument(0)) ((AppsFilterImpl.StateProvider.CurrentStateCallback) invocation.getArgument(0))
.currentState(mExisting, USER_INFO_LIST); .currentState(mExisting, mSharedUserSettings, USER_INFO_LIST);
return new Object(); return new Object();
}).when(mStateProvider) }).when(mStateProvider)
.runWithState(any(AppsFilterImpl.StateProvider.CurrentStateCallback.class)); .runWithState(any(AppsFilterImpl.StateProvider.CurrentStateCallback.class));
@@ -393,7 +391,7 @@ public class AppsFilterImplTest {
public void testQueriesDifferentProvider_Filters() throws Exception { public void testQueriesDifferentProvider_Filters() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
final WatchableTester watcher = new WatchableTester(appsFilter, "onChange"); final WatchableTester watcher = new WatchableTester(appsFilter, "onChange");
watcher.register(); watcher.register();
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
@@ -418,7 +416,7 @@ public class AppsFilterImplTest {
public void testQueriesProviderWithSemiColon_FilterMatches() throws Exception { public void testQueriesProviderWithSemiColon_FilterMatches() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -437,7 +435,7 @@ public class AppsFilterImplTest {
public void testQueriesAction_NoMatchingAction_Filters() throws Exception { public void testQueriesAction_NoMatchingAction_Filters() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -454,7 +452,7 @@ public class AppsFilterImplTest {
public void testQueriesAction_NoMatchingActionFilterLowSdk_DoesntFilter() throws Exception { public void testQueriesAction_NoMatchingActionFilterLowSdk_DoesntFilter() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -475,7 +473,7 @@ public class AppsFilterImplTest {
public void testNoQueries_Filters() throws Exception { public void testNoQueries_Filters() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -492,7 +490,7 @@ public class AppsFilterImplTest {
public void testNoUsesLibrary_Filters() throws Exception { public void testNoUsesLibrary_Filters() throws Exception {
final AppsFilterImpl appsFilter = new AppsFilterImpl(mStateProvider, mFeatureConfigMock, final AppsFilterImpl appsFilter = new AppsFilterImpl(mStateProvider, mFeatureConfigMock,
new String[]{}, /* systemAppsQueryable */ false, /* overlayProvider */ null, new String[]{}, /* systemAppsQueryable */ false, /* overlayProvider */ null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -518,7 +516,7 @@ public class AppsFilterImplTest {
public void testUsesLibrary_DoesntFilter() throws Exception { public void testUsesLibrary_DoesntFilter() throws Exception {
final AppsFilterImpl appsFilter = new AppsFilterImpl(mStateProvider, mFeatureConfigMock, final AppsFilterImpl appsFilter = new AppsFilterImpl(mStateProvider, mFeatureConfigMock,
new String[]{}, /* systemAppsQueryable */ false, /* overlayProvider */ null, new String[]{}, /* systemAppsQueryable */ false, /* overlayProvider */ null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -545,7 +543,7 @@ public class AppsFilterImplTest {
public void testUsesOptionalLibrary_DoesntFilter() throws Exception { public void testUsesOptionalLibrary_DoesntFilter() throws Exception {
final AppsFilterImpl appsFilter = new AppsFilterImpl(mStateProvider, mFeatureConfigMock, final AppsFilterImpl appsFilter = new AppsFilterImpl(mStateProvider, mFeatureConfigMock,
new String[]{}, /* systemAppsQueryable */ false, /* overlayProvider */ null, new String[]{}, /* systemAppsQueryable */ false, /* overlayProvider */ null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -572,7 +570,7 @@ public class AppsFilterImplTest {
public void testUsesLibrary_ShareUid_DoesntFilter() throws Exception { public void testUsesLibrary_ShareUid_DoesntFilter() throws Exception {
final AppsFilterImpl appsFilter = new AppsFilterImpl(mStateProvider, mFeatureConfigMock, final AppsFilterImpl appsFilter = new AppsFilterImpl(mStateProvider, mFeatureConfigMock,
new String[]{}, /* systemAppsQueryable */ false, /* overlayProvider */ null, new String[]{}, /* systemAppsQueryable */ false, /* overlayProvider */ null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -604,7 +602,7 @@ public class AppsFilterImplTest {
public void testForceQueryable_SystemDoesntFilter() throws Exception { public void testForceQueryable_SystemDoesntFilter() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -623,7 +621,7 @@ public class AppsFilterImplTest {
public void testForceQueryable_NonSystemFilters() throws Exception { public void testForceQueryable_NonSystemFilters() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -641,7 +639,7 @@ public class AppsFilterImplTest {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new AppsFilterImpl(mStateProvider, mFeatureConfigMock,
new String[]{"com.some.package"}, false, null, new String[]{"com.some.package"}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -660,7 +658,7 @@ public class AppsFilterImplTest {
public void testSystemSignedTarget_DoesntFilter() throws CertificateException { public void testSystemSignedTarget_DoesntFilter() throws CertificateException {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
final Signature frameworkSignature = Mockito.mock(Signature.class); final Signature frameworkSignature = Mockito.mock(Signature.class);
@@ -690,7 +688,7 @@ public class AppsFilterImplTest {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new AppsFilterImpl(mStateProvider, mFeatureConfigMock,
new String[]{"com.some.package"}, false, null, new String[]{"com.some.package"}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -708,8 +706,7 @@ public class AppsFilterImplTest {
public void testSystemQueryable_DoesntFilter() throws Exception { public void testSystemQueryable_DoesntFilter() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{},
true /* system force queryable */, null, mMockExecutor, true /* system force queryable */, null, mMockExecutor);
mMockPmInternal);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -727,7 +724,7 @@ public class AppsFilterImplTest {
public void testQueriesPackage_DoesntFilter() throws Exception { public void testQueriesPackage_DoesntFilter() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -746,7 +743,7 @@ public class AppsFilterImplTest {
.thenReturn(false); .thenReturn(false);
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -763,7 +760,7 @@ public class AppsFilterImplTest {
public void testSystemUid_DoesntFilter() throws Exception { public void testSystemUid_DoesntFilter() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -779,7 +776,7 @@ public class AppsFilterImplTest {
public void testSystemUidSecondaryUser_DoesntFilter() throws Exception { public void testSystemUidSecondaryUser_DoesntFilter() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -796,7 +793,7 @@ public class AppsFilterImplTest {
public void testNonSystemUid_NoCallingSetting_Filters() throws Exception { public void testNonSystemUid_NoCallingSetting_Filters() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -811,7 +808,7 @@ public class AppsFilterImplTest {
public void testNoTargetPackage_filters() throws Exception { public void testNoTargetPackage_filters() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -869,7 +866,7 @@ public class AppsFilterImplTest {
return Collections.emptyMap(); return Collections.emptyMap();
} }
}, },
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -925,16 +922,11 @@ public class AppsFilterImplTest {
.setOverlayTargetOverlayableName("overlayableName"); .setOverlayTargetOverlayableName("overlayableName");
ParsingPackage actorOne = pkg("com.some.package.actor.one"); ParsingPackage actorOne = pkg("com.some.package.actor.one");
ParsingPackage actorTwo = pkg("com.some.package.actor.two"); ParsingPackage actorTwo = pkg("com.some.package.actor.two");
ArraySet<PackageStateInternal> actorSharedSettingPackages = new ArraySet<>();
PackageSetting ps1 = getPackageSettingFromParsingPackage(actorOne, DUMMY_ACTOR_APPID, PackageSetting ps1 = getPackageSettingFromParsingPackage(actorOne, DUMMY_ACTOR_APPID,
null /*settingBuilder*/); null /*settingBuilder*/);
PackageSetting ps2 = getPackageSettingFromParsingPackage(actorTwo, DUMMY_ACTOR_APPID, PackageSetting ps2 = getPackageSettingFromParsingPackage(actorTwo, DUMMY_ACTOR_APPID,
null /*settingBuilder*/); null /*settingBuilder*/);
actorSharedSettingPackages.add(ps1);
actorSharedSettingPackages.add(ps2);
when(mMockPmInternal.getSharedUserPackages(any(Integer.class))).thenReturn(
actorSharedSettingPackages
);
final AppsFilterImpl appsFilter = new AppsFilterImpl( final AppsFilterImpl appsFilter = new AppsFilterImpl(
mStateProvider, mStateProvider,
mFeatureConfigMock, mFeatureConfigMock,
@@ -965,7 +957,7 @@ public class AppsFilterImplTest {
return Collections.emptyMap(); return Collections.emptyMap();
} }
}, },
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -989,7 +981,7 @@ public class AppsFilterImplTest {
public void testInitiatingApp_DoesntFilter() throws Exception { public void testInitiatingApp_DoesntFilter() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -1007,7 +999,7 @@ public class AppsFilterImplTest {
public void testUninstalledInitiatingApp_Filters() throws Exception { public void testUninstalledInitiatingApp_Filters() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -1025,7 +1017,7 @@ public class AppsFilterImplTest {
public void testOriginatingApp_Filters() throws Exception { public void testOriginatingApp_Filters() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
final WatchableTester watcher = new WatchableTester(appsFilter, "onChange"); final WatchableTester watcher = new WatchableTester(appsFilter, "onChange");
watcher.register(); watcher.register();
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
@@ -1050,7 +1042,7 @@ public class AppsFilterImplTest {
public void testInstallingApp_DoesntFilter() throws Exception { public void testInstallingApp_DoesntFilter() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
final WatchableTester watcher = new WatchableTester(appsFilter, "onChange"); final WatchableTester watcher = new WatchableTester(appsFilter, "onChange");
watcher.register(); watcher.register();
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
@@ -1075,7 +1067,7 @@ public class AppsFilterImplTest {
public void testInstrumentation_DoesntFilter() throws Exception { public void testInstrumentation_DoesntFilter() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
final WatchableTester watcher = new WatchableTester(appsFilter, "onChange"); final WatchableTester watcher = new WatchableTester(appsFilter, "onChange");
watcher.register(); watcher.register();
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
@@ -1104,7 +1096,7 @@ public class AppsFilterImplTest {
public void testWhoCanSee() throws Exception { public void testWhoCanSee() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
final WatchableTester watcher = new WatchableTester(appsFilter, "onChange"); final WatchableTester watcher = new WatchableTester(appsFilter, "onChange");
watcher.register(); watcher.register();
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
@@ -1177,7 +1169,7 @@ public class AppsFilterImplTest {
public void testOnChangeReport() throws Exception { public void testOnChangeReport() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
final WatchableTester watcher = new WatchableTester(appsFilter, "onChange"); final WatchableTester watcher = new WatchableTester(appsFilter, "onChange");
watcher.register(); watcher.register();
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
@@ -1250,7 +1242,7 @@ public class AppsFilterImplTest {
public void testOnChangeReportedFilter() throws Exception { public void testOnChangeReportedFilter() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
final WatchableTester watcher = new WatchableTester(appsFilter, "onChange filter"); final WatchableTester watcher = new WatchableTester(appsFilter, "onChange filter");
@@ -1276,7 +1268,7 @@ public class AppsFilterImplTest {
public void testAppsFilterRead() throws Exception { public void testAppsFilterRead() throws Exception {
final AppsFilterImpl appsFilter = final AppsFilterImpl appsFilter =
new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null, new AppsFilterImpl(mStateProvider, mFeatureConfigMock, new String[]{}, false, null,
mMockExecutor, mMockPmInternal); mMockExecutor);
simulateAddBasicAndroid(appsFilter); simulateAddBasicAndroid(appsFilter);
appsFilter.onSystemReady(); appsFilter.onSystemReady();
@@ -1379,6 +1371,7 @@ public class AppsFilterImplTest {
if (sharedUserSetting != null) { if (sharedUserSetting != null) {
sharedUserSetting.addPackage(setting); sharedUserSetting.addPackage(setting);
setting.setSharedUserAppId(sharedUserSetting.mAppId); setting.setSharedUserAppId(sharedUserSetting.mAppId);
mSharedUserSettings.add(sharedUserSetting);
} }
filter.addPackage(setting); filter.addPackage(setting);
} }