Snap for 9066247 from d51fdaa573 to udc-release

Change-Id: I13a53c652e2d61fed4fb8cf40f440b991b9b38d2
This commit is contained in:
Android Build Coastguard Worker committed 2022-09-15 02:57:47 +00:00
commit 6830e1aba0
41 files changed
+377 -167

No files matched your search

+5
View File
@@ -43,4 +43,9 @@
<!-- Accessibility actions -->
<item type="id" name="action_move_to_top_or_left" />
<item type="id" name="action_move_to_bottom_or_right" />
<!-- The max scale for the wallpaper when it's zoomed in -->
<item name="config_wallpaperMaxScale" format="float" type="dimen">
@*android:dimen/config_wallpaperMaxScale
</item>
</resources>
@@ -42,7 +42,7 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_SCRIM_FOR_APP_LAU
import static com.android.launcher3.config.FeatureFlags.KEYGUARD_ANIMATION;
import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY;
import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
import static com.android.launcher3.statehandlers.DepthController.DEPTH;
import static com.android.launcher3.statehandlers.DepthController.STATE_DEPTH;
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
import static com.android.launcher3.views.FloatingIconView.getFloatingIconView;
@@ -58,6 +58,8 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.ActivityOptions;
import android.app.WindowConfiguration;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -84,6 +86,7 @@ import android.view.SurfaceControl;
import android.view.View;
import android.view.ViewRootImpl;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;
@@ -124,8 +127,6 @@ import com.android.quickstep.util.SurfaceTransactionApplier;
import com.android.quickstep.util.WorkspaceRevealAnim;
import com.android.quickstep.views.FloatingWidgetView;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.system.ActivityCompat;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.BlurUtils;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
import com.android.systemui.shared.system.QuickStepContract;
@@ -135,7 +136,6 @@ import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.RemoteTransitionCompat;
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.wm.shell.startingsurface.IStartingWindowListener;
import java.util.ArrayList;
@@ -294,8 +294,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
RemoteAnimationAdapterCompat adapterCompat =
new RemoteAnimationAdapterCompat(runner, duration, statusBarTransitionDelay,
mLauncher.getIApplicationThread());
return new ActivityOptionsWrapper(
ActivityOptionsCompat.makeRemoteAnimation(adapterCompat), onEndCallback);
ActivityOptions options = ActivityOptions.makeRemoteAnimation(
adapterCompat.getWrapped(),
adapterCompat.getRemoteTransition().getTransition());
return new ActivityOptionsWrapper(options, onEndCallback);
}
/**
@@ -385,7 +387,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
@Override
public void onAnimationStart(Animator animation) {
mLauncher.addOnResumeCallback(() ->
ObjectAnimator.ofFloat(mLauncher.getDepthController(), DEPTH,
ObjectAnimator.ofFloat(mLauncher.getDepthController(), STATE_DEPTH,
mLauncher.getStateManager().getState().getDepth(
mLauncher)).start());
}
@@ -409,7 +411,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
@Override
public void onAnimationStart(Animator animation) {
mLauncher.addOnResumeCallback(() ->
ObjectAnimator.ofFloat(mLauncher.getDepthController(), DEPTH,
ObjectAnimator.ofFloat(mLauncher.getDepthController(), STATE_DEPTH,
mLauncher.getStateManager().getState().getDepth(
mLauncher)).start());
}
@@ -1052,7 +1054,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
&& BlurUtils.supportsBlursOnWindows();
MyDepthController depthController = new MyDepthController(mLauncher);
ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController, DEPTH,
ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController, STATE_DEPTH,
BACKGROUND_APP.getDepth(mLauncher))
.setDuration(APP_LAUNCH_DURATION);
@@ -1093,8 +1095,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
mWallpaperOpenRunner = createWallpaperOpenRunner(false /* fromUnlock */);
RemoteAnimationDefinitionCompat definition = new RemoteAnimationDefinitionCompat();
definition.addRemoteAnimation(WindowManagerWrapper.TRANSIT_WALLPAPER_OPEN,
WindowManagerWrapper.ACTIVITY_TYPE_STANDARD,
definition.addRemoteAnimation(WindowManager.TRANSIT_OLD_WALLPAPER_OPEN,
WindowConfiguration.ACTIVITY_TYPE_STANDARD,
new RemoteAnimationAdapterCompat(
new LauncherAnimationRunner(mHandler, mWallpaperOpenRunner,
false /* startAtFrontOfQueue */),
@@ -1104,7 +1106,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
if (KEYGUARD_ANIMATION.get()) {
mKeyguardGoingAwayRunner = createWallpaperOpenRunner(true /* fromUnlock */);
definition.addRemoteAnimation(
WindowManagerWrapper.TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
new RemoteAnimationAdapterCompat(
new LauncherAnimationRunner(
mHandler, mKeyguardGoingAwayRunner,
@@ -1113,7 +1115,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
mLauncher.getIApplicationThread()));
}
new ActivityCompat(mLauncher).registerRemoteAnimations(definition);
mLauncher.registerRemoteAnimations(definition.getWrapped());
}
}
@@ -1152,7 +1154,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
return;
}
if (hasControlRemoteAppTransitionPermission()) {
new ActivityCompat(mLauncher).unregisterRemoteAnimations();
mLauncher.unregisterRemoteAnimations();
// Also clear strong references to the runners registered with the remote animation
// definition so we don't have to wait for the system gc
@@ -1601,7 +1603,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
true /* animateOverviewScrim */, launcherView).getAnimators());
if (!areAllTargetsTranslucent(appTargets)) {
anim.play(ObjectAnimator.ofFloat(mLauncher.getDepthController(), DEPTH,
anim.play(ObjectAnimator.ofFloat(mLauncher.getDepthController(),
STATE_DEPTH,
BACKGROUND_APP.getDepth(mLauncher), NORMAL.getDepth(mLauncher)));
}
@@ -165,7 +165,8 @@ public class DepthController extends BaseDepthController implements StateHandler
float toDepth = toState.getDepth(mLauncher);
if (Float.compare(mDepth, toDepth) != 0) {
animation.setFloat(this, DEPTH, toDepth, config.getInterpolator(ANIM_DEPTH, LINEAR));
animation.setFloat(this, STATE_DEPTH, toDepth,
config.getInterpolator(ANIM_DEPTH, LINEAR));
}
}
@@ -179,7 +180,7 @@ public class DepthController extends BaseDepthController implements StateHandler
public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
mIgnoreStateChangesDuringMultiWindowAnimation = true;
ObjectAnimator mwAnimation = ObjectAnimator.ofFloat(this, DEPTH,
ObjectAnimator mwAnimation = ObjectAnimator.ofFloat(this, STATE_DEPTH,
mLauncher.getStateManager().getState().getDepth(mLauncher, isInMultiWindowMode))
.setDuration(300);
mwAnimation.addListener(new AnimatorListenerAdapter() {
@@ -15,9 +15,10 @@
*/
package com.android.launcher3.taskbar;
import static android.view.InsetsState.ITYPE_EXTRA_NAVIGATION_BAR;
import static com.android.launcher3.taskbar.TaskbarLauncherStateController.FLAG_RESUMED;
import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS;
import static com.android.systemui.shared.system.WindowManagerWrapper.ITYPE_EXTRA_NAVIGATION_BAR;
import android.animation.Animator;
import android.animation.AnimatorSet;
@@ -17,6 +17,7 @@ package com.android.launcher3.taskbar;
import static android.view.View.AccessibilityDelegate;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION;
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor;
@@ -42,7 +43,6 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_O
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING;
import static com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo.TOUCHABLE_INSETS_REGION;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
@@ -69,6 +69,7 @@ import android.view.View.OnAttachStateChangeListener;
import android.view.View.OnClickListener;
import android.view.View.OnHoverListener;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -88,7 +89,6 @@ import com.android.systemui.shared.rotation.FloatingRotationButton;
import com.android.systemui.shared.rotation.RotationButton;
import com.android.systemui.shared.rotation.RotationButtonController;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.ViewTreeObserverWrapper;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -167,7 +167,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
// Variables for moving nav buttons to a separate window above IME
private boolean mAreNavButtonsInSeparateWindow = false;
private BaseDragLayer<TaskbarActivityContext> mSeparateWindowParent; // Initialized in init.
private final ViewTreeObserverWrapper.OnComputeInsetsListener mSeparateWindowInsetsComputer =
private final ViewTreeObserver.OnComputeInternalInsetsListener mSeparateWindowInsetsComputer =
this::onComputeInsetsForSeparateWindow;
private final RecentsHitboxExtender mHitboxExtender = new RecentsHitboxExtender();
@@ -833,14 +833,14 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
mSeparateWindowParent.addOnAttachStateChangeListener(new OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View view) {
ViewTreeObserverWrapper.addOnComputeInsetsListener(
mSeparateWindowParent.getViewTreeObserver(), mSeparateWindowInsetsComputer);
mSeparateWindowParent.getViewTreeObserver().addOnComputeInternalInsetsListener(
mSeparateWindowInsetsComputer);
}
@Override
public void onViewDetachedFromWindow(View view) {
mSeparateWindowParent.removeOnAttachStateChangeListener(this);
ViewTreeObserverWrapper.removeOnComputeInsetsListener(
mSeparateWindowParent.getViewTreeObserver().removeOnComputeInternalInsetsListener(
mSeparateWindowInsetsComputer);
}
});
@@ -868,7 +868,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
mContext.getDragLayer().addView(mNavButtonsView);
}
private void onComputeInsetsForSeparateWindow(ViewTreeObserverWrapper.InsetsInfo insetsInfo) {
private void onComputeInsetsForSeparateWindow(ViewTreeObserver.InternalInsetsInfo insetsInfo) {
addVisibleButtonsRegion(mSeparateWindowParent, insetsInfo.touchableRegion);
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION);
}
@@ -24,6 +24,7 @@ import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -32,9 +33,6 @@ import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.views.BaseDragLayer;
import com.android.systemui.shared.system.ViewTreeObserverWrapper;
import com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo;
import com.android.systemui.shared.system.ViewTreeObserverWrapper.OnComputeInsetsListener;
/**
* Top-level ViewGroup that hosts the TaskbarView as well as Views created by it such as Folder.
@@ -42,7 +40,8 @@ import com.android.systemui.shared.system.ViewTreeObserverWrapper.OnComputeInset
public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
private final TaskbarBackgroundRenderer mBackgroundRenderer;
private final OnComputeInsetsListener mTaskbarInsetsComputer = this::onComputeTaskbarInsets;
private final ViewTreeObserver.OnComputeInternalInsetsListener mTaskbarInsetsComputer =
this::onComputeTaskbarInsets;
// Initialized in init.
private TaskbarDragLayerController.TaskbarDragLayerCallbacks mControllerCallbacks;
@@ -80,7 +79,7 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
mControllers = mControllerCallbacks.getTouchControllers();
}
private void onComputeTaskbarInsets(InsetsInfo insetsInfo) {
private void onComputeTaskbarInsets(ViewTreeObserver.InternalInsetsInfo insetsInfo) {
if (mControllerCallbacks != null) {
mControllerCallbacks.updateInsetsTouchability(insetsInfo);
}
@@ -88,7 +87,7 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
protected void onDestroy(boolean forceDestroy) {
if (forceDestroy) {
ViewTreeObserverWrapper.removeOnComputeInsetsListener(mTaskbarInsetsComputer);
getViewTreeObserver().removeOnComputeInternalInsetsListener(mTaskbarInsetsComputer);
}
}
@@ -99,8 +98,7 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
ViewTreeObserverWrapper.addOnComputeInsetsListener(getViewTreeObserver(),
mTaskbarInsetsComputer);
getViewTreeObserver().addOnComputeInternalInsetsListener(mTaskbarInsetsComputer);
}
@Override
@@ -17,12 +17,12 @@ package com.android.launcher3.taskbar;
import android.content.res.Resources;
import android.graphics.Rect;
import android.view.ViewTreeObserver;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.util.TouchController;
import com.android.quickstep.AnimatedFloat;
import com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo;
import java.io.PrintWriter;
@@ -157,9 +157,9 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
/**
* Called to update the touchable insets.
* @see InsetsInfo#setTouchableInsets(int)
* @see ViewTreeObserver.InternalInsetsInfo#setTouchableInsets(int)
*/
public void updateInsetsTouchability(InsetsInfo insetsInfo) {
public void updateInsetsTouchability(ViewTreeObserver.InternalInsetsInfo insetsInfo) {
mControllers.taskbarInsetsController.updateInsetsTouchability(insetsInfo);
}
@@ -20,6 +20,11 @@ import android.graphics.Region
import android.view.InsetsFrameProvider
import android.view.InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES
import android.view.InsetsState
import android.view.InsetsState.ITYPE_BOTTOM_TAPPABLE_ELEMENT
import android.view.InsetsState.ITYPE_EXTRA_NAVIGATION_BAR
import android.view.ViewTreeObserver
import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME
import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION
import android.view.WindowManager
import android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD
import android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION
@@ -29,9 +34,6 @@ import com.android.launcher3.DeviceProfile
import com.android.launcher3.anim.AlphaUpdateListener
import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController
import com.android.quickstep.KtR
import com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo
import com.android.systemui.shared.system.WindowManagerWrapper
import com.android.systemui.shared.system.WindowManagerWrapper.*
import java.io.PrintWriter
/**
@@ -55,8 +57,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
this.controllers = controllers
windowLayoutParams = context.windowLayoutParams
val wmWrapper: WindowManagerWrapper = getInstance()
wmWrapper.setProvidesInsetsTypes(
setProvidesInsetsTypes(
windowLayoutParams,
intArrayOf(
ITYPE_EXTRA_NAVIGATION_BAR,
@@ -108,10 +109,22 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
}
/**
* Called to update the touchable insets.
* @see InsetsInfo.setTouchableInsets
* Sets {@param providesInsetsTypes} as the inset types provided by {@param params}.
* @param params The window layout params.
* @param providesInsetsTypes The inset types we would like this layout params to provide.
*/
fun updateInsetsTouchability(insetsInfo: InsetsInfo) {
fun setProvidesInsetsTypes(params: WindowManager.LayoutParams, providesInsetsTypes: IntArray) {
params.providedInsets = arrayOfNulls<InsetsFrameProvider>(providesInsetsTypes.size);
for (i in providesInsetsTypes.indices) {
params.providedInsets[i] = InsetsFrameProvider(providesInsetsTypes[i]);
}
}
/**
* Called to update the touchable insets.
* @see InternalInsetsInfo.setTouchableInsets
*/
fun updateInsetsTouchability(insetsInfo: ViewTreeObserver.InternalInsetsInfo) {
insetsInfo.touchableRegion.setEmpty()
// Always have nav buttons be touchable
controllers.navbarButtonsViewController.addVisibleButtonsRegion(
@@ -120,18 +133,18 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
var insetsIsTouchableRegion = true
if (context.dragLayer.alpha < AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD) {
// Let touches pass through us.
insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION)
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
} else if (controllers.navbarButtonsViewController.isImeVisible) {
insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION)
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
} else if (!controllers.uiController.isTaskbarTouchable) {
// Let touches pass through us.
insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION)
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
} else if (controllers.taskbarDragController.isSystemDragInProgress) {
// Let touches pass through us.
insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION)
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
} else if (AbstractFloatingView.hasOpenView(context, TYPE_TASKBAR_ALL_APPS)) {
// Let touches pass through us.
insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION)
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
} else if (controllers.taskbarViewController.areIconsVisible()
|| AbstractFloatingView.hasOpenView(context, AbstractFloatingView.TYPE_ALL)
|| context.isNavBarKidsModeActive
@@ -139,15 +152,15 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
// Taskbar has some touchable elements, take over the full taskbar area
insetsInfo.setTouchableInsets(
if (context.isTaskbarWindowFullscreen) {
InsetsInfo.TOUCHABLE_INSETS_FRAME
TOUCHABLE_INSETS_FRAME
} else {
insetsInfo.touchableRegion.set(contentRegion)
InsetsInfo.TOUCHABLE_INSETS_REGION
TOUCHABLE_INSETS_REGION
}
)
insetsIsTouchableRegion = false
} else {
insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION)
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
}
context.excludeFromMagnificationRegion(insetsIsTouchableRegion)
}
@@ -32,6 +32,7 @@ import android.annotation.Nullable;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.util.Log;
import android.view.InsetsController;
import android.view.View;
import android.view.ViewConfiguration;
@@ -46,7 +47,6 @@ import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.AnimatedFloat;
import com.android.quickstep.SystemUiProxy;
import com.android.systemui.shared.system.WindowManagerWrapper;
import java.io.PrintWriter;
import java.util.Arrays;
@@ -96,7 +96,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
* How long to stash/unstash when manually invoked via long press.
*/
public static final long TASKBAR_STASH_DURATION =
WindowManagerWrapper.ANIMATION_DURATION_RESIZE;
InsetsController.ANIMATION_DURATION_RESIZE;
/**
* How long to stash/unstash when keyboard is appearing/disappearing.
@@ -17,15 +17,16 @@ package com.android.launcher3.taskbar.allapps;
import static android.view.KeyEvent.ACTION_UP;
import static android.view.KeyEvent.KEYCODE_BACK;
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
import static com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo.TOUCHABLE_INSETS_REGION;
import android.content.Context;
import android.graphics.Insets;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
import android.view.WindowInsets;
import com.android.launcher3.AbstractFloatingView;
@@ -47,9 +48,6 @@ import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.OnboardingPrefs;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.views.BaseDragLayer;
import com.android.systemui.shared.system.ViewTreeObserverWrapper;
import com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo;
import com.android.systemui.shared.system.ViewTreeObserverWrapper.OnComputeInsetsListener;
/**
* Window context for the taskbar all apps overlay.
@@ -163,7 +161,7 @@ class TaskbarAllAppsContext extends BaseTaskbarContext {
/** Root drag layer for this context. */
private static class TaskbarAllAppsDragLayer extends
BaseDragLayer<TaskbarAllAppsContext> implements OnComputeInsetsListener {
BaseDragLayer<TaskbarAllAppsContext> implements OnComputeInternalInsetsListener {
private TaskbarAllAppsDragLayer(Context context) {
super(context, null, 1);
@@ -174,14 +172,13 @@ class TaskbarAllAppsContext extends BaseTaskbarContext {
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
ViewTreeObserverWrapper.addOnComputeInsetsListener(
getViewTreeObserver(), this);
getViewTreeObserver().addOnComputeInternalInsetsListener(this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
ViewTreeObserverWrapper.removeOnComputeInsetsListener(this);
getViewTreeObserver().removeOnComputeInternalInsetsListener(this);
}
@Override
@@ -207,7 +204,7 @@ class TaskbarAllAppsContext extends BaseTaskbarContext {
}
@Override
public void onComputeInsets(InsetsInfo inoutInfo) {
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo inoutInfo) {
if (mActivity.mDragController.isSystemDragInProgress()) {
inoutInfo.touchableRegion.setEmpty();
inoutInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION);
@@ -27,9 +27,11 @@ import static com.android.launcher3.LauncherState.NO_OFFSET;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK;
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
import static com.android.launcher3.anim.Interpolators.EMPHASIZED;
import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.config.FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE;
import static com.android.launcher3.config.FeatureFlags.ENABLE_WIDGET_PICKER_DEPTH;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP;
import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
import static com.android.launcher3.popup.QuickstepSystemShortcut.getSplitSelectShortcutByPosition;
@@ -44,6 +46,7 @@ import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
import static com.android.launcher3.util.Executors.THREAD_POOL_EXECUTOR;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.quickstep.util.BaseDepthController.WIDGET_DEPTH;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY;
import android.animation.AnimatorSet;
@@ -75,6 +78,7 @@ import com.android.launcher3.LauncherState;
import com.android.launcher3.QuickstepAccessibilityDelegate;
import com.android.launcher3.QuickstepTransitionManager;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.anim.AnimatorPlaybackController;
@@ -135,7 +139,6 @@ import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.unfold.UnfoldTransitionFactory;
import com.android.systemui.unfold.UnfoldTransitionProgressProvider;
@@ -583,6 +586,11 @@ public class QuickstepLauncher extends Launcher {
public void onWidgetsTransition(float progress) {
super.onWidgetsTransition(progress);
onTaskbarInAppDisplayProgressUpdate(progress, WIDGETS_PAGE_PROGRESS_INDEX);
if (ENABLE_WIDGET_PICKER_DEPTH.get() && !Utilities.IS_RUNNING_IN_TEST_HARNESS) {
WIDGET_DEPTH.set(getDepthController(),
Utilities.mapToRange(progress, 0f, 1f, 0f, getDeviceProfile().bottomSheetDepth,
EMPHASIZED));
}
}
private void onTaskbarInAppDisplayProgressUpdate(float progress, int flag) {
@@ -791,8 +799,8 @@ public class QuickstepLauncher extends Launcher {
? mAppTransitionManager.getActivityLaunchOptions(v)
: super.getActivityLaunchOptions(v, item);
if (mLastTouchUpTime > 0) {
ActivityOptionsCompat.setLauncherSourceInfo(
activityOptions.options, mLastTouchUpTime);
activityOptions.options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_LAUNCHER,
mLastTouchUpTime);
}
activityOptions.options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON);
activityOptions.options.setLaunchDisplayId(
@@ -16,7 +16,6 @@
package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS;
import android.content.Context;
@@ -26,7 +25,6 @@ import com.android.launcher3.DeviceProfile.DeviceProfileListenable;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.Themes;
/**
@@ -44,9 +42,9 @@ public class AllAppsState extends LauncherState {
@Override
public <DEVICE_PROFILE_CONTEXT extends Context & DeviceProfileListenable>
int getTransitionDuration(DEVICE_PROFILE_CONTEXT context, boolean isToState) {
return context.getDeviceProfile().isTablet
? 500
: isToState ? 600 : 300;
return isToState
? context.getDeviceProfile().allAppsOpenDuration
: context.getDeviceProfile().allAppsCloseDuration;
}
@Override
@@ -83,15 +81,7 @@ public class AllAppsState extends LauncherState {
protected <DEVICE_PROFILE_CONTEXT extends Context & DeviceProfile.DeviceProfileListenable>
float getDepthUnchecked(DEVICE_PROFILE_CONTEXT context) {
if (context.getDeviceProfile().isTablet) {
// The goal is to set wallpaper to zoom at workspaceContentScale when in AllApps.
// When depth is 0, wallpaper zoom is set to maxWallpaperScale.
// When depth is 1, wallpaper zoom is set to 1.
// For depth to achieve zoom set to maxWallpaperScale * workspaceContentScale:
float maxWallpaperScale = context.getResources().getFloat(
com.android.internal.R.dimen.config_wallpaperMaxScale);
return Utilities.mapToRange(
maxWallpaperScale * context.getDeviceProfile().workspaceContentScale,
maxWallpaperScale, 1f, 0f, 1f, LINEAR);
return context.getDeviceProfile().bottomSheetDepth;
} else {
// The scrim fades in at approximately 50% of the swipe gesture.
// This means that the depth should be greater than 1, in order to fully zoom out.
@@ -87,6 +87,7 @@ import android.window.PictureInPictureSurfaceTransaction;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import com.android.internal.util.LatencyTracker;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
@@ -127,7 +128,6 @@ import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.InputConsumerController;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
import com.android.systemui.shared.system.LatencyTrackerCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;
@@ -622,8 +622,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
Object traceToken = TraceHelper.INSTANCE.beginSection("logToggleRecents",
TraceHelper.FLAG_IGNORE_BINDERS);
LatencyTrackerCompat.logToggleRecents(
mContext, (int) (mLauncherFrameDrawnTime - mTouchTimeMs));
LatencyTracker.getInstance(mContext).logAction(LatencyTracker.ACTION_TOGGLE_RECENTS,
(int) (mLauncherFrameDrawnTime - mTouchTimeMs));
TraceHelper.INSTANCE.endSection(traceToken);
// This method is only called when STATE_GESTURE_STARTED is set, so we can enable the
@@ -20,6 +20,7 @@ import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.SET_END_TARGET;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.SET_END_TARGET_HOME;
import android.annotation.Nullable;
import android.annotation.TargetApi;
@@ -330,6 +331,16 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
ActiveGestureLog.INSTANCE.addLog(
/* event= */ "setEndTarget " + mEndTarget,
/* gestureEvent= */ SET_END_TARGET);
switch (mEndTarget) {
case HOME:
ActiveGestureLog.INSTANCE.trackEvent(SET_END_TARGET_HOME);
break;
case RECENTS:
case NEW_TASK:
case LAST_TASK:
default:
// No-Op
}
if (isAtomic) {
mStateCallback.setState(STATE_END_TARGET_ANIMATION_FINISHED);
}
@@ -193,7 +193,20 @@ public class OverviewCommandHelper {
}
}
if (activityInterface.switchToRecentsIfVisible(() -> scheduleNextTask(cmd))) {
final Runnable completeCallback = () -> {
if (cmd.type == TYPE_SHOW_NEXT_FOCUS) {
RecentsView rv = activityInterface.getVisibleRecentsView();
// When the overview is launched via alt tab (cmd type is TYPE_SHOW_NEXT_FOCUS),
// the touch mode somehow is not change to false by the Android framework.
// The subsequent tab to go through tasks in overview can only be dispatched to
// focuses views, while focus can only be requested in
// {@link View#requestFocusNoSearch(int, Rect)} when touch mode is false. To note,
// here we launch overview from home.
rv.getViewRootImpl().touchModeChanged(false);
}
scheduleNextTask(cmd);
};
if (activityInterface.switchToRecentsIfVisible(completeCallback)) {
// If successfully switched, wait until animation finishes
return false;
}
@@ -268,6 +281,13 @@ public class OverviewCommandHelper {
RecentsView rv =
mOverviewComponentObserver.getActivityInterface().getVisibleRecentsView();
if (rv != null) {
// When the overview is launched via alt tab (cmd type is TYPE_SHOW_NEXT_FOCUS),
// the touch mode somehow is not change to false by the Android framework.
// The subsequent tab to go through tasks in overview can only be dispatched to
// focuses views, while focus can only be requested in
// {@link View#requestFocusNoSearch(int, Rect)} when touch mode is false. To note,
// here we launch overview with live tile.
rv.getViewRootImpl().touchModeChanged(false);
// Ensure that recents view has focus so that it receives the followup key inputs
TaskView taskView = rv.getNextTaskView();
if (taskView == null) {
@@ -20,6 +20,7 @@ import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.KeyguardManager;
import android.os.Build;
import android.os.Process;
import android.os.RemoteException;
@@ -31,7 +32,6 @@ 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;
import com.android.wm.shell.util.GroupedRecentTaskInfo;
import com.android.wm.shell.util.SplitBounds;
@@ -49,7 +49,7 @@ public class RecentTasksList {
private static final TaskLoadResult INVALID_RESULT = new TaskLoadResult(-1, false, 0);
private final KeyguardManagerCompat mKeyguardManager;
private final KeyguardManager mKeyguardManager;
private final LooperExecutor mMainThreadExecutor;
private final SystemUiProxy mSysUiProxy;
@@ -66,8 +66,8 @@ public class RecentTasksList {
// Tasks are stored in order of least recently launched to most recently launched.
private ArrayList<ActivityManager.RunningTaskInfo> mRunningTasks;
public RecentTasksList(LooperExecutor mainThreadExecutor,
KeyguardManagerCompat keyguardManager, SystemUiProxy sysUiProxy) {
public RecentTasksList(LooperExecutor mainThreadExecutor, KeyguardManager keyguardManager,
SystemUiProxy sysUiProxy) {
mMainThreadExecutor = mainThreadExecutor;
mKeyguardManager = keyguardManager;
mChangeId = 1;
@@ -30,6 +30,7 @@ import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MOD
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.app.ActivityOptions;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
@@ -77,7 +78,6 @@ import com.android.quickstep.util.TISBindHelper;
import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@@ -263,8 +263,10 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
wrapper, RECENTS_LAUNCH_DURATION,
RECENTS_LAUNCH_DURATION - STATUS_BAR_TRANSITION_DURATION
- STATUS_BAR_TRANSITION_PRE_DELAY, getIApplicationThread());
final ActivityOptionsWrapper activityOptions = new ActivityOptionsWrapper(
ActivityOptionsCompat.makeRemoteAnimation(adapterCompat),
final ActivityOptions options = ActivityOptions.makeRemoteAnimation(
adapterCompat.getWrapped(),
adapterCompat.getRemoteTransition().getTransition());
final ActivityOptionsWrapper activityOptions = new ActivityOptionsWrapper(options,
onEndCallback);
activityOptions.options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON);
activityOptions.options.setLaunchDisplayId(
@@ -406,8 +408,10 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
RemoteAnimationAdapterCompat adapterCompat =
new RemoteAnimationAdapterCompat(runner, HOME_APPEAR_DURATION, 0,
getIApplicationThread());
startHomeIntentSafely(this,
ActivityOptionsCompat.makeRemoteAnimation(adapterCompat).toBundle());
ActivityOptions options = ActivityOptions.makeRemoteAnimation(
adapterCompat.getWrapped(),
adapterCompat.getRemoteTransition().getTransition());
startHomeIntentSafely(this, options.toBundle());
}
private final RemoteAnimationFactory mAnimationToHomeFactory =
@@ -22,6 +22,7 @@ import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.KeyguardManager;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.Intent;
@@ -40,7 +41,6 @@ import com.android.quickstep.util.TaskVisualsChangeListener;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.KeyguardManagerCompat;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;
@@ -75,7 +75,8 @@ public class RecentsModel implements IconChangeListener, TaskStackChangeListener
private RecentsModel(Context context) {
mContext = context;
mTaskList = new RecentTasksList(MAIN_EXECUTOR,
new KeyguardManagerCompat(context), SystemUiProxy.INSTANCE.get(context));
context.getSystemService(KeyguardManager.class),
SystemUiProxy.INSTANCE.get(context));
IconProvider iconProvider = new IconProvider(context);
mIconCache = new TaskIconCache(context, RECENTS_MODEL_EXECUTOR, iconProvider);
@@ -41,7 +41,6 @@ import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.RemoteTransitionCompat;
import com.android.systemui.shared.system.TaskStackChangeListener;
@@ -233,7 +232,8 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
RemoteTransitionCompat transition = new RemoteTransitionCompat(mCallbacks,
mController != null ? mController.getController() : null,
mCtx.getIApplicationThread());
final ActivityOptions options = ActivityOptionsCompat.makeRemoteTransition(transition);
final ActivityOptions options = ActivityOptions.makeRemoteTransition(
transition.getTransition());
// Allowing to pause Home if Home is top activity and Recents is not Home. So when user
// start home when recents animation is playing, the home activity can be resumed again
// to let the transition controller collect Home activity.
@@ -16,6 +16,8 @@
package com.android.quickstep;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_SELECTIONS;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP;
@@ -26,9 +28,12 @@ import android.graphics.Color;
import android.graphics.Rect;
import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.util.Log;
import android.view.View;
import android.view.WindowInsets;
import android.view.WindowManagerGlobal;
import android.window.SplashScreen;
import androidx.annotation.Nullable;
@@ -52,8 +57,6 @@ import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecCompat
import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecsFuture;
import com.android.systemui.shared.recents.view.RecentsTransition;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.WindowManagerWrapper;
import java.util.Collections;
import java.util.List;
@@ -121,6 +124,7 @@ public interface TaskShortcutFactory {
}
class FreeformSystemShortcut extends SystemShortcut<BaseDraggingActivity> {
private static final String TAG = "FreeformSystemShortcut";
private Handler mHandler;
@@ -193,7 +197,7 @@ public interface TaskShortcutFactory {
taskId, thumbnail, taskBounds));
}
};
WindowManagerWrapper.getInstance().overridePendingAppTransitionMultiThumbFuture(
overridePendingAppTransitionMultiThumbFuture(
future, animStartedListener, mHandler, true /* scaleUp */,
taskKey.displayId);
mTarget.getStatsLogManager().logger().withItemInfo(mTaskView.getItemInfo())
@@ -201,8 +205,27 @@ public interface TaskShortcutFactory {
}
}
/**
* Overrides a pending app transition.
*/
private void overridePendingAppTransitionMultiThumbFuture(
AppTransitionAnimationSpecsFuture animationSpecFuture, Runnable animStartedCallback,
Handler animStartedCallbackHandler, boolean scaleUp, int displayId) {
try {
WindowManagerGlobal.getWindowManagerService()
.overridePendingAppTransitionMultiThumbFuture(
animationSpecFuture.getFuture(),
RecentsTransition.wrapStartedListener(animStartedCallbackHandler,
animStartedCallback), scaleUp, displayId);
} catch (RemoteException e) {
Log.w(TAG, "Failed to override pending app transition (multi-thumbnail future): ",
e);
}
}
private ActivityOptions makeLaunchOptions(Activity activity) {
ActivityOptions activityOptions = ActivityOptionsCompat.makeFreeformOptions();
ActivityOptions activityOptions = ActivityOptions.makeBasic();
activityOptions.setLaunchWindowingMode(WINDOWING_MODE_FREEFORM);
// Arbitrary bounds only because freeform is in dev mode right now
final View decorView = activity.getWindow().getDecorView();
final WindowInsets insets = decorView.getRootWindowInsets();
@@ -36,7 +36,7 @@ import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR;
import static com.android.launcher3.anim.Interpolators.clampToProgress;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.statehandlers.DepthController.DEPTH;
import static com.android.launcher3.statehandlers.DepthController.STATE_DEPTH;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
@@ -367,7 +367,7 @@ public final class TaskViewUtils {
});
if (depthController != null) {
out.setFloat(depthController, DEPTH, BACKGROUND_APP.getDepth(baseActivity),
out.setFloat(depthController, STATE_DEPTH, BACKGROUND_APP.getDepth(baseActivity),
TOUCH_RESPONSE_INTERPOLATOR);
}
}
@@ -33,9 +33,10 @@ public class ActiveGestureErrorDetector {
* Enums associated to gesture navigation events.
*/
public enum GestureEvent {
MOTION_DOWN, MOTION_UP, SET_END_TARGET, ON_SETTLED_ON_END_TARGET, START_RECENTS_ANIMATION,
FINISH_RECENTS_ANIMATION, CANCEL_RECENTS_ANIMATION, SET_ON_PAGE_TRANSITION_END_CALLBACK,
CANCEL_CURRENT_ANIMATION, CLEANUP_SCREENSHOT,
MOTION_DOWN, MOTION_UP, SET_END_TARGET, SET_END_TARGET_HOME, ON_SETTLED_ON_END_TARGET,
START_RECENTS_ANIMATION, FINISH_RECENTS_ANIMATION, CANCEL_RECENTS_ANIMATION,
SET_ON_PAGE_TRANSITION_END_CALLBACK, CANCEL_CURRENT_ANIMATION, CLEANUP_SCREENSHOT,
SCROLLER_ANIMATION_ABORTED,
/**
* These GestureEvents are specifically associated to state flags that get set in
@@ -123,6 +124,16 @@ public class ActiveGestureErrorDetector {
+ "being set.",
writer);
break;
case SCROLLER_ANIMATION_ABORTED:
errorDetected |= printErrorIfTrue(
encounteredEvents.contains(GestureEvent.SET_END_TARGET_HOME)
&& !encounteredEvents.contains(
GestureEvent.ON_SETTLED_ON_END_TARGET),
/* errorMessage= */ prefix + "\t\trecents view scroller animation "
+ "aborted after setting end target HOME, but before"
+ " settling on end target.",
writer);
break;
case STATE_GESTURE_COMPLETED:
errorDetected |= printErrorIfTrue(
!encounteredEvents.contains(GestureEvent.MOTION_UP),
@@ -173,6 +184,7 @@ public class ActiveGestureErrorDetector {
break;
case MOTION_DOWN:
case SET_END_TARGET:
case SET_END_TARGET_HOME:
case START_RECENTS_ANIMATION:
case SET_ON_PAGE_TRANSITION_END_CALLBACK:
case CANCEL_CURRENT_ANIMATION:
@@ -24,6 +24,7 @@ import android.view.SurfaceControl;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.MultiPropertyFactory;
import com.android.systemui.shared.system.BlurUtils;
/**
@@ -31,7 +32,7 @@ import com.android.systemui.shared.system.BlurUtils;
*/
public class BaseDepthController {
public static final FloatProperty<BaseDepthController> DEPTH =
private static final FloatProperty<BaseDepthController> DEPTH =
new FloatProperty<BaseDepthController>("depth") {
@Override
public void setValue(BaseDepthController depthController, float depth) {
@@ -44,6 +45,19 @@ public class BaseDepthController {
}
};
private static final MultiPropertyFactory<BaseDepthController> DEPTH_PROPERTY_FACTORY =
new MultiPropertyFactory<>("depthProperty", DEPTH, Float::max);
private static final int DEPTH_INDEX_STATE_TRANSITION = 1;
private static final int DEPTH_INDEX_WIDGET = 2;
/** Property to set the depth for state transition. */
public static final FloatProperty<BaseDepthController> STATE_DEPTH =
DEPTH_PROPERTY_FACTORY.get(DEPTH_INDEX_STATE_TRANSITION);
/** Property to set the depth for widget picker. */
public static final FloatProperty<BaseDepthController> WIDGET_DEPTH =
DEPTH_PROPERTY_FACTORY.get(DEPTH_INDEX_WIDGET);
protected final Launcher mLauncher;
/**
@@ -15,6 +15,8 @@
*/
package com.android.quickstep.util;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.states.RotationHelper.deltaRotation;
import static com.android.launcher3.touch.PagedOrientationHandler.MATRIX_POST_TRANSLATE;
@@ -25,7 +27,6 @@ import static com.android.launcher3.util.SplitConfigurationOptions.StagePosition
import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS;
import static com.android.quickstep.util.RecentsOrientedState.postDisplayRotation;
import static com.android.quickstep.util.RecentsOrientedState.preDisplayRotation;
import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_FULLSCREEN;
import android.animation.TimeInterpolator;
import android.content.Context;
@@ -43,7 +43,7 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TI
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_CLEAR_ALL;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_DISMISS_SWIPE_UP;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN;
import static com.android.launcher3.statehandlers.DepthController.DEPTH;
import static com.android.launcher3.statehandlers.DepthController.STATE_DEPTH;
import static com.android.launcher3.touch.PagedOrientationHandler.CANVAS_TRANSLATE;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
@@ -165,6 +165,8 @@ import com.android.quickstep.TaskThumbnailCache;
import com.android.quickstep.TaskViewUtils;
import com.android.quickstep.TopTaskTracker;
import com.android.quickstep.ViewUtils;
import com.android.quickstep.util.ActiveGestureErrorDetector;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.RecentsOrientedState;
@@ -1236,6 +1238,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
@Override
protected void onPageEndTransition() {
super.onPageEndTransition();
ActiveGestureLog.INSTANCE.addLog(
"onPageEndTransition: current page index updated", mCurrentPage);
if (isClearAllHidden() && !mActivity.getDeviceProfile().isTablet) {
mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, false);
}
@@ -1426,6 +1430,12 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
updateGridProperties();
}
@Override
protected void onScrollerAnimationAborted() {
ActiveGestureLog.INSTANCE.addLog("scroller animation aborted",
ActiveGestureErrorDetector.GestureEvent.SCROLLER_ANIMATION_ABORTED);
}
protected void applyLoadPlan(ArrayList<GroupTask> taskGroups) {
if (mPendingAnimation != null) {
mPendingAnimation.addEndListener(success -> applyLoadPlan(taskGroups));
@@ -4423,7 +4433,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
DepthController depthController = getDepthController();
if (depthController != null) {
ObjectAnimator depthAnimator = ObjectAnimator.ofFloat(depthController, DEPTH,
ObjectAnimator depthAnimator = ObjectAnimator.ofFloat(depthController, STATE_DEPTH,
BACKGROUND_APP.getDepth(mActivity));
anim.play(depthAnimator);
}
@@ -16,11 +16,11 @@
package com.android.quickstep.views;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_FULLSCREEN;
import android.content.Context;
import android.graphics.Bitmap;
@@ -48,6 +48,7 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.util.AttributeSet;
import android.util.FloatProperty;
import android.util.Log;
@@ -99,7 +100,6 @@ import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@@ -659,12 +659,12 @@ public class TaskView extends FrameLayout implements Reusable {
TestProtocol.SEQUENCE_MAIN, "startActivityFromRecentsAsync", mTask);
// Indicate success once the system has indicated that the transition has started
ActivityOptions opts = ActivityOptionsCompat.makeCustomAnimation(
getContext(), 0, 0, () -> callback.accept(true), MAIN_EXECUTOR.getHandler());
ActivityOptions opts = makeCustomAnimation(getContext(), 0, 0,
() -> callback.accept(true), MAIN_EXECUTOR.getHandler());
opts.setLaunchDisplayId(
getDisplay() == null ? DEFAULT_DISPLAY : getDisplay().getDisplayId());
if (freezeTaskList) {
ActivityOptionsCompat.setFreezeRecentTasksList(opts);
opts.setFreezeRecentTasksReordering();
}
// TODO(b/202826469): Replace setSplashScreenStyle with setDisableStartingWindow.
opts.setSplashScreenStyle(mSnapshotView.shouldShowSplashView()
@@ -686,6 +686,20 @@ public class TaskView extends FrameLayout implements Reusable {
}
}
/**
* Returns ActivityOptions for overriding task transition animation.
*/
private ActivityOptions makeCustomAnimation(Context context, int enterResId,
int exitResId, final Runnable callback, final Handler callbackHandler) {
return ActivityOptions.makeCustomTaskAnimation(context, enterResId, exitResId,
callbackHandler,
elapsedRealTime -> {
if (callback != null) {
callbackHandler.post(callback);
}
}, null /* finishedListener */);
}
/**
* Launch of the current task (both live and inactive tasks) with an animation.
*/
@@ -26,12 +26,12 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.app.ActivityManager;
import android.app.KeyguardManager;
import androidx.test.filters.SmallTest;
import com.android.launcher3.util.LooperExecutor;
import com.android.quickstep.util.GroupTask;
import com.android.systemui.shared.system.KeyguardManagerCompat;
import com.android.wm.shell.util.GroupedRecentTaskInfo;
import org.junit.Before;
@@ -56,8 +56,8 @@ public class RecentTasksListTest {
public void setup() {
MockitoAnnotations.initMocks(this);
LooperExecutor mockMainThreadExecutor = mock(LooperExecutor.class);
KeyguardManagerCompat mockKeyguardManagerCompat = mock(KeyguardManagerCompat.class);
mRecentTasksList = new RecentTasksList(mockMainThreadExecutor, mockKeyguardManagerCompat,
KeyguardManager mockKeyguardManager = mock(KeyguardManager.class);
mRecentTasksList = new RecentTasksList(mockMainThreadExecutor, mockKeyguardManager,
mockSystemUiProxy);
}
+7
View File
@@ -18,4 +18,11 @@
<!-- The duration of the PagedView page snap animation -->
<integer name="config_pageSnapAnimationDuration">550</integer>
<!-- The duration of the Widget picker opening and closing animation -->
<integer name="config_bottomSheetOpenDuration">500</integer>
<integer name="config_bottomSheetCloseDuration">500</integer>
<!-- The duration of the AllApps opening and closing animation -->
<integer name="config_allAppsOpenDuration">@integer/config_bottomSheetOpenDuration</integer>
<integer name="config_allAppsCloseDuration">@integer/config_bottomSheetCloseDuration</integer>
</resources>
+11
View File
@@ -193,4 +193,15 @@
<dimen name="swipe_back_window_scale_x_margin">10dp</dimen>
<dimen name="swipe_back_window_max_delta_y">160dp</dimen>
<dimen name="swipe_back_window_corner_radius">40dp</dimen>
<!-- The duration of the bottom sheet opening and closing animation -->
<integer name="config_bottomSheetOpenDuration">267</integer>
<integer name="config_bottomSheetCloseDuration">267</integer>
<!-- The duration of the AllApps opening and closing animation -->
<integer name="config_allAppsOpenDuration">600</integer>
<integer name="config_allAppsCloseDuration">300</integer>
<!-- The max scale for the wallpaper when it's zoomed in -->
<item name="config_wallpaperMaxScale" format="float" type="dimen">0</item>
</resources>
+33 -1
View File
@@ -22,6 +22,7 @@ import static com.android.launcher3.InvariantDeviceProfile.INDEX_TWO_PANEL_LANDS
import static com.android.launcher3.InvariantDeviceProfile.INDEX_TWO_PANEL_PORTRAIT;
import static com.android.launcher3.Utilities.dpiFromPx;
import static com.android.launcher3.Utilities.pxFromSp;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.ICON_OVERLAP_FACTOR;
import static com.android.launcher3.icons.GraphicsUtils.getShapePath;
import static com.android.launcher3.testing.shared.ResourceUtils.pxFromDp;
@@ -181,11 +182,19 @@ public class DeviceProfile {
private final int hotseatQsbShadowHeight;
public int hotseatBorderSpace;
// Bottom sheets
public int bottomSheetTopPadding;
public int bottomSheetOpenDuration;
public int bottomSheetCloseDuration;
public float bottomSheetWorkspaceScale;
public float bottomSheetDepth;
// All apps
public Point allAppsBorderSpacePx;
public int allAppsShiftRange;
public int allAppsTopPadding;
public int bottomSheetTopPadding;
public int allAppsOpenDuration;
public int allAppsCloseDuration;
public int allAppsCellHeightPx;
public int allAppsCellWidthPx;
public int allAppsIconSizePx;
@@ -316,6 +325,21 @@ public class DeviceProfile {
bottomSheetTopPadding = mInsets.top // statusbar height
+ res.getDimensionPixelSize(R.dimen.bottom_sheet_extra_top_padding)
+ (isTablet ? 0 : edgeMarginPx); // phones need edgeMarginPx additional padding
bottomSheetOpenDuration = res.getInteger(R.integer.config_bottomSheetOpenDuration);
bottomSheetCloseDuration = res.getInteger(R.integer.config_bottomSheetCloseDuration);
if (isTablet) {
bottomSheetWorkspaceScale = workspaceContentScale;
// The goal is to set wallpaper to zoom at workspaceContentScale when in AllApps.
// When depth is 0, wallpaper zoom is set to maxWallpaperScale.
// When depth is 1, wallpaper zoom is set to 1.
// For depth to achieve zoom set to maxWallpaperScale * workspaceContentScale:
float maxWallpaperScale = res.getFloat(R.dimen.config_wallpaperMaxScale);
bottomSheetDepth = Utilities.mapToRange(maxWallpaperScale * workspaceContentScale,
maxWallpaperScale, 1f, 0f, 1f, LINEAR);
} else {
bottomSheetWorkspaceScale = 1f;
bottomSheetDepth = 0f;
}
folderLabelTextScale = res.getFloat(R.dimen.folder_label_text_scale);
folderContentPaddingLeftRight =
@@ -474,6 +498,8 @@ public class DeviceProfile {
allAppsShiftRange =
res.getDimensionPixelSize(R.dimen.all_apps_starting_vertical_translate);
}
allAppsOpenDuration = res.getInteger(R.integer.config_allAppsOpenDuration);
allAppsCloseDuration = res.getInteger(R.integer.config_allAppsCloseDuration);
flingToDeleteThresholdVelocity = res.getDimensionPixelSize(
R.dimen.drag_flingToDeleteMinVelocity);
@@ -1434,9 +1460,15 @@ public class DeviceProfile {
writer.println(prefix + pxToDpStr("folderTopPadding", folderContentPaddingTop));
writer.println(prefix + pxToDpStr("bottomSheetTopPadding", bottomSheetTopPadding));
writer.println(prefix + "\tbottomSheetOpenDuration: " + bottomSheetOpenDuration);
writer.println(prefix + "\tbottomSheetCloseDuration: " + bottomSheetCloseDuration);
writer.println(prefix + "\tbottomSheetWorkspaceScale: " + bottomSheetWorkspaceScale);
writer.println(prefix + "\tbottomSheetDepth: " + bottomSheetDepth);
writer.println(prefix + pxToDpStr("allAppsShiftRange", allAppsShiftRange));
writer.println(prefix + pxToDpStr("allAppsTopPadding", allAppsTopPadding));
writer.println(prefix + "\tallAppsOpenDuration: " + allAppsOpenDuration);
writer.println(prefix + "\tallAppsCloseDuration: " + allAppsCloseDuration);
writer.println(prefix + pxToDpStr("allAppsIconSizePx", allAppsIconSizePx));
writer.println(prefix + pxToDpStr("allAppsIconTextSizePx", allAppsIconTextSizePx));
writer.println(prefix + pxToDpStr("allAppsIconDrawablePaddingPx",
+5 -6
View File
@@ -42,6 +42,7 @@ import static com.android.launcher3.LauncherState.NO_SCALE;
import static com.android.launcher3.LauncherState.SPRING_LOADED;
import static com.android.launcher3.Utilities.postAsyncCallback;
import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.getSupportedActions;
import static com.android.launcher3.anim.Interpolators.EMPHASIZED;
import static com.android.launcher3.logging.StatsLogManager.EventEnum;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
@@ -3234,12 +3235,10 @@ public class Launcher extends StatefulActivity<LauncherState>
* @param progress Transition progress from 0 to 1; where 0 => home and 1 => widgets.
*/
public void onWidgetsTransition(float progress) {
if (mDeviceProfile.isTablet) {
float scale =
Utilities.comp(Utilities.comp(mDeviceProfile.workspaceContentScale) * progress);
WORKSPACE_WIDGET_SCALE.set(getWorkspace(), scale);
HOTSEAT_WIDGET_SCALE.set(getHotseat(), scale);
}
float scale = Utilities.mapToRange(progress, 0f, 1f, 1f,
mDeviceProfile.bottomSheetWorkspaceScale, EMPHASIZED);
WORKSPACE_WIDGET_SCALE.set(getWorkspace(), scale);
HOTSEAT_WIDGET_SCALE.set(getHotseat(), scale);
}
private static class NonConfigInstance {
+8 -3
View File
@@ -259,8 +259,13 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
abortScrollerAnimation(true);
}
protected void onScrollerAnimationAborted() {
// No-Op
}
private void abortScrollerAnimation(boolean resetNextPage) {
mScroller.abortAnimation();
onScrollerAnimationAborted();
// We need to clean up the next page here to avoid computeScrollHelper from
// updating current page on the pass.
if (resetNextPage) {
@@ -555,11 +560,11 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
if (mAllowOverScroll) {
if (newPos < mMinScroll && oldPos >= mMinScroll) {
mEdgeGlowLeft.onAbsorb((int) mScroller.getCurrVelocity());
mScroller.abortAnimation();
abortScrollerAnimation(false);
onEdgeAbsorbingScroll();
} else if (newPos > mMaxScroll && oldPos <= mMaxScroll) {
mEdgeGlowRight.onAbsorb((int) mScroller.getCurrVelocity());
mScroller.abortAnimation();
abortScrollerAnimation(false);
onEdgeAbsorbingScroll();
}
}
@@ -569,7 +574,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
int finalPos = mOrientationHandler.getPrimaryValue(mScroller.getFinalX(),
mScroller.getFinalY());
if (newPos == finalPos && mEdgeGlowLeft.isFinished() && mEdgeGlowRight.isFinished()) {
mScroller.abortAnimation();
abortScrollerAnimation(false);
}
invalidate();
@@ -42,7 +42,7 @@ import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statemanager.StateManager.StateHandler;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.util.MultiAdditivePropertyFactory;
import com.android.launcher3.util.MultiPropertyFactory;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.views.ScrimView;
@@ -141,9 +141,9 @@ public class AllAppsTransitionController
private ScrimView mScrimView;
private final MultiAdditivePropertyFactory<View>
mAppsViewTranslationYPropertyFactory = new MultiAdditivePropertyFactory<>(
"appsViewTranslationY", View.TRANSLATION_Y);
private final MultiPropertyFactory<View>
mAppsViewTranslationYPropertyFactory = new MultiPropertyFactory<>(
"appsViewTranslationY", View.TRANSLATION_Y, Float::sum);
private MultiValueAlpha mAppsViewAlpha;
private boolean mIsTablet;
@@ -302,6 +302,11 @@ public final class FeatureFlags {
"Enable option to log the keyboard latency for both atomic and controlled keyboard "
+ "animations on an EditText");
// Change of wallpaper depth in widget picker is disabled for tests as it causes flakiness on
// very slow cuttlefish devices.
public static final BooleanFlag ENABLE_WIDGET_PICKER_DEPTH = new DeviceFlag(
"ENABLE_WIDGET_PICKER_DEPTH", true, "Enable changing depth in widget picker.");
public static void initialize(Context context) {
synchronized (sDebugFlags) {
for (DebugFlag flag : sDebugFlags) {
@@ -20,7 +20,6 @@ import android.util.ArrayMap;
import android.util.FloatProperty;
import android.util.Log;
import android.util.Property;
import android.view.View;
/**
* Allows to combine multiple values set by several sources.
@@ -30,43 +29,55 @@ import android.view.View;
* time.
*
* This class behaves similarly to [MultiValueAlpha], but is meant to be more abstract and reusable.
* It sets the addition of all values.
* It aggregate all values using the provided [aggregator].
*
* @param <T> Type where to apply the property.
*/
public class MultiAdditivePropertyFactory<T extends View> {
public class MultiPropertyFactory<T> {
private static final boolean DEBUG = false;
private static final String TAG = "MultiAdditivePropertyFactory";
private static final String TAG = "MultiPropertyFactory";
private final String mName;
private final ArrayMap<Integer, MultiAdditiveProperty> mProperties =
new ArrayMap<>();
private final ArrayMap<Integer, MultiProperty> mProperties = new ArrayMap<>();
// This is an optimization for cases when set is called repeatedly with the same setterIndex.
private float mAggregationOfOthers = 0f;
private Integer mLastIndexSet = -1;
private final Property<View, Float> mProperty;
private final Property<T, Float> mProperty;
private final FloatBiFunction mAggregator;
public MultiAdditivePropertyFactory(String name, Property<View, Float> property) {
/**
* Represents a function that accepts two float and produces a float.
*/
public interface FloatBiFunction {
/**
* Applies this function to the given arguments.
*/
float apply(float a, float b);
}
public MultiPropertyFactory(String name, Property<T, Float> property,
FloatBiFunction aggregator) {
mName = name;
mProperty = property;
mAggregator = aggregator;
}
/** Returns the [MultiFloatProperty] associated with [inx], creating it if not present. */
public MultiAdditiveProperty get(Integer index) {
public MultiProperty get(Integer index) {
return mProperties.computeIfAbsent(index,
(k) -> new MultiAdditiveProperty(index, mName + "_" + index));
(k) -> new MultiProperty(index, mName + "_" + index));
}
/**
* Each [setValue] will be aggregated with the other properties values created by the
* corresponding factory.
*/
class MultiAdditiveProperty extends FloatProperty<T> {
class MultiProperty extends FloatProperty<T> {
private final int mInx;
private float mValue = 0f;
MultiAdditiveProperty(int inx, String name) {
MultiProperty(int inx, String name) {
super(name);
mInx = inx;
}
@@ -77,12 +88,13 @@ public class MultiAdditivePropertyFactory<T extends View> {
mAggregationOfOthers = 0f;
mProperties.forEach((key, property) -> {
if (key != mInx) {
mAggregationOfOthers += property.mValue;
mAggregationOfOthers =
mAggregator.apply(mAggregationOfOthers, property.mValue);
}
});
mLastIndexSet = mInx;
}
float lastAggregatedValue = mAggregationOfOthers + newValue;
float lastAggregatedValue = mAggregator.apply(mAggregationOfOthers, newValue);
mValue = newValue;
apply(obj, lastAggregatedValue);
@@ -94,13 +106,13 @@ public class MultiAdditivePropertyFactory<T extends View> {
}
@Override
public Float get(T view) {
public Float get(T object) {
// The scale of the view should match mLastAggregatedValue. Still, if it has been
// changed without using this property, it can differ. As this get method is usually
// used to set the starting point on an animation, this would result in some jumps
// when the view scale is different than the last aggregated value. To stay on the
// safe side, let's return the real view scale.
return mProperty.get(view);
return mProperty.get(object);
}
@Override
@@ -109,7 +121,7 @@ public class MultiAdditivePropertyFactory<T extends View> {
}
}
protected void apply(View view, float value) {
mProperty.set(view, value);
protected void apply(T object, float value) {
mProperty.set(object, value);
}
}
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.widget;
import static com.android.launcher3.anim.Interpolators.EMPHASIZED;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
@@ -26,6 +28,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.WindowInsets;
import android.view.animation.Interpolator;
import android.widget.Toast;
import androidx.annotation.GuardedBy;
@@ -246,6 +249,12 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<Launcher>
return true;
}
@Override
protected Interpolator getIdleInterpolator() {
return mActivityContext.getDeviceProfile().isTablet
? EMPHASIZED : super.getIdleInterpolator();
}
//
// Drag related handling methods that implement {@link DragSource} interface.
//
@@ -85,7 +85,6 @@ public class WidgetsFullSheet extends BaseWidgetSheet
implements ProviderChangedListener, OnActivePageChangedListener,
WidgetsRecyclerView.HeaderViewDimensionsProvider, SearchModeListener {
private static final long DEFAULT_OPEN_DURATION = 267;
private static final long FADE_IN_DURATION = 150;
private static final long EDUCATION_TIP_DELAY_MS = 200;
private static final long EDUCATION_DIALOG_DELAY_MS = 500;
@@ -582,7 +581,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
mOpenCloseAnimator.setValues(
PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
mOpenCloseAnimator
.setDuration(DEFAULT_OPEN_DURATION)
.setDuration(mActivityContext.getDeviceProfile().bottomSheetOpenDuration)
.setInterpolator(AnimationUtils.loadInterpolator(
getContext(), android.R.interpolator.linear_out_slow_in));
mOpenCloseAnimator.addListener(new AnimatorListenerAdapter() {
@@ -603,7 +602,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
@Override
protected void handleClose(boolean animate) {
handleClose(animate, DEFAULT_OPEN_DURATION);
handleClose(animate, mActivityContext.getDeviceProfile().bottomSheetCloseDuration);
}
@Override
@@ -42,9 +42,9 @@ public class AllAppsState extends LauncherState {
@Override
public <DEVICE_PROFILE_CONTEXT extends Context & DeviceProfileListenable>
int getTransitionDuration(DEVICE_PROFILE_CONTEXT context, boolean isToState) {
return !context.getDeviceProfile().isTablet && isToState
? 600
: isToState ? 500 : 300;
return isToState
? context.getDeviceProfile().allAppsOpenDuration
: context.getDeviceProfile().allAppsCloseDuration;
}
@Override
@@ -16,26 +16,32 @@
package com.android.launcher3.util
import android.view.View
import android.util.FloatProperty
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
/** Unit tests for [MultiAdditivePropertyFactory] */
/** Unit tests for [MultiPropertyFactory] */
@SmallTest
@RunWith(AndroidJUnit4::class)
class MultiAdditivePropertyTest {
class MultiPropertyFactoryTest {
private val received = mutableListOf<Float>()
private val factory =
object : MultiAdditivePropertyFactory<View?>("Test", View.TRANSLATION_X) {
override fun apply(obj: View?, value: Float) {
received.add(value)
}
private val receiveProperty: FloatProperty<Any> = object : FloatProperty<Any>("receive") {
override fun setValue(obj: Any?, value: Float) {
received.add(value)
}
override fun get(o: Any): Float {
return 0f
}
}
private val factory = MultiPropertyFactory("depth_property", receiveProperty) {
x: Float, y: Float -> x + y
}
private val p1 = factory.get(1)
private val p2 = factory.get(2)
@@ -68,7 +68,6 @@ import androidx.test.uiautomator.Until;
import com.android.launcher3.testing.shared.ResourceUtils;
import com.android.launcher3.testing.shared.TestInformationRequest;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.systemui.shared.system.ContextUtils;
import com.android.systemui.shared.system.QuickStepContract;
import org.junit.Assert;
@@ -264,7 +263,7 @@ public final class LauncherInstrumentation {
SystemClock.sleep(5000);
} else {
try {
final int userId = ContextUtils.getUserId(getContext());
final int userId = getContext().getUserId();
final String launcherPidCommand = "pidof " + pi.packageName;
final String initialPid = mDevice.executeShellCommand(launcherPidCommand)
.replaceAll("\\s", "");