Snap for 8937168 from f2d61702cd to tm-qpr1-release
Change-Id: I6a322703ae3456d09563f1e033f708401af5766e
This commit is contained in:
@@ -15,9 +15,6 @@
|
||||
*/
|
||||
package com.android.launcher3;
|
||||
|
||||
import static android.app.WindowConfiguration.WINDOW_CONFIG_ROTATION;
|
||||
import static android.content.pm.ActivityInfo.CONFIG_WINDOW_CONFIGURATION;
|
||||
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_HIDE_BACK_BUTTON;
|
||||
import static com.android.launcher3.LauncherState.FLAG_HIDE_BACK_BUTTON;
|
||||
@@ -46,7 +43,6 @@ import android.app.ActivityOptions;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
import android.content.res.Configuration;
|
||||
import android.hardware.SensorManager;
|
||||
import android.hardware.devicestate.DeviceStateManager;
|
||||
import android.os.Bundle;
|
||||
@@ -653,20 +649,6 @@ public abstract class BaseQuickstepLauncher extends Launcher {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean compareConfiguration(Configuration oldConfig, Configuration newConfig) {
|
||||
int diff = newConfig.diff(oldConfig);
|
||||
if ((diff & CONFIG_WINDOW_CONFIGURATION) != 0) {
|
||||
long windowDiff =
|
||||
newConfig.windowConfiguration.diff(oldConfig.windowConfiguration, false);
|
||||
if ((windowDiff & WINDOW_CONFIG_ROTATION) != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.compareConfiguration(oldConfig, newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||
super.dump(prefix, fd, writer, args);
|
||||
|
||||
@@ -15,11 +15,6 @@
|
||||
*/
|
||||
package com.android.quickstep;
|
||||
|
||||
import static android.app.WindowConfiguration.WINDOW_CONFIG_ROTATION;
|
||||
import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
|
||||
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
|
||||
import static android.content.pm.ActivityInfo.CONFIG_WINDOW_CONFIGURATION;
|
||||
|
||||
import static com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION;
|
||||
import static com.android.launcher3.QuickstepTransitionManager.STATUS_BAR_TRANSITION_DURATION;
|
||||
import static com.android.launcher3.QuickstepTransitionManager.STATUS_BAR_TRANSITION_PRE_DELAY;
|
||||
@@ -112,8 +107,6 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
||||
private @Nullable TaskbarManager mTaskbarManager;
|
||||
private @Nullable FallbackTaskbarUIController mTaskbarUIController;
|
||||
|
||||
private Configuration mOldConfig;
|
||||
|
||||
private StateManager<RecentsState> mStateManager;
|
||||
|
||||
// Strong refs to runners which are cleared when the activity is destroyed
|
||||
@@ -165,7 +158,7 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
||||
|
||||
@Override
|
||||
public void onMultiWindowModeChanged(boolean isInMultiWindowMode, Configuration newConfig) {
|
||||
onHandleConfigChanged();
|
||||
onHandleConfigurationChanged();
|
||||
super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig);
|
||||
}
|
||||
|
||||
@@ -175,11 +168,8 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
||||
ACTIVITY_TRACKER.handleNewIntent(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logic for when device configuration changes (rotation, screen size change, multi-window,
|
||||
* etc.)
|
||||
*/
|
||||
protected void onHandleConfigChanged() {
|
||||
@Override
|
||||
protected void onHandleConfigurationChanged() {
|
||||
initDeviceProfile();
|
||||
|
||||
AbstractFloatingView.closeOpenViews(this, true,
|
||||
@@ -340,7 +330,6 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
||||
|
||||
mStateManager = new StateManager<>(this, RecentsState.BG_LAUNCHER);
|
||||
|
||||
mOldConfig = new Configuration(getResources().getConfiguration());
|
||||
initDeviceProfile();
|
||||
setupViews();
|
||||
|
||||
@@ -349,26 +338,6 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
||||
ACTIVITY_TRACKER.handleCreate(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleConfigurationChanged(Configuration newConfig) {
|
||||
if (compareConfiguration(mOldConfig, newConfig)) {
|
||||
onHandleConfigChanged();
|
||||
}
|
||||
mOldConfig.setTo(newConfig);
|
||||
super.handleConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
private boolean compareConfiguration(Configuration oldConfig, Configuration newConfig) {
|
||||
int diff = newConfig.diff(oldConfig);
|
||||
if ((diff & CONFIG_WINDOW_CONFIGURATION) != 0) {
|
||||
long windowDiff =
|
||||
newConfig.windowConfiguration.diff(oldConfig.windowConfiguration, false);
|
||||
return (windowDiff & WINDOW_CONFIG_ROTATION) != 0;
|
||||
}
|
||||
|
||||
return (diff & (CONFIG_ORIENTATION | CONFIG_SCREEN_SIZE)) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateSetEnd(RecentsState state) {
|
||||
super.onStateSetEnd(state);
|
||||
|
||||
@@ -389,10 +389,39 @@ public final class TaskViewUtils {
|
||||
* device is considered in multiWindowMode and things like insets and stuff change
|
||||
* and calculations have to be adjusted in the animations for that
|
||||
*/
|
||||
public static void composeRecentsSplitLaunchAnimator(int initialTaskId,
|
||||
@Nullable PendingIntent initialTaskPendingIntent, int secondTaskId,
|
||||
public static void composeRecentsSplitLaunchAnimator(GroupedTaskView launchingTaskView,
|
||||
@NonNull StateManager stateManager, @Nullable DepthController depthController,
|
||||
int initialTaskId, @Nullable PendingIntent initialTaskPendingIntent, int secondTaskId,
|
||||
@NonNull TransitionInfo transitionInfo, SurfaceControl.Transaction t,
|
||||
@NonNull Runnable finishCallback) {
|
||||
if (launchingTaskView != null) {
|
||||
AnimatorSet animatorSet = new AnimatorSet();
|
||||
animatorSet.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
finishCallback.run();
|
||||
}
|
||||
});
|
||||
|
||||
final RemoteAnimationTargetCompat[] appTargets =
|
||||
RemoteAnimationTargetCompat.wrapApps(transitionInfo, t, null /* leashMap */);
|
||||
final RemoteAnimationTargetCompat[] wallpaperTargets =
|
||||
RemoteAnimationTargetCompat.wrapNonApps(
|
||||
transitionInfo, true /* wallpapers */, t, null /* leashMap */);
|
||||
final RemoteAnimationTargetCompat[] nonAppTargets =
|
||||
RemoteAnimationTargetCompat.wrapNonApps(
|
||||
transitionInfo, false /* wallpapers */, t, null /* leashMap */);
|
||||
final RecentsView recentsView = launchingTaskView.getRecentsView();
|
||||
composeRecentsLaunchAnimator(animatorSet, launchingTaskView,
|
||||
appTargets, wallpaperTargets, nonAppTargets,
|
||||
true, stateManager,
|
||||
recentsView, depthController);
|
||||
|
||||
t.apply();
|
||||
animatorSet.start();
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: consider initialTaskPendingIntent
|
||||
TransitionInfo.Change splitRoot1 = null;
|
||||
TransitionInfo.Change splitRoot2 = null;
|
||||
@@ -657,6 +686,7 @@ public final class TaskViewUtils {
|
||||
public void onAnimationStart(Animator animation) {
|
||||
if (shown) {
|
||||
for (SurfaceControl leash : auxiliarySurfaces) {
|
||||
t.setLayer(leash, Integer.MAX_VALUE);
|
||||
t.setAlpha(leash, 0);
|
||||
t.show(leash);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.android.quickstep;
|
||||
|
||||
import android.graphics.HardwareRenderer;
|
||||
import android.os.Handler;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.View;
|
||||
import android.view.ViewRootImpl;
|
||||
|
||||
@@ -45,22 +46,42 @@ public class ViewUtils {
|
||||
return new FrameHandler(view, onFinishRunnable, canceled).schedule();
|
||||
}
|
||||
|
||||
private static class FrameHandler implements HardwareRenderer.FrameDrawingCallback {
|
||||
private static class FrameHandler implements HardwareRenderer.FrameDrawingCallback,
|
||||
ViewRootImpl.SurfaceChangedCallback {
|
||||
|
||||
final ViewRootImpl mViewRoot;
|
||||
final Runnable mFinishCallback;
|
||||
final BooleanSupplier mCancelled;
|
||||
final Handler mHandler;
|
||||
boolean mFinished;
|
||||
|
||||
int mDeferFrameCount = 1;
|
||||
|
||||
FrameHandler(View view, Runnable finishCallback, BooleanSupplier cancelled) {
|
||||
mViewRoot = view.getViewRootImpl();
|
||||
mViewRoot.addSurfaceChangedCallback(this);
|
||||
mFinishCallback = finishCallback;
|
||||
mCancelled = cancelled;
|
||||
mHandler = new Handler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceCreated(SurfaceControl.Transaction t) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceReplaced(SurfaceControl.Transaction t) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceDestroyed() {
|
||||
// If the root view is detached, then the app won't get any scheduled frames so we need
|
||||
// to force-run any pending callbacks
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFrameDraw(long frame) {
|
||||
Utilities.postAsyncCallback(mHandler, this::onFrame);
|
||||
@@ -77,9 +98,7 @@ public class ViewUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mFinishCallback != null) {
|
||||
mFinishCallback.run();
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
private boolean schedule() {
|
||||
@@ -90,5 +109,17 @@ public class ViewUtils {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void finish() {
|
||||
if (mFinished) {
|
||||
return;
|
||||
}
|
||||
mFinished = true;
|
||||
mDeferFrameCount = 0;
|
||||
if (mFinishCallback != null) {
|
||||
mFinishCallback.run();
|
||||
}
|
||||
mViewRoot.removeSurfaceChangedCallback(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,8 +242,9 @@ public class SplitSelectStateController {
|
||||
@Override
|
||||
public void startAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info,
|
||||
@NonNull SurfaceControl.Transaction t, @NonNull Runnable finishCallback) {
|
||||
TaskViewUtils.composeRecentsSplitLaunchAnimator(mInitialTaskId,
|
||||
mInitialTaskPendingIntent, mSecondTaskId, info, t, () -> {
|
||||
TaskViewUtils.composeRecentsSplitLaunchAnimator(mLaunchingTaskView, mStateManager,
|
||||
mDepthController, mInitialTaskId, mInitialTaskPendingIntent, mSecondTaskId,
|
||||
info, t, () -> {
|
||||
finishCallback.run();
|
||||
if (mSuccessCallback != null) {
|
||||
mSuccessCallback.accept(true);
|
||||
|
||||
@@ -281,6 +281,8 @@
|
||||
<!-- defaults to iconImageSize, if not specified -->
|
||||
<attr name="allAppsIconSize" format="float" />
|
||||
<!-- defaults to allAppsIconSize, if not specified -->
|
||||
<attr name="allAppsIconSizeLandscape" format="float" />
|
||||
<!-- defaults to allAppsIconSize, if not specified -->
|
||||
<attr name="allAppsIconSizeTwoPanelPortrait" format="float" />
|
||||
<!-- defaults to allAppsIconSize, if not specified -->
|
||||
<attr name="allAppsIconSizeTwoPanelLandscape" format="float" />
|
||||
|
||||
@@ -1004,7 +1004,9 @@ public class InvariantDeviceProfile {
|
||||
|
||||
allAppsIconSizes[INDEX_DEFAULT] = a.getFloat(
|
||||
R.styleable.ProfileDisplayOption_allAppsIconSize, iconSizes[INDEX_DEFAULT]);
|
||||
allAppsIconSizes[INDEX_LANDSCAPE] = allAppsIconSizes[INDEX_DEFAULT];
|
||||
allAppsIconSizes[INDEX_LANDSCAPE] = a.getFloat(
|
||||
R.styleable.ProfileDisplayOption_allAppsIconSizeLandscape,
|
||||
iconSizes[INDEX_DEFAULT]);
|
||||
allAppsIconSizes[INDEX_TWO_PANEL_PORTRAIT] = a.getFloat(
|
||||
R.styleable.ProfileDisplayOption_allAppsIconSizeTwoPanelPortrait,
|
||||
allAppsIconSizes[INDEX_DEFAULT]);
|
||||
|
||||
@@ -18,8 +18,6 @@ package com.android.launcher3;
|
||||
|
||||
import static android.app.PendingIntent.FLAG_IMMUTABLE;
|
||||
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
|
||||
import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
|
||||
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
|
||||
import static android.content.pm.ActivityInfo.CONFIG_UI_MODE;
|
||||
import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO;
|
||||
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
|
||||
@@ -310,8 +308,6 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
private static final FloatProperty<Hotseat> HOTSEAT_WIDGET_SCALE =
|
||||
HOTSEAT_SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_WIDGET_TRANSITION);
|
||||
|
||||
private Configuration mOldConfig;
|
||||
|
||||
@Thunk
|
||||
Workspace<?> mWorkspace;
|
||||
@Thunk
|
||||
@@ -466,7 +462,6 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
LauncherAppState app = LauncherAppState.getInstance(this);
|
||||
mOldConfig = new Configuration(getResources().getConfiguration());
|
||||
mModel = app.getModel();
|
||||
|
||||
mRotationHelper = new RotationHelper(this);
|
||||
@@ -614,21 +609,6 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
dispatchDeviceProfileChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleConfigurationChanged(Configuration newConfig) {
|
||||
if (compareConfiguration(mOldConfig, newConfig)) {
|
||||
onIdpChanged(false);
|
||||
}
|
||||
|
||||
mOldConfig.setTo(newConfig);
|
||||
super.handleConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
protected boolean compareConfiguration(Configuration oldConfig, Configuration newConfig) {
|
||||
int diff = newConfig.diff(oldConfig);
|
||||
return (diff & (CONFIG_ORIENTATION | CONFIG_SCREEN_SIZE)) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the drag controller.
|
||||
*/
|
||||
@@ -638,6 +618,11 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
|
||||
@Override
|
||||
public void onIdpChanged(boolean modelPropertiesChanged) {
|
||||
onHandleConfigurationChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHandleConfigurationChanged() {
|
||||
if (!initDeviceProfile(mDeviceProfile.inv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -15,10 +15,14 @@
|
||||
*/
|
||||
package com.android.launcher3.statemanager;
|
||||
|
||||
import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
|
||||
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
|
||||
|
||||
import static com.android.launcher3.LauncherState.FLAG_CLOSE_POPUPS;
|
||||
import static com.android.launcher3.LauncherState.FLAG_NON_INTERACTIVE;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -31,6 +35,7 @@ import com.android.launcher3.LauncherRootView;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory;
|
||||
import com.android.launcher3.statemanager.StateManager.StateHandler;
|
||||
import com.android.launcher3.util.window.WindowManagerProxy;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
|
||||
import java.util.List;
|
||||
@@ -48,6 +53,17 @@ public abstract class StatefulActivity<STATE_TYPE extends BaseState<STATE_TYPE>>
|
||||
|
||||
private LauncherRootView mRootView;
|
||||
|
||||
protected Configuration mOldConfig;
|
||||
private int mOldRotation;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mOldConfig = new Configuration(getResources().getConfiguration());
|
||||
mOldRotation = WindowManagerProxy.INSTANCE.get(this).getRotation(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create handlers to control the property changes for this activity
|
||||
*/
|
||||
@@ -198,5 +214,21 @@ public abstract class StatefulActivity<STATE_TYPE extends BaseState<STATE_TYPE>>
|
||||
* Handles configuration change when system calls {@link #onConfigurationChanged}, or on other
|
||||
* situations that configuration might change.
|
||||
*/
|
||||
public void handleConfigurationChanged(Configuration newConfig) {}
|
||||
public void handleConfigurationChanged(Configuration newConfig) {
|
||||
int diff = newConfig.diff(mOldConfig);
|
||||
int rotation = WindowManagerProxy.INSTANCE.get(this).getRotation(this);
|
||||
if ((diff & (CONFIG_ORIENTATION | CONFIG_SCREEN_SIZE)) != 0
|
||||
|| rotation != mOldRotation) {
|
||||
onHandleConfigurationChanged();
|
||||
}
|
||||
|
||||
mOldConfig.setTo(newConfig);
|
||||
mOldRotation = rotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logic for when device configuration changes (rotation, screen size change, multi-window,
|
||||
* etc.)
|
||||
*/
|
||||
protected abstract void onHandleConfigurationChanged();
|
||||
}
|
||||
|
||||
@@ -20,46 +20,65 @@ import android.graphics.Point;
|
||||
import java.util.Map;
|
||||
|
||||
public class FullReorderCase {
|
||||
|
||||
/** 5x5 Test
|
||||
**/
|
||||
private static final String START_BOARD_STR_5x5 = ""
|
||||
+ "xxxxx\n"
|
||||
+ "222mm\n"
|
||||
+ "222mm\n"
|
||||
+ "ad111\n"
|
||||
+ "bc111";
|
||||
|
||||
private static final Point MOVE_TO_5x5 = new Point(0, 4);
|
||||
|
||||
private static final String END_BOARD_STR_5x5 = ""
|
||||
+ "xxxxx\n"
|
||||
+ "222ad\n"
|
||||
+ "222bc\n"
|
||||
+ "mm111\n"
|
||||
+ "mm111";
|
||||
|
||||
private static final ReorderTestCase TEST_CASE_5x5 = new ReorderTestCase(START_BOARD_STR_5x5,
|
||||
MOVE_TO_5x5,
|
||||
END_BOARD_STR_5x5);
|
||||
|
||||
/** 6x5 Test
|
||||
**/
|
||||
private static final String START_BOARD_STR_6x5 = ""
|
||||
+ "xxxxxx\n"
|
||||
+ "2222mm\n"
|
||||
+ "2222mm\n"
|
||||
+ "ad1111\n"
|
||||
+ "bc1111";
|
||||
|
||||
private static final Point MOVE_TO_6x5 = new Point(0, 4);
|
||||
|
||||
private static final String END_BOARD_STR_6x5 = ""
|
||||
+ "xxxxxx\n"
|
||||
+ "2222ad\n"
|
||||
+ "2222bc\n"
|
||||
+ "mm1111\n"
|
||||
+ "mm1111";
|
||||
|
||||
private static final ReorderTestCase TEST_CASE_6x5 = new ReorderTestCase(START_BOARD_STR_6x5,
|
||||
MOVE_TO_6x5,
|
||||
END_BOARD_STR_6x5);
|
||||
|
||||
/** 4x4 Test
|
||||
**/
|
||||
private static final String START_BOARD_STR_4x4 = ""
|
||||
+ "xxxx\n"
|
||||
+ "22mm\n"
|
||||
+ "admm\n"
|
||||
+ "bc11";
|
||||
private static final Point MOVE_TO_4x4 = new Point(0, 3);
|
||||
private static final String END_BOARD_STR_4x4 = ""
|
||||
+ "xxxx\n"
|
||||
+ "22ad\n"
|
||||
+ "mmbc\n"
|
||||
+ "mm11";
|
||||
|
||||
private static final ReorderTestCase TEST_CASE_4x4 = new ReorderTestCase(START_BOARD_STR_4x4,
|
||||
MOVE_TO_4x4,
|
||||
END_BOARD_STR_4x4);
|
||||
|
||||
public static final Map<Point, ReorderTestCase> TEST_BY_GRID_SIZE =
|
||||
Map.of(new Point(5, 5), TEST_CASE_5x5, new Point(6, 5), TEST_CASE_6x5);
|
||||
Map.of(new Point(5, 5), TEST_CASE_5x5,
|
||||
new Point(6, 5), TEST_CASE_6x5,
|
||||
new Point(4, 4), TEST_CASE_4x4);
|
||||
}
|
||||
|
||||
@@ -20,47 +20,64 @@ import android.graphics.Point;
|
||||
import java.util.Map;
|
||||
|
||||
public class MoveOutReorderCase {
|
||||
|
||||
/** 5x5 Test
|
||||
**/
|
||||
private static final String START_BOARD_STR_5x5 = ""
|
||||
+ "xxxxx\n"
|
||||
+ "34-m-\n"
|
||||
+ "35111\n"
|
||||
+ "32111\n"
|
||||
+ "32111";
|
||||
|
||||
private static final Point MOVE_TO_5x5 = new Point(1, 2);
|
||||
|
||||
private static final String END_BOARD_STR_5x5 = ""
|
||||
+ "xxxxx\n"
|
||||
+ "345--\n"
|
||||
+ "3m111\n"
|
||||
+ "32111\n"
|
||||
+ "32111";
|
||||
|
||||
private static final ReorderTestCase TEST_CASE_5x5 = new ReorderTestCase(START_BOARD_STR_5x5,
|
||||
MOVE_TO_5x5,
|
||||
END_BOARD_STR_5x5);
|
||||
|
||||
|
||||
/** 6x5 Test
|
||||
**/
|
||||
private static final String START_BOARD_STR_6x5 = ""
|
||||
+ "xxxxxx\n"
|
||||
+ "34-m--\n"
|
||||
+ "351111\n"
|
||||
+ "321111\n"
|
||||
+ "321111";
|
||||
|
||||
private static final Point MOVE_TO_6x5 = new Point(1, 2);
|
||||
|
||||
private static final String END_BOARD_STR_6x5 = ""
|
||||
+ "xxxxxx\n"
|
||||
+ "345---\n"
|
||||
+ "3m1111\n"
|
||||
+ "321111\n"
|
||||
+ "321111";
|
||||
|
||||
private static final ReorderTestCase TEST_CASE_6x5 = new ReorderTestCase(START_BOARD_STR_6x5,
|
||||
MOVE_TO_6x5,
|
||||
END_BOARD_STR_6x5);
|
||||
|
||||
/** 4x4 Test
|
||||
**/
|
||||
private static final String START_BOARD_STR_4x4 = ""
|
||||
+ "xxxx\n"
|
||||
+ "34-m\n"
|
||||
+ "3511\n"
|
||||
+ "3211";
|
||||
private static final Point MOVE_TO_4x4 = new Point(1, 2);
|
||||
private static final String END_BOARD_STR_4x4 = ""
|
||||
+ "xxxx\n"
|
||||
+ "345-\n"
|
||||
+ "3m11\n"
|
||||
+ "3211";
|
||||
private static final ReorderTestCase TEST_CASE_4x4 = new ReorderTestCase(START_BOARD_STR_4x4,
|
||||
MOVE_TO_4x4,
|
||||
END_BOARD_STR_4x4);
|
||||
|
||||
public static final Map<Point, ReorderTestCase> TEST_BY_GRID_SIZE =
|
||||
Map.of(new Point(5, 5), TEST_CASE_5x5, new Point(6, 5), TEST_CASE_6x5);
|
||||
Map.of(new Point(5, 5), TEST_CASE_5x5,
|
||||
new Point(6, 5), TEST_CASE_6x5,
|
||||
new Point(4, 4), TEST_CASE_4x4);
|
||||
}
|
||||
|
||||
@@ -17,60 +17,68 @@ package com.android.launcher3.celllayout.testcases;
|
||||
|
||||
import android.graphics.Point;
|
||||
|
||||
import com.android.launcher3.celllayout.CellLayoutBoard;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PushReorderCase {
|
||||
|
||||
/** 5x5 Test
|
||||
**/
|
||||
private static final String START_BOARD_STR_5x5 = ""
|
||||
+ "xxxxx\n"
|
||||
+ "222m-\n"
|
||||
+ "--111\n"
|
||||
+ "--333\n"
|
||||
+ "-----";
|
||||
private static final CellLayoutBoard START_BOARD_5x5 = CellLayoutBoard.boardFromString(
|
||||
START_BOARD_STR_5x5);
|
||||
|
||||
private static final Point MOVE_TO_5x5 = new Point(2, 1);
|
||||
|
||||
private static final String END_BOARD_STR_5x5 = ""
|
||||
+ "xxxxx\n"
|
||||
+ "--m--\n"
|
||||
+ "222--\n"
|
||||
+ "--111\n"
|
||||
+ "--333";
|
||||
private static final CellLayoutBoard END_BOARD_5x5 = CellLayoutBoard.boardFromString(
|
||||
private static final ReorderTestCase TEST_CASE_5x5 = new ReorderTestCase(START_BOARD_STR_5x5,
|
||||
MOVE_TO_5x5,
|
||||
END_BOARD_STR_5x5);
|
||||
|
||||
private static final ReorderTestCase TEST_CASE_5x5 = new ReorderTestCase(START_BOARD_5x5,
|
||||
MOVE_TO_5x5,
|
||||
END_BOARD_5x5);
|
||||
|
||||
|
||||
/** 6x5 Test
|
||||
**/
|
||||
private static final String START_BOARD_STR_6x5 = ""
|
||||
+ "xxxxxx\n"
|
||||
+ "2222m-\n"
|
||||
+ "--111-\n"
|
||||
+ "--333-\n"
|
||||
+ "------";
|
||||
private static final CellLayoutBoard START_BOARD_6x5 = CellLayoutBoard.boardFromString(
|
||||
START_BOARD_STR_6x5);
|
||||
|
||||
private static final Point MOVE_TO_6x5 = new Point(2, 1);
|
||||
|
||||
private static final String END_BOARD_STR_6x5 = ""
|
||||
+ "xxxxxx\n"
|
||||
+ "--m---\n"
|
||||
+ "2222--\n"
|
||||
+ "--111-\n"
|
||||
+ "--333-";
|
||||
private static final CellLayoutBoard END_BOARD_6x5 = CellLayoutBoard.boardFromString(
|
||||
private static final ReorderTestCase TEST_CASE_6x5 = new ReorderTestCase(START_BOARD_STR_6x5,
|
||||
MOVE_TO_6x5,
|
||||
END_BOARD_STR_6x5);
|
||||
|
||||
private static final ReorderTestCase TEST_CASE_6x5 = new ReorderTestCase(START_BOARD_6x5,
|
||||
MOVE_TO_6x5,
|
||||
END_BOARD_6x5);
|
||||
/** 4x4 Test
|
||||
**/
|
||||
private static final String START_BOARD_STR_4x4 = ""
|
||||
+ "xxxx\n"
|
||||
+ "222m\n"
|
||||
+ "-111\n"
|
||||
+ "----";
|
||||
private static final Point MOVE_TO_4x4 = new Point(2, 1);
|
||||
private static final String END_BOARD_STR_4x4 = ""
|
||||
+ "xxxx\n"
|
||||
+ "--m-\n"
|
||||
+ "222-\n"
|
||||
+ "-111";
|
||||
private static final ReorderTestCase TEST_CASE_4x4 = new ReorderTestCase(START_BOARD_STR_4x4,
|
||||
MOVE_TO_4x4,
|
||||
END_BOARD_STR_4x4);
|
||||
|
||||
public static final Map<Point, ReorderTestCase> TEST_BY_GRID_SIZE =
|
||||
Map.of(new Point(5, 5), TEST_CASE_5x5, new Point(6, 5), TEST_CASE_6x5);
|
||||
Map.of(new Point(5, 5), TEST_CASE_5x5,
|
||||
new Point(6, 5), TEST_CASE_6x5,
|
||||
new Point(4, 4), TEST_CASE_4x4);
|
||||
}
|
||||
|
||||
@@ -17,35 +17,47 @@ package com.android.launcher3.celllayout.testcases;
|
||||
|
||||
import android.graphics.Point;
|
||||
|
||||
import com.android.launcher3.celllayout.CellLayoutBoard;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SimpleReorderCase {
|
||||
private static final String START_BOARD_STR = ""
|
||||
|
||||
/** 5x5 Test
|
||||
**/
|
||||
private static final String START_BOARD_STR_5x5 = ""
|
||||
+ "xxxxx\n"
|
||||
+ "--mm-\n"
|
||||
+ "--mm-\n"
|
||||
+ "-----\n"
|
||||
+ "-----";
|
||||
private static final CellLayoutBoard START_BOARD_5x5 = CellLayoutBoard.boardFromString(
|
||||
START_BOARD_STR);
|
||||
|
||||
private static final Point MOVE_TO_5x5 = new Point(4, 4);
|
||||
|
||||
private static final String END_BOARD_STR_5x5 = ""
|
||||
+ "xxxxx\n"
|
||||
+ "-----\n"
|
||||
+ "-----\n"
|
||||
+ "---mm\n"
|
||||
+ "---mm";
|
||||
private static final CellLayoutBoard END_BOARD_5x5 = CellLayoutBoard.boardFromString(
|
||||
private static final ReorderTestCase TEST_CASE_5x5 = new ReorderTestCase(START_BOARD_STR_5x5,
|
||||
MOVE_TO_5x5,
|
||||
END_BOARD_STR_5x5);
|
||||
|
||||
private static final ReorderTestCase TEST_CASE_5x5 = new ReorderTestCase(START_BOARD_5x5,
|
||||
MOVE_TO_5x5,
|
||||
END_BOARD_5x5);
|
||||
/** 4x4 Test
|
||||
**/
|
||||
private static final String START_BOARD_STR_4x4 = ""
|
||||
+ "xxxx\n"
|
||||
+ "--mm\n"
|
||||
+ "--mm\n"
|
||||
+ "----";
|
||||
private static final Point MOVE_TO_4x4 = new Point(3, 3);
|
||||
private static final String END_BOARD_STR_4x4 = ""
|
||||
+ "xxxx\n"
|
||||
+ "----\n"
|
||||
+ "--mm\n"
|
||||
+ "--mm";
|
||||
private static final ReorderTestCase TEST_CASE_4x4 = new ReorderTestCase(START_BOARD_STR_4x4,
|
||||
MOVE_TO_4x4,
|
||||
END_BOARD_STR_4x4);
|
||||
|
||||
public static final Map<Point, ReorderTestCase> TEST_BY_GRID_SIZE =
|
||||
Map.of(new Point(5, 5), TEST_CASE_5x5);
|
||||
Map.of(new Point(5, 5), TEST_CASE_5x5,
|
||||
new Point(4, 4), TEST_CASE_4x4);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user