Snap for 9101843 from 178a45a5ab to tm-qpr1-release

Change-Id: I7c61c97a1cd4d84a436d9ab17871950c38607f63
This commit is contained in:
Android Build Coastguard Worker
2022-09-24 05:20:24 +00:00
13 changed files with 65 additions and 40 deletions
@@ -68,7 +68,7 @@ public class FloatingTaskIntentResolver {
return null;
}
ComponentName component = new ComponentName(packageName, activityName);
Intent intent = new Intent(action).setComponent(component);
Intent intent = new Intent(action).setComponent(component).setPackage(packageName);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Log.d(TAG, "createIntent returning: " + intent);
return intent;
@@ -895,7 +895,7 @@ public class QuickstepLauncher extends Launcher {
// load in, and then proceed to OverviewSplitSelect.
if (isInState(OVERVIEW_SPLIT_SELECT)) {
SplitSelectStateController splitSelectStateController =
((RecentsView) getOverviewPanel()).getSplitPlaceholder();
((RecentsView) getOverviewPanel()).getSplitSelectController();
// Launcher will restart in Overview and then transition to OverviewSplitSelect.
outState.putIBinder(PENDING_SPLIT_SELECT_INFO, ObjectWrapper.wrap(
new PendingSplitSelectInfo(
@@ -1140,13 +1140,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
boolean isCancel) {
long duration = MAX_SWIPE_DURATION;
float currentShift = mCurrentShift.value;
boolean recentsVisible = mRecentsView != null
&& (mRecentsView.getWindowVisibility() == View.VISIBLE);
if (!recentsVisible) {
// We've hit a case where Launcher is been stopped mid-gesture, in this case, force
// a LAST_TASK end target
isCancel = true;
}
final GestureEndTarget endTarget = calculateEndTarget(velocity, endVelocity,
isFling, isCancel);
// Set the state, but don't notify until the animation completes
@@ -1226,7 +1219,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
// Let RecentsView handle the scrolling to the task, which we launch in startNewTask()
// or resumeLastTask().
if (recentsVisible) {
if (mRecentsView != null) {
ActiveGestureLog.INSTANCE.trackEvent(ActiveGestureErrorDetector.GestureEvent
.SET_ON_PAGE_TRANSITION_END_CALLBACK);
mRecentsView.setOnPageTransitionEndCallback(
@@ -240,8 +240,11 @@ public class OverviewCommandHelper {
interactionHandler.onGestureCancelled();
cmd.removeListener(this);
RecentsView createdRecents =
activityInterface.getCreatedActivity().getOverviewPanel();
T createdActivity = activityInterface.getCreatedActivity();
if (createdActivity == null) {
return;
}
RecentsView createdRecents = createdActivity.getOverviewPanel();
if (createdRecents != null) {
createdRecents.onRecentsAnimationComplete();
}
@@ -124,7 +124,7 @@ public class FloatingTaskView extends FrameLayout {
RecentsView recentsView = launcher.getOverviewPanel();
mOrientationHandler = recentsView.getPagedOrientationHandler();
mStagePosition = recentsView.getSplitPlaceholder().getActiveSplitStagePosition();
mStagePosition = recentsView.getSplitSelectController().getActiveSplitStagePosition();
mSplitPlaceholderView.setIcon(icon,
mContext.getResources().getDimensionPixelSize(R.dimen.split_placeholder_icon_size));
mSplitPlaceholderView.getIconView().setRotation(mOrientationHandler.getDegreesRotated());
@@ -191,7 +191,7 @@ public class GroupedTaskView extends TaskView {
// Callbacks run from remote animation when recents animation not currently running
InteractionJankMonitorWrapper.begin(this,
InteractionJankMonitorWrapper.CUJ_SPLIT_SCREEN_ENTER, "Enter form GroupedTaskView");
recentsView.getSplitPlaceholder().launchTasks(this /*groupedTaskView*/,
recentsView.getSplitSelectController().launchTasks(this /*groupedTaskView*/,
success -> {
endCallback.executeAllAndDestroy();
InteractionJankMonitorWrapper.end(
@@ -206,7 +206,7 @@ public class GroupedTaskView extends TaskView {
@Override
public void launchTask(@NonNull Consumer<Boolean> callback, boolean freezeTaskList) {
getRecentsView().getSplitPlaceholder().launchTasks(mTask.key.id, mSecondaryTask.key.id,
getRecentsView().getSplitSelectController().launchTasks(mTask.key.id, mSecondaryTask.key.id,
STAGE_POSITION_TOP_OR_LEFT, callback, freezeTaskList, getSplitRatio());
}
@@ -912,7 +912,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mSplitSelectStateController = splitController;
}
public SplitSelectStateController getSplitPlaceholder() {
public SplitSelectStateController getSplitSelectController() {
return mSplitSelectStateController;
}
@@ -4272,7 +4272,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
* Note that the translation can be its primary or secondary dimension.
*/
public float getSplitSelectTranslation() {
int splitPosition = getSplitPlaceholder().getActiveSplitStagePosition();
int splitPosition = getSplitSelectController().getActiveSplitStagePosition();
if (!shouldShiftThumbnailsForSplitSelect()) {
return 0f;
}
@@ -95,6 +95,7 @@ import com.android.quickstep.TaskUtils;
import com.android.quickstep.TaskViewUtils;
import com.android.quickstep.util.CancellableTask;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.util.SplitSelectStateController;
import com.android.quickstep.util.TaskCornerRadius;
import com.android.quickstep.util.TransformParams;
import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper;
@@ -561,6 +562,18 @@ public class TaskView extends FrameLayout implements Reusable {
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
RecentsView recentsView = getRecentsView();
if (recentsView == null || mTask == null) {
return false;
}
SplitSelectStateController splitSelectStateController =
recentsView.getSplitSelectController();
if (splitSelectStateController.isSplitSelectActive() &&
splitSelectStateController.getInitialTaskId() == mTask.key.id) {
// Prevent taps on the this taskview if it's being animated into split select state
return false;
}
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
mLastTouchDownPosition.set(ev.getX(), ev.getY());
}
+1 -1
View File
@@ -480,7 +480,6 @@ public class Launcher extends StatefulActivity<LauncherState>
mAppWidgetHost = createAppWidgetHost();
mAppWidgetHost.startListening();
inflateRootView(R.layout.launcher);
setupViews();
crossFadeWithPreviousAppearance();
mPopupDataProvider = new PopupDataProvider(this::updateNotificationDots);
@@ -1259,6 +1258,7 @@ public class Launcher extends StatefulActivity<LauncherState>
* Finds all the views we need and configure them properly.
*/
protected void setupViews() {
inflateRootView(R.layout.launcher);
mDragLayer = findViewById(R.id.drag_layer);
mFocusHandler = mDragLayer.getFocusIndicatorHelper();
mWorkspace = mDragLayer.findViewById(R.id.workspace);
@@ -97,12 +97,10 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
bottomMargin += dp.hotseatQsbHeight;
}
if (!dp.isGestureMode) {
if (dp.isTaskbarPresent) {
bottomMargin += dp.taskbarSize;
} else {
bottomMargin += insets.bottom;
}
if (!dp.isGestureMode && dp.isTaskbarPresent) {
bottomMargin += dp.taskbarSize;
} else {
bottomMargin += insets.bottom;
}
lp.bottomMargin = bottomMargin;
@@ -94,9 +94,6 @@ public final class FeatureFlags {
getDebugFlag("ENABLE_FLOATING_SEARCH_BAR", false,
"Keep All Apps search bar at the bottom (but above keyboard if open)");
public static final BooleanFlag ENABLE_QUICK_SEARCH = new DeviceFlag("ENABLE_QUICK_SEARCH",
true, "Use quick search behavior.");
public static final BooleanFlag ENABLE_HIDE_HEADER = new DeviceFlag("ENABLE_HIDE_HEADER",
true, "Hide header on keyboard before typing in all apps");
@@ -281,14 +278,6 @@ public final class FeatureFlags {
"FOLDABLE_WORKSPACE_REORDER", true,
"In foldables, when reordering the icons and widgets, is now going to use both sides");
public static final BooleanFlag SHOW_SEARCH_EDUCARD_QSB = new DeviceFlag(
"SHOW_SEARCH_EDUCARD_QSB", false, "Shows Search Educard for QSB entry in OneSearch.");
public static final BooleanFlag ENABLE_IME_LATENCY_LOGGER = getDebugFlag(
"ENABLE_IME_LATENCY_LOGGER", false,
"Enable option to log the keyboard latency for both atomic and controlled keyboard "
+ "animations on an EditText");
public static final BooleanFlag ENABLE_WIDGET_PICKER_DEPTH = new DeviceFlag(
"ENABLE_WIDGET_PICKER_DEPTH", false, "Enable changing depth in widget picker.");
@@ -297,6 +286,9 @@ public final class FeatureFlags {
"Enable showing the new 'delightful pagination'"
+ " which is a brand new animation for folder pagination");
public static final BooleanFlag POPUP_MATERIAL_U = new DeviceFlag(
"POPUP_MATERIAL_U", false, "Switch popup UX to use material U");
public static void initialize(Context context) {
synchronized (sDebugFlags) {
for (DebugFlag flag : sDebugFlags) {
@@ -744,8 +744,9 @@ public class StatsLogManager implements ResourceBasedOverride {
HOT(2),
TIMEOUT(3),
FAIL(4),
COLD_USERWAITING(5);
COLD_USERWAITING(5),
ATOMIC(6),
CONTROLLED(7);
private final int mId;
LatencyType(int id) {
@@ -59,10 +59,13 @@ public class PageIndicatorDots extends View implements PageIndicator {
private static final int DOT_ACTIVE_ALPHA = 255;
private static final int DOT_INACTIVE_ALPHA = 128;
private static final int DOT_GAP_FACTOR = 3;
private static final float DOT_GAP_FACTOR_FLOAT = 3.8f;
// This value approximately overshoots to 1.5 times the original size.
private static final float ENTER_ANIMATION_OVERSHOOT_TENSION = 4.9f;
private static final float INDICATOR_ROTATION = 180f;
private static final RectF sTempRect = new RectF();
private static final Property<PageIndicatorDots, Float> CURRENT_POSITION
@@ -121,7 +124,12 @@ public class PageIndicatorDots extends View implements PageIndicator {
mPaginationPaint.setStyle(Style.FILL);
mPaginationPaint.setColor(Themes.getAttrColor(context, R.attr.folderPaginationColor));
mDotRadius = getResources().getDimension(R.dimen.page_indicator_dot_size) / 2;
mCircleGap = DOT_GAP_FACTOR * mDotRadius;
if (SHOW_DELIGHTFUL_PAGINATION_FOLDER.get()) {
mCircleGap = DOT_GAP_FACTOR_FLOAT * mDotRadius;
} else {
mCircleGap = DOT_GAP_FACTOR * mDotRadius;
}
mPageIndicatorSize = getResources().getDimension(
R.dimen.page_indicator_current_page_indicator_size);
if (!SHOW_DELIGHTFUL_PAGINATION_FOLDER.get()) {
@@ -298,7 +306,17 @@ public class PageIndicatorDots extends View implements PageIndicator {
mPaginationPaint.setAlpha(DOT_ACTIVE_ALPHA);
if (SHOW_DELIGHTFUL_PAGINATION_FOLDER.get()) {
canvas.drawRect(getActiveRect(), mPaginationPaint);
RectF currRect = getActiveRect();
int scrollPerPage = getScrollPerPage();
// This IF is to avoid division by 0
if (scrollPerPage != 0) {
int delta = mCurrentScroll % scrollPerPage;
canvas.rotate((INDICATOR_ROTATION * delta) / scrollPerPage,
currRect.centerX(), currRect.centerY());
}
canvas.drawRect(currRect, mPaginationPaint);
} else {
canvas.drawRoundRect(getActiveRect(), mDotRadius, mDotRadius, mPaginationPaint);
}
@@ -375,11 +393,18 @@ public class PageIndicatorDots extends View implements PageIndicator {
return (mPageIndicatorSize / 2) - mDotRadius;
}
/**
* Returns an int that is the amount we need to scroll per page
*/
private int getScrollPerPage() {
return mNumPages > 1 ? mTotalScroll / (mNumPages - 1) : 0;
}
/**
* The current scroll adjusted for the distance the indicator needs to travel on the screen
*/
private float getIndicatorScrollDistance() {
float scrollPerPage = mNumPages > 1 ? mTotalScroll / (mNumPages - 1) : 0;
int scrollPerPage = getScrollPerPage();
return scrollPerPage != 0 ? ((float) mCurrentScroll / scrollPerPage) * mCircleGap : 0;
}