Fix waiting for launcher initialization

am: c8d496fe00

Change-Id: I7d764152d5d9da8c9df8db479dd01683d9e6148a
This commit is contained in:
vadimt 2019-07-18 19:10:06 -07:00 committed by android-build-merger
commit d3c2a6cecf
4 changed files with 10 additions and 11 deletions

View File

@ -186,7 +186,7 @@ public class TouchInteractionService extends Service {
return mMyBinder;
}
public static boolean isInputMonitorInitialized() {
public static boolean isInitialized() {
return true;
}
}

View File

@ -38,7 +38,7 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
case TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED: {
response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
TouchInteractionService.isInputMonitorInitialized());
TouchInteractionService.isInitialized());
return response;
}

View File

@ -77,7 +77,6 @@ import com.android.launcher3.logging.EventLogArray;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.provider.RestoreDbTask;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.LooperExecutor;
import com.android.launcher3.util.UiThreadHelper;
import com.android.quickstep.SysUINavigationMode.Mode;
@ -154,6 +153,7 @@ public class TouchInteractionService extends Service implements
MAIN_THREAD_EXECUTOR.execute(TouchInteractionService.this::initInputMonitor);
MAIN_THREAD_EXECUTOR.execute(TouchInteractionService.this::onSystemUiProxySet);
MAIN_THREAD_EXECUTOR.execute(() -> preloadOverview(true /* fromInit */));
sIsInitialized = true;
}
@Override
@ -227,15 +227,15 @@ public class TouchInteractionService extends Service implements
};
private static boolean sConnected = false;
private static boolean sInputMonitorInitialized = false;
private static boolean sIsInitialized = false;
private static final SwipeSharedState sSwipeSharedState = new SwipeSharedState();
public static boolean isConnected() {
return sConnected;
}
public static boolean isInputMonitorInitialized() {
return sInputMonitorInitialized;
public static boolean isInitialized() {
return sIsInitialized;
}
public static SwipeSharedState getSwipeSharedState() {
@ -336,7 +336,6 @@ public class TouchInteractionService extends Service implements
mInputMonitorCompat.dispose();
mInputMonitorCompat = null;
}
sInputMonitorInitialized = false;
}
private void initInputMonitor() {
@ -354,7 +353,6 @@ public class TouchInteractionService extends Service implements
Log.e(TAG, "Unable to create input monitor", e);
}
initTouchBounds();
sInputMonitorInitialized = true;
}
private int getNavbarSize(String resName) {
@ -492,6 +490,7 @@ public class TouchInteractionService extends Service implements
@Override
public void onDestroy() {
sIsInitialized = false;
if (mIsUserUnlocked) {
mInputConsumer.unregisterInputConsumer();
mOverviewComponentObserver.onDestroy();

View File

@ -396,7 +396,7 @@ public final class LauncherInstrumentation {
}
private UiObject2 verifyContainerType(ContainerType containerType) {
//waitForTouchInteractionService();
waitForLauncherInitialized();
assertEquals("Unexpected display rotation",
mExpectedRotation, mDevice.getDisplayRotation());
@ -468,7 +468,7 @@ public final class LauncherInstrumentation {
}
}
private void waitForTouchInteractionService() {
private void waitForLauncherInitialized() {
for (int i = 0; i < 100; ++i) {
if (getTestInfo(
TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED).
@ -477,7 +477,7 @@ public final class LauncherInstrumentation {
}
SystemClock.sleep(100);
}
fail("TouchInteractionService didn't connect");
fail("Launcher didn't initialize");
}
Parcelable executeAndWaitForEvent(Runnable command,