Quick patch for PredictionUiStateManager.applyState interrupting allapps
Constructor of PredictionUiStateManager posts an action in 5 sec, which may interfere with the process of opening all apps. Waiting until the posted action happens. Hopefully this will fix massive flakes. Bug: 131854153 Change-Id: I6544eae1a3b063c03e78185826c05a76add1f71b
This commit is contained in:
parent
9fb137bb73
commit
0c1ed7cb4c
|
@ -197,7 +197,10 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean mDebugHadStateUpdate;
|
||||||
|
|
||||||
private void updatePredictionStateAfterCallback() {
|
private void updatePredictionStateAfterCallback() {
|
||||||
|
mDebugHadStateUpdate = true;
|
||||||
boolean validResults = false;
|
boolean validResults = false;
|
||||||
for (List l : mPredictionServicePredictions) {
|
for (List l : mPredictionServicePredictions) {
|
||||||
validResults |= l != null && !l.isEmpty();
|
validResults |= l != null && !l.isEmpty();
|
||||||
|
|
|
@ -70,6 +70,9 @@ public class AppPredictionsUITests extends AbstractQuickStepTest {
|
||||||
AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker());
|
AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker());
|
||||||
|
|
||||||
PredictionUiStateManager.INSTANCE.initializeForTesting(null);
|
PredictionUiStateManager.INSTANCE.initializeForTesting(null);
|
||||||
|
waitForLauncherCondition("Prediction never had state update",
|
||||||
|
launcher -> PredictionUiStateManager.INSTANCE.get(
|
||||||
|
mTargetContext).mDebugHadStateUpdate);
|
||||||
|
|
||||||
mCallback = PredictionUiStateManager.INSTANCE.get(mTargetContext).appPredictorCallback(
|
mCallback = PredictionUiStateManager.INSTANCE.get(mTargetContext).appPredictorCallback(
|
||||||
Client.HOME);
|
Client.HOME);
|
||||||
|
|
|
@ -2553,4 +2553,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||||
|
|
||||||
void onLauncherResume();
|
void onLauncherResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean debugIsPredictionInitialized() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,8 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
||||||
test.mDevice.pressHome();
|
test.mDevice.pressHome();
|
||||||
}
|
}
|
||||||
test.waitForLauncherCondition("Launcher didn't start", launcher -> launcher != null);
|
test.waitForLauncherCondition("Launcher didn't start", launcher -> launcher != null);
|
||||||
|
test.waitForLauncherCondition("Prediction never had state update",
|
||||||
|
launcher -> launcher.debugIsPredictionInitialized());
|
||||||
test.waitForState("Launcher internal state didn't switch to Home", LauncherState.NORMAL);
|
test.waitForState("Launcher internal state didn't switch to Home", LauncherState.NORMAL);
|
||||||
test.waitForResumed("Launcher internal state is still Background");
|
test.waitForResumed("Launcher internal state is still Background");
|
||||||
// Check that we switched to home.
|
// Check that we switched to home.
|
||||||
|
|
Loading…
Reference in New Issue