Merge "Resolve Test flakes" into ub-launcher3-rvc-dev
This commit is contained in:
commit
3d668090af
|
@ -851,20 +851,23 @@ public class LoaderTask implements Runnable {
|
|||
}
|
||||
|
||||
private List<AppInfo> loadCachedPredictions() {
|
||||
List<ComponentKey> componentKeys = mApp.getPredictionModel().getPredictionComponentKeys();
|
||||
List<AppInfo> results = new ArrayList<>();
|
||||
if (componentKeys == null) return results;
|
||||
List<LauncherActivityInfo> l;
|
||||
mBgDataModel.cachedPredictedItems.clear();
|
||||
for (ComponentKey key : componentKeys) {
|
||||
l = mLauncherApps.getActivityList(key.componentName.getPackageName(), key.user);
|
||||
if (l.size() == 0) continue;
|
||||
boolean quietMode = mUserManager.isQuietModeEnabled(key.user);
|
||||
AppInfo info = new AppInfo(l.get(0), key.user, quietMode);
|
||||
mBgDataModel.cachedPredictedItems.add(info);
|
||||
mIconCache.getTitleAndIcon(info, false);
|
||||
synchronized (mBgDataModel) {
|
||||
List<ComponentKey> componentKeys =
|
||||
mApp.getPredictionModel().getPredictionComponentKeys();
|
||||
List<AppInfo> results = new ArrayList<>();
|
||||
if (componentKeys == null) return results;
|
||||
List<LauncherActivityInfo> l;
|
||||
mBgDataModel.cachedPredictedItems.clear();
|
||||
for (ComponentKey key : componentKeys) {
|
||||
l = mLauncherApps.getActivityList(key.componentName.getPackageName(), key.user);
|
||||
if (l.size() == 0) continue;
|
||||
boolean quietMode = mUserManager.isQuietModeEnabled(key.user);
|
||||
AppInfo info = new AppInfo(l.get(0), key.user, quietMode);
|
||||
mBgDataModel.cachedPredictedItems.add(info);
|
||||
mIconCache.getTitleAndIcon(info, false);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private List<LauncherActivityInfo> loadAllApps() {
|
||||
|
|
|
@ -37,6 +37,8 @@ import android.os.Debug;
|
|||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.StrictMode;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
|
@ -276,6 +278,15 @@ public abstract class AbstractLauncherUiTest {
|
|||
mTargetContext = InstrumentationRegistry.getTargetContext();
|
||||
mTargetPackage = mTargetContext.getPackageName();
|
||||
mLauncherPid = mLauncher.getPid();
|
||||
|
||||
UserManager userManager = mTargetContext.getSystemService(UserManager.class);
|
||||
if (userManager != null) {
|
||||
for (UserHandle userHandle : userManager.getUserProfiles()) {
|
||||
if (!userHandle.isSystem()) {
|
||||
mDevice.executeShellCommand("pm remove-user " + userHandle.getIdentifier());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
Loading…
Reference in New Issue