Snap for 13271084 from 4a22d06f6a to 25Q3-release
Change-Id: Iabe17cd9636568e27a4b88be0570bc4e77b77284
This commit is contained in:
commit
c196a61923
31 files changed
+303
-191
No files matched your search
@@ -120,3 +120,10 @@ flag {
|
||||
purpose: PURPOSE_BUGFIX
|
||||
}
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "enable_refactor_digital_wellbeing_toast"
|
||||
namespace: "launcher_overview"
|
||||
description: "Enables rewritten version of digital wellbeing toast in overview."
|
||||
bug: "404838605"
|
||||
}
|
||||
@@ -52,6 +52,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content" />
|
||||
|
||||
<include layout="@layout/digital_wellbeing_toast"
|
||||
android:id="@+id/digital_wellbeing_toast"/>
|
||||
<ViewStub
|
||||
android:id="@+id/digital_wellbeing_toast"
|
||||
android:inflatedId="@id/digital_wellbeing_toast"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/digital_wellbeing_toast_height" />
|
||||
</com.android.quickstep.views.TaskView>
|
||||
@@ -81,9 +81,15 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content" />
|
||||
|
||||
<include layout="@layout/digital_wellbeing_toast"
|
||||
android:id="@+id/digital_wellbeing_toast"/>
|
||||
<ViewStub
|
||||
android:id="@+id/digital_wellbeing_toast"
|
||||
android:inflatedId="@id/digital_wellbeing_toast"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/digital_wellbeing_toast_height" />
|
||||
|
||||
<include layout="@layout/digital_wellbeing_toast"
|
||||
android:id="@+id/bottomRight_digital_wellbeing_toast"/>
|
||||
<ViewStub
|
||||
android:id="@+id/bottomRight_digital_wellbeing_toast"
|
||||
android:inflatedId="@id/bottomRight_digital_wellbeing_toast"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/digital_wellbeing_toast_height" />
|
||||
</com.android.quickstep.views.GroupedTaskView>
|
||||
@@ -26,6 +26,7 @@ import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLA
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.graphics.Rect;
|
||||
import android.text.TextUtils;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -50,7 +51,6 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
|
||||
private final TaskbarView mTaskbarView;
|
||||
private final View mHoverView;
|
||||
private final ArrowTipView mHoverToolTipView;
|
||||
private final String mToolTipText;
|
||||
private final int mYOffset;
|
||||
|
||||
public TaskbarHoverToolTipController(TaskbarActivityContext activity, TaskbarView taskbarView,
|
||||
@@ -59,17 +59,6 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
|
||||
mTaskbarView = taskbarView;
|
||||
mHoverView = hoverView;
|
||||
|
||||
if (mHoverView instanceof BubbleTextView) {
|
||||
mToolTipText = ((BubbleTextView) mHoverView).getText().toString();
|
||||
} else if (mHoverView instanceof FolderIcon
|
||||
&& ((FolderIcon) mHoverView).mInfo.title != null) {
|
||||
mToolTipText = ((FolderIcon) mHoverView).mInfo.title.toString();
|
||||
} else if (mHoverView instanceof AppPairIcon) {
|
||||
mToolTipText = ((AppPairIcon) mHoverView).getTitleTextView().getText().toString();
|
||||
} else {
|
||||
mToolTipText = null;
|
||||
}
|
||||
|
||||
ContextThemeWrapper arrowContextWrapper = new ContextThemeWrapper(mActivity,
|
||||
R.style.ArrowTipTaskbarStyle);
|
||||
mHoverToolTipView = new ArrowTipView(arrowContextWrapper, /* isPointingUp = */ false,
|
||||
@@ -111,9 +100,15 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
|
||||
}
|
||||
|
||||
private void maybeRevealHoverToolTip() {
|
||||
if (mHoverView == null || mToolTipText == null) {
|
||||
if (mHoverView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String toolTipText = getToolTipText();
|
||||
if (TextUtils.isEmpty(toolTipText)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not show tooltip if taskbar icons are transitioning to hotseat.
|
||||
if (mActivity.isIconAlignedWithHotseat()) {
|
||||
return;
|
||||
@@ -128,7 +123,19 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
|
||||
}
|
||||
|
||||
Rect iconViewBounds = Utilities.getViewBounds(mHoverView);
|
||||
mHoverToolTipView.showAtLocation(mToolTipText, iconViewBounds.centerX(),
|
||||
mHoverToolTipView.showAtLocation(toolTipText, iconViewBounds.centerX(),
|
||||
mTaskbarView.getTop() - mYOffset, /* shouldAutoClose= */ false);
|
||||
}
|
||||
|
||||
private String getToolTipText() {
|
||||
if (mHoverView instanceof BubbleTextView btv) {
|
||||
return btv.getText().toString();
|
||||
} else if (mHoverView instanceof FolderIcon icon && icon.mInfo.title != null) {
|
||||
return icon.mInfo.title.toString();
|
||||
} else if (mHoverView instanceof AppPairIcon icon) {
|
||||
return icon.getTitleTextView().getText().toString();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -559,8 +559,7 @@ public class TaskbarManager implements DisplayDecorationListener {
|
||||
*/
|
||||
private void showTaskbarFromBroadcast(Intent intent) {
|
||||
debugPrimaryTaskbar("destroyTaskbarForDisplay");
|
||||
// TODO: make this code displayId specific
|
||||
TaskbarActivityContext taskbar = getTaskbarForDisplay(getDefaultDisplayId());
|
||||
TaskbarActivityContext taskbar = getTaskbarForDisplay(getFocusedDisplayId());
|
||||
if (ACTION_SHOW_TASKBAR.equals(intent.getAction()) && taskbar != null) {
|
||||
taskbar.showTaskbarFromBroadcast();
|
||||
}
|
||||
@@ -580,7 +579,7 @@ public class TaskbarManager implements DisplayDecorationListener {
|
||||
* Toggles All Apps for Taskbar or Launcher depending on the current state.
|
||||
*/
|
||||
public void toggleAllAppsSearch() {
|
||||
TaskbarActivityContext taskbar = getTaskbarForDisplay(getDefaultDisplayId());
|
||||
TaskbarActivityContext taskbar = getTaskbarForDisplay(getFocusedDisplayId());
|
||||
if (taskbar == null) {
|
||||
// Home All Apps should be toggled from this class, because the controllers are not
|
||||
// initialized when Taskbar is disabled (i.e. TaskbarActivityContext is null).
|
||||
@@ -1682,6 +1681,10 @@ public class TaskbarManager implements DisplayDecorationListener {
|
||||
return mPrimaryDisplayId;
|
||||
}
|
||||
|
||||
private int getFocusedDisplayId() {
|
||||
return SystemUiProxy.INSTANCE.get(mBaseContext).getFocusState().getFocusedDisplayId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs debug information about the TaskbarManager for primary display.
|
||||
* @param debugReason A string describing the reason for the debug log.
|
||||
|
||||
@@ -736,7 +736,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
if (taskIcon != null) {
|
||||
taskIcon = taskIcon.getConstantState().newDrawable().mutate();
|
||||
}
|
||||
btv.applyIconAndLabel(taskIcon, task.titleDescription);
|
||||
btv.applyIconAndLabel(taskIcon, task.title, task.titleDescription);
|
||||
btv.setTag(singleTask);
|
||||
}
|
||||
|
||||
|
||||
@@ -177,6 +177,8 @@ import com.android.quickstep.RecentsModel;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.TaskUtils;
|
||||
import com.android.quickstep.TouchInteractionService.TISBinder;
|
||||
import com.android.quickstep.fallback.window.RecentsDisplayModel;
|
||||
import com.android.quickstep.fallback.window.RecentsWindowManager;
|
||||
import com.android.quickstep.util.ActiveGestureProtoLogProxy;
|
||||
import com.android.quickstep.util.AsyncClockEventDelegate;
|
||||
import com.android.quickstep.util.LauncherUnfoldAnimationController;
|
||||
@@ -862,6 +864,13 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
if (overviewCommandHelper != null) {
|
||||
overviewCommandHelper.clearPendingCommands();
|
||||
}
|
||||
RecentsDisplayModel recentsDisplayModel = RecentsDisplayModel.getINSTANCE().get(this);
|
||||
recentsDisplayModel.getActiveDisplayResources().forEach(resource -> {
|
||||
RecentsWindowManager recentsWindowManager = resource.getRecentsWindowManager();
|
||||
if (recentsWindowManager != null) {
|
||||
recentsWindowManager.onNewIntent();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public QuickstepTransitionManager getAppTransitionManager() {
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.android.launcher3.statemanager.BaseState
|
||||
import com.android.launcher3.statemanager.StatefulContainer
|
||||
import com.android.launcher3.taskbar.TaskbarManager
|
||||
import com.android.launcher3.util.LockedUserState.Companion.get
|
||||
import com.android.quickstep.fallback.window.RecentsWindowFlags
|
||||
import com.android.quickstep.inputconsumers.AccessibilityInputConsumer
|
||||
import com.android.quickstep.inputconsumers.AssistantInputConsumer
|
||||
import com.android.quickstep.inputconsumers.BubbleBarInputConsumer
|
||||
@@ -631,6 +632,7 @@ object InputConsumerUtils {
|
||||
inputEventReceiver,
|
||||
gestureState,
|
||||
event,
|
||||
runningTask.isHomeTask,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -790,13 +792,16 @@ object InputConsumerUtils {
|
||||
inputEventReceiver: InputChannelCompat.InputEventReceiver,
|
||||
gestureState: GestureState,
|
||||
event: MotionEvent,
|
||||
isHomeTask: Boolean,
|
||||
): InputConsumer where T : RecentsViewContainer, T : StatefulContainer<S> {
|
||||
val shouldDefer =
|
||||
(!overviewComponentObserver.isHomeAndOverviewSame ||
|
||||
gestureState
|
||||
.getContainerInterface<S, T>()
|
||||
.deferStartingActivity(deviceState, event))
|
||||
val disableHorizontalSwipe = deviceState.isInExclusionRegion(event)
|
||||
val disableHorizontalSwipe =
|
||||
deviceState.isInExclusionRegion(event) &&
|
||||
(!RecentsWindowFlags.enableOverviewInWindow || !isHomeTask)
|
||||
return OtherActivityInputConsumer(
|
||||
/* base= */ context,
|
||||
deviceState,
|
||||
|
||||
@@ -206,7 +206,7 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
|
||||
@Override
|
||||
protected WindowInsets getWindowInsets() {
|
||||
RecentsViewContainer container = getRecentsViewContainer();
|
||||
WindowInsets insets = container == null
|
||||
WindowInsets insets = container == null || container.getRootView() == null
|
||||
? null : container.getRootView().getRootWindowInsets();
|
||||
return insets == null ? super.getWindowInsets() : insets;
|
||||
}
|
||||
|
||||
@@ -85,9 +85,9 @@ class TaskIconCache(
|
||||
|
||||
// TODO(b/387496731): Add ensureActive() calls if they show performance benefit
|
||||
override suspend fun getIcon(task: Task): TaskCacheEntry {
|
||||
task.icon?.let {
|
||||
task.icon?.let { icon ->
|
||||
// Nothing to load, the icon is already loaded
|
||||
return TaskCacheEntry(it, task.titleDescription ?: "", task.title)
|
||||
return TaskCacheEntry(icon, task.titleDescription ?: "", task.title ?: "")
|
||||
}
|
||||
|
||||
val entry = getCacheEntry(task)
|
||||
|
||||
@@ -23,6 +23,7 @@ import static com.android.quickstep.fallback.RecentsState.DEFAULT;
|
||||
import static com.android.quickstep.fallback.RecentsState.MODAL_TASK;
|
||||
import static com.android.quickstep.fallback.RecentsState.OVERVIEW_SPLIT_SELECT;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
@@ -136,17 +137,22 @@ public class FallbackRecentsView<CONTAINER_TYPE extends Context & RecentsViewCon
|
||||
@Nullable AnimatorSet animatorSet, GestureState.GestureEndTarget endTarget,
|
||||
RemoteTargetHandle[] remoteTargetHandles) {
|
||||
super.onPrepareGestureEndAnimation(animatorSet, endTarget, remoteTargetHandles);
|
||||
if (mHomeTask != null && endTarget == RECENTS && animatorSet != null) {
|
||||
TaskView tv = getTaskViewByTaskId(mHomeTask.key.id);
|
||||
if (tv != null) {
|
||||
PendingAnimation pa = new PendingAnimation(TASK_DISMISS_DURATION);
|
||||
createTaskDismissAnimation(pa, tv, true, false,
|
||||
if (mHomeTask != null && endTarget == RECENTS) {
|
||||
TaskView homeTaskView = getTaskViewByTaskId(mHomeTask.key.id);
|
||||
if (homeTaskView != null) {
|
||||
PendingAnimation pendingAnimation = new PendingAnimation(TASK_DISMISS_DURATION);
|
||||
createTaskDismissAnimation(pendingAnimation, homeTaskView, true, false,
|
||||
TASK_DISMISS_DURATION, false /* dismissingForSplitSelection*/,
|
||||
false /* isExpressiveDismiss */);
|
||||
pa.addEndListener(e -> setCurrentTask(-1));
|
||||
AnimatorPlaybackController controller = pa.createPlaybackController();
|
||||
pendingAnimation.addEndListener(e -> setCurrentTask(-1));
|
||||
AnimatorPlaybackController controller = pendingAnimation.createPlaybackController();
|
||||
controller.dispatchOnStart();
|
||||
animatorSet.play(controller.getAnimationPlayer());
|
||||
Animator homeDismissAnimator = controller.getAnimationPlayer();
|
||||
if (animatorSet != null) {
|
||||
animatorSet.play(homeDismissAnimator);
|
||||
} else {
|
||||
homeDismissAnimator.setDuration(0).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,6 +297,10 @@ class RecentsWindowManager(context: Context, wallpaperColorHints: Int) :
|
||||
stateManager.moveToRestState()
|
||||
}
|
||||
|
||||
fun onNewIntent() {
|
||||
cleanupRecentsWindow()
|
||||
}
|
||||
|
||||
private fun cleanupRecentsWindow() {
|
||||
RecentsWindowProtoLogProxy.logCleanup(isShowing())
|
||||
if (isShowing()) {
|
||||
|
||||
@@ -34,6 +34,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.debounce
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.flatMapLatest
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
@@ -91,6 +92,16 @@ class TaskViewModel(
|
||||
val state: Flow<TaskTileUiState> =
|
||||
combine(taskData, isLiveTile, overlayEnabled, isCentralTask, ::mapToTaskTile)
|
||||
.distinctUntilChanged()
|
||||
.debounce { state ->
|
||||
// Debouncing only when thumbnails are not present gives the best results.
|
||||
// This is because thumbnail loading is a decent predictor of there being no more
|
||||
// emissions to come as they are typically the last emission for a TaskView.
|
||||
if (state.tasks.any { (it as? TaskData.Data)?.thumbnailData?.thumbnail == null }) {
|
||||
DEBOUNCE_DELAY_MS
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
.flowOn(dispatcherProvider.background)
|
||||
|
||||
fun bind(vararg taskId: TaskId) {
|
||||
@@ -150,5 +161,6 @@ class TaskViewModel(
|
||||
|
||||
private companion object {
|
||||
const val TAG = "TaskViewModel"
|
||||
const val DEBOUNCE_DELAY_MS = 16L
|
||||
}
|
||||
}
|
||||
@@ -179,7 +179,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
?.inflate()
|
||||
}
|
||||
|
||||
private fun positionTaskWindows() {
|
||||
private fun positionTaskWindows(updateLayout: Boolean = false) {
|
||||
if (taskContainers.isEmpty()) {
|
||||
return
|
||||
}
|
||||
@@ -197,33 +197,33 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
val scaleWidth = taskViewWidth / screenWidth.toFloat()
|
||||
val scaleHeight = taskViewHeight / screenHeight.toFloat()
|
||||
|
||||
taskContainers.forEach {
|
||||
val taskId = it.task.key.id
|
||||
val fullscreenTaskPosition =
|
||||
fullscreenTaskPositions.firstOrNull { it.taskId == taskId } ?: return
|
||||
val overviewTaskPosition =
|
||||
taskContainers.forEach { taskContainer ->
|
||||
val taskId = taskContainer.task.key.id
|
||||
val fullscreenTaskBounds =
|
||||
fullscreenTaskPositions.firstOrNull { it.taskId == taskId }?.bounds ?: return
|
||||
val overviewTaskBounds =
|
||||
if (enableDesktopExplodedView()) {
|
||||
viewModel!!
|
||||
.organizedDesktopTaskPositions
|
||||
.firstOrNull { it.taskId == taskId }
|
||||
?.let { organizedPosition ->
|
||||
TEMP_OVERVIEW_TASK_POSITION.apply {
|
||||
lerpRect(
|
||||
fullscreenTaskPosition.bounds,
|
||||
organizedPosition.bounds,
|
||||
explodeProgress,
|
||||
)
|
||||
}
|
||||
} ?: fullscreenTaskPosition.bounds
|
||||
?.bounds ?: fullscreenTaskBounds
|
||||
} else {
|
||||
fullscreenTaskPosition.bounds
|
||||
fullscreenTaskBounds
|
||||
}
|
||||
val currentTaskBounds =
|
||||
if (enableDesktopExplodedView()) {
|
||||
TEMP_OVERVIEW_TASK_POSITION.apply {
|
||||
lerpRect(fullscreenTaskBounds, overviewTaskBounds, explodeProgress)
|
||||
}
|
||||
} else {
|
||||
fullscreenTaskBounds
|
||||
}
|
||||
|
||||
if (enableDesktopExplodedView()) {
|
||||
getRemoteTargetHandle(taskId)?.let { remoteTargetHandle ->
|
||||
val fromRect =
|
||||
TEMP_FROM_RECTF.apply {
|
||||
set(fullscreenTaskPosition.bounds)
|
||||
set(fullscreenTaskBounds)
|
||||
scale(scaleWidth)
|
||||
offset(
|
||||
lastComputedTaskSize.left.toFloat(),
|
||||
@@ -232,7 +232,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
}
|
||||
val toRect =
|
||||
TEMP_TO_RECTF.apply {
|
||||
set(overviewTaskPosition)
|
||||
set(currentTaskBounds)
|
||||
scale(scaleWidth)
|
||||
offset(
|
||||
lastComputedTaskSize.left.toFloat(),
|
||||
@@ -246,41 +246,30 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
}
|
||||
}
|
||||
|
||||
val taskLeft = overviewTaskPosition.left * scaleWidth
|
||||
val taskTop = overviewTaskPosition.top * scaleHeight
|
||||
val taskWidth = overviewTaskPosition.width() * scaleWidth
|
||||
val taskHeight = overviewTaskPosition.height() * scaleHeight
|
||||
// TODO(b/394660950): Revisit the choice to update the layout when explodeProgress == 1.
|
||||
// To run the explode animation in reverse, it may be simpler to use translation/scale
|
||||
// for all cases where the progress is non-zero.
|
||||
if (explodeProgress == 0.0f || explodeProgress == 1.0f) {
|
||||
// Reset scaling and translation that may have been applied during animation.
|
||||
it.snapshotView.apply {
|
||||
scaleX = 1.0f
|
||||
scaleY = 1.0f
|
||||
translationX = 0.0f
|
||||
translationY = 0.0f
|
||||
}
|
||||
|
||||
val overviewTaskLeft = overviewTaskBounds.left * scaleWidth
|
||||
val overviewTaskTop = overviewTaskBounds.top * scaleHeight
|
||||
val overviewTaskWidth = overviewTaskBounds.width() * scaleWidth
|
||||
val overviewTaskHeight = overviewTaskBounds.height() * scaleHeight
|
||||
if (updateLayout) {
|
||||
// Position the task to the same position as it would be on the desktop
|
||||
it.snapshotView.updateLayoutParams<LayoutParams> {
|
||||
taskContainer.snapshotView.updateLayoutParams<LayoutParams> {
|
||||
gravity = Gravity.LEFT or Gravity.TOP
|
||||
width = taskWidth.toInt()
|
||||
height = taskHeight.toInt()
|
||||
leftMargin = taskLeft.toInt()
|
||||
topMargin = taskTop.toInt()
|
||||
width = overviewTaskWidth.toInt()
|
||||
height = overviewTaskHeight.toInt()
|
||||
leftMargin = overviewTaskLeft.toInt()
|
||||
topMargin = overviewTaskTop.toInt()
|
||||
}
|
||||
|
||||
if (
|
||||
enableDesktopRecentsTransitionsCornersBugfix() && enableRefactorTaskThumbnail()
|
||||
) {
|
||||
it.thumbnailView.outlineBounds =
|
||||
if (intersects(overviewTaskPosition, screenRect))
|
||||
Rect(overviewTaskPosition).apply {
|
||||
taskContainer.thumbnailView.outlineBounds =
|
||||
if (intersects(overviewTaskBounds, screenRect))
|
||||
Rect(overviewTaskBounds).apply {
|
||||
intersectUnchecked(screenRect)
|
||||
// Offset to 0,0 to transform into TaskThumbnailView's coordinate
|
||||
// system.
|
||||
offset(-overviewTaskPosition.left, -overviewTaskPosition.top)
|
||||
offset(-overviewTaskBounds.left, -overviewTaskBounds.top)
|
||||
left = (left * scaleWidth).roundToInt()
|
||||
top = (top * scaleHeight).roundToInt()
|
||||
right = (right * scaleWidth).roundToInt()
|
||||
@@ -288,17 +277,21 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
}
|
||||
else null
|
||||
}
|
||||
} else {
|
||||
// During the animation, apply translation and scale such that the view is
|
||||
// transformed to where we want, without triggering layout.
|
||||
it.snapshotView.apply {
|
||||
pivotX = 0.0f
|
||||
pivotY = 0.0f
|
||||
translationX = taskLeft - left
|
||||
translationY = taskTop - top
|
||||
scaleX = taskWidth / width.toFloat()
|
||||
scaleY = taskHeight / height.toFloat()
|
||||
}
|
||||
}
|
||||
|
||||
val currentTaskLeft = currentTaskBounds.left * scaleWidth
|
||||
val currentTaskTop = currentTaskBounds.top * scaleHeight
|
||||
val currentTaskWidth = currentTaskBounds.width() * scaleWidth
|
||||
val currentTaskHeight = currentTaskBounds.height() * scaleHeight
|
||||
// During the animation, apply translation and scale such that the view is transformed
|
||||
// to where we want, without triggering layout.
|
||||
taskContainer.snapshotView.apply {
|
||||
pivotX = 0.0f
|
||||
pivotY = 0.0f
|
||||
translationX = currentTaskLeft - overviewTaskLeft
|
||||
translationY = currentTaskTop - overviewTaskTop
|
||||
scaleX = currentTaskWidth / overviewTaskWidth
|
||||
scaleY = currentTaskHeight / overviewTaskHeight
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -509,7 +502,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
if (enableDesktopExplodedView()) {
|
||||
viewModel?.organizeDesktopTasks(desktopSize, fullscreenTaskPositions)
|
||||
}
|
||||
positionTaskWindows()
|
||||
positionTaskWindows(updateLayout = true)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -109,6 +109,9 @@ class GroupedTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
else R.layout.icon_view
|
||||
}
|
||||
?.inflate()
|
||||
findViewById<ViewStub>(R.id.bottomRight_digital_wellbeing_toast)
|
||||
?.apply { layoutResource = R.layout.digital_wellbeing_toast }
|
||||
?.inflate()
|
||||
}
|
||||
|
||||
override fun onRecycle() {
|
||||
|
||||
@@ -2771,6 +2771,7 @@ public abstract class RecentsView<
|
||||
}
|
||||
if (enableRefactorTaskThumbnail()) {
|
||||
mRecentsViewModel.onReset();
|
||||
getTaskViews().forEach(TaskView::cancelJobs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -429,6 +429,7 @@ constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int = 0) :
|
||||
|
||||
var additionalTranslationX = 0f
|
||||
if (
|
||||
taskView.pagedOrientationHandler.isLayoutNaturalToLauncher &&
|
||||
taskContainer.stagePosition == SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT
|
||||
) {
|
||||
// Animate menu and icon when split task would display off the side of the screen.
|
||||
|
||||
@@ -780,6 +780,10 @@ constructor(
|
||||
else R.layout.icon_view
|
||||
}
|
||||
?.inflate()
|
||||
|
||||
findViewById<ViewStub>(R.id.digital_wellbeing_toast)
|
||||
?.apply { layoutResource = R.layout.digital_wellbeing_toast }
|
||||
?.inflate()
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() =
|
||||
@@ -888,17 +892,21 @@ constructor(
|
||||
return thumbnailPosition
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() =
|
||||
traceSection("TaskView.onDetachedFromWindow") {
|
||||
super.onDetachedFromWindow()
|
||||
if (enableRefactorTaskThumbnail()) {
|
||||
// The jobs are being cancelled in the background thread. So we make a copy of the
|
||||
// list to prevent cleaning a new job that might be added to this list during
|
||||
// onAttach or another moment in the lifecycle.
|
||||
val coroutineJobsToCancel = coroutineJobs.toList()
|
||||
coroutineJobs.clear()
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
cancelJobs()
|
||||
}
|
||||
|
||||
fun cancelJobs() =
|
||||
traceSection("TaskView.cancelJobs") {
|
||||
// The jobs are being cancelled in the background thread. So we make a copy of the
|
||||
// list to prevent cleaning a new job that might be added to this list during
|
||||
// onAttach or another moment in the lifecycle.
|
||||
val coroutineJobsToCancel = coroutineJobs.toList()
|
||||
coroutineJobs.clear()
|
||||
if (coroutineJobsToCancel.isNotEmpty()) {
|
||||
coroutineScope.launch(dispatcherProvider.background) {
|
||||
traceSection("TaskView.onDetachedFromWindow.cancellingJobs") {
|
||||
traceSection("TaskView.cancelJobs.cancellingJobs") {
|
||||
coroutineJobsToCancel.forEach {
|
||||
it.cancel("TaskView detaching from window")
|
||||
}
|
||||
|
||||
+9
@@ -147,6 +147,15 @@ class TaskbarHoverToolTipControllerTest {
|
||||
assertThat(isHoverToolTipOpen).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onHover_emptyTitle_noTooltip() {
|
||||
runOnMainSync {
|
||||
iconView.text = ""
|
||||
iconView.dispatchGenericMotionEvent(HOVER_ENTER)
|
||||
}
|
||||
assertThat(isHoverToolTipOpen).isFalse()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val HOVER_EXIT = MotionEvent.obtain(0, 0, ACTION_HOVER_EXIT, 0f, 0f, 0)
|
||||
private val HOVER_ENTER = MotionEvent.obtain(0, 0, ACTION_HOVER_ENTER, 0f, 0f, 0)
|
||||
|
||||
@@ -31,6 +31,7 @@ import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.platform.test.annotations.EnableFlags;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.filters.LargeTest;
|
||||
@@ -39,6 +40,7 @@ import androidx.test.runner.AndroidJUnit4;
|
||||
import androidx.test.uiautomator.By;
|
||||
import androidx.test.uiautomator.Until;
|
||||
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.tapl.BaseOverview;
|
||||
import com.android.launcher3.tapl.LaunchedAppState;
|
||||
@@ -65,6 +67,7 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -560,20 +563,21 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
|
||||
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
@EnableFlags(value = Flags.FLAG_ENABLE_GRID_ONLY_OVERVIEW)
|
||||
public void testDismissBottomRow() throws Exception {
|
||||
assumeTrue(mLauncher.isTablet());
|
||||
mLauncher.goHome().switchToOverview().dismissAllTasks();
|
||||
startTestAppsWithCheck();
|
||||
|
||||
Overview overview = mLauncher.goHome().switchToOverview();
|
||||
assertIsInState("Launcher internal state didn't switch to Overview",
|
||||
ExpectedState.OVERVIEW);
|
||||
final Integer numTasks = getFromRecentsView(RecentsView::getTaskViewCount);
|
||||
OverviewTask bottomTask = overview.getCurrentTasksForTablet().stream().max(
|
||||
Comparator.comparingInt(OverviewTask::getTaskCenterY)).get();
|
||||
assertNotNull("bottomTask null", bottomTask);
|
||||
|
||||
bottomTask.dismiss();
|
||||
Optional<OverviewTask> bottomTask = overview.getCurrentTasksForTablet().stream().max(
|
||||
Comparator.comparingInt(OverviewTask::getTaskCenterY));
|
||||
assertTrue("bottomTask null", bottomTask.isPresent());
|
||||
|
||||
bottomTask.get().dismiss();
|
||||
runOnRecentsView(recentsView -> assertEquals(
|
||||
"Dismissing a bottomTask didn't remove 1 bottomTask from Overview",
|
||||
numTasks - 1, recentsView.getTaskViewCount()));
|
||||
@@ -581,34 +585,38 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
|
||||
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
@EnableFlags(value = Flags.FLAG_ENABLE_GRID_ONLY_OVERVIEW)
|
||||
public void testDismissLastGridRow() throws Exception {
|
||||
assumeTrue(mLauncher.isTablet());
|
||||
mLauncher.goHome().switchToOverview().dismissAllTasks();
|
||||
startTestAppsWithCheck();
|
||||
startTestActivity(3);
|
||||
startTestActivity(4);
|
||||
runOnRecentsView(
|
||||
recentsView -> assertNotEquals("Grid overview should have unequal row counts",
|
||||
recentsView.getTopRowTaskCountForTablet(),
|
||||
recentsView.getBottomRowTaskCountForTablet()));
|
||||
runOnRecentsView(recentsView -> assertNotEquals(
|
||||
"Grid overview should have unequal row counts",
|
||||
recentsView.getTopRowTaskCountForTablet(),
|
||||
recentsView.getBottomRowTaskCountForTablet()));
|
||||
Overview overview = mLauncher.goHome().switchToOverview();
|
||||
assertIsInState("Launcher internal state didn't switch to Overview",
|
||||
ExpectedState.OVERVIEW);
|
||||
|
||||
overview.flingForwardUntilClearAllVisible();
|
||||
assertTrue("Clear All not visible.", overview.isClearAllVisible());
|
||||
final Integer numTasks = getFromRecentsView(RecentsView::getTaskViewCount);
|
||||
OverviewTask lastGridTask = overview.getCurrentTasksForTablet().stream().min(
|
||||
Comparator.comparingInt(OverviewTask::getTaskCenterX)).get();
|
||||
assertNotNull("lastGridTask null.", lastGridTask);
|
||||
Optional<OverviewTask> lastGridTask = overview.getCurrentTasksForTablet().stream().min(
|
||||
Comparator.comparingInt(OverviewTask::getTaskCenterX));
|
||||
assertTrue("lastGridTask null.", lastGridTask.isPresent());
|
||||
|
||||
lastGridTask.dismiss();
|
||||
|
||||
runOnRecentsView(recentsView -> assertEquals(
|
||||
"Dismissing a lastGridTask didn't remove 1 lastGridTask from Overview",
|
||||
numTasks - 1, recentsView.getTaskViewCount()));
|
||||
runOnRecentsView(recentsView -> assertEquals("Grid overview should have equal row counts.",
|
||||
recentsView.getTopRowTaskCountForTablet(),
|
||||
recentsView.getBottomRowTaskCountForTablet()));
|
||||
lastGridTask.get().dismiss();
|
||||
runOnRecentsView(recentsView -> {
|
||||
assertEquals(
|
||||
"Dismissing a lastGridTask didn't remove 1 lastGridTask from Overview",
|
||||
numTasks - 1, recentsView.getTaskViewCount());
|
||||
assertEquals(
|
||||
"Grid overview should have equal row counts.",
|
||||
recentsView.getTopRowTaskCountForTablet(),
|
||||
recentsView.getBottomRowTaskCountForTablet());
|
||||
});
|
||||
assertTrue("Clear All not visible.", overview.isClearAllVisible());
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
android:contentDescription="@string/all_apps_personal_tab_content_description"
|
||||
android:textColor="@color/all_apps_tab_text"
|
||||
android:textSize="14sp"
|
||||
style="?android:attr/borderlessButtonStyle" />
|
||||
style="@style/AllAppsPersonalWorkTabStyle" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tab_work"
|
||||
@@ -50,5 +50,5 @@
|
||||
android:contentDescription="@string/all_apps_work_tab_content_description"
|
||||
android:textColor="@color/all_apps_tab_text"
|
||||
android:textSize="14sp"
|
||||
style="?android:attr/borderlessButtonStyle" />
|
||||
style="@style/AllAppsPersonalWorkTabStyle" />
|
||||
</com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip>
|
||||
@@ -75,7 +75,7 @@
|
||||
android:maxLines="1"
|
||||
android:visibility="gone"
|
||||
android:alpha="0"
|
||||
style="@style/TextHeadline"/>
|
||||
style="@style/PrivateSpaceLockTextStyle"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
|
||||
@@ -38,7 +38,8 @@
|
||||
android:textAlignment="center"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:textSize="14sp" />
|
||||
android:textSize="14sp"
|
||||
style="@style/WorkPausedBodyTextStyle"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
@@ -50,5 +51,6 @@
|
||||
android:background="@drawable/bg_work_apps_paused_action_button"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textSize="14sp" />
|
||||
android:textSize="14sp"
|
||||
style="@style/WorkPausedBodyTextStyle"/>
|
||||
</com.android.launcher3.allapps.WorkPausedCard>
|
||||
@@ -45,5 +45,5 @@
|
||||
android:layout_marginStart="@dimen/work_fab_text_start_margin"
|
||||
android:layout_marginEnd="@dimen/work_fab_text_end_margin"
|
||||
android:maxLines="1"
|
||||
style="@style/TextHeadline"/>
|
||||
style="@style/WorkModeFabTextStyle"/>
|
||||
</LinearLayout>
|
||||
+33
-1
@@ -364,6 +364,9 @@
|
||||
<item name="android:stateListAnimator">@animator/all_apps_fastscroll_icon_anim</item>
|
||||
<item name="android:paddingLeft">@dimen/dynamic_grid_cell_padding_x</item>
|
||||
<item name="android:paddingRight">@dimen/dynamic_grid_cell_padding_x</item>
|
||||
<item name="android:fontFamily" android:featureFlag="com.android.launcher3.gsf_res">
|
||||
variable-title-small
|
||||
</item>
|
||||
</style>
|
||||
|
||||
|
||||
@@ -474,7 +477,36 @@
|
||||
<style name="PrivateSpaceHeaderTextStyle">
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:textColor">@color/materialColorOnSurface</item>
|
||||
<item name="android:fontFamily">google-sans-text-medium</item>
|
||||
<item name="android:fontFamily" android:featureFlag="com.android.launcher3.gsf_res">
|
||||
variable-title-medium
|
||||
</item>
|
||||
<item name="android:fontFamily" android:featureFlag="!com.android.launcher3.gsf_res">
|
||||
google-sans-text-medium
|
||||
</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
</style>
|
||||
|
||||
<style name="PrivateSpaceLockTextStyle" parent="TextHeadline">
|
||||
<item name="android:fontFamily" android:featureFlag="com.android.launcher3.gsf_res">
|
||||
variable-title-small
|
||||
</item>
|
||||
</style>
|
||||
|
||||
<style name="AllAppsPersonalWorkTabStyle" parent="@style/Widget.AppCompat.Button.Borderless">
|
||||
<item name="android:fontFamily" android:featureFlag="com.android.launcher3.gsf_res">
|
||||
variable-title-small
|
||||
</item>
|
||||
</style>
|
||||
|
||||
<style name="WorkModeFabTextStyle" parent="TextHeadline">
|
||||
<item name="android:fontFamily" android:featureFlag="com.android.launcher3.gsf_res">
|
||||
variable-title-small
|
||||
</item>
|
||||
</style>
|
||||
|
||||
<style name="WorkPausedBodyTextStyle">
|
||||
<item name="android:fontFamily" android:featureFlag="com.android.launcher3.gsf_res">
|
||||
variable-title-small
|
||||
</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -473,10 +473,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
* Directly set the icon and label.
|
||||
*/
|
||||
@UiThread
|
||||
public void applyIconAndLabel(Drawable icon, CharSequence label) {
|
||||
public void applyIconAndLabel(Drawable icon, CharSequence title, CharSequence description) {
|
||||
applyCompoundDrawables(icon);
|
||||
setText(label);
|
||||
setContentDescription(label);
|
||||
setText(title);
|
||||
setContentDescription(description);
|
||||
}
|
||||
|
||||
/** Updates whether the app this view represents is currently running. */
|
||||
|
||||
@@ -56,11 +56,9 @@ import com.android.launcher3.util.RunnableList;
|
||||
import com.android.systemui.shared.Flags;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@@ -171,16 +169,10 @@ public class GridCustomizationsProxy implements ProxyProvider {
|
||||
if (Flags.newCustomizationPickerUi()) {
|
||||
MatrixCursor cursor = new MatrixCursor(new String[]{
|
||||
KEY_SHAPE_KEY, KEY_SHAPE_TITLE, KEY_PATH, KEY_IS_DEFAULT});
|
||||
String currentShapePath = mThemeManager.getIconState().getIconMask();
|
||||
Optional<IconShapeModel> selectedShape = Arrays.stream(
|
||||
ShapesProvider.INSTANCE.getIconShapes()).filter(
|
||||
shape -> shape.getPathString().equals(currentShapePath)
|
||||
).findFirst();
|
||||
// Handle default for when current shape doesn't match new shapes.
|
||||
if (selectedShape.isEmpty()) {
|
||||
selectedShape = Optional.of(Arrays.stream(
|
||||
ShapesProvider.INSTANCE.getIconShapes()
|
||||
).findFirst().get());
|
||||
String currentShape = mPrefs.get(PREF_ICON_SHAPE);
|
||||
if (TextUtils.isEmpty(currentShape)) {
|
||||
// Handle default for when there is no current shape.
|
||||
currentShape = ShapesProvider.INSTANCE.getIconShapes()[0].getKey();
|
||||
}
|
||||
|
||||
for (IconShapeModel shape : ShapesProvider.INSTANCE.getIconShapes()) {
|
||||
@@ -188,7 +180,7 @@ public class GridCustomizationsProxy implements ProxyProvider {
|
||||
.add(KEY_SHAPE_KEY, shape.getKey())
|
||||
.add(KEY_SHAPE_TITLE, shape.getTitle())
|
||||
.add(KEY_PATH, shape.getPathString())
|
||||
.add(KEY_IS_DEFAULT, shape.equals(selectedShape.get()));
|
||||
.add(KEY_IS_DEFAULT, shape.getKey().equals(currentShape));
|
||||
}
|
||||
return cursor;
|
||||
} else {
|
||||
@@ -254,9 +246,9 @@ public class GridCustomizationsProxy implements ProxyProvider {
|
||||
if (match == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
mIdp.setCurrentGrid(mContext, gridName);
|
||||
if (Flags.newCustomizationPickerUi()) {
|
||||
boolean didGridChange = !mPrefs.get(LauncherPrefs.GRID_NAME).equals(gridName);
|
||||
if (Flags.newCustomizationPickerUi() && didGridChange) {
|
||||
try {
|
||||
// Wait for device profile to be fully reloaded and applied to the launcher
|
||||
loadModelSync(mContext);
|
||||
|
||||
@@ -88,7 +88,12 @@ internal constructor(
|
||||
canvas.clipPath(overridePath)
|
||||
canvas.drawColor(Color.BLACK)
|
||||
canvas.save()
|
||||
canvas.scale(iconScale, iconScale, canvas.width / 2f, canvas.height / 2f)
|
||||
canvas.scale(
|
||||
iconScale,
|
||||
iconScale,
|
||||
drawable.bounds.exactCenterX(),
|
||||
drawable.bounds.exactCenterY(),
|
||||
)
|
||||
if (drawable.background != null) {
|
||||
drawable.background.draw(canvas)
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
|
||||
import com.android.launcher3.graphics.ShapeDelegate;
|
||||
import com.android.launcher3.graphics.ThemeManager;
|
||||
|
||||
/**
|
||||
@@ -67,6 +68,7 @@ public class ClipIconView extends View implements ClipPathView {
|
||||
private @Nullable Drawable mBackground;
|
||||
|
||||
private boolean mIsAdaptiveIcon = false;
|
||||
private boolean mIsFolderIcon = false;
|
||||
|
||||
private ValueAnimator mRevealAnimator;
|
||||
private float mIconScale;
|
||||
@@ -180,8 +182,9 @@ public class ClipIconView extends View implements ClipPathView {
|
||||
if ((!isOpening || Flags.enableLauncherIconShapes())
|
||||
&& progress >= shapeProgressStart) {
|
||||
if (mRevealAnimator == null) {
|
||||
mRevealAnimator = themeManager.getIconShape()
|
||||
.createRevealAnimator(this, mStartRevealRect,
|
||||
ShapeDelegate shape = mIsFolderIcon ? themeManager.getFolderShape()
|
||||
: themeManager.getIconShape();
|
||||
mRevealAnimator = shape.createRevealAnimator(this, mStartRevealRect,
|
||||
mOutline, mTaskCornerRadius, !isOpening);
|
||||
mRevealAnimator.addListener(forEndCallback(() -> mRevealAnimator = null));
|
||||
mRevealAnimator.start();
|
||||
@@ -235,7 +238,7 @@ public class ClipIconView extends View implements ClipPathView {
|
||||
boolean isOpening, DeviceProfile dp) {
|
||||
mIsAdaptiveIcon = drawable instanceof AdaptiveIconDrawable;
|
||||
if (mIsAdaptiveIcon) {
|
||||
boolean isFolderIcon = drawable instanceof FolderAdaptiveIcon;
|
||||
mIsFolderIcon = drawable instanceof FolderAdaptiveIcon;
|
||||
|
||||
AdaptiveIconDrawable adaptiveIcon = (AdaptiveIconDrawable) drawable;
|
||||
Drawable background = adaptiveIcon.getBackground();
|
||||
@@ -255,7 +258,7 @@ public class ClipIconView extends View implements ClipPathView {
|
||||
int blurMargin = mBlurSizeOutline / 2;
|
||||
mFinalDrawableBounds.set(0, 0, originalWidth, originalHeight);
|
||||
|
||||
if (!isFolderIcon) {
|
||||
if (!mIsFolderIcon) {
|
||||
mFinalDrawableBounds.inset(iconOffset - blurMargin, iconOffset - blurMargin);
|
||||
}
|
||||
mForeground.setBounds(mFinalDrawableBounds);
|
||||
@@ -263,7 +266,7 @@ public class ClipIconView extends View implements ClipPathView {
|
||||
|
||||
mStartRevealRect.set(0, 0, originalWidth, originalHeight);
|
||||
|
||||
if (!isFolderIcon) {
|
||||
if (!mIsFolderIcon) {
|
||||
Utilities.scaleRectAboutCenter(mStartRevealRect, ICON_VISIBLE_AREA_FACTOR);
|
||||
}
|
||||
|
||||
@@ -319,11 +322,13 @@ public class ClipIconView extends View implements ClipPathView {
|
||||
canvas.clipPath(mClipPath);
|
||||
}
|
||||
int count2 = canvas.save();
|
||||
float iconCenterX =
|
||||
(mFinalDrawableBounds.right - mFinalDrawableBounds.left) / 2f * mIconScale;
|
||||
float iconCenterY =
|
||||
(mFinalDrawableBounds.bottom - mFinalDrawableBounds.top) / 2f * mIconScale;
|
||||
canvas.scale(mIconScale, mIconScale, iconCenterX, iconCenterY);
|
||||
if (!mIsFolderIcon) {
|
||||
float iconCenterX =
|
||||
(mFinalDrawableBounds.right - mFinalDrawableBounds.left) / 2f * mIconScale;
|
||||
float iconCenterY =
|
||||
(mFinalDrawableBounds.bottom - mFinalDrawableBounds.top) / 2f * mIconScale;
|
||||
canvas.scale(mIconScale, mIconScale, iconCenterX, iconCenterY);
|
||||
}
|
||||
if (mBackground != null) {
|
||||
mBackground.draw(canvas);
|
||||
}
|
||||
|
||||
+24
-33
@@ -39,11 +39,9 @@ import com.android.launcher3.model.data.WorkspaceItemInfo
|
||||
import com.android.launcher3.shortcuts.ShortcutKey
|
||||
import com.android.launcher3.util.ComponentKey
|
||||
import com.android.launcher3.util.IntSparseArrayMap
|
||||
import com.android.launcher3.util.LauncherModelHelper
|
||||
import com.android.launcher3.util.LauncherModelHelper.SandboxModelContext
|
||||
import com.android.launcher3.util.SandboxApplication
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import java.util.function.Predicate
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
@@ -60,19 +58,20 @@ import org.mockito.kotlin.whenever
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ShortcutsChangedTaskTest {
|
||||
@get:Rule val setFlagsRule: SetFlagsRule = SetFlagsRule()
|
||||
@get:Rule val context = SandboxApplication()
|
||||
|
||||
private lateinit var shortcutsChangedTask: ShortcutsChangedTask
|
||||
private lateinit var modelHelper: LauncherModelHelper
|
||||
private lateinit var context: SandboxModelContext
|
||||
private lateinit var launcherApps: LauncherApps
|
||||
private var shortcuts: List<ShortcutInfo> = emptyList()
|
||||
|
||||
private val expectedPackage: String = "expected"
|
||||
private val expectedShortcutId: String = "shortcut_id"
|
||||
private val user: UserHandle = myUserHandle()
|
||||
|
||||
private val mockTaskController: ModelTaskController = mock()
|
||||
private val mockAllApps: AllAppsList = mock()
|
||||
private val mockIconCache: IconCache = mock()
|
||||
private val bgDataModel = BgDataModel(mock())
|
||||
|
||||
private val expectedWai =
|
||||
WorkspaceItemInfo().apply {
|
||||
@@ -87,9 +86,6 @@ class ShortcutsChangedTaskTest {
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
modelHelper = LauncherModelHelper()
|
||||
modelHelper.loadModelSync()
|
||||
context = modelHelper.sandboxContext
|
||||
launcherApps = context.spyService(LauncherApps::class.java)
|
||||
whenever(mockTaskController.context).thenReturn(context)
|
||||
whenever(mockTaskController.iconCache).thenReturn(mockIconCache)
|
||||
@@ -99,11 +95,6 @@ class ShortcutsChangedTaskTest {
|
||||
shortcutsChangedTask = ShortcutsChangedTask(expectedPackage, shortcuts, user, false)
|
||||
}
|
||||
|
||||
@After
|
||||
fun teardown() {
|
||||
modelHelper.destroy()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `When installed pinned shortcut is found then keep in workspace`() {
|
||||
// Given
|
||||
@@ -114,7 +105,7 @@ class ShortcutsChangedTaskTest {
|
||||
whenever(id).thenReturn(expectedShortcutId)
|
||||
}
|
||||
)
|
||||
val items: IntSparseArrayMap<ItemInfo> = modelHelper.bgDataModel.itemsIdMap
|
||||
val items: IntSparseArrayMap<ItemInfo> = bgDataModel.itemsIdMap
|
||||
items.put(expectedWai.id, expectedWai)
|
||||
doReturn(
|
||||
ApplicationInfo().apply {
|
||||
@@ -127,7 +118,7 @@ class ShortcutsChangedTaskTest {
|
||||
.getApplicationInfo(eq(expectedPackage), any(), eq(user))
|
||||
doReturn(shortcuts).whenever(launcherApps).getShortcuts(any(), eq(user))
|
||||
// When
|
||||
shortcutsChangedTask.execute(mockTaskController, modelHelper.bgDataModel, mockAllApps)
|
||||
shortcutsChangedTask.execute(mockTaskController, bgDataModel, mockAllApps)
|
||||
// Then
|
||||
verify(mockIconCache).getShortcutIcon(eq(expectedWai), any<CacheableShortcutInfo>())
|
||||
verify(mockTaskController).bindUpdatedWorkspaceItems(listOf(expectedWai))
|
||||
@@ -144,7 +135,7 @@ class ShortcutsChangedTaskTest {
|
||||
whenever(id).thenReturn(expectedShortcutId)
|
||||
}
|
||||
)
|
||||
val items: IntSparseArrayMap<ItemInfo> = modelHelper.bgDataModel.itemsIdMap
|
||||
val items: IntSparseArrayMap<ItemInfo> = bgDataModel.itemsIdMap
|
||||
items.put(expectedWai.id, expectedWai)
|
||||
doReturn(
|
||||
ApplicationInfo().apply {
|
||||
@@ -157,7 +148,7 @@ class ShortcutsChangedTaskTest {
|
||||
.getApplicationInfo(eq(expectedPackage), any(), eq(user))
|
||||
doReturn(shortcuts).whenever(launcherApps).getShortcuts(any(), eq(user))
|
||||
// When
|
||||
shortcutsChangedTask.execute(mockTaskController, modelHelper.bgDataModel, mockAllApps)
|
||||
shortcutsChangedTask.execute(mockTaskController, bgDataModel, mockAllApps)
|
||||
// Then
|
||||
verify(mockTaskController)
|
||||
.deleteAndBindComponentsRemoved(
|
||||
@@ -177,7 +168,7 @@ class ShortcutsChangedTaskTest {
|
||||
whenever(id).thenReturn(expectedShortcutId)
|
||||
}
|
||||
)
|
||||
val items: IntSparseArrayMap<ItemInfo> = modelHelper.bgDataModel.itemsIdMap
|
||||
val items: IntSparseArrayMap<ItemInfo> = bgDataModel.itemsIdMap
|
||||
items.put(expectedWai.id, expectedWai)
|
||||
doReturn(
|
||||
ApplicationInfo().apply {
|
||||
@@ -190,7 +181,7 @@ class ShortcutsChangedTaskTest {
|
||||
.getApplicationInfo(eq(expectedPackage), any(), eq(user))
|
||||
doReturn(shortcuts).whenever(launcherApps).getShortcuts(any(), eq(user))
|
||||
// When
|
||||
shortcutsChangedTask.execute(mockTaskController, modelHelper.bgDataModel, mockAllApps)
|
||||
shortcutsChangedTask.execute(mockTaskController, bgDataModel, mockAllApps)
|
||||
// Then
|
||||
verify(mockIconCache).getShortcutIcon(eq(expectedWai), any<CacheableShortcutInfo>())
|
||||
verify(mockTaskController).bindUpdatedWorkspaceItems(listOf(expectedWai))
|
||||
@@ -206,7 +197,7 @@ class ShortcutsChangedTaskTest {
|
||||
whenever(id).thenReturn(expectedShortcutId)
|
||||
}
|
||||
)
|
||||
val items: IntSparseArrayMap<ItemInfo> = modelHelper.bgDataModel.itemsIdMap
|
||||
val items: IntSparseArrayMap<ItemInfo> = bgDataModel.itemsIdMap
|
||||
items.put(expectedWai.id, expectedWai)
|
||||
doReturn(
|
||||
ApplicationInfo().apply {
|
||||
@@ -219,7 +210,7 @@ class ShortcutsChangedTaskTest {
|
||||
.getApplicationInfo(eq(expectedPackage), any(), eq(user))
|
||||
doReturn(shortcuts).whenever(launcherApps).getShortcuts(any(), eq(user))
|
||||
// When
|
||||
shortcutsChangedTask.execute(mockTaskController, modelHelper.bgDataModel, mockAllApps)
|
||||
shortcutsChangedTask.execute(mockTaskController, bgDataModel, mockAllApps)
|
||||
// Then
|
||||
verify(mockTaskController, times(0)).deleteAndBindComponentsRemoved(any(), any())
|
||||
verify(mockTaskController, times(0)).bindUpdatedWorkspaceItems(any())
|
||||
@@ -236,7 +227,7 @@ class ShortcutsChangedTaskTest {
|
||||
whenever(id).thenReturn(expectedShortcutId)
|
||||
}
|
||||
)
|
||||
val items: IntSparseArrayMap<ItemInfo> = modelHelper.bgDataModel.itemsIdMap
|
||||
val items: IntSparseArrayMap<ItemInfo> = bgDataModel.itemsIdMap
|
||||
items.put(expectedWai.id, expectedWai)
|
||||
doReturn(
|
||||
ApplicationInfo().apply {
|
||||
@@ -249,7 +240,7 @@ class ShortcutsChangedTaskTest {
|
||||
.getApplicationInfo(eq(expectedPackage), any(), eq(user))
|
||||
doReturn(shortcuts).whenever(launcherApps).getShortcuts(any(), eq(user))
|
||||
// When
|
||||
shortcutsChangedTask.execute(mockTaskController, modelHelper.bgDataModel, mockAllApps)
|
||||
shortcutsChangedTask.execute(mockTaskController, bgDataModel, mockAllApps)
|
||||
// Then
|
||||
verify(mockIconCache).getShortcutIcon(eq(expectedWai), any<CacheableShortcutInfo>())
|
||||
verify(mockTaskController).bindUpdatedWorkspaceItems(listOf(expectedWai))
|
||||
@@ -266,7 +257,7 @@ class ShortcutsChangedTaskTest {
|
||||
whenever(id).thenReturn(expectedShortcutId)
|
||||
}
|
||||
)
|
||||
val items: IntSparseArrayMap<ItemInfo> = modelHelper.bgDataModel.itemsIdMap
|
||||
val items: IntSparseArrayMap<ItemInfo> = bgDataModel.itemsIdMap
|
||||
items.put(expectedWai.id, expectedWai)
|
||||
doReturn(
|
||||
ApplicationInfo().apply {
|
||||
@@ -279,7 +270,7 @@ class ShortcutsChangedTaskTest {
|
||||
.getApplicationInfo(eq(expectedPackage), any(), eq(user))
|
||||
doReturn(shortcuts).whenever(launcherApps).getShortcuts(any(), eq(user))
|
||||
// When
|
||||
shortcutsChangedTask.execute(mockTaskController, modelHelper.bgDataModel, mockAllApps)
|
||||
shortcutsChangedTask.execute(mockTaskController, bgDataModel, mockAllApps)
|
||||
// Then
|
||||
verify(mockIconCache).getShortcutIcon(eq(expectedWai), any<CacheableShortcutInfo>())
|
||||
verify(mockTaskController).bindUpdatedWorkspaceItems(listOf(expectedWai))
|
||||
@@ -309,10 +300,10 @@ class ShortcutsChangedTaskTest {
|
||||
shouldUpdateIdMap = true,
|
||||
)
|
||||
// When
|
||||
shortcutsChangedTask.execute(mockTaskController, modelHelper.bgDataModel, mockAllApps)
|
||||
shortcutsChangedTask.execute(mockTaskController, bgDataModel, mockAllApps)
|
||||
// Then
|
||||
assertThat(modelHelper.bgDataModel.deepShortcutMap).containsEntry(expectedKey, 1)
|
||||
verify(mockTaskController).bindDeepShortcuts(eq(modelHelper.bgDataModel))
|
||||
assertThat(bgDataModel.deepShortcutMap).containsEntry(expectedKey, 1)
|
||||
verify(mockTaskController).bindDeepShortcuts(eq(bgDataModel))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -339,10 +330,10 @@ class ShortcutsChangedTaskTest {
|
||||
shouldUpdateIdMap = false,
|
||||
)
|
||||
// When
|
||||
shortcutsChangedTask.execute(mockTaskController, modelHelper.bgDataModel, mockAllApps)
|
||||
shortcutsChangedTask.execute(mockTaskController, bgDataModel, mockAllApps)
|
||||
// Then
|
||||
assertThat(modelHelper.bgDataModel.deepShortcutMap).doesNotContainKey(expectedKey)
|
||||
verify(mockTaskController, times(0)).bindDeepShortcuts(eq(modelHelper.bgDataModel))
|
||||
assertThat(bgDataModel.deepShortcutMap).doesNotContainKey(expectedKey)
|
||||
verify(mockTaskController, times(0)).bindDeepShortcuts(eq(bgDataModel))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -356,7 +347,7 @@ class ShortcutsChangedTaskTest {
|
||||
whenever(id).thenReturn(expectedShortcutId)
|
||||
}
|
||||
)
|
||||
val items: IntSparseArrayMap<ItemInfo> = modelHelper.bgDataModel.itemsIdMap
|
||||
val items: IntSparseArrayMap<ItemInfo> = bgDataModel.itemsIdMap
|
||||
items.put(expectedWai.id, expectedWai)
|
||||
doReturn(
|
||||
ApplicationInfo().apply {
|
||||
@@ -369,7 +360,7 @@ class ShortcutsChangedTaskTest {
|
||||
.getApplicationInfo(eq(expectedPackage), any(), eq(user))
|
||||
doReturn(shortcuts).whenever(launcherApps).getShortcuts(any(), eq(user))
|
||||
// When
|
||||
shortcutsChangedTask.execute(mockTaskController, modelHelper.bgDataModel, mockAllApps)
|
||||
shortcutsChangedTask.execute(mockTaskController, bgDataModel, mockAllApps)
|
||||
// Then
|
||||
verify(mockTaskController, times(0)).deleteAndBindComponentsRemoved(any(), any())
|
||||
verify(mockTaskController, times(0)).bindUpdatedWorkspaceItems(any())
|
||||
|
||||
@@ -985,7 +985,7 @@ public final class LauncherInstrumentation {
|
||||
waitUntilLauncherObjectGone(APPS_RES_ID);
|
||||
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
if (isTablet() && !is3PLauncher() && !isRecentsWindowEnabled()) {
|
||||
if (isTablet() && !is3PLauncher()) {
|
||||
waitForSystemLauncherObject(TASKBAR_RES_ID);
|
||||
} else {
|
||||
waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
|
||||
|
||||
Reference in new issue
Block a user