Snap for 9044085 from bdcdcf9edd to udc-release

Change-Id: I1daab84941c3d911fa2c9daa0a3866e0989071c9
This commit is contained in:
Android Build Coastguard Worker committed 2022-09-09 01:25:51 +00:00
commit 032cfaa332
13 files changed
+101 -29

No files matched your search

@@ -868,6 +868,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
btv.post(() -> mControllers.taskbarPopupController.showForIcon(btv));
}
public boolean isInApp() {
return mControllers.taskbarStashController.isInApp();
}
protected void dumpLogs(String prefix, PrintWriter pw) {
pw.println(prefix + "TaskbarActivityContext:");
@@ -340,6 +340,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
return ActiveGestureErrorDetector.GestureEvent.STATE_CAPTURE_SCREENSHOT;
} else if (stateFlag == STATE_HANDLER_INVALIDATED) {
return ActiveGestureErrorDetector.GestureEvent.STATE_HANDLER_INVALIDATED;
} else if (stateFlag == STATE_LAUNCHER_DRAWN) {
return ActiveGestureErrorDetector.GestureEvent.STATE_LAUNCHER_DRAWN;
}
return null;
}
@@ -116,7 +116,13 @@ public class MultiStateCallback {
if (gestureEvent == null) {
continue;
}
ActiveGestureLog.INSTANCE.trackEvent(gestureEvent);
if (gestureEvent.mLogEvent && gestureEvent.mTrackEvent) {
ActiveGestureLog.INSTANCE.addLog(gestureEvent.name(), gestureEvent);
} else if (gestureEvent.mLogEvent) {
ActiveGestureLog.INSTANCE.addLog(gestureEvent.name());
} else if (gestureEvent.mTrackEvent) {
ActiveGestureLog.INSTANCE.trackEvent(gestureEvent);
}
}
}
@@ -27,9 +27,9 @@ import android.util.SparseBooleanArray;
import androidx.annotation.VisibleForTesting;
import com.android.quickstep.util.GroupTask;
import com.android.launcher3.util.LooperExecutor;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.quickstep.util.GroupTask;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.system.KeyguardManagerCompat;
import com.android.wm.shell.recents.IRecentTasksListener;
@@ -254,8 +254,12 @@ public class RecentTasksList {
TaskLoadResult allTasks = new TaskLoadResult(requestId, loadKeysOnly, rawTasks.size());
for (GroupedRecentTaskInfo rawTask : rawTasks) {
ActivityManager.RecentTaskInfo taskInfo1 = rawTask.mTaskInfo1;
ActivityManager.RecentTaskInfo taskInfo2 = rawTask.mTaskInfo2;
if (rawTask.getType() == GroupedRecentTaskInfo.TYPE_FREEFORM) {
// TODO: add entry for freeform tasks
continue;
}
ActivityManager.RecentTaskInfo taskInfo1 = rawTask.getTaskInfo1();
ActivityManager.RecentTaskInfo taskInfo2 = rawTask.getTaskInfo2();
Task.TaskKey task1Key = new Task.TaskKey(taskInfo1);
Task task1 = loadKeysOnly
? new Task(task1Key)
@@ -272,7 +276,7 @@ public class RecentTasksList {
task2.setLastSnapshotData(taskInfo2);
}
final SplitConfigurationOptions.SplitBounds launcherSplitBounds =
convertSplitBounds(rawTask.mSplitBounds);
convertSplitBounds(rawTask.getSplitBounds());
allTasks.add(new GroupTask(task1, task2, launcherSplitBounds));
}
@@ -310,8 +314,8 @@ public class RecentTasksList {
mSysUiProxy.getRecentTasks(Integer.MAX_VALUE, currentUserId);
writer.println(prefix + " rawTasks=[");
for (GroupedRecentTaskInfo task : rawTasks) {
writer.println(prefix + " t1=" + task.mTaskInfo1.taskId
+ " t2=" + (task.mTaskInfo2 != null ? task.mTaskInfo2.taskId : "-1"));
writer.println(prefix + " t1=" + task.getTaskInfo1().taskId
+ " t2=" + (task.getTaskInfo2() != null ? task.getTaskInfo2().taskId : "-1"));
}
writer.println(prefix + " ]");
}
@@ -462,7 +462,8 @@ public class TouchInteractionService extends Service
mOverviewComponentObserver = new OverviewComponentObserver(this, mDeviceState);
mOverviewCommandHelper = new OverviewCommandHelper(this,
mOverviewComponentObserver, mTaskAnimationManager);
mResetGestureInputConsumer = new ResetGestureInputConsumer(mTaskAnimationManager);
mResetGestureInputConsumer = new ResetGestureInputConsumer(
mTaskAnimationManager, mTaskbarManager::getCurrentActivityContext);
mInputConsumer = InputConsumerController.getRecentsAnimationInputConsumer();
mInputConsumer.registerInputConsumer();
onSystemUiFlagsChanged(mDeviceState.getSystemUiStateFlags());
@@ -17,18 +17,25 @@ package com.android.quickstep.inputconsumers;
import android.view.MotionEvent;
import com.android.launcher3.taskbar.TaskbarActivityContext;
import com.android.quickstep.InputConsumer;
import com.android.quickstep.TaskAnimationManager;
import java.util.function.Supplier;
/**
* A NO_OP input consumer which also resets any pending gesture
*/
public class ResetGestureInputConsumer implements InputConsumer {
private final TaskAnimationManager mTaskAnimationManager;
private final Supplier<TaskbarActivityContext> mActivityContextSupplier;
public ResetGestureInputConsumer(TaskAnimationManager taskAnimationManager) {
public ResetGestureInputConsumer(
TaskAnimationManager taskAnimationManager,
Supplier<TaskbarActivityContext> activityContextSupplier) {
mTaskAnimationManager = taskAnimationManager;
mActivityContextSupplier = activityContextSupplier;
}
@Override
@@ -40,7 +47,9 @@ public class ResetGestureInputConsumer implements InputConsumer {
public void onMotionEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN
&& mTaskAnimationManager.isRecentsAnimationRunning()) {
mTaskAnimationManager.finishRunningRecentsAnimation(false /* toHome */);
TaskbarActivityContext tac = mActivityContextSupplier.get();
mTaskAnimationManager.finishRunningRecentsAnimation(
/* toHome= */ tac != null && !tac.isInApp());
}
}
}
@@ -46,7 +46,19 @@ public class ActiveGestureErrorDetector {
STATE_GESTURE_STARTED, STATE_GESTURE_COMPLETED, STATE_GESTURE_CANCELLED,
STATE_END_TARGET_ANIMATION_FINISHED, STATE_RECENTS_SCROLLING_FINISHED,
STATE_CAPTURE_SCREENSHOT, STATE_SCREENSHOT_CAPTURED, STATE_HANDLER_INVALIDATED,
STATE_RECENTS_ANIMATION_CANCELED
STATE_RECENTS_ANIMATION_CANCELED, STATE_LAUNCHER_DRAWN(true, false);
public final boolean mLogEvent;
public final boolean mTrackEvent;
GestureEvent() {
this(false, true);
}
GestureEvent(boolean logEvent, boolean trackEvent) {
mLogEvent = logEvent;
mTrackEvent = trackEvent;
}
}
private ActiveGestureErrorDetector() {}
@@ -168,6 +180,7 @@ public class ActiveGestureErrorDetector {
case STATE_END_TARGET_ANIMATION_FINISHED:
case STATE_CAPTURE_SCREENSHOT:
case STATE_HANDLER_INVALIDATED:
case STATE_LAUNCHER_DRAWN:
default:
// No-Op
}
@@ -250,8 +250,7 @@ public class GroupedTaskView extends TaskView {
@Override
public void setOverlayEnabled(boolean overlayEnabled) {
super.setOverlayEnabled(overlayEnabled);
mSnapshotView2.setOverlayEnabled(overlayEnabled);
// Intentional no-op to prevent setting smart actions overlay on thumbnails
}
@Override
@@ -53,7 +53,9 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
HIDDEN_NON_ZERO_ROTATION,
HIDDEN_NO_TASKS,
HIDDEN_NO_RECENTS,
HIDDEN_SPLIT_SCREEN})
HIDDEN_SPLIT_SCREEN,
HIDDEN_SPLIT_SELECT_ACTIVE
})
@Retention(RetentionPolicy.SOURCE)
public @interface ActionsHiddenFlags { }
@@ -61,6 +63,7 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
public static final int HIDDEN_NO_TASKS = 1 << 1;
public static final int HIDDEN_NO_RECENTS = 1 << 2;
public static final int HIDDEN_SPLIT_SCREEN = 1 << 3;
public static final int HIDDEN_SPLIT_SELECT_ACTIVE = 1 << 4;
@IntDef(flag = true, value = {
DISABLED_SCROLLING,
@@ -79,6 +82,11 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
private static final int INDEX_HIDDEN_FLAGS_ALPHA = 3;
private static final int INDEX_SHARE_TARGET_ALPHA = 4;
public @interface SplitButtonDisabledFlags { }
public static final int FLAG_IS_NOT_TABLET = 1 << 0;
public static final int FLAG_SINGLE_TASK = 1 << 1;
private MultiValueAlpha mMultiValueAlpha;
private Button mSplitButton;
@@ -88,6 +96,9 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
@ActionsDisabledFlags
protected int mDisabledFlags;
@SplitButtonDisabledFlags
private int mSplitButtonDisabledFlags;
@Nullable
protected T mCallbacks;
@@ -182,6 +193,20 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
LayoutUtils.setViewEnabled(this, isEnabled);
}
/**
* Updates the proper flags to indicate whether the "Split screen" button should be enabled.
*
* @param flag The flag to update.
* @param enable Whether to enable the disable flag: True will cause view to be disabled.
*/
public void updateSplitButtonFlags(@SplitButtonDisabledFlags int flag, boolean enable) {
if (enable) {
mSplitButtonDisabledFlags |= flag;
} else {
mSplitButtonDisabledFlags &= ~flag;
}
}
public AlphaProperty getContentAlpha() {
return mMultiValueAlpha.getProperty(INDEX_CONTENT_ALPHA);
}
@@ -263,12 +288,17 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
0, 0, 0);
}
public void setSplitButtonVisible(boolean visible) {
/**
* Shows/hides the "Split" button based on the status of mHiddenFlags.
*/
public void updateSplitButtonVisibility() {
if (mSplitButton == null) {
return;
}
mSplitButton.setVisibility(visible ? VISIBLE : GONE);
findViewById(R.id.action_split_space).setVisibility(visible ? VISIBLE : GONE);
boolean shouldBeVisible = mSplitButtonDisabledFlags == 0
// and neither of these flags are active
&& (mHiddenFlags & (HIDDEN_SPLIT_SCREEN | HIDDEN_SPLIT_SELECT_ACTIVE)) == 0;
mSplitButton.setVisibility(shouldBeVisible ? VISIBLE : GONE);
findViewById(R.id.action_split_space).setVisibility(shouldBeVisible ? VISIBLE : GONE);
}
}
@@ -52,10 +52,13 @@ import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITIO
import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK;
import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId;
import static com.android.quickstep.views.ClearAllButton.DISMISS_ALPHA;
import static com.android.quickstep.views.OverviewActionsView.FLAG_IS_NOT_TABLET;
import static com.android.quickstep.views.OverviewActionsView.FLAG_SINGLE_TASK;
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NON_ZERO_ROTATION;
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_RECENTS;
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_TASKS;
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_SPLIT_SCREEN;
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_SPLIT_SELECT_ACTIVE;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -3394,11 +3397,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
private void updateCurrentTaskActionsVisibility() {
boolean isCurrentSplit = getCurrentPageTaskView() instanceof GroupedTaskView;
mActionsView.updateHiddenFlags(HIDDEN_SPLIT_SCREEN, isCurrentSplit);
if (isCurrentSplit) {
return;
}
mActionsView.setSplitButtonVisible(
mActivity.getDeviceProfile().isTablet && getTaskViewCount() > 1);
mActionsView.updateHiddenFlags(HIDDEN_SPLIT_SELECT_ACTIVE, isSplitSelectionActive());
mActionsView.updateSplitButtonFlags(FLAG_IS_NOT_TABLET,
!mActivity.getDeviceProfile().isTablet);
mActionsView.updateSplitButtonFlags(FLAG_SINGLE_TASK, getTaskViewCount() <= 1);
mActionsView.updateSplitButtonVisibility();
}
/**
@@ -70,7 +70,7 @@ public class RecentTasksListTest {
@Test
public void loadTasksInBackground_onlyKeys_noValidTaskDescription() {
GroupedRecentTaskInfo recentTaskInfos = new GroupedRecentTaskInfo(
GroupedRecentTaskInfo recentTaskInfos = GroupedRecentTaskInfo.forSplitTasks(
new ActivityManager.RecentTaskInfo(), new ActivityManager.RecentTaskInfo(), null);
when(mockSystemUiProxy.getRecentTasks(anyInt(), anyInt()))
.thenReturn(new ArrayList<>(Collections.singletonList(recentTaskInfos)));
@@ -90,8 +90,8 @@ public class RecentTasksListTest {
task1.taskDescription = new ActivityManager.TaskDescription(taskDescription);
ActivityManager.RecentTaskInfo task2 = new ActivityManager.RecentTaskInfo();
task2.taskDescription = new ActivityManager.TaskDescription();
GroupedRecentTaskInfo recentTaskInfos = new GroupedRecentTaskInfo(
task1, task2, null);
GroupedRecentTaskInfo recentTaskInfos = GroupedRecentTaskInfo.forSplitTasks(task1, task2,
null);
when(mockSystemUiProxy.getRecentTasks(anyInt(), anyInt()))
.thenReturn(new ArrayList<>(Collections.singletonList(recentTaskInfos)));
+2 -1
View File
@@ -34,7 +34,8 @@
android:clipChildren="false"
android:orientation="horizontal"
android:paddingLeft="12dp"
android:paddingRight="12dp" >
android:paddingRight="12dp"
android:alpha="0">
<com.android.launcher3.folder.FolderNameEditText
android:id="@+id/folder_name"
@@ -65,12 +65,12 @@ public final class FeatureFlags {
*/
public static final BooleanFlag ENABLE_INPUT_CONSUMER_REASON_LOGGING = getDebugFlag(
"ENABLE_INPUT_CONSUMER_REASON_LOGGING",
false,
true,
"Log the reason why an Input Consumer was selected for a gesture.");
public static final BooleanFlag ENABLE_GESTURE_ERROR_DETECTION = getDebugFlag(
"ENABLE_GESTURE_ERROR_DETECTION",
false,
true,
"Analyze gesture events and log detected errors");
// When enabled the promise icon is visible in all apps while installation an app.