mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 01:46:49 +00:00
Freezing all apps updates during certain tests
This CL adds a very low risk because most (but not all) changes affect only Launcher behavior during the test. This should fix a lab-only flake when all apps keeps changing while the test is working with it. Example: test figures out which icon to click, by the moment it clicks there, there is another icon there, or the icon is under the search box, and clicking opens IME. Switching test devices to airplane mode didn't help. The earlier change that prevents popup menu cancellation is not general enough. Now the tests are given an API to explicitly freeze and unfreeze all-apps, which should be a final solution. Bug: 132900132 Bug: 133765434 Change-Id: I8b81cc9be004482beb6cdcdd05406e2d9b4c7629
This commit is contained in:
@@ -23,9 +23,13 @@ import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.MainThreadExecutor;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.allapps.AllAppsStore;
|
||||
import com.android.launcher3.util.ResourceBasedOverride;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class TestInformationHandler implements ResourceBasedOverride {
|
||||
|
||||
public static TestInformationHandler newInstance(Context context) {
|
||||
@@ -77,6 +81,32 @@ public class TestInformationHandler implements ResourceBasedOverride {
|
||||
case TestProtocol.REQUEST_DISABLE_DEBUG_TRACING:
|
||||
TestProtocol.sDebugTracing = false;
|
||||
break;
|
||||
|
||||
case TestProtocol.REQUEST_FREEZE_APP_LIST:
|
||||
new MainThreadExecutor().execute(() ->
|
||||
mLauncher.getAppsView().getAppsStore().enableDeferUpdates(
|
||||
AllAppsStore.DEFER_UPDATES_TEST));
|
||||
break;
|
||||
|
||||
case TestProtocol.REQUEST_UNFREEZE_APP_LIST:
|
||||
new MainThreadExecutor().execute(() ->
|
||||
mLauncher.getAppsView().getAppsStore().disableDeferUpdates(
|
||||
AllAppsStore.DEFER_UPDATES_TEST));
|
||||
break;
|
||||
|
||||
case TestProtocol.REQUEST_APP_LIST_FREEZE_FLAGS: {
|
||||
try {
|
||||
final int deferUpdatesFlags = new MainThreadExecutor().submit(() ->
|
||||
mLauncher.getAppsView().getAppsStore().getDeferUpdatesFlags()).get();
|
||||
response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD,
|
||||
deferUpdatesFlags);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user