Merge "Import translations. DO NOT MERGE ANYWHERE" into main
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index 05e1535..851f2b3 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -157,8 +157,8 @@
import com.android.quickstep.util.WorkspaceRevealAnim;
import com.android.quickstep.views.FloatingWidgetView;
import com.android.quickstep.views.RecentsView;
-import com.android.systemui.animation.ActivityLaunchAnimator;
-import com.android.systemui.animation.DelegateLaunchAnimatorController;
+import com.android.systemui.animation.ActivityTransitionAnimator;
+import com.android.systemui.animation.DelegateTransitionAnimatorController;
import com.android.systemui.animation.LaunchableView;
import com.android.systemui.animation.RemoteAnimationDelegate;
import com.android.systemui.shared.system.BlurUtils;
@@ -1838,8 +1838,8 @@
// The CUJ is logged by the click handler, so we don't log it inside the animation
// library.
- ActivityLaunchAnimator.Controller controllerDelegate =
- ActivityLaunchAnimator.Controller.fromView(viewToUse, null /* cujType */);
+ ActivityTransitionAnimator.Controller controllerDelegate =
+ ActivityTransitionAnimator.Controller.fromView(viewToUse, null /* cujType */);
if (controllerDelegate == null) {
return null;
@@ -1847,15 +1847,15 @@
// This wrapper allows us to override the default value, telling the controller that the
// current window is below the animating window.
- ActivityLaunchAnimator.Controller controller =
- new DelegateLaunchAnimatorController(controllerDelegate) {
+ ActivityTransitionAnimator.Controller controller =
+ new DelegateTransitionAnimatorController(controllerDelegate) {
@Override
public boolean isBelowAnimatingWindow() {
return true;
}
};
- ActivityLaunchAnimator.Callback callback = task -> {
+ ActivityTransitionAnimator.Callback callback = task -> {
final int backgroundColor =
startingWindowListener.mBackgroundColor == Color.TRANSPARENT
? launcher.getScrimView().getBackgroundColor()
@@ -1863,15 +1863,17 @@
return ColorUtils.setAlphaComponent(backgroundColor, 255);
};
- ActivityLaunchAnimator.Listener listener = new ActivityLaunchAnimator.Listener() {
- @Override
- public void onLaunchAnimationEnd() {
- onEndCallback.executeAllAndDestroy();
- }
- };
+ ActivityTransitionAnimator.Listener listener =
+ new ActivityTransitionAnimator.Listener() {
+ @Override
+ public void onTransitionAnimationEnd() {
+ onEndCallback.executeAllAndDestroy();
+ }
+ };
return new ContainerAnimationRunner(
- new ActivityLaunchAnimator.AnimationDelegate(controller, callback, listener));
+ new ActivityTransitionAnimator.AnimationDelegate(
+ controller, callback, listener));
}
/**
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
index 8e4a78f..9f6994a 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
@@ -304,6 +304,10 @@
callbacks.addListener(mTaskBarRecentsAnimationListener);
((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchListener(() ->
mTaskBarRecentsAnimationListener.endGestureStateOverride(true));
+
+ ((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchCancelledRunnable(() -> {
+ updateStateForUserFinishedToApp(false /* finishedToApp */);
+ });
return animatorSet;
}
@@ -770,21 +774,29 @@
mTaskBarRecentsAnimationListener = null;
((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchListener(null);
- // Update the visible state immediately to ensure a seamless handoff
- boolean launcherVisible = !finishedToApp;
- updateStateForFlag(FLAG_TRANSITION_TO_VISIBLE, false);
- updateStateForFlag(FLAG_VISIBLE, launcherVisible);
- applyState();
-
- TaskbarStashController controller = mControllers.taskbarStashController;
- if (DEBUG) {
- Log.d(TAG, "endGestureStateOverride - FLAG_IN_APP: " + finishedToApp);
- }
- controller.updateStateForFlag(FLAG_IN_APP, finishedToApp);
- controller.applyState();
+ updateStateForUserFinishedToApp(finishedToApp);
}
}
+ /**
+ * Updates the visible state immediately to ensure a seamless handoff.
+ * @param finishedToApp True iff user is in an app.
+ */
+ private void updateStateForUserFinishedToApp(boolean finishedToApp) {
+ // Update the visible state immediately to ensure a seamless handoff
+ boolean launcherVisible = !finishedToApp;
+ updateStateForFlag(FLAG_TRANSITION_TO_VISIBLE, false);
+ updateStateForFlag(FLAG_VISIBLE, launcherVisible);
+ applyState();
+
+ TaskbarStashController controller = mControllers.taskbarStashController;
+ if (DEBUG) {
+ Log.d(TAG, "endGestureStateOverride - FLAG_IN_APP: " + finishedToApp);
+ }
+ controller.updateStateForFlag(FLAG_IN_APP, finishedToApp);
+ controller.applyState();
+ }
+
private static String getStateString(int flags) {
StringJoiner result = new StringJoiner("|");
appendFlag(result, flags, FLAG_VISIBLE, "flag_visible");
diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java
index 8ff43f0..c2cd11c 100644
--- a/quickstep/src/com/android/quickstep/TaskViewUtils.java
+++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java
@@ -646,6 +646,18 @@
});
});
}
+
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ super.onAnimationCancel(animation);
+ recentsView.onTaskLaunchedInLiveTileModeCancelled();
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ super.onAnimationEnd(animation);
+ recentsView.setTaskLaunchCancelledRunnable(null);
+ }
};
} else {
AnimatorPlaybackController controller =
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 5228420..b6b7d58 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -491,6 +491,7 @@
mDeviceState = new RecentsAnimationDeviceState(this, true);
mTaskbarManager = new TaskbarManager(this);
mRotationTouchHelper = mDeviceState.getRotationTouchHelper();
+ mInputConsumer = InputConsumerController.getRecentsAnimationInputConsumer();
BootAwarePreloader.start(this);
// Call runOnUserUnlocked() before any other callbacks to ensure everything is initialized.
@@ -538,13 +539,13 @@
@UiThread
public void onUserUnlocked() {
+ Log.d(TAG, "onUserUnlocked: userId=" + getUserId());
mTaskAnimationManager = new TaskAnimationManager(this);
mOverviewComponentObserver = new OverviewComponentObserver(this, mDeviceState);
mOverviewCommandHelper = new OverviewCommandHelper(this,
mOverviewComponentObserver, mTaskAnimationManager);
mResetGestureInputConsumer = new ResetGestureInputConsumer(
mTaskAnimationManager, mTaskbarManager::getCurrentActivityContext);
- mInputConsumer = InputConsumerController.getRecentsAnimationInputConsumer();
mInputConsumer.registerInputConsumer();
onSystemUiFlagsChanged(mDeviceState.getSystemUiStateFlags());
onAssistantVisibilityChanged();
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index fecbf08..9884d8d 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -759,6 +759,9 @@
private RunnableList mSideTaskLaunchCallback;
@Nullable
private TaskLaunchListener mTaskLaunchListener;
+ @Nullable
+ private Runnable mOnTaskLaunchCancelledRunnable;
+
// keeps track of the state of the filter for tasks in recents view
private final RecentsFilterState mFilterState = new RecentsFilterState();
@@ -1195,6 +1198,21 @@
}
}
+ /**
+ * This is a one-time callback when touching in live tile mode. It's reset to null right
+ * after it's called.
+ */
+ public void setTaskLaunchCancelledRunnable(Runnable onTaskLaunchCancelledRunnable) {
+ mOnTaskLaunchCancelledRunnable = onTaskLaunchCancelledRunnable;
+ }
+
+ public void onTaskLaunchedInLiveTileModeCancelled() {
+ if (mOnTaskLaunchCancelledRunnable != null) {
+ mOnTaskLaunchCancelledRunnable.run();
+ mOnTaskLaunchCancelledRunnable = null;
+ }
+ }
+
private void executeSideTaskLaunchCallback() {
if (mSideTaskLaunchCallback != null) {
mSideTaskLaunchCallback.executeAllAndDestroy();
diff --git a/res/layout/widgets_full_sheet.xml b/res/layout/widgets_full_sheet.xml
index 47bf9e7..009359c 100644
--- a/res/layout/widgets_full_sheet.xml
+++ b/res/layout/widgets_full_sheet.xml
@@ -45,7 +45,7 @@
android:visibility="gone"
android:textSize="18sp"
android:layout_below="@id/search_and_recommendations_container"
- tools:text="No widgets available" />
+ tools:text="@string/no_widgets_available" />
<!-- Fast scroller popup -->
<TextView
diff --git a/res/layout/widgets_two_pane_sheet.xml b/res/layout/widgets_two_pane_sheet.xml
index 01c1b10..cd7f2e1 100644
--- a/res/layout/widgets_two_pane_sheet.xml
+++ b/res/layout/widgets_two_pane_sheet.xml
@@ -47,6 +47,16 @@
android:textColor="?attr/widgetPickerTitleColor"
android:textSize="24sp" />
+ <TextView
+ android:id="@+id/no_widgets_text"
+ style="@style/PrimaryHeadline"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:textSize="18sp"
+ android:visibility="gone"
+ tools:text="@string/no_widgets_available" />
+
<LinearLayout
android:id="@+id/linear_layout_container"
android:layout_width="match_parent"
@@ -57,6 +67,9 @@
android:id="@+id/recycler_view_container"
android:layout_width="0dp"
android:layout_height="match_parent"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:paddingBottom="24dp"
android:layout_gravity="start"
android:layout_weight="0.33">
<TextView
@@ -90,15 +103,6 @@
android:gravity="end"
android:layout_gravity="end"
android:orientation="horizontal">
- <TextView
- android:id="@+id/no_widgets_text"
- style="@style/PrimaryHeadline"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center"
- android:textSize="18sp"
- android:visibility="gone"
- tools:text="No widgets available" />
<ScrollView
android:id="@+id/right_pane_scroll_view"
android:layout_width="match_parent"
diff --git a/res/layout/widgets_two_pane_sheet_paged_view.xml b/res/layout/widgets_two_pane_sheet_paged_view.xml
index 4a7749b..887efb8 100644
--- a/res/layout/widgets_two_pane_sheet_paged_view.xml
+++ b/res/layout/widgets_two_pane_sheet_paged_view.xml
@@ -22,6 +22,8 @@
android:gravity="start"
android:paddingHorizontal="@dimen/widget_list_horizontal_margin_two_pane"
android:layout_gravity="start"
+ android:clipChildren="false"
+ android:clipToPadding="false"
android:layout_alignParentStart="true">
<com.android.launcher3.widget.picker.WidgetPagedView
android:id="@+id/widgets_view_pager"
diff --git a/res/layout/widgets_two_pane_sheet_recyclerview.xml b/res/layout/widgets_two_pane_sheet_recyclerview.xml
index 8b48abb..f3d3b16 100644
--- a/res/layout/widgets_two_pane_sheet_recyclerview.xml
+++ b/res/layout/widgets_two_pane_sheet_recyclerview.xml
@@ -21,6 +21,7 @@
android:layout_height="match_parent"
android:gravity="start"
android:layout_gravity="start"
+ android:clipChildren="false"
android:layout_alignParentStart="true">
<com.android.launcher3.widget.picker.WidgetsRecyclerView
diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
index 17d9276..28bae59 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -173,6 +173,7 @@
protected WidgetsSearchBar mSearchBar;
protected TextView mHeaderTitle;
protected RecyclerViewFastScroller mFastScroller;
+ protected int mBottomPadding;
public WidgetsFullSheet(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
@@ -370,15 +371,16 @@
@Override
public void setInsets(Rect insets) {
super.setInsets(insets);
- int bottomPadding = Math.max(insets.bottom, mNavBarScrimHeight);
- setBottomPadding(mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView, bottomPadding);
- setBottomPadding(mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView, bottomPadding);
+ mBottomPadding = Math.max(insets.bottom, mNavBarScrimHeight);
+ setBottomPadding(mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView, mBottomPadding);
+ setBottomPadding(mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView, mBottomPadding);
if (mHasWorkProfile) {
- setBottomPadding(mAdapters.get(AdapterHolder.WORK).mWidgetsRecyclerView, bottomPadding);
+ setBottomPadding(mAdapters.get(AdapterHolder.WORK)
+ .mWidgetsRecyclerView, mBottomPadding);
}
- ((MarginLayoutParams) mNoWidgetsView.getLayoutParams()).bottomMargin = bottomPadding;
+ ((MarginLayoutParams) mNoWidgetsView.getLayoutParams()).bottomMargin = mBottomPadding;
- if (bottomPadding > 0) {
+ if (mBottomPadding > 0) {
setupNavBarColor();
} else {
clearNavBarColor();
@@ -387,6 +389,15 @@
requestLayout();
}
+ @Override
+ public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+ WindowInsets w = super.onApplyWindowInsets(insets);
+ if (mInsets.bottom != mNavBarScrimHeight) {
+ setInsets(mInsets);
+ }
+ return w;
+ }
+
private void setBottomPadding(RecyclerView recyclerView, int bottomPadding) {
recyclerView.setPadding(
recyclerView.getPaddingLeft(),
@@ -791,8 +802,9 @@
if (mDeviceProfile.isLandscape != dp.isLandscape && dp.isTablet && !dp.isTwoPanels) {
handleClose(false);
show(BaseActivity.fromContext(getContext()), false);
- } else {
+ } else if (!isTwoPane()) {
reset();
+ resetExpandedHeaders();
}
// When folding/unfolding the foldables, we need to switch between the regular widget picker
diff --git a/src/com/android/launcher3/widget/picker/WidgetsTwoPaneSheet.java b/src/com/android/launcher3/widget/picker/WidgetsTwoPaneSheet.java
index 26c04f5..5a1ec87 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsTwoPaneSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsTwoPaneSheet.java
@@ -20,6 +20,7 @@
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Outline;
+import android.graphics.Rect;
import android.os.Process;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -58,11 +59,13 @@
private FrameLayout mSuggestedWidgetsContainer;
private WidgetsListHeader mSuggestedWidgetsHeader;
+ private PackageUserKey mSuggestedWidgetsPackageUserKey;
private LinearLayout mRightPane;
private ScrollView mRightPaneScrollView;
private WidgetsListTableViewHolderBinder mWidgetsListTableViewHolderBinder;
private int mActivePage = -1;
+ private PackageUserKey mSelectedHeader;
private final ViewOutlineProvider mViewOutlineProviderRightPane = new ViewOutlineProvider() {
@Override
@@ -124,6 +127,7 @@
mFastScroller.setVisibility(GONE);
}
+ /** Overrides onConfigurationChanged method from WidgetsFullSheet. Needed for b/319150904 */
@Override
protected void onConfigurationChanged(Configuration newConfig) {}
@@ -147,6 +151,23 @@
}
layoutParams.weight = layoutParams.width == 0 ? 0.33F : 0;
leftPane.setLayoutParams(layoutParams);
+ requestApplyInsets();
+ if (mSelectedHeader != null) {
+ if (mSelectedHeader.equals(mSuggestedWidgetsPackageUserKey)) {
+ mSuggestedWidgetsHeader.callOnClick();
+ } else {
+ getHeaderChangeListener().onHeaderChanged(mSelectedHeader);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onWidgetsBound() {
+ super.onWidgetsBound();
+ if (!mHasRecommendedWidgets && mSelectedHeader == null) {
+ mAdapters.get(mActivePage).mWidgetsListAdapter.selectFirstHeaderEntry();
+ mAdapters.get(mActivePage).mWidgetsRecyclerView.scrollToTop();
}
}
@@ -195,6 +216,8 @@
mRightPane.removeAllViews();
mRightPane.addView(mRecommendedWidgetsTable);
mRightPaneScrollView.setScrollY(0);
+ mSuggestedWidgetsPackageUserKey = PackageUserKey.fromPackageItemInfo(packageItemInfo);
+ mSelectedHeader = mSuggestedWidgetsPackageUserKey;
});
mSuggestedWidgetsContainer.addView(mSuggestedWidgetsHeader);
}
@@ -273,6 +296,7 @@
return new HeaderChangeListener() {
@Override
public void onHeaderChanged(@NonNull PackageUserKey selectedHeader) {
+ mSelectedHeader = selectedHeader;
WidgetsListContentEntry contentEntry = mActivityContext.getPopupDataProvider()
.getSelectedAppWidgets(selectedHeader);
@@ -303,6 +327,18 @@
}
@Override
+ public void setInsets(Rect insets) {
+ super.setInsets(insets);
+ FrameLayout rightPaneContainer = mContent.findViewById(R.id.right_pane_container);
+ rightPaneContainer.setPadding(
+ rightPaneContainer.getPaddingLeft(),
+ rightPaneContainer.getPaddingTop(),
+ rightPaneContainer.getPaddingRight(),
+ mBottomPadding);
+ requestLayout();
+ }
+
+ @Override
protected int getWidgetListHorizontalMargin() {
return getResources().getDimensionPixelSize(
R.dimen.widget_list_left_pane_horizontal_margin);
diff --git a/tests/multivalentTests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/multivalentTests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index f0d2e20..978e1f2 100644
--- a/tests/multivalentTests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/multivalentTests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -83,6 +83,7 @@
import org.junit.rules.TestRule;
import java.io.IOException;
+import java.util.Objects;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -223,14 +224,9 @@
public SetFlagsRule mSetFlagsRule = new SetFlagsRule(DEVICE_DEFAULT);
public static void initialize(AbstractLauncherUiTest test) throws Exception {
- initialize(test, false);
- }
-
- public static void initialize(
- AbstractLauncherUiTest test, boolean clearWorkspace) throws Exception {
- test.reinitializeLauncherData(clearWorkspace);
+ test.reinitializeLauncherData();
test.mDevice.pressHome();
- test.waitForLauncherCondition("Launcher didn't start", launcher -> launcher != null);
+ test.waitForLauncherCondition("Launcher didn't start", Objects::nonNull);
test.waitForState("Launcher internal state didn't switch to Home",
() -> LauncherState.NORMAL);
test.waitForResumed("Launcher internal state is still Background");
@@ -310,6 +306,8 @@
}
onTestStart();
+
+ initialize(this);
}
/** Method that should be called when a test starts. */
diff --git a/tests/multivalentTests/src/com/android/launcher3/util/rule/FailureWatcher.java b/tests/multivalentTests/src/com/android/launcher3/util/rule/FailureWatcher.java
index 10b428a..7fba33e 100644
--- a/tests/multivalentTests/src/com/android/launcher3/util/rule/FailureWatcher.java
+++ b/tests/multivalentTests/src/com/android/launcher3/util/rule/FailureWatcher.java
@@ -125,8 +125,6 @@
Log.e(TAG, "Failed to save accessibility hierarchy", ex);
}
- dumpCommand("logcat -d -s TestRunner", diagFile(description, "FilteredLogcat", "txt"));
-
// Dump bugreport
if (!sSavedBugreport) {
dumpCommand("bugreportz -s", diagFile(description, "Bugreport", "zip"));
diff --git a/tests/src/com/android/launcher3/AbstractDeviceProfileTest.kt b/tests/src/com/android/launcher3/AbstractDeviceProfileTest.kt
index dbafe79..2905d85 100644
--- a/tests/src/com/android/launcher3/AbstractDeviceProfileTest.kt
+++ b/tests/src/com/android/launcher3/AbstractDeviceProfileTest.kt
@@ -17,9 +17,12 @@
import android.content.Context
import android.content.res.Configuration
-import android.content.res.Resources
import android.graphics.Point
import android.graphics.Rect
+import android.platform.test.rule.AllowedDevices
+import android.platform.test.rule.DeviceProduct
+import android.platform.test.rule.IgnoreLimit
+import android.platform.test.rule.LimitDevicesRule
import android.util.DisplayMetrics
import android.view.Surface
import androidx.test.core.app.ApplicationProvider
@@ -32,7 +35,6 @@
import com.android.launcher3.util.rule.TestStabilityRule
import com.android.launcher3.util.window.CachedDisplayInfo
import com.android.launcher3.util.window.WindowManagerProxy
-import com.android.wm.shell.Flags
import com.google.common.truth.Truth
import java.io.BufferedReader
import java.io.File
@@ -52,6 +54,8 @@
*
* For an implementation that mocks InvariantDeviceProfile, use [FakeInvariantDeviceProfileTest]
*/
+@AllowedDevices(allowed = [DeviceProduct.CF_PHONE])
+@IgnoreLimit(ignoreLimit = BuildConfig.IS_STUDIO_BUILD)
abstract class AbstractDeviceProfileTest {
protected val testContext: Context = InstrumentationRegistry.getInstrumentation().context
protected lateinit var context: SandboxContext
@@ -59,15 +63,11 @@
private val displayController: DisplayController = mock()
private val windowManagerProxy: WindowManagerProxy = mock()
private val launcherPrefs: LauncherPrefs = mock()
- private val allowLeftRightSplitInPortrait: Boolean = initAllowLeftRightSplitInPortrait()
- fun initAllowLeftRightSplitInPortrait(): Boolean {
- val res = Resources.getSystem()
- val resId = res.getIdentifier("config_leftRightSplitInPortrait", "bool", "android")
- return Flags.enableLeftRightSplitInPortrait() && resId > 0 && res.getBoolean(resId)
- }
@Rule @JvmField val testStabilityRule = TestStabilityRule()
+ @Rule @JvmField val limitDevicesRule = LimitDevicesRule()
+
class DeviceSpec(
val naturalSize: Pair<Int, Int>,
var densityDpi: Int,
@@ -311,22 +311,6 @@
protected fun assertDump(dp: DeviceProfile, folderName: String, filename: String) {
val dump = dump(context!!, dp, "${folderName}_$filename.txt")
var expected = readDumpFromAssets(testContext, "$folderName/$filename.txt")
-
- // TODO(b/315230497): We don't currently have device-specific device profile dumps, so just
- // update the result before we do the comparison
- if (allowLeftRightSplitInPortrait) {
- val isLeftRightSplitInPortrait =
- when {
- allowLeftRightSplitInPortrait && dp.isTablet -> !dp.isLandscape
- else -> dp.isLandscape
- }
- expected =
- expected.replace(
- Regex("isLeftRightSplit:\\w+"),
- "isLeftRightSplit:$isLeftRightSplitInPortrait"
- )
- }
-
Truth.assertThat(dump).isEqualTo(expected)
}
diff --git a/tests/src/com/android/launcher3/FakeInvariantDeviceProfileTest.kt b/tests/src/com/android/launcher3/FakeInvariantDeviceProfileTest.kt
index 30b5663..251a401 100644
--- a/tests/src/com/android/launcher3/FakeInvariantDeviceProfileTest.kt
+++ b/tests/src/com/android/launcher3/FakeInvariantDeviceProfileTest.kt
@@ -18,6 +18,10 @@
import android.content.Context
import android.graphics.PointF
import android.graphics.Rect
+import android.platform.test.rule.AllowedDevices
+import android.platform.test.rule.DeviceProduct
+import android.platform.test.rule.IgnoreLimit
+import android.platform.test.rule.LimitDevicesRule
import android.util.SparseArray
import androidx.test.core.app.ApplicationProvider
import com.android.launcher3.DeviceProfile.DEFAULT_DIMENSION_PROVIDER
@@ -27,6 +31,7 @@
import java.io.PrintWriter
import java.io.StringWriter
import org.junit.Before
+import org.junit.Rule
import org.mockito.kotlin.any
import org.mockito.kotlin.mock
import org.mockito.kotlin.whenever
@@ -37,6 +42,8 @@
*
* For an implementation that creates InvariantDeviceProfile, use [AbstractDeviceProfileTest]
*/
+@AllowedDevices(allowed = [DeviceProduct.CF_PHONE])
+@IgnoreLimit(ignoreLimit = BuildConfig.IS_STUDIO_BUILD)
abstract class FakeInvariantDeviceProfileTest {
protected var context: Context? = null
@@ -49,6 +56,8 @@
protected var isGestureMode: Boolean = true
protected var isTransientTaskbar: Boolean = true
+ @Rule @JvmField val limitDevicesRule = LimitDevicesRule()
+
@Before
fun setUp() {
context = ApplicationProvider.getApplicationContext()
diff --git a/tests/src/com/android/launcher3/allapps/TaplAllAppsIconsWorkingTest.java b/tests/src/com/android/launcher3/allapps/TaplAllAppsIconsWorkingTest.java
index ba74244..ef5af0f 100644
--- a/tests/src/com/android/launcher3/allapps/TaplAllAppsIconsWorkingTest.java
+++ b/tests/src/com/android/launcher3/allapps/TaplAllAppsIconsWorkingTest.java
@@ -15,8 +15,6 @@
*/
package com.android.launcher3.allapps;
-import static com.android.launcher3.ui.AbstractLauncherUiTest.initialize;
-
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
diff --git a/tests/src/com/android/launcher3/allapps/TaplKeyboardFocusTest.java b/tests/src/com/android/launcher3/allapps/TaplKeyboardFocusTest.java
index ee32e97..db574a1 100644
--- a/tests/src/com/android/launcher3/allapps/TaplKeyboardFocusTest.java
+++ b/tests/src/com/android/launcher3/allapps/TaplKeyboardFocusTest.java
@@ -15,7 +15,6 @@
*/
package com.android.launcher3.allapps;
-import static com.android.launcher3.ui.AbstractLauncherUiTest.initialize;
import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
diff --git a/tests/src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java b/tests/src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java
index a1f2cef..ec24397 100644
--- a/tests/src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java
+++ b/tests/src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java
@@ -16,7 +16,6 @@
package com.android.launcher3.appiconmenu;
import static com.android.launcher3.util.TestConstants.AppNames.TEST_APP_NAME;
-import static com.android.launcher3.ui.AbstractLauncherUiTest.initialize;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
diff --git a/tests/src/com/android/launcher3/dragging/TaplDragTest.java b/tests/src/com/android/launcher3/dragging/TaplDragTest.java
index b633452..9942602 100644
--- a/tests/src/com/android/launcher3/dragging/TaplDragTest.java
+++ b/tests/src/com/android/launcher3/dragging/TaplDragTest.java
@@ -230,7 +230,7 @@
allApps.unfreeze();
}
// Reset the workspace for the next shortcut creation.
- initialize(this, true);
+ reinitializeLauncherData(true);
endTime = SystemClock.uptimeMillis();
elapsedTime = endTime - startTime;
Log.d("testDragAppIconToWorkspaceCellTime",
diff --git a/tests/src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java b/tests/src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java
index 0b9de0f..1e765c0 100644
--- a/tests/src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java
+++ b/tests/src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java
@@ -16,7 +16,6 @@
package com.android.launcher3.dragging;
import static com.android.launcher3.testing.shared.TestProtocol.ICON_MISSING;
-import static com.android.launcher3.ui.AbstractLauncherUiTest.initialize;
import static com.android.launcher3.util.TestConstants.AppNames.DUMMY_APP_NAME;
import static com.android.launcher3.util.TestConstants.AppNames.GMAIL_APP_NAME;
import static com.android.launcher3.util.TestConstants.AppNames.MAPS_APP_NAME;
diff --git a/tests/src/com/android/launcher3/ui/TaplWorkProfileTest.java b/tests/src/com/android/launcher3/ui/TaplWorkProfileTest.java
index cb30854..f8f5dde 100644
--- a/tests/src/com/android/launcher3/ui/TaplWorkProfileTest.java
+++ b/tests/src/com/android/launcher3/ui/TaplWorkProfileTest.java
@@ -28,10 +28,13 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
+import android.platform.test.rule.ScreenRecordRule;
import android.util.Log;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.LargeTest;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.R;
@@ -47,11 +50,14 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import java.io.IOException;
import java.util.Objects;
import java.util.function.Predicate;
+@LargeTest
+@RunWith(AndroidJUnit4.class)
public class TaplWorkProfileTest extends AbstractLauncherUiTest {
private static final int WORK_PAGE = ActivityAllAppsContainerView.AdapterHolder.WORK;
@@ -64,6 +70,7 @@
@Override
public void setUp() throws Exception {
super.setUp();
+ initialize(this);
String output =
mDevice.executeShellCommand(
"pm create-user --profileOf 0 --managed TestProfile");
@@ -139,7 +146,7 @@
// Staging; will be promoted to presubmit if stable
@TestStabilityRule.Stability(flavors = LOCAL | PLATFORM_POSTSUBMIT)
-
+ @ScreenRecordRule.ScreenRecord
@Test
public void toggleWorks() {
assumeTrue(mWorkProfileSetupSuccessful);