resolve merge conflicts of f17eb616a8 to ub-launcher3-qt-r1-dev
Bug: None Test: I solemnly swear I tested this conflict resolution. Change-Id: I4e177dfb7ba3bde6eb53f63c2f2df273feef90ee
This commit is contained in:
-9
@@ -204,15 +204,6 @@ public abstract class RecentsUiFactory {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean-up logic that occurs when recents is no longer in use/visible.
|
||||
*
|
||||
* @param launcher the launcher activity
|
||||
*/
|
||||
public static void resetOverview(Launcher launcher) {
|
||||
launcher.<RecentsView>getOverviewPanel().reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Recents logic that triggers when launcher state changes or launcher activity stops/resumes.
|
||||
*
|
||||
|
||||
-3
@@ -21,7 +21,6 @@ import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.allapps.AllAppsTransitionController;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
||||
import com.android.quickstep.util.ClipAnimationHelper;
|
||||
import com.android.quickstep.util.LayoutUtils;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.quickstep.views.TaskView;
|
||||
@@ -45,8 +44,6 @@ public class BackgroundAppState extends OverviewState {
|
||||
|
||||
@Override
|
||||
public void onStateEnabled(Launcher launcher) {
|
||||
RecentsView rv = launcher.getOverviewPanel();
|
||||
rv.setOverviewStateEnabled(true);
|
||||
AbstractFloatingView.closeAllOpenViews(launcher, false);
|
||||
}
|
||||
|
||||
|
||||
-8
@@ -86,17 +86,9 @@ public class OverviewState extends LauncherState {
|
||||
|
||||
@Override
|
||||
public void onStateEnabled(Launcher launcher) {
|
||||
RecentsView rv = launcher.getOverviewPanel();
|
||||
rv.setOverviewStateEnabled(true);
|
||||
AbstractFloatingView.closeAllOpenViews(launcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateDisabled(Launcher launcher) {
|
||||
RecentsView rv = launcher.getOverviewPanel();
|
||||
rv.setOverviewStateEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateTransitionEnd(Launcher launcher) {
|
||||
launcher.getRotationHelper().setCurrentStateRequest(REQUEST_ROTATE);
|
||||
|
||||
@@ -36,8 +36,6 @@ import java.util.List;
|
||||
*/
|
||||
public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
|
||||
public static final String AIAI_PACKAGE = "com.google.android.as";
|
||||
|
||||
/** Note that these will be shown in order from top to bottom, if available for the task. */
|
||||
private static final TaskSystemShortcut[] MENU_OPTIONS = new TaskSystemShortcut[]{
|
||||
new TaskSystemShortcut.AppInfo(),
|
||||
@@ -51,29 +49,33 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
new MainThreadInitializedObject<>(c -> Overrides.getObject(TaskOverlayFactory.class,
|
||||
c, R.string.task_overlay_factory_class));
|
||||
|
||||
public List<TaskSystemShortcut> getEnabledShortcuts(TaskView taskView) {
|
||||
final ArrayList<TaskSystemShortcut> shortcuts = new ArrayList<>();
|
||||
final BaseDraggingActivity activity = BaseActivity.fromContext(taskView.getContext());
|
||||
for (TaskSystemShortcut menuOption : MENU_OPTIONS) {
|
||||
View.OnClickListener onClickListener =
|
||||
menuOption.getOnClickListener(activity, taskView);
|
||||
if (onClickListener != null) {
|
||||
shortcuts.add(menuOption);
|
||||
}
|
||||
}
|
||||
return shortcuts;
|
||||
}
|
||||
|
||||
public TaskOverlay createOverlay(View thumbnailView) {
|
||||
return new TaskOverlay();
|
||||
}
|
||||
|
||||
public static class TaskOverlay {
|
||||
|
||||
public void setTaskInfo(Task task, ThumbnailData thumbnail, Matrix matrix) {
|
||||
}
|
||||
/**
|
||||
* Called when the current task is interactive for the user
|
||||
*/
|
||||
public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix) { }
|
||||
|
||||
public void reset() {
|
||||
}
|
||||
|
||||
public List<TaskSystemShortcut> getEnabledShortcuts(TaskView taskView) {
|
||||
final ArrayList<TaskSystemShortcut> shortcuts = new ArrayList<>();
|
||||
final BaseDraggingActivity activity = BaseActivity.fromContext(taskView.getContext());
|
||||
for (TaskSystemShortcut menuOption : MENU_OPTIONS) {
|
||||
View.OnClickListener onClickListener =
|
||||
menuOption.getOnClickListener(activity, taskView);
|
||||
if (onClickListener != null) {
|
||||
shortcuts.add(menuOption);
|
||||
}
|
||||
}
|
||||
return shortcuts;
|
||||
}
|
||||
/**
|
||||
* Called when the overlay is no longer used.
|
||||
*/
|
||||
public void reset() { }
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -35,6 +35,7 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity> {
|
||||
public FallbackRecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setOverviewStateEnabled(true);
|
||||
setOverlayEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+18
-1
@@ -20,6 +20,7 @@ import static com.android.launcher3.LauncherState.ALL_APPS_HEADER_EXTRA;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.LauncherState.RECENTS_CLEAR_ALL_BUTTON;
|
||||
import static com.android.launcher3.LauncherState.SPRING_LOADED;
|
||||
import static com.android.launcher3.QuickstepAppTransitionManagerImpl.ALL_APPS_PROGRESS_OFF_SCREEN;
|
||||
import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PROGRESS;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
|
||||
@@ -37,6 +38,7 @@ import android.view.View;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.LauncherStateManager.StateListener;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.appprediction.PredictionUiStateManager;
|
||||
@@ -51,7 +53,7 @@ import com.android.quickstep.util.LayoutUtils;
|
||||
* {@link RecentsView} used in Launcher activity
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
public class LauncherRecentsView extends RecentsView<Launcher> {
|
||||
public class LauncherRecentsView extends RecentsView<Launcher> implements StateListener {
|
||||
|
||||
private final TransformParams mTransformParams = new TransformParams();
|
||||
|
||||
@@ -66,6 +68,7 @@ public class LauncherRecentsView extends RecentsView<Launcher> {
|
||||
public LauncherRecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setContentAlpha(0);
|
||||
mActivity.getStateManager().addStateListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -221,6 +224,20 @@ public class LauncherRecentsView extends RecentsView<Launcher> {
|
||||
PredictionUiStateManager.INSTANCE.get(getContext()).switchClient(Client.HOME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateTransitionStart(LauncherState toState) {
|
||||
setOverviewStateEnabled(toState.overviewUi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateTransitionComplete(LauncherState finalState) {
|
||||
if (finalState == NORMAL || finalState == SPRING_LOADED) {
|
||||
// Clean-up logic that occurs when recents is no longer in use/visible.
|
||||
reset();
|
||||
}
|
||||
setOverlayEnabled(finalState == OVERVIEW);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOverviewStateEnabled(boolean enabled) {
|
||||
super.setOverviewStateEnabled(enabled);
|
||||
|
||||
@@ -72,6 +72,9 @@ import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.ListView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.dynamicanimation.animation.SpringForce;
|
||||
|
||||
import com.android.launcher3.BaseActivity;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Insettable;
|
||||
@@ -111,9 +114,6 @@ import com.android.systemui.shared.system.TaskStackChangeListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.dynamicanimation.animation.SpringForce;
|
||||
|
||||
/**
|
||||
* A list of recent tasks.
|
||||
*/
|
||||
@@ -168,8 +168,6 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
||||
// The threshold at which we update the SystemUI flags when animating from the task into the app
|
||||
public static final float UPDATE_SYSUI_FLAGS_THRESHOLD = 0.85f;
|
||||
|
||||
private static final float[] sTempFloatArray = new float[3];
|
||||
|
||||
protected final T mActivity;
|
||||
private final float mFastFlingVelocity;
|
||||
private final RecentsModel mModel;
|
||||
@@ -189,6 +187,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
||||
|
||||
private boolean mDwbToastShown;
|
||||
private boolean mDisallowScrollToClearAll;
|
||||
private boolean mOverlayEnabled;
|
||||
|
||||
/**
|
||||
* TODO: Call reloadIdNeeded in onTaskStackChanged.
|
||||
@@ -428,11 +427,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
||||
// Clear the task data for the removed child if it was visible
|
||||
if (child != mClearAllButton) {
|
||||
TaskView taskView = (TaskView) child;
|
||||
Task task = taskView.getTask();
|
||||
if (mHasVisibleTaskData.get(task.key.id)) {
|
||||
mHasVisibleTaskData.delete(task.key.id);
|
||||
taskView.onTaskListVisibilityChanged(false /* visible */);
|
||||
}
|
||||
mHasVisibleTaskData.delete(taskView.getTask().key.id);
|
||||
mTaskViewPool.recycle(taskView);
|
||||
}
|
||||
}
|
||||
@@ -455,7 +450,6 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
||||
public void setOverviewStateEnabled(boolean enabled) {
|
||||
mOverviewStateEnabled = enabled;
|
||||
updateTaskStackListenerState();
|
||||
if (!enabled) mDwbToastShown = false;
|
||||
}
|
||||
|
||||
public void onDigitalWellbeingToastShown() {
|
||||
@@ -582,6 +576,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
||||
}
|
||||
resetTaskVisuals();
|
||||
onTaskStackUpdated();
|
||||
updateEnabledOverlays();
|
||||
}
|
||||
|
||||
public int getTaskViewCount() {
|
||||
@@ -780,6 +775,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
||||
|
||||
unloadVisibleTaskData();
|
||||
setCurrentPage(0);
|
||||
mDwbToastShown = false;
|
||||
}
|
||||
|
||||
public @Nullable TaskView getRunningTaskView() {
|
||||
@@ -1545,6 +1541,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
||||
protected void notifyPageSwitchListener(int prevPage) {
|
||||
super.notifyPageSwitchListener(prevPage);
|
||||
loadVisibleTaskData();
|
||||
updateEnabledOverlays();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1685,4 +1682,19 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
||||
public ClipAnimationHelper getTempClipAnimationHelper() {
|
||||
return mTempClipAnimationHelper;
|
||||
}
|
||||
|
||||
private void updateEnabledOverlays() {
|
||||
int overlayEnabledPage = mOverlayEnabled ? getNextPage() : -1;
|
||||
int taskCount = getTaskViewCount();
|
||||
for (int i = 0; i < taskCount; i++) {
|
||||
((TaskView) getChildAt(i)).setOverlayEnabled(i == overlayEnabledPage);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOverlayEnabled(boolean overlayEnabled) {
|
||||
if (mOverlayEnabled != overlayEnabled) {
|
||||
mOverlayEnabled = overlayEnabled;
|
||||
updateEnabledOverlays();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
import com.android.quickstep.TaskOverlayFactory;
|
||||
import com.android.quickstep.TaskSystemShortcut;
|
||||
import com.android.quickstep.TaskUtils;
|
||||
import com.android.quickstep.views.IconView.OnScaleUpdateListener;
|
||||
@@ -196,7 +197,7 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||
|
||||
final BaseDraggingActivity activity = BaseDraggingActivity.fromContext(getContext());
|
||||
final List<TaskSystemShortcut> shortcuts =
|
||||
taskView.getTaskOverlay().getEnabledShortcuts(taskView);
|
||||
TaskOverlayFactory.INSTANCE.get(getContext()).getEnabledShortcuts(taskView);
|
||||
final int count = shortcuts.size();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
final TaskSystemShortcut menuOption = shortcuts.get(i);
|
||||
|
||||
+21
-10
@@ -98,6 +98,9 @@ public class TaskThumbnailView extends View {
|
||||
private float mDimAlphaMultiplier = 1f;
|
||||
private float mSaturation = 1f;
|
||||
|
||||
private boolean mOverlayEnabled;
|
||||
private boolean mRotated;
|
||||
|
||||
public TaskThumbnailView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
@@ -192,10 +195,6 @@ public class TaskThumbnailView extends View {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public TaskOverlay getTaskOverlay() {
|
||||
return mOverlay;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
RectF currentDrawnInsets = mFullscreenParams.mCurrentDrawnInsets;
|
||||
@@ -257,6 +256,22 @@ public class TaskThumbnailView extends View {
|
||||
return (TaskView) getParent();
|
||||
}
|
||||
|
||||
public void setOverlayEnabled(boolean overlayEnabled) {
|
||||
if (mOverlayEnabled != overlayEnabled) {
|
||||
mOverlayEnabled = overlayEnabled;
|
||||
updateOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateOverlay() {
|
||||
// The overlay doesn't really work when the screenshot is rotated, so don't add it.
|
||||
if (mOverlayEnabled && !mRotated && mBitmapShader != null && mThumbnailData != null) {
|
||||
mOverlay.initOverlay(mTask, mThumbnailData, mMatrix);
|
||||
} else {
|
||||
mOverlay.reset();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateThumbnailPaintFilter() {
|
||||
int mul = (int) ((1 - mDimAlpha * mDimAlphaMultiplier) * 255);
|
||||
ColorFilter filter = getColorFilter(mul, mIsDarkTextTheme, mSaturation);
|
||||
@@ -351,12 +366,8 @@ public class TaskThumbnailView extends View {
|
||||
mPaint.setShader(mBitmapShader);
|
||||
}
|
||||
|
||||
if (isRotated) {
|
||||
// The overlay doesn't really work when the screenshot is rotated, so don't add it.
|
||||
mOverlay.reset();
|
||||
} else {
|
||||
mOverlay.setTaskInfo(mTask, mThumbnailData, mMatrix);
|
||||
}
|
||||
mRotated = isRotated;
|
||||
updateOverlay();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.FloatProperty;
|
||||
import android.util.Log;
|
||||
import android.util.Property;
|
||||
import android.view.View;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
@@ -253,10 +252,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
return mIconView;
|
||||
}
|
||||
|
||||
public TaskOverlayFactory.TaskOverlay getTaskOverlay() {
|
||||
return mSnapshotView.getTaskOverlay();
|
||||
}
|
||||
|
||||
public AnimatorPlaybackController createLaunchAnimationForRunningTask() {
|
||||
final PendingAnimation pendingAnimation =
|
||||
getRecentsView().createTaskLauncherAnimation(this, RECENTS_LAUNCH_DURATION);
|
||||
@@ -488,6 +483,8 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
// Clear any references to the thumbnail (it will be re-read either from the cache or the
|
||||
// system on next bind)
|
||||
mSnapshotView.setThumbnail(mTask, null);
|
||||
setOverlayEnabled(false);
|
||||
onTaskListVisibilityChanged(false);
|
||||
if (mTask != null) {
|
||||
mTask.thumbnail = null;
|
||||
}
|
||||
@@ -608,7 +605,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
|
||||
final Context context = getContext();
|
||||
final List<TaskSystemShortcut> shortcuts =
|
||||
mSnapshotView.getTaskOverlay().getEnabledShortcuts(this);
|
||||
TaskOverlayFactory.INSTANCE.get(getContext()).getEnabledShortcuts(this);
|
||||
final int count = shortcuts.size();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
final TaskSystemShortcut menuOption = shortcuts.get(i);
|
||||
@@ -647,7 +644,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
}
|
||||
|
||||
final List<TaskSystemShortcut> shortcuts =
|
||||
mSnapshotView.getTaskOverlay().getEnabledShortcuts(this);
|
||||
TaskOverlayFactory.INSTANCE.get(getContext()).getEnabledShortcuts(this);
|
||||
final int count = shortcuts.size();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
final TaskSystemShortcut menuOption = shortcuts.get(i);
|
||||
@@ -733,6 +730,10 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
return mShowScreenshot;
|
||||
}
|
||||
|
||||
public void setOverlayEnabled(boolean overlayEnabled) {
|
||||
mSnapshotView.setOverlayEnabled(overlayEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* We update and subsequently draw these in {@link #setFullscreenProgress(float)}.
|
||||
*/
|
||||
|
||||
@@ -258,9 +258,6 @@ public class LauncherState {
|
||||
* Called when the start transition ends and the user settles on this particular state.
|
||||
*/
|
||||
public void onStateTransitionEnd(Launcher launcher) {
|
||||
if (this == NORMAL || this == SPRING_LOADED) {
|
||||
UiFactory.resetOverview(launcher);
|
||||
}
|
||||
if (this == NORMAL) {
|
||||
// Clear any rotation locks when going to normal state
|
||||
launcher.getRotationHelper().setCurrentStateRequest(REQUEST_NONE);
|
||||
|
||||
Reference in New Issue
Block a user