Merge "Fix TwoPanelWorkspaceTests" into tm-qpr-dev am: 90259a6db4 am: d8e5795131 am: f8f602d76c
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/22185922 Change-Id: I4de17f84f2dbb2c11bb3d162ee64d494d7801972 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
committed by
Automerger Merge Worker
commit
a63da2cf09
@@ -33,6 +33,7 @@ import android.view.ViewGroup;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import com.android.launcher3.DeviceProfile;
|
import com.android.launcher3.DeviceProfile;
|
||||||
import com.android.launcher3.DragSource;
|
import com.android.launcher3.DragSource;
|
||||||
@@ -51,6 +52,8 @@ import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
|||||||
import com.android.launcher3.model.data.ItemInfo;
|
import com.android.launcher3.model.data.ItemInfo;
|
||||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||||
import com.android.launcher3.popup.SystemShortcut;
|
import com.android.launcher3.popup.SystemShortcut;
|
||||||
|
import com.android.launcher3.testing.TestLogging;
|
||||||
|
import com.android.launcher3.testing.shared.TestProtocol;
|
||||||
import com.android.launcher3.touch.ItemLongClickListener;
|
import com.android.launcher3.touch.ItemLongClickListener;
|
||||||
import com.android.launcher3.uioverrides.PredictedAppIcon;
|
import com.android.launcher3.uioverrides.PredictedAppIcon;
|
||||||
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||||
@@ -89,10 +92,14 @@ public class HotseatPredictionController implements DragController.DragListener,
|
|||||||
|
|
||||||
private List<PredictedAppIcon.PredictedIconOutlineDrawing> mOutlineDrawings = new ArrayList<>();
|
private List<PredictedAppIcon.PredictedIconOutlineDrawing> mOutlineDrawings = new ArrayList<>();
|
||||||
|
|
||||||
|
private boolean mEnableHotseatLongPressTipForTesting = true;
|
||||||
|
|
||||||
private final View.OnLongClickListener mPredictionLongClickListener = v -> {
|
private final View.OnLongClickListener mPredictionLongClickListener = v -> {
|
||||||
if (!ItemLongClickListener.canStartDrag(mLauncher)) return false;
|
if (!ItemLongClickListener.canStartDrag(mLauncher)) return false;
|
||||||
if (mLauncher.getWorkspace().isSwitchingState()) return false;
|
if (mLauncher.getWorkspace().isSwitchingState()) return false;
|
||||||
if (!mLauncher.getOnboardingPrefs().getBoolean(
|
|
||||||
|
TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "onWorkspaceItemLongClick");
|
||||||
|
if (mEnableHotseatLongPressTipForTesting && !mLauncher.getOnboardingPrefs().getBoolean(
|
||||||
OnboardingPrefs.HOTSEAT_LONGPRESS_TIP_SEEN)) {
|
OnboardingPrefs.HOTSEAT_LONGPRESS_TIP_SEEN)) {
|
||||||
Snackbar.show(mLauncher, R.string.hotseat_tip_gaps_filled,
|
Snackbar.show(mLauncher, R.string.hotseat_tip_gaps_filled,
|
||||||
R.string.hotseat_prediction_settings, null,
|
R.string.hotseat_prediction_settings, null,
|
||||||
@@ -132,6 +139,12 @@ public class HotseatPredictionController implements DragController.DragListener,
|
|||||||
onHotseatHierarchyChanged();
|
onHotseatHierarchyChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Enables/disabled the hotseat prediction icon long press edu for testing. */
|
||||||
|
@VisibleForTesting
|
||||||
|
public void enableHotseatEdu(boolean enable) {
|
||||||
|
mEnableHotseatLongPressTipForTesting = enable;
|
||||||
|
}
|
||||||
|
|
||||||
private void onHotseatHierarchyChanged() {
|
private void onHotseatHierarchyChanged() {
|
||||||
if (mPauseFlags == 0 && !mLauncher.isWorkspaceLoading()) {
|
if (mPauseFlags == 0 && !mLauncher.isWorkspaceLoading()) {
|
||||||
// Post update after a single frame to avoid layout within layout
|
// Post update after a single frame to avoid layout within layout
|
||||||
|
|||||||
@@ -316,6 +316,12 @@ public class QuickstepLauncher extends Launcher {
|
|||||||
return mHotseatPredictionController;
|
return mHotseatPredictionController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableHotseatEdu(boolean enable) {
|
||||||
|
super.enableHotseatEdu(enable);
|
||||||
|
mHotseatPredictionController.enableHotseatEdu(enable);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the {@link QuickstepTransitionManager} instance to use for managing transitions.
|
* Builds the {@link QuickstepTransitionManager} instance to use for managing transitions.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3261,6 +3261,10 @@ public class Launcher extends StatefulActivity<LauncherState>
|
|||||||
return new LauncherAccessibilityDelegate(this);
|
return new LauncherAccessibilityDelegate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Enables/disabled the hotseat prediction icon long press edu for testing. */
|
||||||
|
@VisibleForTesting
|
||||||
|
public void enableHotseatEdu(boolean enable) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see LauncherState#getOverviewScaleAndOffset(Launcher)
|
* @see LauncherState#getOverviewScaleAndOffset(Launcher)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
|||||||
|
|
||||||
// Pre verifying the screens
|
// Pre verifying the screens
|
||||||
executeOnLauncher(launcher -> {
|
executeOnLauncher(launcher -> {
|
||||||
|
launcher.enableHotseatEdu(false);
|
||||||
assertPagesExist(launcher, 0, 1);
|
assertPagesExist(launcher, 0, 1);
|
||||||
assertItemsOnPage(launcher, 0, "Play Store", "Maps");
|
assertItemsOnPage(launcher, 0, "Play Store", "Maps");
|
||||||
assertPageEmpty(launcher, 1);
|
assertPageEmpty(launcher, 1);
|
||||||
@@ -67,6 +68,7 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
|||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
|
executeOnLauncher(launcher -> launcher.enableHotseatEdu(true));
|
||||||
mLauncher.useDefaultWorkspaceLayoutOnReload();
|
mLauncher.useDefaultWorkspaceLayoutOnReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user