mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 23:36:47 +00:00
Merge "Revert^2 "Wait for LauncherModel loaded in waitForLauncherInitialized"" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
9d4fb2b5be
@@ -41,6 +41,7 @@ import androidx.annotation.Keep;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.android.launcher3.BaseActivity;
|
||||
import com.android.launcher3.BubbleTextView;
|
||||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
@@ -136,6 +137,10 @@ public class TestInformationHandler implements ResourceBasedOverride {
|
||||
});
|
||||
}
|
||||
|
||||
case TestProtocol.REQUEST_IS_LAUNCHER_BINDING: {
|
||||
return getUIProperty(Bundle::putBoolean, t -> isLauncherBinding(), () -> true);
|
||||
}
|
||||
|
||||
case TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED: {
|
||||
return getUIProperty(Bundle::putBoolean, t -> isLauncherInitialized(), () -> true);
|
||||
}
|
||||
@@ -484,6 +489,11 @@ public class TestInformationHandler implements ResourceBasedOverride {
|
||||
return target;
|
||||
}
|
||||
|
||||
protected boolean isLauncherBinding() {
|
||||
BaseActivity baseActivity = Launcher.ACTIVITY_TRACKER.getCreatedActivity();
|
||||
return baseActivity != null && baseActivity.isBindingItems();
|
||||
}
|
||||
|
||||
protected boolean isLauncherInitialized() {
|
||||
return Launcher.ACTIVITY_TRACKER.getCreatedActivity() == null
|
||||
|| LauncherAppState.getInstance(mContext).getModel().isModelLoaded();
|
||||
|
||||
@@ -87,6 +87,7 @@ public final class TestProtocol {
|
||||
"home-to-all-apps-swipe-height";
|
||||
public static final String REQUEST_ICON_HEIGHT =
|
||||
"icon-height";
|
||||
public static final String REQUEST_IS_LAUNCHER_BINDING = "is-launcher-binding";
|
||||
public static final String REQUEST_IS_LAUNCHER_INITIALIZED = "is-launcher-initialized";
|
||||
public static final String REQUEST_IS_LAUNCHER_LAUNCHER_ACTIVITY_STARTED =
|
||||
"is-launcher-activity-started";
|
||||
|
||||
@@ -1002,6 +1002,19 @@ public final class LauncherInstrumentation {
|
||||
}
|
||||
|
||||
public void waitForLauncherInitialized() {
|
||||
boolean isLauncherBinding = true;
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
isLauncherBinding = getTestInfo(TestProtocol.REQUEST_IS_LAUNCHER_BINDING)
|
||||
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
|
||||
if (!isLauncherBinding) {
|
||||
break;
|
||||
}
|
||||
SystemClock.sleep(100);
|
||||
}
|
||||
if (isLauncherBinding) {
|
||||
fail("Launcher didn't finish binding");
|
||||
}
|
||||
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
if (getTestInfo(
|
||||
TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED).
|
||||
@@ -1010,7 +1023,6 @@ public final class LauncherInstrumentation {
|
||||
}
|
||||
SystemClock.sleep(100);
|
||||
}
|
||||
checkForAnomaly();
|
||||
fail("Launcher didn't initialize");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user