fix: Conflict incoming changes from 15-dev
This commit is contained in:
1 parent
14e352c827
commit
2e76c99dad
1726 files changed
+146970
-95027
No files matched your search
@@ -40,6 +40,7 @@ import static com.android.app.animation.Interpolators.DECELERATE_1_5;
|
||||
import static com.android.app.animation.Interpolators.DECELERATE_1_7;
|
||||
import static com.android.app.animation.Interpolators.EXAGGERATED_EASE;
|
||||
import static com.android.app.animation.Interpolators.LINEAR;
|
||||
import static com.android.internal.util.LatencyTracker.ACTION_DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE;
|
||||
import static com.android.launcher3.BaseActivity.EVENT_DESTROYED;
|
||||
import static com.android.launcher3.BaseActivity.INVISIBLE_ALL;
|
||||
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_APP_TRANSITIONS;
|
||||
@@ -79,7 +80,6 @@ import android.app.ActivityOptions;
|
||||
import android.app.WindowConfiguration;
|
||||
import android.app.role.RoleManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
@@ -98,7 +98,6 @@ import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.Size;
|
||||
import android.view.CrossWindowBlurListeners;
|
||||
import android.view.IRemoteAnimationFinishedCallback;
|
||||
import android.view.RemoteAnimationAdapter;
|
||||
import android.view.RemoteAnimationDefinition;
|
||||
@@ -121,7 +120,9 @@ import androidx.annotation.Nullable;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import com.android.app.animation.Animations;
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.internal.jank.Cuj;
|
||||
import com.android.internal.util.LatencyTracker;
|
||||
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
|
||||
import com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory;
|
||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||
@@ -131,7 +132,6 @@ import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.shortcuts.DeepShortcutView;
|
||||
import com.android.launcher3.statehandlers.DepthController;
|
||||
import com.android.launcher3.taskbar.LauncherTaskbarUIController;
|
||||
import com.android.launcher3.testing.shared.ResourceUtils;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
@@ -235,7 +235,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
private static final int MAX_NUM_TASKS = 5;
|
||||
|
||||
// Cross-fade duration between App Widget and App
|
||||
// Cross-fade duration between App Widget and App when launching from widget.
|
||||
private static final int WIDGET_CROSSFADE_DURATION_MILLIS = 125;
|
||||
|
||||
protected final QuickstepLauncher mLauncher;
|
||||
@@ -266,6 +266,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
private RemoteTransition mLauncherOpenTransition;
|
||||
|
||||
private final RemoteAnimationCoordinateTransfer mCoordinateTransfer;
|
||||
private final LatencyTracker mLatencyTracker;
|
||||
|
||||
private LauncherBackAnimationController mBackAnimationController;
|
||||
private final AnimatorListenerAdapter mForceInvisibleListener = new AnimatorListenerAdapter() {
|
||||
@@ -289,8 +290,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
private final SystemUiProxy mSystemUiProxy;
|
||||
|
||||
public QuickstepTransitionManager(Context context) {
|
||||
mLauncher = Launcher.cast(Launcher.getLauncher(context));
|
||||
public QuickstepTransitionManager(QuickstepLauncher launcher) {
|
||||
mLauncher = launcher;
|
||||
mDragLayer = mLauncher.getDragLayer();
|
||||
mHandler = new Handler(Looper.getMainLooper());
|
||||
mDeviceProfile = mLauncher.getDeviceProfile();
|
||||
@@ -316,10 +317,12 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
mSystemUiProxy.setStartingWindowListener(mStartingWindowListener);
|
||||
}
|
||||
|
||||
mOpeningXInterpolator = AnimationUtils.loadInterpolator(context, R.interpolator.app_open_x);
|
||||
mOpeningInterpolator = AnimationUtils.loadInterpolator(context,
|
||||
R.interpolator.emphasized_interpolator);
|
||||
mOpeningXInterpolator = AnimationUtils.loadInterpolator(
|
||||
launcher, R.interpolator.app_open_x);
|
||||
mOpeningInterpolator = AnimationUtils.loadInterpolator(
|
||||
launcher, R.interpolator.emphasized_interpolator);
|
||||
mCoordinateTransfer = new RemoteAnimationCoordinateTransfer(mLauncher);
|
||||
mLatencyTracker = LatencyTracker.getInstance(launcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -374,6 +377,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
LauncherTaskbarUIController taskbarController = mLauncher.getTaskbarUIController();
|
||||
if (syncAppLaunchWithTaskbarStash()
|
||||
&& enableScalingRevealHomeAnimation()
|
||||
&& mLauncher.getStateManager().getState() == NORMAL
|
||||
&& taskbarController != null) {
|
||||
taskbarController.setIgnoreInAppFlagForSync(true);
|
||||
mLauncher.addEventCallback(EVENT_DESTROYED, onEndCallback::executeAllAndDestroy);
|
||||
@@ -513,7 +517,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
target = t;
|
||||
break;
|
||||
}
|
||||
if (target == null) return new Rect(0, 0, mDeviceProfile.widthPx, mDeviceProfile.heightPx);
|
||||
final int widthPx = mDeviceProfile.getDeviceProperties().getWidthPx();
|
||||
final int heightPx = mDeviceProfile.getDeviceProperties().getHeightPx();
|
||||
if (target == null) return new Rect(0, 0, widthPx, heightPx);
|
||||
final Rect bounds = new Rect(target.screenSpaceBounds);
|
||||
if (target.localBounds != null) {
|
||||
bounds.set(target.localBounds);
|
||||
@@ -523,10 +529,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
if (rotationChange != 0) {
|
||||
if ((rotationChange % 2) == 1) {
|
||||
// undoing rotation, so our "original" parent size is actually flipped
|
||||
Utilities.rotateBounds(bounds, mDeviceProfile.heightPx, mDeviceProfile.widthPx,
|
||||
Utilities.rotateBounds(bounds, heightPx, widthPx,
|
||||
4 - rotationChange);
|
||||
} else {
|
||||
Utilities.rotateBounds(bounds, mDeviceProfile.widthPx, mDeviceProfile.heightPx,
|
||||
Utilities.rotateBounds(bounds, widthPx, heightPx,
|
||||
4 - rotationChange);
|
||||
}
|
||||
}
|
||||
@@ -565,7 +571,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
final View appsView = mLauncher.getAppsView();
|
||||
final float startAlpha = appsView.getAlpha();
|
||||
final float startScale = SCALE_PROPERTY.get(appsView);
|
||||
if (mDeviceProfile.isTablet) {
|
||||
if (mDeviceProfile.getDeviceProperties().isTablet()) {
|
||||
|
||||
// AllApps should not fade at all in tablets.
|
||||
alphas = new float[]{1, 1};
|
||||
}
|
||||
@@ -602,13 +609,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
endListener = composeViewContentAnimator(launcherAnimator, alphas, scales);
|
||||
} else {
|
||||
List<View> viewsToAnimate = new ArrayList<>();
|
||||
Workspace<?> workspace = mLauncher.getWorkspace();
|
||||
if (Flags.coordinateWorkspaceScale()) {
|
||||
viewsToAnimate.add(workspace);
|
||||
} else {
|
||||
workspace.forEachVisiblePage(
|
||||
view -> viewsToAnimate.add(((CellLayout) view).getShortcutsAndWidgets()));
|
||||
}
|
||||
viewsToAnimate.add(mLauncher.getWorkspace());
|
||||
|
||||
Hotseat hotseat = mLauncher.getHotseat();
|
||||
// Do not scale hotseat as a whole when taskbar is present, and scale QSB only if it's
|
||||
@@ -624,22 +625,19 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
viewsToAnimate.forEach(view -> {
|
||||
view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
||||
|
||||
float[] scale = scales;
|
||||
if (Flags.coordinateWorkspaceScale()) {
|
||||
// Start the animation from the current value, instead of assuming the views are
|
||||
// in their resting state, so interrupted animations merge seamlessly.
|
||||
// TODO(b/367591368): ideally these animations would be refactored to be
|
||||
// controlled centrally so each instances doesn't need to care about this
|
||||
// coordination.
|
||||
scale = new float[]{view.getScaleX(), scales[1]};
|
||||
// Start the animation from the current value, instead of assuming the views are
|
||||
// in their resting state, so interrupted animations merge seamlessly.
|
||||
// TODO(b/367591368): ideally these animations would be refactored to be
|
||||
// controlled centrally so each instances doesn't need to care about this
|
||||
// coordination.
|
||||
float[] scale = new float[]{view.getScaleX(), scales[1]};
|
||||
|
||||
// Cancel any ongoing animations. This is necessary to avoid a conflict between
|
||||
// e.g. the unfinished animation triggered when closing an app back to Home and
|
||||
// this animation caused by a launch.
|
||||
Animations.Companion.cancelOngoingAnimation(view);
|
||||
// Make sure to cache the current animation, so it can be properly interrupted.
|
||||
Animations.Companion.setOngoingAnimation(view, launcherAnimator);
|
||||
}
|
||||
// Cancel any ongoing animations. This is necessary to avoid a conflict between
|
||||
// e.g. the unfinished animation triggered when closing an app back to Home and
|
||||
// this animation caused by a launch.
|
||||
Animations.Companion.cancelOngoingAnimation(view);
|
||||
// Make sure to cache the current animation, so it can be properly interrupted.
|
||||
Animations.Companion.setOngoingAnimation(view, launcherAnimator);
|
||||
|
||||
ObjectAnimator scaleAnim = ObjectAnimator.ofFloat(view, SCALE_PROPERTY, scale)
|
||||
.setDuration(CONTENT_SCALE_DURATION);
|
||||
@@ -652,10 +650,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
SCALE_PROPERTY.set(view, 1f);
|
||||
view.setLayerType(View.LAYER_TYPE_NONE, null);
|
||||
|
||||
if (Flags.coordinateWorkspaceScale()) {
|
||||
// Reset the cached animation.
|
||||
Animations.Companion.setOngoingAnimation(view, null /* animation */);
|
||||
}
|
||||
// Reset the cached animation.
|
||||
Animations.Companion.setOngoingAnimation(view, null /* animation */);
|
||||
});
|
||||
mLauncher.resumeExpensiveViewUpdates();
|
||||
};
|
||||
@@ -698,6 +694,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
private boolean shouldCropToInset(RemoteAnimationTarget target) {
|
||||
return enableDynamicInsetsForAppLaunch()
|
||||
&& mDeviceProfile.isTaskbarPresent
|
||||
&& mDeviceProfile.isTaskbarPresentInApps
|
||||
&& target != null && !target.willShowImeOnTarget
|
||||
&& !isTransientTaskbar(mLauncher);
|
||||
@@ -804,7 +801,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
final float initialWindowRadius = supportsRoundedCornersOnWindows(mLauncher.getResources())
|
||||
? Math.max(crop.width(), crop.height()) / 2f
|
||||
: 0f;
|
||||
final float finalWindowRadius = mDeviceProfile.isMultiWindowMode
|
||||
final float finalWindowRadius = mDeviceProfile.getDeviceProperties().isMultiWindowMode()
|
||||
? 0 : getWindowCornerRadius(mLauncher);
|
||||
final float finalShadowRadius = appTargetsAreTranslucent ? 0 : mMaxShadowRadius;
|
||||
|
||||
@@ -887,8 +884,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
final int windowCropWidth = crop.width();
|
||||
final int windowCropHeight = crop.height();
|
||||
if (rotationChange != 0) {
|
||||
Utilities.rotateBounds(crop, mDeviceProfile.widthPx,
|
||||
mDeviceProfile.heightPx, rotationChange);
|
||||
Utilities.rotateBounds(crop, mDeviceProfile.getDeviceProperties().getWidthPx(),
|
||||
mDeviceProfile.getDeviceProperties().getHeightPx(), rotationChange);
|
||||
}
|
||||
|
||||
// Scale the size of the icon to match the size of the window crop.
|
||||
@@ -935,14 +932,14 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
matrix.setScale(scale, scale);
|
||||
if (rotationChange == 1) {
|
||||
matrix.postTranslate(windowTransY0,
|
||||
mDeviceProfile.widthPx - (windowTransX0 + scaledCropWidth));
|
||||
mDeviceProfile.getDeviceProperties().getWidthPx() - (windowTransX0 + scaledCropWidth));
|
||||
} else if (rotationChange == 2) {
|
||||
matrix.postTranslate(
|
||||
mDeviceProfile.widthPx - (windowTransX0 + scaledCropWidth),
|
||||
mDeviceProfile.heightPx - (windowTransY0 + scaledCropHeight));
|
||||
mDeviceProfile.getDeviceProperties().getWidthPx() - (windowTransX0 + scaledCropWidth),
|
||||
mDeviceProfile.getDeviceProperties().getHeightPx() - (windowTransY0 + scaledCropHeight));
|
||||
} else if (rotationChange == 3) {
|
||||
matrix.postTranslate(
|
||||
mDeviceProfile.heightPx - (windowTransY0 + scaledCropHeight),
|
||||
mDeviceProfile.getDeviceProperties().getHeightPx() - (windowTransY0 + scaledCropHeight),
|
||||
windowTransX0);
|
||||
} else {
|
||||
matrix.postTranslate(windowTransX0, windowTransY0);
|
||||
@@ -1034,7 +1031,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
FloatingWidgetView.getDefaultBackgroundColor(mLauncher, openingTarget);
|
||||
}
|
||||
|
||||
final float finalWindowRadius = mDeviceProfile.isMultiWindowMode
|
||||
final float finalWindowRadius = mDeviceProfile.getDeviceProperties().isMultiWindowMode()
|
||||
? 0 : getWindowCornerRadius(mLauncher);
|
||||
final FloatingWidgetView floatingView = FloatingWidgetView.getFloatingWidgetView(mLauncher,
|
||||
v, widgetBackgroundBounds,
|
||||
@@ -1149,19 +1146,24 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
return animatorSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns animator that controls depth/blur of the background.
|
||||
*/
|
||||
private ObjectAnimator getBackgroundAnimator() {
|
||||
/** Returns animator that controls depth/blur of the background during app/widget opening. */
|
||||
private Animator getBackgroundAnimator() {
|
||||
if (Flags.allAppsBlur()) {
|
||||
// Don't animate/blur the background for this launch, regardless of the launcher state.
|
||||
// We have too many performance issues with the blur.
|
||||
return new AnimatorSet();
|
||||
}
|
||||
|
||||
// When launching an app from overview that doesn't map to a task, we still want to just
|
||||
// blur the wallpaper instead of the launcher surface as well
|
||||
boolean allowBlurringLauncher = mLauncher.getStateManager().getState() != OVERVIEW
|
||||
&& BlurUtils.supportsBlursOnWindows();
|
||||
LauncherState launcherState = mLauncher.getStateManager().getState();
|
||||
boolean allowBlurringLauncher =
|
||||
launcherState != OVERVIEW && BlurUtils.supportsBlursOnWindows();
|
||||
|
||||
LaunchDepthController depthController = new LaunchDepthController(mLauncher);
|
||||
ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController.stateDepth,
|
||||
MULTI_PROPERTY_VALUE, BACKGROUND_APP.getDepth(mLauncher))
|
||||
.setDuration(APP_LAUNCH_DURATION);
|
||||
ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(
|
||||
mLauncher.getDepthController().stateDepth, MULTI_PROPERTY_VALUE,
|
||||
BACKGROUND_APP.getDepth(mLauncher))
|
||||
.setDuration(APP_LAUNCH_DURATION);
|
||||
|
||||
if (allowBlurringLauncher) {
|
||||
// Create a temporary effect layer, that lives on top of launcher, so we can apply
|
||||
@@ -1182,18 +1184,14 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
.setEffectLayer()
|
||||
.build();
|
||||
|
||||
backgroundRadiusAnim.addListener(AnimatorListeners.forEndCallback(() ->
|
||||
new SurfaceControl.Transaction().remove(dimLayer).apply()));
|
||||
backgroundRadiusAnim.addListener(AnimatorListeners.forEndCallback(() -> {
|
||||
// Use try-with-resources to ensure the transaction gets closed.
|
||||
try (SurfaceControl.Transaction transaction = new SurfaceControl.Transaction()) {
|
||||
transaction.remove(dimLayer).apply();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
backgroundRadiusAnim.addListener(
|
||||
AnimatorListeners.forEndCallback(() -> {
|
||||
// reset the depth to match the main depth controller's depth
|
||||
depthController.stateDepth
|
||||
.setValue(mLauncher.getDepthController().stateDepth.getValue());
|
||||
depthController.dispose();
|
||||
}));
|
||||
|
||||
return backgroundRadiusAnim;
|
||||
}
|
||||
|
||||
@@ -1431,9 +1429,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
DeviceProfile dp = mLauncher.getDeviceProfile();
|
||||
final int halfIconSize = dp.iconSizePx / 2;
|
||||
float primaryDimension = orientationHandler
|
||||
.getPrimaryValue(dp.availableWidthPx, dp.availableHeightPx);
|
||||
.getPrimaryValue(dp.getDeviceProperties().getAvailableWidthPx(), dp.getDeviceProperties().getAvailableHeightPx());
|
||||
float secondaryDimension = orientationHandler
|
||||
.getSecondaryValue(dp.availableWidthPx, dp.availableHeightPx);
|
||||
.getSecondaryValue(dp.getDeviceProperties().getAvailableWidthPx(), dp.getDeviceProperties().getAvailableHeightPx());
|
||||
final float targetX = primaryDimension / 2f;
|
||||
final float targetY = secondaryDimension - dp.hotseatBarSizePx;
|
||||
return new RectF(targetX - halfIconSize, targetY - halfIconSize,
|
||||
@@ -1463,13 +1461,13 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
// Get floating view and target rect.
|
||||
boolean isInHotseat = false;
|
||||
if (launcherView instanceof LauncherAppWidgetHostView) {
|
||||
Size windowSize = new Size(mDeviceProfile.availableWidthPx,
|
||||
mDeviceProfile.availableHeightPx);
|
||||
Size windowSize = new Size(mDeviceProfile.getDeviceProperties().getAvailableWidthPx(),
|
||||
mDeviceProfile.getDeviceProperties().getAvailableHeightPx());
|
||||
int fallbackBackgroundColor =
|
||||
FloatingWidgetView.getDefaultBackgroundColor(mLauncher, runningTaskTarget);
|
||||
floatingWidget = FloatingWidgetView.getFloatingWidgetView(mLauncher,
|
||||
(LauncherAppWidgetHostView) launcherView, targetRect, windowSize,
|
||||
mDeviceProfile.isMultiWindowMode ? 0 : getWindowCornerRadius(mLauncher),
|
||||
mDeviceProfile.getDeviceProperties().isMultiWindowMode() ? 0 : getWindowCornerRadius(mLauncher),
|
||||
isTransluscent, fallbackBackgroundColor);
|
||||
} else if (launcherView != null && !RemoveAnimationSettingsTracker.INSTANCE.get(
|
||||
mLauncher).isRemoveAnimationEnabled()) {
|
||||
@@ -1500,7 +1498,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
Rect closingWindowStartRect = new Rect();
|
||||
closingWindowStartRectF.round(closingWindowStartRect);
|
||||
Rect closingWindowOriginalRect =
|
||||
new Rect(0, 0, mDeviceProfile.widthPx, mDeviceProfile.heightPx);
|
||||
new Rect(0, 0, mDeviceProfile.getDeviceProperties().getWidthPx(), mDeviceProfile.getDeviceProperties().getHeightPx());
|
||||
if (floatingIconView != null) {
|
||||
anim.addAnimatorListener(floatingIconView);
|
||||
floatingIconView.setOnTargetChangeListener(anim::onTargetPositionChanged);
|
||||
@@ -1508,15 +1506,20 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
FloatingIconView finalFloatingIconView = floatingIconView;
|
||||
|
||||
// We want the window alpha to be 0 once this threshold is met, so that the
|
||||
// FolderIconView can be seen morphing into the icon shape.
|
||||
// FloatingIconView can be seen morphing into the icon shape.
|
||||
final float windowAlphaThreshold = 1f - SHAPE_PROGRESS_DURATION;
|
||||
|
||||
RectFSpringAnim.OnUpdateListener runner = new SpringAnimRunner(targets, targetRect,
|
||||
closingWindowStartRect, closingWindowOriginalRect, startWindowCornerRadius) {
|
||||
@Override
|
||||
public void onUpdate(RectF currentRectF, float progress) {
|
||||
finalFloatingIconView.update(1f, currentRectF, progress, windowAlphaThreshold,
|
||||
getCornerRadius(progress), false);
|
||||
// We want the icon alpha to be 1 once this threshold is met, so that it can be
|
||||
// seen morphing into the icon shape. But before the threshold, we want to limit
|
||||
// the alpha to reduce the blur effect behind the window.
|
||||
float iconAlpha =
|
||||
Interpolators.clampToProgress(progress, 0f, windowAlphaThreshold);
|
||||
finalFloatingIconView.update(iconAlpha, currentRectF, progress,
|
||||
windowAlphaThreshold, getCornerRadius(progress), false);
|
||||
|
||||
super.onUpdate(currentRectF, progress);
|
||||
}
|
||||
@@ -1573,7 +1576,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
Rect tmpRect = new Rect();
|
||||
ValueAnimator closingAnimator = ValueAnimator.ofFloat(0, 1);
|
||||
int duration = CLOSING_TRANSITION_DURATION_MS;
|
||||
float windowCornerRadius = mDeviceProfile.isMultiWindowMode
|
||||
float windowCornerRadius = mDeviceProfile.getDeviceProperties().isMultiWindowMode()
|
||||
? 0 : getWindowCornerRadius(mLauncher);
|
||||
float startShadowRadius = areAllTargetsTranslucent(appTargets) ? 0 : mMaxShadowRadius;
|
||||
closingAnimator.setDuration(duration);
|
||||
@@ -1643,14 +1646,20 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
}
|
||||
|
||||
private void addCujInstrumentation(Animator anim, int cuj) {
|
||||
anim.addListener(getCujAnimationSuccessListener(cuj));
|
||||
anim.addListener(getCujAnimationSuccessListener(cuj, /* cujPreStartCallback= */null));
|
||||
}
|
||||
|
||||
private void addCujInstrumentation(Animator anim, int cuj, Runnable cujPreStartCallback) {
|
||||
anim.addListener(getCujAnimationSuccessListener(cuj, cujPreStartCallback));
|
||||
}
|
||||
|
||||
private void addCujInstrumentation(RectFSpringAnim anim, int cuj) {
|
||||
anim.addAnimatorListener(getCujAnimationSuccessListener(cuj));
|
||||
anim.addAnimatorListener(
|
||||
getCujAnimationSuccessListener(cuj, /* cujPreStartCallback= */null));
|
||||
}
|
||||
|
||||
private AnimationSuccessListener getCujAnimationSuccessListener(int cuj) {
|
||||
private AnimationSuccessListener getCujAnimationSuccessListener(
|
||||
int cuj, Runnable cujPreStartCallback) {
|
||||
return new AnimationSuccessListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
@@ -1664,7 +1673,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
return;
|
||||
}
|
||||
mHandled = true;
|
||||
|
||||
if (cujPreStartCallback != null) {
|
||||
cujPreStartCallback.run();
|
||||
}
|
||||
InteractionJankMonitorWrapper.begin(mDragLayer, cuj);
|
||||
|
||||
mDragLayer.post(() ->
|
||||
@@ -1772,12 +1783,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
true /* animateOverviewScrim */, launcherView).getAnimators());
|
||||
}
|
||||
|
||||
if (!areAllTargetsTranslucent(appTargets)) {
|
||||
anim.play(ObjectAnimator.ofFloat(mLauncher.getDepthController().stateDepth,
|
||||
MULTI_PROPERTY_VALUE,
|
||||
BACKGROUND_APP.getDepth(mLauncher), NORMAL.getDepth(mLauncher)));
|
||||
}
|
||||
|
||||
// We play StaggeredWorkspaceAnim as a part of the closing window animation.
|
||||
playWorkspaceReveal = false;
|
||||
}
|
||||
@@ -1816,8 +1821,13 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
addCujInstrumentation(rectFSpringAnim, Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME);
|
||||
} else {
|
||||
if (isFreeformAnimation(appTargets)) {
|
||||
addCujInstrumentation(anim,
|
||||
Cuj.CUJ_DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE);
|
||||
addCujInstrumentation(
|
||||
anim,
|
||||
Cuj.CUJ_DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE,
|
||||
/* cujPreStartCallback= */ () -> {
|
||||
mLatencyTracker.onActionEnd(
|
||||
ACTION_DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE);
|
||||
});
|
||||
}
|
||||
addCujInstrumentation(anim, playFallBackAnimation
|
||||
? Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK
|
||||
@@ -1854,7 +1864,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
}
|
||||
});
|
||||
} else if (playWorkspaceReveal) {
|
||||
anim.play(new WorkspaceRevealAnim(mLauncher, false).getAnimators());
|
||||
anim.play(new WorkspaceRevealAnim(mLauncher, false).getAnimators());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2256,17 +2266,20 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
boolean toLauncher, RectF resultRect) {
|
||||
final int taskRotation = target.windowConfiguration.getRotation();
|
||||
final DeviceProfile profile = mLauncher.getDeviceProfile();
|
||||
final int rotation = profile.getDeviceProperties().getRotationHint();
|
||||
final int widthPx = profile.getDeviceProperties().getWidthPx();
|
||||
final int heightPx = profile.getDeviceProperties().getWidthPx();
|
||||
|
||||
final int rotationDelta = toLauncher
|
||||
? android.util.RotationUtils.deltaRotation(taskRotation, profile.rotationHint)
|
||||
: android.util.RotationUtils.deltaRotation(profile.rotationHint, taskRotation);
|
||||
? android.util.RotationUtils.deltaRotation(taskRotation, rotation)
|
||||
: android.util.RotationUtils.deltaRotation(rotation, taskRotation);
|
||||
if (rotationDelta != ROTATION_0) {
|
||||
// Get original display size when task is on top but with different rotation
|
||||
if (rotationDelta % 2 != 0 && toLauncher && (profile.rotationHint == ROTATION_0
|
||||
|| profile.rotationHint == ROTATION_180)) {
|
||||
mDisplayRect.set(0, 0, profile.heightPx, profile.widthPx);
|
||||
if (rotationDelta % 2 != 0 && toLauncher && (rotation == ROTATION_0
|
||||
|| rotation == ROTATION_180)) {
|
||||
mDisplayRect.set(0, 0, heightPx, widthPx);
|
||||
} else {
|
||||
mDisplayRect.set(0, 0, profile.widthPx, profile.heightPx);
|
||||
mDisplayRect.set(0, 0, widthPx, heightPx);
|
||||
}
|
||||
currentRect.round(mTmpResult);
|
||||
android.util.RotationUtils.rotateBounds(mTmpResult, mDisplayRect, rotationDelta);
|
||||
@@ -2405,19 +2418,4 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
return Utilities.mapToRange(progress, start, end, 1, 0, ACCELERATE_1_5);
|
||||
}
|
||||
}
|
||||
|
||||
public static class LaunchDepthController extends DepthController {
|
||||
public LaunchDepthController(QuickstepLauncher launcher) {
|
||||
super(launcher);
|
||||
try {
|
||||
setCrossWindowBlursEnabled(
|
||||
CrossWindowBlurListeners.getInstance().isCrossWindowBlurEnabled());
|
||||
} catch (Throwable t) {
|
||||
// LC-Ignored
|
||||
}
|
||||
// Make sure that the starting value matches the current depth set by the main
|
||||
// controller.
|
||||
stateDepth.setValue(launcher.getDepthController().stateDepth.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,10 +33,12 @@ import android.view.accessibility.AccessibilityManager;
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.allapps.FloatingHeaderRow;
|
||||
import com.android.launcher3.allapps.FloatingHeaderView;
|
||||
import com.android.launcher3.util.Themes;
|
||||
|
||||
/**
|
||||
* A view which shows a horizontal divider
|
||||
@@ -84,9 +86,10 @@ public class AppsDividerView extends View implements FloatingHeaderRow {
|
||||
getResources().getDimensionPixelSize(R.dimen.all_apps_divider_height)
|
||||
};
|
||||
|
||||
mStrokeColor = context.getColor(R.color.materialColorOutlineVariant);
|
||||
|
||||
mAllAppsLabelTextColor = context.getColor(R.color.materialColorOnSurfaceVariant);
|
||||
mStrokeColor = Flags.allAppsBlur()
|
||||
? Themes.getAttrColor(context, R.attr.bottomSheetDragHandleColor)
|
||||
: context.getColor(R.color.materialColorOutlineVariant);
|
||||
mAllAppsLabelTextColor = context.getColor(R.color.materialColorOnSurface);
|
||||
|
||||
mAccessibilityManager = AccessibilityManager.getInstance(context);
|
||||
setShowAllAppsLabel(!ALL_APPS_VISITED_COUNT.hasReachedMax(context));
|
||||
@@ -211,7 +214,8 @@ public class AppsDividerView extends View implements FloatingHeaderRow {
|
||||
private Layout getAllAppsLabelLayout() {
|
||||
if (mAllAppsLabelLayout == null) {
|
||||
mPaint.setAntiAlias(true);
|
||||
mPaint.setTypeface(Typeface.create("google-sans", Typeface.NORMAL));
|
||||
mPaint.setTypeface(Typeface.create(Flags.gsfRes() ? "variable-title-small"
|
||||
: "google-sans", Typeface.NORMAL));
|
||||
mPaint.setTextSize(
|
||||
getResources().getDimensionPixelSize(R.dimen.all_apps_label_text_size));
|
||||
|
||||
|
||||
@@ -143,9 +143,10 @@ public class PredictionRowView<T extends Context & ActivityContext>
|
||||
@Override
|
||||
public int getExpectedHeight() {
|
||||
DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
|
||||
int iconHeight = deviceProfile.allAppsIconSizePx;
|
||||
int iconPadding = deviceProfile.allAppsIconDrawablePaddingPx;
|
||||
int textHeight = Utilities.calculateTextHeight(deviceProfile.allAppsIconTextSizePx);
|
||||
int iconHeight = deviceProfile.getAllAppsProfile().getIconSizePx();
|
||||
int iconPadding = deviceProfile.getAllAppsProfile().getIconDrawablePaddingPx();
|
||||
int textHeight = Utilities.calculateTextHeight(
|
||||
deviceProfile.getAllAppsProfile().getIconTextSizePx());
|
||||
int totalHeight = iconHeight + iconPadding + textHeight + mVerticalPadding * 2;
|
||||
// Prediction row height will be 4dp bigger than the regular apps in A-Z list when two line
|
||||
// is not enabled. Otherwise, the extra height will increase by just the textHeight.
|
||||
@@ -235,7 +236,11 @@ public class PredictionRowView<T extends Context & ActivityContext>
|
||||
lp.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
} else {
|
||||
// Ensure the all apps icon height matches the workspace icons in portrait mode.
|
||||
lp.height = mActivityContext.getDeviceProfile().allAppsCellHeightPx;
|
||||
lp.height =
|
||||
mActivityContext
|
||||
.getDeviceProfile()
|
||||
.getAllAppsProfile()
|
||||
.getCellHeightPx();
|
||||
}
|
||||
lp.width = 0;
|
||||
lp.weight = 1;
|
||||
|
||||
@@ -16,22 +16,32 @@
|
||||
|
||||
package com.android.launcher3.dagger
|
||||
|
||||
import app.lawnchair.factory.LawnchairWidgetHolder
|
||||
import app.lawnchair.util.LawnchairWindowManagerProxy
|
||||
import com.android.launcher3.backuprestore.LauncherRestoreEventLogger
|
||||
import com.android.launcher3.icons.LauncherIconProvider
|
||||
import com.android.launcher3.icons.LauncherIconProviderImpl
|
||||
import com.android.launcher3.logging.StatsLogManager.StatsLogManagerFactory
|
||||
import com.android.launcher3.uioverrides.QuickstepWidgetHolder.QuickstepWidgetHolderFactory
|
||||
import com.android.launcher3.uioverrides.SystemApiWrapper
|
||||
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapperImpl
|
||||
import com.android.launcher3.util.ApiWrapper
|
||||
import com.android.launcher3.util.InstantAppResolver
|
||||
import com.android.launcher3.util.PluginManagerWrapper
|
||||
import com.android.launcher3.util.window.RefreshRateTracker
|
||||
import com.android.launcher3.util.window.WindowManagerProxy
|
||||
import com.android.launcher3.widget.LauncherWidgetHolder.WidgetHolderFactory
|
||||
import com.android.quickstep.InstantAppResolverImpl
|
||||
import com.android.quickstep.LauncherRestoreEventLoggerImpl
|
||||
import com.android.quickstep.logging.StatsLogCompatManager.StatsLogCompatManagerFactory
|
||||
import com.android.quickstep.util.ChoreographerFrameRateTracker
|
||||
import com.android.quickstep.util.GestureExclusionManager
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
|
||||
import app.lawnchair.factory.LawnchairWidgetHolder
|
||||
import app.lawnchair.util.LawnchairWindowManagerProxy
|
||||
|
||||
private object Modules {}
|
||||
|
||||
@Module
|
||||
@@ -41,7 +51,22 @@ abstract class WindowManagerProxyModule {
|
||||
|
||||
@Module
|
||||
abstract class ApiWrapperModule {
|
||||
@Binds
|
||||
abstract fun bindStatsLogManagerFactory(
|
||||
impl: StatsLogCompatManagerFactory
|
||||
): StatsLogManagerFactory
|
||||
|
||||
@Binds abstract fun bindApiWrapper(systemApiWrapper: SystemApiWrapper): ApiWrapper
|
||||
|
||||
@Binds
|
||||
abstract fun bindIconProvider(iconProviderImpl: LauncherIconProviderImpl): LauncherIconProvider
|
||||
|
||||
@Binds abstract fun bindInstantAppResolver(impl: InstantAppResolverImpl): InstantAppResolver
|
||||
|
||||
@Binds
|
||||
abstract fun bindRestoreEventLogger(
|
||||
impl: LauncherRestoreEventLoggerImpl
|
||||
): LauncherRestoreEventLogger
|
||||
}
|
||||
|
||||
@Module
|
||||
@@ -67,4 +92,9 @@ object StaticObjectModule {
|
||||
@Provides
|
||||
@JvmStatic
|
||||
fun provideRefreshRateTracker(): RefreshRateTracker = ChoreographerFrameRateTracker
|
||||
|
||||
@Provides
|
||||
@JvmStatic
|
||||
fun provideActivityManagerWrapper(): ActivityManagerWrapper =
|
||||
ActivityManagerWrapper.getInstance()
|
||||
}
|
||||
@@ -81,11 +81,13 @@ constructor(
|
||||
val animators = mutableListOf<Animator>()
|
||||
val animatorFinishedCallback: (Animator) -> Unit = { animator ->
|
||||
animators -= animator
|
||||
if (animators.isEmpty()) finishedCallback.run()
|
||||
if (animators.isEmpty()) {
|
||||
RemoteRunnable.executeSafely(finishedCallback)
|
||||
}
|
||||
}
|
||||
animators += animatorHelper.createAnimators(info, animatorFinishedCallback)
|
||||
if (animators.isEmpty()) {
|
||||
finishedCallback.run()
|
||||
RemoteRunnable.executeSafely(finishedCallback)
|
||||
return
|
||||
}
|
||||
animators.forEach { it.start() }
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.launcher3.desktop
|
||||
import android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD
|
||||
import android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM
|
||||
import android.content.Context
|
||||
import android.window.DesktopExperienceFlags
|
||||
import android.window.DesktopModeFlags
|
||||
import android.window.RemoteTransition
|
||||
import android.window.TransitionFilter
|
||||
@@ -84,7 +85,9 @@ class DesktopAppLaunchTransitionManager(
|
||||
mWindowingMode = WINDOWING_MODE_FREEFORM
|
||||
mModes = DesktopAppLaunchTransition.LAUNCH_CHANGE_MODES
|
||||
mMustBeTask = true
|
||||
mOrder = CONTAINER_ORDER_TOP
|
||||
if (!DesktopExperienceFlags.ENABLE_DESKTOP_APP_LAUNCH_BUGFIX.isTrue) {
|
||||
mOrder = CONTAINER_ORDER_TOP
|
||||
}
|
||||
}
|
||||
return TransitionFilter().apply {
|
||||
mTypeSet = DesktopAppLaunchTransition.LAUNCH_CHANGE_MODES
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.android.quickstep.util.DesksUtils.Companion.areMultiDesksFlagsEnabled
|
||||
import com.android.quickstep.views.DesktopTaskView
|
||||
import com.android.quickstep.views.TaskContainer
|
||||
import com.android.quickstep.views.TaskView
|
||||
import com.android.window.flags.Flags
|
||||
import com.android.window.flags2.Flags
|
||||
import com.android.wm.shell.shared.desktopmode.DesktopModeTransitionSource
|
||||
import java.util.function.Consumer
|
||||
|
||||
@@ -46,10 +46,14 @@ class DesktopRecentsTransitionController(
|
||||
private val depthController: DepthController?,
|
||||
) {
|
||||
|
||||
/** Launch desktop tasks from recents view */
|
||||
/**
|
||||
* Launch desktop tasks from recents view and activate the new freeform task with id
|
||||
* [taskIdToReorderToFront] if it's provided and already on the given desk.
|
||||
*/
|
||||
fun launchDesktopFromRecents(
|
||||
desktopTaskView: DesktopTaskView,
|
||||
animated: Boolean,
|
||||
taskIdToReorderToFront: Int? = null,
|
||||
callback: Consumer<Boolean>? = null,
|
||||
) {
|
||||
val animRunner =
|
||||
@@ -62,9 +66,13 @@ class DesktopRecentsTransitionController(
|
||||
)
|
||||
val transition = RemoteTransition(animRunner, appThread, "RecentsToDesktop")
|
||||
if (areMultiDesksFlagsEnabled()) {
|
||||
systemUiProxy.activateDesk(desktopTaskView.deskId, transition)
|
||||
systemUiProxy.activateDesk(desktopTaskView.deskId, transition, taskIdToReorderToFront)
|
||||
} else {
|
||||
systemUiProxy.showDesktopApps(desktopTaskView.displayId, transition)
|
||||
systemUiProxy.showDesktopApps(
|
||||
desktopTaskView.displayId,
|
||||
transition,
|
||||
taskIdToReorderToFront,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.util.IntArray;
|
||||
import com.android.launcher3.views.ArrowTipView;
|
||||
import com.android.launcher3.views.Snackbar;
|
||||
|
||||
@@ -57,7 +56,6 @@ public class HotseatEduController {
|
||||
private HotseatEduDialog mActiveDialog;
|
||||
|
||||
private ArrayList<ItemInfo> mNewItems = new ArrayList<>();
|
||||
private IntArray mNewScreens = null;
|
||||
|
||||
HotseatEduController(Launcher launcher) {
|
||||
mLauncher = launcher;
|
||||
@@ -96,7 +94,6 @@ public class HotseatEduController {
|
||||
}
|
||||
if (pageId == -1) {
|
||||
pageId = mLauncher.getModel().getModelDbController().getNewScreenId();
|
||||
mNewScreens = IntArray.wrap(pageId);
|
||||
}
|
||||
boolean isPortrait = !mLauncher.getDeviceProfile().isVerticalBarLayout();
|
||||
int hotseatItemsNum = mLauncher.getDeviceProfile().numShownHotseatIcons;
|
||||
@@ -117,18 +114,7 @@ public class HotseatEduController {
|
||||
void moveHotseatItems() {
|
||||
mHotseat.removeAllViewsInLayout();
|
||||
if (!mNewItems.isEmpty()) {
|
||||
int lastPage = mNewItems.get(mNewItems.size() - 1).screenId;
|
||||
ArrayList<ItemInfo> animated = new ArrayList<>();
|
||||
ArrayList<ItemInfo> nonAnimated = new ArrayList<>();
|
||||
|
||||
for (ItemInfo info : mNewItems) {
|
||||
if (info.screenId == lastPage) {
|
||||
animated.add(info);
|
||||
} else {
|
||||
nonAnimated.add(info);
|
||||
}
|
||||
}
|
||||
mLauncher.bindAppsAdded(mNewScreens, nonAnimated, animated);
|
||||
mLauncher.bindItemsAdded(mNewItems);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.uioverrides.PredictedAppIcon;
|
||||
import com.android.launcher3.views.AbstractSlideInView;
|
||||
|
||||
import java.util.List;
|
||||
@@ -89,11 +88,11 @@ public class HotseatEduDialog extends AbstractSlideInView<Launcher> implements I
|
||||
mSampleHotseat = findViewById(R.id.sample_prediction);
|
||||
|
||||
Context context = getContext();
|
||||
DeviceProfile grid = mActivityContext.getDeviceProfile();
|
||||
Rect padding = grid.getHotseatLayoutPadding(context);
|
||||
DeviceProfile dp = mActivityContext.getDeviceProfile();
|
||||
Rect padding = dp.getHotseatLayoutPadding(context);
|
||||
|
||||
mSampleHotseat.getLayoutParams().height = grid.cellHeightPx;
|
||||
mSampleHotseat.setGridSize(grid.numShownHotseatIcons, 1);
|
||||
mSampleHotseat.getLayoutParams().height = dp.cellHeightPx;
|
||||
mSampleHotseat.setGridSize(dp.numShownHotseatIcons, 1);
|
||||
mSampleHotseat.setPadding(padding.left, 0, padding.right, 0);
|
||||
|
||||
Button turnOnBtn = findViewById(R.id.turn_predictions_on);
|
||||
@@ -103,7 +102,8 @@ public class HotseatEduDialog extends AbstractSlideInView<Launcher> implements I
|
||||
mDismissBtn.setOnClickListener(this::onDismiss);
|
||||
|
||||
LinearLayout buttonContainer = findViewById(R.id.button_container);
|
||||
int adjustedMarginEnd = grid.hotseatBarEndOffset - buttonContainer.getPaddingEnd();
|
||||
int adjustedMarginEnd =
|
||||
dp.getHotseatProfile().getBarEndOffset() - buttonContainer.getPaddingEnd();
|
||||
if (InvariantDeviceProfile.INSTANCE.get(context)
|
||||
.getDeviceProfile(context).isTaskbarPresent && adjustedMarginEnd > 0) {
|
||||
((LinearLayout.LayoutParams) buttonContainer.getLayoutParams()).setMarginEnd(
|
||||
@@ -184,10 +184,9 @@ public class HotseatEduDialog extends AbstractSlideInView<Launcher> implements I
|
||||
private void populatePreview(List<WorkspaceItemInfo> predictions) {
|
||||
for (int i = 0; i < mActivityContext.getDeviceProfile().numShownHotseatIcons; i++) {
|
||||
WorkspaceItemInfo info = predictions.get(i);
|
||||
PredictedAppIcon icon = PredictedAppIcon.createIcon(mSampleHotseat, info);
|
||||
View icon = mActivityContext.getItemInflater().inflateItem(info, mSampleHotseat);
|
||||
icon.setEnabled(false);
|
||||
icon.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||
icon.verifyHighRes();
|
||||
CellLayoutLayoutParams lp = new CellLayoutLayoutParams(i, 0, 1, 1);
|
||||
mSampleHotseat.addViewToCellLayout(icon, i, info.getViewId(), lp, true);
|
||||
}
|
||||
|
||||
+24
-36
@@ -29,7 +29,6 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.ComponentName;
|
||||
import android.util.Log;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -47,14 +46,15 @@ import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.dragndrop.DragOptions;
|
||||
import com.android.launcher3.graphics.DragPreviewProvider;
|
||||
import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
|
||||
import com.android.launcher3.logger.LauncherAtom.PredictedHotseatContainer;
|
||||
import com.android.launcher3.logging.InstanceId;
|
||||
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.PredictedContainerInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.pm.UserCache;
|
||||
import com.android.launcher3.popup.SystemShortcut;
|
||||
@@ -81,11 +81,9 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
SystemShortcut.Factory<QuickstepLauncher>, DeviceProfile.OnDeviceProfileChangeListener,
|
||||
DragSource, ViewGroup.OnHierarchyChangeListener {
|
||||
|
||||
private static final String TAG = "HotseatPredictionController";
|
||||
private static final int FLAG_UPDATE_PAUSED = 1 << 0;
|
||||
private static final int FLAG_DRAG_IN_PROGRESS = 1 << 1;
|
||||
private static final int FLAG_FILL_IN_PROGRESS = 1 << 2;
|
||||
private static final int FLAG_REMOVING_PREDICTED_ICON = 1 << 3;
|
||||
private static final int FLAG_DRAG_IN_PROGRESS = 1 << 0;
|
||||
private static final int FLAG_FILL_IN_PROGRESS = 1 << 1;
|
||||
private static final int FLAG_REMOVING_PREDICTED_ICON = 1 << 2;
|
||||
|
||||
private int mHotSeatItemsCount;
|
||||
|
||||
@@ -232,7 +230,7 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
if (icon.applyFromWorkspaceItemWithAnimation(predictedItem, numViewsAnimated)) {
|
||||
numViewsAnimated++;
|
||||
}
|
||||
icon.finishBinding(mPredictionLongClickListener);
|
||||
finishBinding(icon);
|
||||
} else {
|
||||
newItems.add(predictedItem);
|
||||
}
|
||||
@@ -246,9 +244,9 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
private void bindItems(List<WorkspaceItemInfo> itemsToAdd, boolean animate) {
|
||||
AnimatorSet animationSet = new AnimatorSet();
|
||||
for (WorkspaceItemInfo item : itemsToAdd) {
|
||||
PredictedAppIcon icon = PredictedAppIcon.createIcon(mHotseat, item);
|
||||
View icon = mLauncher.getItemInflater().inflateItem(item, mHotseat);
|
||||
mLauncher.getWorkspace().addInScreenFromBind(icon, item);
|
||||
icon.finishBinding(mPredictionLongClickListener);
|
||||
finishBinding(icon);
|
||||
if (animate) {
|
||||
animationSet.play(ObjectAnimator.ofFloat(icon, SCALE_PROPERTY, 0.2f, 1));
|
||||
}
|
||||
@@ -262,6 +260,11 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
}
|
||||
}
|
||||
|
||||
private void finishBinding(View view) {
|
||||
view.setOnLongClickListener(mPredictionLongClickListener);
|
||||
((CellLayoutLayoutParams) view.getLayoutParams()).canReorder = false;
|
||||
}
|
||||
|
||||
private void removeOutlineDrawings() {
|
||||
if (mOutlineDrawings.isEmpty()) return;
|
||||
for (PredictedAppIcon.PredictedIconOutlineDrawing outlineDrawing : mOutlineDrawings) {
|
||||
@@ -279,33 +282,11 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
mLauncher.removeOnDeviceProfileChangeListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* start and pauses predicted apps update on the hotseat
|
||||
*/
|
||||
public void setPauseUIUpdate(boolean paused) {
|
||||
mPauseFlags = paused
|
||||
? (mPauseFlags | FLAG_UPDATE_PAUSED)
|
||||
: (mPauseFlags & ~FLAG_UPDATE_PAUSED);
|
||||
if (!paused) {
|
||||
fillGapsWithPrediction();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that if the flag FLAG_UPDATE_PAUSED is active we set it to false.
|
||||
*/
|
||||
public void verifyUIUpdateNotPaused() {
|
||||
if ((mPauseFlags & FLAG_UPDATE_PAUSED) != 0) {
|
||||
setPauseUIUpdate(false);
|
||||
Log.e(TAG, "FLAG_UPDATE_PAUSED should not be set to true (see b/339700174)");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets or updates the predicted items
|
||||
*/
|
||||
public void setPredictedItems(FixedContainerItems items) {
|
||||
mPredictedItems = new ArrayList(items.items);
|
||||
public void setPredictedItems(PredictedContainerInfo items) {
|
||||
mPredictedItems = items.getContents();
|
||||
if (mPredictedItems.isEmpty()) {
|
||||
HotseatRestoreHelper.restoreBackup(mLauncher);
|
||||
}
|
||||
@@ -503,10 +484,18 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
private class PinPrediction extends SystemShortcut<QuickstepLauncher> {
|
||||
|
||||
private PinPrediction(QuickstepLauncher target, ItemInfo itemInfo, View originalView) {
|
||||
super(R.drawable.ic_pin, R.string.pin_prediction, target,
|
||||
super(getDrawableId(), R.string.pin_prediction, target,
|
||||
itemInfo, originalView);
|
||||
}
|
||||
|
||||
public static int getDrawableId() {
|
||||
if (Flags.enableLauncherVisualRefresh()) {
|
||||
return R.drawable.keep_24px;
|
||||
} else {
|
||||
return R.drawable.ic_pin;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismissTaskMenuView();
|
||||
@@ -522,7 +511,6 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
|
||||
private static String getStateString(int flags) {
|
||||
StringJoiner str = new StringJoiner("|");
|
||||
appendFlag(str, flags, FLAG_UPDATE_PAUSED, "FLAG_UPDATE_PAUSED");
|
||||
appendFlag(str, flags, FLAG_DRAG_IN_PROGRESS, "FLAG_DRAG_IN_PROGRESS");
|
||||
appendFlag(str, flags, FLAG_FILL_IN_PROGRESS, "FLAG_FILL_IN_PROGRESS");
|
||||
appendFlag(str, flags, FLAG_REMOVING_PREDICTED_ICON,
|
||||
|
||||
@@ -22,9 +22,8 @@ import static android.app.prediction.AppTargetEvent.ACTION_UNDISMISS;
|
||||
import static android.app.prediction.AppTargetEvent.ACTION_UNPIN;
|
||||
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APPS_PREDICTION;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_PREDICTION;
|
||||
import static com.android.launcher3.logger.LauncherAtomExtensions.ExtendedContainers.ContainerCase.DEVICE_SEARCH_RESULT_CONTAINER;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_DRAGDROP;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_DISMISS_PREDICTION_UNDO;
|
||||
@@ -42,6 +41,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_TAP;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_ADD_BUTTON_TAP;
|
||||
import static com.android.launcher3.model.PredictionHelper.getLocationString;
|
||||
import static com.android.launcher3.model.PredictionHelper.isTrackedForHotseatPrediction;
|
||||
import static com.android.launcher3.model.PredictionHelper.isTrackedForWidgetPrediction;
|
||||
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
@@ -65,10 +65,6 @@ import androidx.annotation.WorkerThread;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.logger.LauncherAtom;
|
||||
import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
|
||||
import com.android.launcher3.logger.LauncherAtom.FolderContainer;
|
||||
import com.android.launcher3.logger.LauncherAtom.HotseatContainer;
|
||||
import com.android.launcher3.logger.LauncherAtom.WorkspaceContainer;
|
||||
import com.android.launcher3.logging.StatsLogManager.EventEnum;
|
||||
import com.android.launcher3.pm.UserCache;
|
||||
import com.android.launcher3.shortcuts.ShortcutRequest;
|
||||
@@ -76,7 +72,6 @@ import com.android.launcher3.util.UserIconInfo;
|
||||
import com.android.quickstep.logging.StatsLogCompatManager.StatsLogConsumer;
|
||||
import com.android.systemui.shared.system.SysUiStatsLog;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.function.ObjIntConsumer;
|
||||
|
||||
@@ -121,7 +116,10 @@ public class AppEventProducer implements StatsLogConsumer {
|
||||
// TODO: remove the running test check when b/231648228 is fixed.
|
||||
if (target != null && !Utilities.isRunningInTestHarness()) {
|
||||
AppTargetEvent event = new AppTargetEvent.Builder(target, eventId)
|
||||
.setLaunchLocation(getContainer(locationInfo))
|
||||
.setLaunchLocation(getLocationString(
|
||||
locationInfo.getContainerInfo(),
|
||||
locationInfo.getWidget().getSpanX(),
|
||||
locationInfo.getWidget().getSpanY()))
|
||||
.build();
|
||||
mMessageHandler.obtainMessage(MSG_LAUNCH, targetPredictor, 0, event).sendToTarget();
|
||||
}
|
||||
@@ -135,10 +133,10 @@ public class AppEventProducer implements StatsLogConsumer {
|
||||
|| event == LAUNCHER_QUICKSWITCH_RIGHT
|
||||
|| event == LAUNCHER_QUICKSWITCH_LEFT
|
||||
|| event == LAUNCHER_APP_LAUNCH_DRAGDROP) {
|
||||
sendEvent(atomInfo, ACTION_LAUNCH, CONTAINER_PREDICTION);
|
||||
sendEvent(atomInfo, ACTION_LAUNCH, CONTAINER_ALL_APPS_PREDICTION);
|
||||
} else if (event == LAUNCHER_ITEM_DROPPED_ON_DONT_SUGGEST
|
||||
|| event == LAUNCHER_SYSTEM_SHORTCUT_DONT_SUGGEST_APP_TAP) {
|
||||
sendEvent(atomInfo, ACTION_DISMISS, CONTAINER_PREDICTION);
|
||||
sendEvent(atomInfo, ACTION_DISMISS, CONTAINER_ALL_APPS_PREDICTION);
|
||||
} else if (event == LAUNCHER_ITEM_DRAG_STARTED) {
|
||||
mLastDragItem = atomInfo;
|
||||
} else if (event == LAUNCHER_ITEM_DROP_COMPLETED) {
|
||||
@@ -183,9 +181,9 @@ public class AppEventProducer implements StatsLogConsumer {
|
||||
AppTarget target = new AppTarget.Builder(new AppTargetId("launcher:launcher"),
|
||||
mContext.getPackageName(), Process.myUserHandle())
|
||||
.build();
|
||||
sendEvent(target, atomInfo, ACTION_LAUNCH, CONTAINER_PREDICTION);
|
||||
sendEvent(target, atomInfo, ACTION_LAUNCH, CONTAINER_ALL_APPS_PREDICTION);
|
||||
} else {
|
||||
sendEvent(atomInfo, ACTION_LAUNCH, CONTAINER_PREDICTION);
|
||||
sendEvent(atomInfo, ACTION_LAUNCH, CONTAINER_ALL_APPS_PREDICTION);
|
||||
}
|
||||
} else if (event == LAUNCHER_DISMISS_PREDICTION_UNDO) {
|
||||
sendEvent(atomInfo, ACTION_UNDISMISS, CONTAINER_HOTSEAT_PREDICTION);
|
||||
@@ -277,68 +275,6 @@ public class AppEventProducer implements StatsLogConsumer {
|
||||
}
|
||||
}
|
||||
|
||||
private String getContainer(LauncherAtom.ItemInfo info) {
|
||||
ContainerInfo ci = info.getContainerInfo();
|
||||
switch (ci.getContainerCase()) {
|
||||
case WORKSPACE: {
|
||||
// In case the item type is not widgets, the spaceX and spanY default to 1.
|
||||
int spanX = info.getWidget().getSpanX();
|
||||
int spanY = info.getWidget().getSpanY();
|
||||
return getWorkspaceContainerString(ci.getWorkspace(), spanX, spanY);
|
||||
}
|
||||
case HOTSEAT: {
|
||||
return getHotseatContainerString(ci.getHotseat());
|
||||
}
|
||||
case TASK_SWITCHER_CONTAINER: {
|
||||
return "task-switcher";
|
||||
}
|
||||
case ALL_APPS_CONTAINER: {
|
||||
return "all-apps";
|
||||
}
|
||||
case PREDICTED_HOTSEAT_CONTAINER: {
|
||||
return "predictions/hotseat";
|
||||
}
|
||||
case PREDICTION_CONTAINER: {
|
||||
return "predictions";
|
||||
}
|
||||
case SHORTCUTS_CONTAINER: {
|
||||
return "deep-shortcuts";
|
||||
}
|
||||
case TASK_BAR_CONTAINER: {
|
||||
return "taskbar";
|
||||
}
|
||||
case FOLDER: {
|
||||
FolderContainer fc = ci.getFolder();
|
||||
switch (fc.getParentContainerCase()) {
|
||||
case WORKSPACE:
|
||||
return "folder/" + getWorkspaceContainerString(fc.getWorkspace(), 1, 1);
|
||||
case HOTSEAT:
|
||||
return "folder/" + getHotseatContainerString(fc.getHotseat());
|
||||
}
|
||||
return "folder";
|
||||
}
|
||||
case SEARCH_RESULT_CONTAINER:
|
||||
return "search-results";
|
||||
case EXTENDED_CONTAINERS: {
|
||||
if (ci.getExtendedContainers().getContainerCase()
|
||||
== DEVICE_SEARCH_RESULT_CONTAINER) {
|
||||
return "search-results";
|
||||
}
|
||||
}
|
||||
default: // fall out
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String getWorkspaceContainerString(WorkspaceContainer wc, int spanX, int spanY) {
|
||||
return String.format(Locale.ENGLISH, "workspace/%d/[%d,%d]/[%d,%d]",
|
||||
wc.getPageIndex(), wc.getGridX(), wc.getGridY(), spanX, spanY);
|
||||
}
|
||||
|
||||
private static String getHotseatContainerString(HotseatContainer hc) {
|
||||
return String.format(Locale.ENGLISH, "hotseat/%1$d/[%1$d,0]/[1,1]", hc.getIndex());
|
||||
}
|
||||
|
||||
private static ComponentName parseNullable(String componentNameString) {
|
||||
return TextUtils.isEmpty(componentNameString)
|
||||
? null : ComponentName.unflattenFromString(componentNameString);
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.android.launcher3.model;
|
||||
import static com.android.launcher3.EncryptionType.ENCRYPTED;
|
||||
import static com.android.launcher3.LauncherPrefs.nonRestorableItem;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
|
||||
import static com.android.launcher3.icons.cache.CacheLookupFlag.DEFAULT_LOOKUP_FLAG;
|
||||
import static com.android.quickstep.InstantAppResolverImpl.COMPONENT_CLASS_MARKER;
|
||||
|
||||
import android.app.prediction.AppTarget;
|
||||
@@ -35,13 +34,13 @@ import com.android.launcher3.ConstantItem;
|
||||
import com.android.launcher3.LauncherModel.ModelUpdateTask;
|
||||
import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.icons.IconCache;
|
||||
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
||||
import com.android.launcher3.model.QuickstepModelDelegate.PredictorState;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.PredictedContainerInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -72,8 +71,9 @@ public class PredictionUpdateTask implements ModelUpdateTask {
|
||||
LauncherPrefs.get(context).put(LAST_PREDICTION_ENABLED, !mTargets.isEmpty());
|
||||
|
||||
Set<UserHandle> usersForChangedShortcuts =
|
||||
dataModel.extraItems.get(mPredictorState.containerId).items.stream()
|
||||
.filter(info -> info.itemType == ITEM_TYPE_DEEP_SHORTCUT)
|
||||
dataModel.itemsIdMap.getPredictedContents(mPredictorState.containerId).stream()
|
||||
.filter(info -> info != null &&
|
||||
info.itemType == ITEM_TYPE_DEEP_SHORTCUT)
|
||||
.map(info -> info.user)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
@@ -107,7 +107,7 @@ public class PredictionUpdateTask implements ModelUpdateTask {
|
||||
return null;
|
||||
}
|
||||
AppInfo ai = new AppInfo(context, lai, user);
|
||||
iconCache.getTitleAndIcon(ai, lai, DEFAULT_LOOKUP_FLAG);
|
||||
iconCache.getTitleAndIcon(ai, lai, mPredictorState.lookupFlag);
|
||||
return ai.makeWorkspaceItem(context);
|
||||
});
|
||||
|
||||
@@ -120,12 +120,12 @@ public class PredictionUpdateTask implements ModelUpdateTask {
|
||||
items.add(itemInfo);
|
||||
}
|
||||
|
||||
FixedContainerItems fci = new FixedContainerItems(mPredictorState.containerId, items);
|
||||
dataModel.extraItems.put(fci.containerId, fci);
|
||||
taskController.bindExtraContainerItems(fci);
|
||||
PredictedContainerInfo pci = new PredictedContainerInfo(mPredictorState.containerId, items);
|
||||
dataModel.updateAndDispatchItem(pci /* item */, null /* owner */);
|
||||
taskController.bindUpdatedWorkspaceItems(Collections.singleton(pci));
|
||||
usersForChangedShortcuts.forEach(u -> dataModel.updateShortcutPinnedState(context, u));
|
||||
|
||||
// Save to disk
|
||||
mPredictorState.storage.write(context, fci.items);
|
||||
mPredictorState.storage.write(context, pci.getContents());
|
||||
}
|
||||
}
|
||||
@@ -15,21 +15,19 @@
|
||||
*/
|
||||
package com.android.launcher3.model;
|
||||
|
||||
import static android.Manifest.permission.PACKAGE_USAGE_STATS;
|
||||
import static android.text.format.DateUtils.DAY_IN_MILLIS;
|
||||
import static android.text.format.DateUtils.formatElapsedTime;
|
||||
|
||||
import static com.android.launcher3.EncryptionType.ENCRYPTED;
|
||||
import static com.android.launcher3.LauncherPrefs.nonRestorableItem;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APPS_PREDICTION;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_PREDICTION;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.DESKTOP_ICON_FLAG;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
|
||||
import static com.android.launcher3.hybridhotseat.HotseatPredictionModel.convertDataModelToAppTargetBundle;
|
||||
import static com.android.launcher3.icons.cache.CacheLookupFlag.DEFAULT_LOOKUP_FLAG;
|
||||
import static com.android.launcher3.model.PredictionHelper.getAppTargetFromItemInfo;
|
||||
import static com.android.launcher3.model.PredictionHelper.wrapAppTargetWithItemLocation;
|
||||
import static com.android.launcher3.model.PredictionHelper.getBundleForHotseatPredictions;
|
||||
import static com.android.launcher3.model.PredictionHelper.getBundleForWidgetPredictions;
|
||||
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
|
||||
import android.Manifest;
|
||||
@@ -38,8 +36,6 @@ import static java.util.stream.Collectors.toCollection;
|
||||
import android.app.StatsManager;
|
||||
import android.app.prediction.AppPredictionContext;
|
||||
import android.app.prediction.AppPredictionManager;
|
||||
import android.app.prediction.AppPredictor;
|
||||
import android.app.prediction.AppTarget;
|
||||
import android.app.prediction.AppTargetEvent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -53,8 +49,6 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.StatsEvent;
|
||||
|
||||
import androidx.annotation.AnyThread;
|
||||
import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
@@ -66,33 +60,21 @@ import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.dagger.ApplicationContext;
|
||||
import com.android.launcher3.icons.cache.CacheLookupFlag;
|
||||
import com.android.launcher3.logger.LauncherAtom;
|
||||
import com.android.launcher3.logging.InstanceId;
|
||||
import com.android.launcher3.logging.InstanceIdSequence;
|
||||
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.CollectionInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.model.data.PredictedContainerInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceData;
|
||||
import com.android.launcher3.pm.UserCache;
|
||||
import com.android.launcher3.shortcuts.ShortcutKey;
|
||||
import com.android.launcher3.util.ApiWrapper;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.launcher3.util.IntSparseArrayMap;
|
||||
import com.android.launcher3.util.PackageManagerHelper;
|
||||
import com.android.launcher3.util.PersistedItemArray;
|
||||
import com.android.quickstep.logging.SettingsChangeLogger;
|
||||
import com.android.quickstep.logging.StatsLogCompatManager;
|
||||
import com.android.quickstep.util.ContextualSearchStateManager;
|
||||
import com.android.systemui.shared.system.SysUiStatsLog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
@@ -105,7 +87,6 @@ import app.lawnchair.compat.LawnchairQuickstepCompat;
|
||||
*/
|
||||
public class QuickstepModelDelegate extends ModelDelegate {
|
||||
|
||||
private static final String BUNDLE_KEY_ADDED_APP_WIDGETS = "added_app_widgets";
|
||||
private static final int NUM_OF_RECOMMENDED_WIDGETS_PREDICATION = 20;
|
||||
|
||||
private static final boolean IS_DEBUG = false;
|
||||
@@ -115,17 +96,18 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
nonRestorableItem("LAST_SNAPSHOT_TIME_MILLIS", 0L, ENCRYPTED);
|
||||
|
||||
@VisibleForTesting
|
||||
final PredictorState mAllAppsState = new PredictorState(
|
||||
CONTAINER_PREDICTION, "all_apps_predictions", DEFAULT_LOOKUP_FLAG);
|
||||
final PredictorState mAllPredictionAppsState = new PredictorState(
|
||||
CONTAINER_ALL_APPS_PREDICTION, "all_apps_predictions", DEFAULT_LOOKUP_FLAG);
|
||||
@VisibleForTesting
|
||||
final PredictorState mHotseatState = new PredictorState(
|
||||
final PredictorState mHotseatPredictionState = new PredictorState(
|
||||
CONTAINER_HOTSEAT_PREDICTION, "hotseat_predictions", DESKTOP_ICON_FLAG);
|
||||
@VisibleForTesting
|
||||
final PredictorState mWidgetsRecommendationState = new PredictorState(
|
||||
CONTAINER_WIDGETS_PREDICTION, "widgets_prediction", DESKTOP_ICON_FLAG);
|
||||
|
||||
private final InvariantDeviceProfile mIDP;
|
||||
private final PackageManagerHelper mPmHelper;
|
||||
private final UserCache mUserCache;
|
||||
private final PredictedItemFactory.Factory mItemParserFactory;
|
||||
private final AppEventProducer mAppEventProducer;
|
||||
|
||||
private final StatsManager mStatsManager;
|
||||
@@ -135,11 +117,15 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
@Inject
|
||||
public QuickstepModelDelegate(@ApplicationContext Context context,
|
||||
InvariantDeviceProfile idp,
|
||||
PackageManagerHelper pmHelper,
|
||||
UserCache userCache,
|
||||
PredictedItemFactory.Factory itemParserFactory,
|
||||
@Nullable @Named("ICONS_DB") String dbFileName) {
|
||||
super(context);
|
||||
|
||||
|
||||
mIDP = idp;
|
||||
mPmHelper = pmHelper;
|
||||
mUserCache = userCache;
|
||||
mItemParserFactory = itemParserFactory;
|
||||
|
||||
mAppEventProducer = new AppEventProducer(context, this::onAppTargetEvent);
|
||||
StatsLogCompatManager.LOGS_CONSUMER.add(mAppEventProducer);
|
||||
@@ -150,76 +136,26 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
? null : context.getSystemService(StatsManager.class);
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@Override
|
||||
public void loadAndBindWorkspaceItems(@NonNull UserManagerState ums,
|
||||
@NonNull BgDataModel.Callbacks[] callbacks,
|
||||
@NonNull Map<ShortcutKey, ShortcutInfo> pinnedShortcuts) {
|
||||
loadAndBindItems(ums, pinnedShortcuts, callbacks, mIDP.numDatabaseHotseatIcons,
|
||||
mHotseatState);
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@Override
|
||||
public void loadAndBindAllAppsItems(@NonNull UserManagerState ums,
|
||||
@NonNull BgDataModel.Callbacks[] callbacks,
|
||||
@NonNull Map<ShortcutKey, ShortcutInfo> pinnedShortcuts) {
|
||||
loadAndBindItems(ums, pinnedShortcuts, callbacks, mIDP.numDatabaseAllAppsColumns,
|
||||
mAllAppsState);
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private void loadAndBindItems(@NonNull UserManagerState ums,
|
||||
@NonNull Map<ShortcutKey, ShortcutInfo> pinnedShortcuts,
|
||||
@NonNull BgDataModel.Callbacks[] callbacks,
|
||||
int numColumns, @NonNull PredictorState state) {
|
||||
// TODO: Implement caching and preloading
|
||||
|
||||
WorkspaceItemFactory factory =
|
||||
new WorkspaceItemFactory(mContext, ums, mPmHelper, pinnedShortcuts, numColumns,
|
||||
state.containerId, state.lookupFlag);
|
||||
FixedContainerItems fci = new FixedContainerItems(state.containerId,
|
||||
state.storage.read(mContext, factory, ums.allUsers::get));
|
||||
mDataModel.extraItems.put(state.containerId, fci);
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@Override
|
||||
public void loadAndBindOtherItems(@NonNull BgDataModel.Callbacks[] callbacks) {
|
||||
FixedContainerItems widgetPredictionFCI = new FixedContainerItems(
|
||||
mWidgetsRecommendationState.containerId, new ArrayList<>());
|
||||
public void loadAndAddExtraModelItems(@NonNull IntSparseArrayMap<ItemInfo> outLoadedItems) {
|
||||
loadAndBindPredictedItems(
|
||||
mIDP.numDatabaseHotseatIcons, mHotseatPredictionState, outLoadedItems);
|
||||
loadAndBindPredictedItems(mIDP.numDatabaseAllAppsColumns, mAllPredictionAppsState,
|
||||
outLoadedItems);
|
||||
|
||||
// Widgets prediction isn't used frequently. And thus, it is not persisted on disk.
|
||||
mDataModel.extraItems.put(mWidgetsRecommendationState.containerId, widgetPredictionFCI);
|
||||
|
||||
bindPredictionItems(callbacks, widgetPredictionFCI);
|
||||
loadStringCache(mDataModel.stringCache);
|
||||
PredictedContainerInfo widgetPredictionFCI = new PredictedContainerInfo(
|
||||
mWidgetsRecommendationState.containerId, new ArrayList<>());
|
||||
outLoadedItems.put(mWidgetsRecommendationState.containerId, widgetPredictionFCI);
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
private void bindPredictionItems(@NonNull BgDataModel.Callbacks[] callbacks,
|
||||
@NonNull FixedContainerItems fci) {
|
||||
Executors.MAIN_EXECUTOR.execute(() -> {
|
||||
for (BgDataModel.Callbacks c : callbacks) {
|
||||
c.bindExtraContainerItems(fci);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@WorkerThread
|
||||
public void bindAllModelExtras(@NonNull BgDataModel.Callbacks[] callbacks) {
|
||||
Iterable<FixedContainerItems> containerItems;
|
||||
synchronized (mDataModel.extraItems) {
|
||||
containerItems = mDataModel.extraItems.clone();
|
||||
}
|
||||
Executors.MAIN_EXECUTOR.execute(() -> {
|
||||
for (BgDataModel.Callbacks c : callbacks) {
|
||||
for (FixedContainerItems fci : containerItems) {
|
||||
c.bindExtraContainerItems(fci);
|
||||
}
|
||||
}
|
||||
});
|
||||
private void loadAndBindPredictedItems(int numColumns,
|
||||
@NonNull PredictorState state, @NonNull IntSparseArrayMap<ItemInfo> outLoadedItems) {
|
||||
PredictedItemFactory parser = mItemParserFactory.newParser(numColumns, state);
|
||||
PredictedContainerInfo fci = new PredictedContainerInfo(state.containerId,
|
||||
state.storage.read(mContext, parser, mUserCache::getUserForSerialNumber));
|
||||
outLoadedItems.put(state.containerId, fci);
|
||||
}
|
||||
|
||||
public void markActive() {
|
||||
@@ -254,9 +190,9 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
elapsedTime));
|
||||
}
|
||||
} else {
|
||||
IntSparseArrayMap<ItemInfo> itemsIdMap;
|
||||
WorkspaceData itemsIdMap;
|
||||
synchronized (mDataModel) {
|
||||
itemsIdMap = mDataModel.itemsIdMap.clone();
|
||||
itemsIdMap = mDataModel.itemsIdMap.copy();
|
||||
}
|
||||
InstanceId instanceId = new InstanceIdSequence().newInstanceId();
|
||||
for (ItemInfo info : itemsIdMap) {
|
||||
@@ -287,9 +223,9 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
MODEL_EXECUTOR,
|
||||
(i, eventList) -> {
|
||||
InstanceId instanceId = new InstanceIdSequence().newInstanceId();
|
||||
IntSparseArrayMap<ItemInfo> itemsIdMap;
|
||||
WorkspaceData itemsIdMap;
|
||||
synchronized (mDataModel) {
|
||||
itemsIdMap = mDataModel.itemsIdMap.clone();
|
||||
itemsIdMap = mDataModel.itemsIdMap.copy();
|
||||
}
|
||||
|
||||
for (ItemInfo info : itemsIdMap) {
|
||||
@@ -303,7 +239,7 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
Log.d(TAG,
|
||||
String.format(
|
||||
"Successfully logged %d workspace items with instanceId=%d",
|
||||
itemsIdMap.size(), instanceId.getId()));
|
||||
eventList.size(), instanceId.getId()));
|
||||
additionalSnapshotEvents(instanceId);
|
||||
SettingsChangeLogger.INSTANCE.get(mContext).logSnapshot(instanceId);
|
||||
return StatsManager.PULL_SUCCESS;
|
||||
@@ -317,7 +253,7 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
}
|
||||
|
||||
private static CollectionInfo getContainer(
|
||||
ItemInfo info, IntSparseArrayMap<ItemInfo> itemsIdMap) {
|
||||
ItemInfo info, WorkspaceData itemsIdMap) {
|
||||
if (info.container > 0) {
|
||||
ItemInfo containerInfo = itemsIdMap.get(info.container);
|
||||
|
||||
@@ -336,12 +272,8 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
@Override
|
||||
public void validateData() {
|
||||
super.validateData();
|
||||
if (mAllAppsState.predictor != null) {
|
||||
mAllAppsState.predictor.requestPredictionUpdate();
|
||||
}
|
||||
if (mWidgetsRecommendationState.predictor != null) {
|
||||
mWidgetsRecommendationState.predictor.requestPredictionUpdate();
|
||||
}
|
||||
mAllPredictionAppsState.requestPredictionUpdate();
|
||||
mWidgetsRecommendationState.requestPredictionUpdate();
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
@@ -361,8 +293,8 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
}
|
||||
|
||||
private void destroyPredictors() {
|
||||
mAllAppsState.destroyPredictor();
|
||||
mHotseatState.destroyPredictor();
|
||||
mAllPredictionAppsState.destroyPredictor();
|
||||
mHotseatPredictionState.destroyPredictor();
|
||||
mWidgetsRecommendationState.destroyPredictor();
|
||||
}
|
||||
|
||||
@@ -377,251 +309,82 @@ public class QuickstepModelDelegate extends ModelDelegate {
|
||||
return;
|
||||
}
|
||||
|
||||
int usagePerm = mContext.checkCallingOrSelfPermission(Manifest.permission.PACKAGE_USAGE_STATS);
|
||||
int usagePerm = mContext.checkCallingOrSelfPermission(PACKAGE_USAGE_STATS);
|
||||
if (usagePerm != PackageManager.PERMISSION_GRANTED)
|
||||
return;
|
||||
|
||||
registerPredictor(mAllAppsState, apm.createAppPredictionSession(
|
||||
mAllPredictionAppsState.registerPredictor(mContext,
|
||||
new AppPredictionContext.Builder(mContext)
|
||||
.setUiSurface("home")
|
||||
.setPredictedTargetCount(mIDP.numDatabaseAllAppsColumns)
|
||||
.build()));
|
||||
.setUiSurface("home")
|
||||
.setPredictedTargetCount(mIDP.numDatabaseAllAppsColumns)
|
||||
.build(),
|
||||
mModel,
|
||||
PredictionUpdateTask::new);
|
||||
|
||||
|
||||
// TODO: get bundle
|
||||
registerHotseatPredictor(apm, mContext);
|
||||
registerHotseatPredictor(mContext);
|
||||
|
||||
registerWidgetsPredictor(apm.createAppPredictionSession(
|
||||
mWidgetsRecommendationState.registerPredictor(mContext,
|
||||
new AppPredictionContext.Builder(mContext)
|
||||
.setUiSurface("widgets")
|
||||
.setExtras(getBundleForWidgetsOnWorkspace(mContext, mDataModel))
|
||||
.setPredictedTargetCount(NUM_OF_RECOMMENDED_WIDGETS_PREDICATION)
|
||||
.build()));
|
||||
.setUiSurface("widgets")
|
||||
.setExtras(getBundleForWidgetPredictions(mContext, mDataModel))
|
||||
.setPredictedTargetCount(NUM_OF_RECOMMENDED_WIDGETS_PREDICATION)
|
||||
.build(),
|
||||
mModel,
|
||||
WidgetsPredictionUpdateTask::new);
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private void recreateHotseatPredictor() {
|
||||
mHotseatState.destroyPredictor();
|
||||
if (!mActive) {
|
||||
return;
|
||||
}
|
||||
mHotseatPredictionState.destroyPredictor();
|
||||
|
||||
AppPredictionManager apm = mContext.getSystemService(AppPredictionManager.class);
|
||||
if (apm == null) {
|
||||
return;
|
||||
if (apm == null) return;
|
||||
|
||||
int usagePerm = mContext.checkCallingOrSelfPermission(PACKAGE_USAGE_STATS);
|
||||
if (usagePerm != PackageManager.PERMISSION_GRANTED) return;
|
||||
|
||||
if (mActive) {
|
||||
registerHotseatPredictor(mContext);
|
||||
}
|
||||
registerHotseatPredictor(apm, mContext);
|
||||
}
|
||||
|
||||
private void registerHotseatPredictor(AppPredictionManager apm, Context context) {
|
||||
registerPredictor(mHotseatState, apm.createAppPredictionSession(
|
||||
private void registerHotseatPredictor(Context context) {
|
||||
mHotseatPredictionState.registerPredictor(context,
|
||||
new AppPredictionContext.Builder(context)
|
||||
.setUiSurface("hotseat")
|
||||
.setPredictedTargetCount(mIDP.numDatabaseHotseatIcons)
|
||||
.setExtras(convertDataModelToAppTargetBundle(context, mDataModel))
|
||||
.build()));
|
||||
}
|
||||
|
||||
private void registerPredictor(PredictorState state, AppPredictor predictor) {
|
||||
state.setTargets(Collections.emptyList());
|
||||
state.predictor = predictor;
|
||||
state.predictor.registerPredictionUpdates(
|
||||
MODEL_EXECUTOR, t -> handleUpdate(state, t));
|
||||
state.predictor.requestPredictionUpdate();
|
||||
}
|
||||
|
||||
private void handleUpdate(PredictorState state, List<AppTarget> targets) {
|
||||
if (state.setTargets(targets)) {
|
||||
// No diff, skip
|
||||
return;
|
||||
}
|
||||
mModel.enqueueModelUpdateTask(new PredictionUpdateTask(state, targets));
|
||||
}
|
||||
|
||||
private void registerWidgetsPredictor(AppPredictor predictor) {
|
||||
mWidgetsRecommendationState.predictor = predictor;
|
||||
mWidgetsRecommendationState.predictor.registerPredictionUpdates(
|
||||
MODEL_EXECUTOR, targets -> {
|
||||
if (mWidgetsRecommendationState.setTargets(targets)) {
|
||||
// No diff, skip
|
||||
return;
|
||||
}
|
||||
mModel.enqueueModelUpdateTask(
|
||||
new WidgetsPredictionUpdateTask(mWidgetsRecommendationState, targets));
|
||||
});
|
||||
mWidgetsRecommendationState.predictor.requestPredictionUpdate();
|
||||
.setUiSurface("hotseat")
|
||||
.setPredictedTargetCount(mIDP.numDatabaseHotseatIcons)
|
||||
.setExtras(getBundleForHotseatPredictions(context, mDataModel))
|
||||
.build(),
|
||||
mModel, PredictionUpdateTask::new);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void onAppTargetEvent(AppTargetEvent event, int client) {
|
||||
PredictorState state;
|
||||
switch(client) {
|
||||
case CONTAINER_PREDICTION:
|
||||
state = mAllAppsState;
|
||||
case CONTAINER_ALL_APPS_PREDICTION:
|
||||
state = mAllPredictionAppsState;
|
||||
break;
|
||||
case CONTAINER_WIDGETS_PREDICTION:
|
||||
state = mWidgetsRecommendationState;
|
||||
break;
|
||||
case CONTAINER_HOTSEAT_PREDICTION:
|
||||
default:
|
||||
state = mHotseatState;
|
||||
state = mHotseatPredictionState;
|
||||
break;
|
||||
}
|
||||
if (state.predictor != null) {
|
||||
state.predictor.notifyAppTargetEvent(event);
|
||||
Log.d(TAG, "notifyAppTargetEvent action=" + event.getAction()
|
||||
+ " launchLocation=" + event.getLaunchLocation());
|
||||
if (state == mHotseatState
|
||||
&& (event.getAction() == AppTargetEvent.ACTION_PIN
|
||||
|| event.getAction() == AppTargetEvent.ACTION_UNPIN)) {
|
||||
// Recreate hot seat predictor when we need to query for hot seat due to pin or
|
||||
// unpin app icons.
|
||||
recreateHotseatPredictor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Bundle getBundleForWidgetsOnWorkspace(Context context, BgDataModel dataModel) {
|
||||
Bundle bundle = new Bundle();
|
||||
ArrayList<AppTargetEvent> widgetEvents =
|
||||
dataModel.itemsIdMap.stream()
|
||||
.filter(PredictionHelper::isTrackedForWidgetPrediction)
|
||||
.map(item -> {
|
||||
AppTarget target = getAppTargetFromItemInfo(context, item);
|
||||
if (target == null) return null;
|
||||
return wrapAppTargetWithItemLocation(
|
||||
target, AppTargetEvent.ACTION_PIN, item);
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.collect(toCollection(ArrayList::new));
|
||||
bundle.putParcelableArrayList(BUNDLE_KEY_ADDED_APP_WIDGETS, widgetEvents);
|
||||
return bundle;
|
||||
}
|
||||
|
||||
static class PredictorState {
|
||||
|
||||
public final int containerId;
|
||||
public final PersistedItemArray<ItemInfo> storage;
|
||||
public AppPredictor predictor;
|
||||
public CacheLookupFlag lookupFlag;
|
||||
|
||||
private List<AppTarget> mLastTargets;
|
||||
|
||||
PredictorState(int containerId, String storageName, CacheLookupFlag lookupFlag) {
|
||||
this.containerId = containerId;
|
||||
storage = new PersistedItemArray<>(storageName);
|
||||
mLastTargets = Collections.emptyList();
|
||||
this.lookupFlag = lookupFlag;
|
||||
}
|
||||
|
||||
public void destroyPredictor() {
|
||||
if (predictor != null) {
|
||||
predictor.destroy();
|
||||
predictor = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the new targets and returns true if it was the same as before.
|
||||
*/
|
||||
boolean setTargets(List<AppTarget> newTargets) {
|
||||
List<AppTarget> oldTargets = mLastTargets;
|
||||
mLastTargets = newTargets;
|
||||
|
||||
int size = oldTargets.size();
|
||||
return size == newTargets.size() && IntStream.range(0, size)
|
||||
.allMatch(i -> areAppTargetsSame(oldTargets.get(i), newTargets.get(i)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two targets for the properties which we care about
|
||||
*/
|
||||
private static boolean areAppTargetsSame(AppTarget t1, AppTarget t2) {
|
||||
if (!Objects.equals(t1.getPackageName(), t2.getPackageName())
|
||||
|| !Objects.equals(t1.getUser(), t2.getUser())
|
||||
|| !Objects.equals(t1.getClassName(), t2.getClassName())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ShortcutInfo s1 = t1.getShortcutInfo();
|
||||
ShortcutInfo s2 = t2.getShortcutInfo();
|
||||
if (s1 != null) {
|
||||
if (s2 == null || !Objects.equals(s1.getId(), s2.getId())) {
|
||||
return false;
|
||||
}
|
||||
} else if (s2 != null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static class WorkspaceItemFactory implements PersistedItemArray.ItemFactory<ItemInfo> {
|
||||
|
||||
private final Context mContext;
|
||||
private final UserManagerState mUMS;
|
||||
private final PackageManagerHelper mPmHelper;
|
||||
private final Map<ShortcutKey, ShortcutInfo> mPinnedShortcuts;
|
||||
private final int mMaxCount;
|
||||
private final int mContainer;
|
||||
private final CacheLookupFlag mLookupFlag;
|
||||
|
||||
private int mReadCount = 0;
|
||||
|
||||
protected WorkspaceItemFactory(
|
||||
Context context, UserManagerState ums,
|
||||
PackageManagerHelper pmHelper, Map<ShortcutKey, ShortcutInfo> pinnedShortcuts,
|
||||
int maxCount, int container, CacheLookupFlag lookupFlag) {
|
||||
mContext = context;
|
||||
mUMS = ums;
|
||||
mPmHelper = pmHelper;
|
||||
mPinnedShortcuts = pinnedShortcuts;
|
||||
mMaxCount = maxCount;
|
||||
mContainer = container;
|
||||
mLookupFlag = lookupFlag;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemInfo createInfo(int itemType, UserHandle user, Intent intent) {
|
||||
if (mReadCount >= mMaxCount) {
|
||||
return null;
|
||||
}
|
||||
switch (itemType) {
|
||||
case ITEM_TYPE_APPLICATION: {
|
||||
LauncherActivityInfo lai = mContext
|
||||
.getSystemService(LauncherApps.class)
|
||||
.resolveActivity(intent, user);
|
||||
if (lai == null) {
|
||||
return null;
|
||||
}
|
||||
AppInfo info = new AppInfo(
|
||||
lai,
|
||||
UserCache.INSTANCE.get(mContext).getUserInfo(user),
|
||||
ApiWrapper.INSTANCE.get(mContext),
|
||||
mPmHelper,
|
||||
mUMS.isUserQuiet(user));
|
||||
info.container = mContainer;
|
||||
LauncherAppState.getInstance(mContext).getIconCache()
|
||||
.getTitleAndIcon(info, lai, mLookupFlag);
|
||||
mReadCount++;
|
||||
return info.makeWorkspaceItem(mContext);
|
||||
}
|
||||
case ITEM_TYPE_DEEP_SHORTCUT: {
|
||||
ShortcutKey key = ShortcutKey.fromIntent(intent, user);
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
ShortcutInfo si = mPinnedShortcuts.get(key);
|
||||
if (si == null) {
|
||||
return null;
|
||||
}
|
||||
WorkspaceItemInfo wii = new WorkspaceItemInfo(si, mContext);
|
||||
wii.container = mContainer;
|
||||
LauncherAppState.getInstance(mContext).getIconCache().getShortcutIcon(wii, si);
|
||||
mReadCount++;
|
||||
return wii;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
state.notifyAppTargetEvent(event);
|
||||
Log.d(TAG, "notifyAppTargetEvent action=" + event.getAction()
|
||||
+ " launchLocation=" + event.getLaunchLocation());
|
||||
if (state == mHotseatPredictionState
|
||||
&& (event.getAction() == AppTargetEvent.ACTION_PIN
|
||||
|| event.getAction() == AppTargetEvent.ACTION_UNPIN)) {
|
||||
// Recreate hot seat predictor when we need to query for hot seat due to pin or
|
||||
// unpin app icons.
|
||||
recreateHotseatPredictor();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ import javax.inject.Inject;
|
||||
public final class WellbeingModel implements SafeCloseable {
|
||||
private static final String TAG = "WellbeingModel";
|
||||
private static final int[] RETRY_TIMES_MS = {5000, 15000, 30000};
|
||||
private static final boolean DEBUG = false;
|
||||
private static final boolean DEBUG = true;
|
||||
|
||||
// Welbeing contract
|
||||
private static final String PATH_ACTIONS = "actions";
|
||||
@@ -181,7 +181,7 @@ public final class WellbeingModel implements SafeCloseable {
|
||||
// Work profile apps are not recognized by digital wellbeing.
|
||||
if (userId != UserHandle.myUserId()) {
|
||||
if (DEBUG || mIsInTest) {
|
||||
Log.d(TAG, "getShortcutForApp [" + packageName + "]: not current user");
|
||||
Log.w(TAG, "getShortcutForApp [" + packageName + "]: not current user");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -191,12 +191,12 @@ public final class WellbeingModel implements SafeCloseable {
|
||||
final RemoteAction action = actionId != null ? mActionIdMap.get(actionId) : null;
|
||||
if (action == null) {
|
||||
if (DEBUG || mIsInTest) {
|
||||
Log.d(TAG, "getShortcutForApp [" + packageName + "]: no action");
|
||||
Log.w(TAG, "getShortcutForApp [" + packageName + "]: no action");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (DEBUG || mIsInTest) {
|
||||
Log.d(TAG,
|
||||
Log.w(TAG,
|
||||
"getShortcutForApp [" + packageName + "]: action: '" + action.getTitle()
|
||||
+ "'");
|
||||
}
|
||||
|
||||
@@ -31,9 +31,8 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.launcher3.LauncherModel.ModelUpdateTask;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
||||
import com.android.launcher3.model.QuickstepModelDelegate.PredictorState;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.PredictedContainerInfo;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.widget.PendingAddWidgetInfo;
|
||||
import com.android.launcher3.widget.picker.WidgetRecommendationCategoryProvider;
|
||||
@@ -134,11 +133,11 @@ public final class WidgetsPredictionUpdateTask implements ModelUpdateTask {
|
||||
.map(it -> new PendingAddWidgetInfo(it.widgetInfo, CONTAINER_WIDGETS_PREDICTION,
|
||||
categoryProvider.getWidgetRecommendationCategory(context, it)))
|
||||
.collect(Collectors.toList());
|
||||
FixedContainerItems fixedContainerItems =
|
||||
new FixedContainerItems(mPredictorState.containerId, items);
|
||||
PredictedContainerInfo pci =
|
||||
new PredictedContainerInfo(mPredictorState.containerId, items);
|
||||
|
||||
dataModel.extraItems.put(mPredictorState.containerId, fixedContainerItems);
|
||||
taskController.bindExtraContainerItems(fixedContainerItems);
|
||||
dataModel.updateAndDispatchItem(pci /* item */, null /* owner */);
|
||||
taskController.bindUpdatedWorkspaceItems(Collections.singleton(pci));
|
||||
|
||||
// Don't store widgets prediction to disk because it is not used frequently.
|
||||
}
|
||||
|
||||
@@ -33,12 +33,12 @@ import android.view.ViewTreeObserver;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.BaseActivity;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.statemanager.StateManager.StateHandler;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
import com.android.quickstep.util.BaseDepthController;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
@@ -68,12 +68,13 @@ public class DepthController extends BaseDepthController implements StateHandler
|
||||
// Ensure {@link mOnDrawListener} is added only once to avoid spamming DragLayer's mRunQueue
|
||||
// via {@link View#post(Runnable)}
|
||||
private boolean mIsOnDrawListenerAdded = false;
|
||||
private boolean mRemoveOnDrawListenerCancelled = false;
|
||||
|
||||
private final boolean mEnableDepth;
|
||||
|
||||
public DepthController(Launcher l) {
|
||||
super(l);
|
||||
var pref = PreferenceManager2.getInstance(l).getWallpaperDepthEffect();
|
||||
public DepthController(QuickstepLauncher launcher) {
|
||||
super(launcher);
|
||||
var pref = PreferenceManager2.getInstance(launcher).getWallpaperDepthEffect();
|
||||
mEnableDepth = PreferenceExtensionsKt.firstBlocking(pref);
|
||||
}
|
||||
|
||||
@@ -87,7 +88,12 @@ public class DepthController extends BaseDepthController implements StateHandler
|
||||
} catch (Throwable t) {
|
||||
// LC-Ignored
|
||||
}
|
||||
view.post(this::removeOnDrawListener);
|
||||
mRemoveOnDrawListenerCancelled = false;
|
||||
view.post(() -> {
|
||||
if (!mRemoveOnDrawListenerCancelled) {
|
||||
removeOnDrawListener();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ensureDependencies() {
|
||||
@@ -159,6 +165,7 @@ public class DepthController extends BaseDepthController implements StateHandler
|
||||
} else {
|
||||
removeOnDrawListener();
|
||||
setBaseSurface(null);
|
||||
setEarlyWakeup(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,6 +213,7 @@ public class DepthController extends BaseDepthController implements StateHandler
|
||||
}
|
||||
|
||||
private void addOnDrawListener() {
|
||||
mRemoveOnDrawListenerCancelled = true;
|
||||
if (mIsOnDrawListenerAdded) {
|
||||
return;
|
||||
}
|
||||
@@ -214,6 +222,7 @@ public class DepthController extends BaseDepthController implements StateHandler
|
||||
}
|
||||
|
||||
private void removeOnDrawListener() {
|
||||
mRemoveOnDrawListenerCancelled = true;
|
||||
if (!mIsOnDrawListenerAdded) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@ import android.util.SparseArray
|
||||
import android.view.Display.DEFAULT_DISPLAY
|
||||
import android.window.DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY
|
||||
import androidx.core.util.forEach
|
||||
import com.android.internal.util.LatencyTracker
|
||||
import com.android.launcher3.LauncherState
|
||||
//import com.android.launcher3.R
|
||||
import com.android.launcher3.dagger.ApplicationContext
|
||||
import com.android.launcher3.dagger.LauncherAppComponent
|
||||
import com.android.launcher3.dagger.LauncherAppSingleton
|
||||
@@ -46,6 +48,8 @@ import java.io.PrintWriter
|
||||
import java.lang.ref.WeakReference
|
||||
import javax.inject.Inject
|
||||
|
||||
import com.android.wm.shell.R as SharedR
|
||||
|
||||
/**
|
||||
* Controls the visibility of the workspace and the resumed / paused state when desktop mode is
|
||||
* enabled.
|
||||
@@ -175,7 +179,7 @@ constructor(
|
||||
private var desktopTaskListener: DesktopTaskListenerImpl?
|
||||
|
||||
init {
|
||||
desktopTaskListener = DesktopTaskListenerImpl(this, context, context.displayId)
|
||||
desktopTaskListener = DesktopTaskListenerImpl(this, context)
|
||||
systemUiProxy.setDesktopTaskListener(desktopTaskListener)
|
||||
|
||||
lifecycleTracker.addCloseable {
|
||||
@@ -543,9 +547,16 @@ constructor(
|
||||
return
|
||||
}
|
||||
|
||||
getDisplayDeskConfig(displayId)?.also {
|
||||
check(it.deskIds.add(deskId)) {
|
||||
"Found a duplicate desk Id: $deskId on display: $displayId"
|
||||
// Add the config for the desk if there is nothing yet, as the display can start without any
|
||||
// desks.
|
||||
if (getDisplayDeskConfig(displayId) == null) {
|
||||
displaysDesksConfigsMap[displayId] =
|
||||
DisplayDeskConfig(displayId, INACTIVE_DESK_ID, mutableSetOf(deskId))
|
||||
} else {
|
||||
getDisplayDeskConfig(displayId)!!.also {
|
||||
check(it.deskIds.add(deskId)) {
|
||||
"Found a duplicate desk Id: $deskId on display: $displayId"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -574,8 +585,6 @@ constructor(
|
||||
return
|
||||
}
|
||||
|
||||
val wasInDesktopMode = isInDesktopModeAndNotInOverview(displayId)
|
||||
|
||||
getDisplayDeskConfig(displayId)?.also {
|
||||
check(oldActiveDesk == it.activeDeskId) {
|
||||
"Mismatch between the Shell's oldActiveDesk: $oldActiveDesk, and Launcher's: ${it.activeDeskId}"
|
||||
@@ -590,8 +599,20 @@ constructor(
|
||||
notifyOnActiveDeskChanged(displayId, newActiveDesk, oldActiveDesk)
|
||||
}
|
||||
|
||||
if (wasInDesktopMode != isInDesktopModeAndNotInOverview(displayId)) {
|
||||
notifyIsInDesktopModeChanged(displayId, !wasInDesktopMode)
|
||||
if (
|
||||
(newActiveDesk == INACTIVE_DESK_ID || oldActiveDesk == INACTIVE_DESK_ID) &&
|
||||
!launcherAnimationRunning
|
||||
) {
|
||||
val duration = context.resources.getInteger(SharedR.integer.to_desktop_animation_duration_ms)
|
||||
if (oldActiveDesk == INACTIVE_DESK_ID && newActiveDesk != INACTIVE_DESK_ID) {
|
||||
notifyTaskbarDesktopModeListenersForEntry(duration)
|
||||
} else if (newActiveDesk == INACTIVE_DESK_ID && oldActiveDesk != INACTIVE_DESK_ID) {
|
||||
notifyTaskbarDesktopModeListenersForExit(duration)
|
||||
} else {
|
||||
// do nothing because user switch between two desktop.
|
||||
}
|
||||
} else {
|
||||
isNotifyingDesktopVisibilityPending = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -645,9 +666,9 @@ constructor(
|
||||
private class DesktopTaskListenerImpl(
|
||||
controller: DesktopVisibilityController,
|
||||
@ApplicationContext private val context: Context,
|
||||
private val displayId: Int,
|
||||
) : Stub() {
|
||||
private val controller = WeakReference(controller)
|
||||
private val displayId = context.displayId
|
||||
|
||||
override fun onListenerConnected(
|
||||
displayDeskStates: Array<DisplayDeskState>,
|
||||
@@ -658,7 +679,9 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Not needed by multi-desks")
|
||||
override fun onTasksVisibilityChanged(displayId: Int, visibleTasksCount: Int) {
|
||||
if (enableMultipleDesktops(context)) return
|
||||
if (displayId != this.displayId) return
|
||||
MAIN_EXECUTOR.execute {
|
||||
controller.get()?.apply {
|
||||
@@ -688,9 +711,9 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: b/402496827 - The multi-desks backend needs to be updated to call this API only
|
||||
// once, not between desk switches.
|
||||
@Deprecated("Not needed by multi-desks")
|
||||
override fun onEnterDesktopModeTransitionStarted(transitionDuration: Int) {
|
||||
if (enableMultipleDesktops(context)) return
|
||||
val controller = controller.get() ?: return
|
||||
MAIN_EXECUTOR.execute {
|
||||
Log.d(
|
||||
@@ -699,18 +722,19 @@ constructor(
|
||||
"duration= " +
|
||||
transitionDuration),
|
||||
)
|
||||
if (enableMultipleDesktops(context)) {
|
||||
controller.notifyTaskbarDesktopModeListenersForEntry(transitionDuration)
|
||||
} else if (!controller.isInDesktopModeDeprecated) {
|
||||
if (!controller.isInDesktopModeDeprecated) {
|
||||
controller.isInDesktopModeDeprecated = true
|
||||
controller.notifyTaskbarDesktopModeListenersForEntry(transitionDuration)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: b/402496827 - The multi-desks backend needs to be updated to call this API only
|
||||
// once, not between desk switches.
|
||||
override fun onExitDesktopModeTransitionStarted(transitionDuration: Int) {
|
||||
@Deprecated("Not needed by multi-desks")
|
||||
override fun onExitDesktopModeTransitionStarted(
|
||||
transitionDuration: Int,
|
||||
shouldEndUpAtHome: Boolean,
|
||||
) {
|
||||
if (enableMultipleDesktops(context)) return
|
||||
val controller = controller.get() ?: return
|
||||
MAIN_EXECUTOR.execute {
|
||||
Log.d(
|
||||
@@ -719,9 +743,17 @@ constructor(
|
||||
"duration= " +
|
||||
transitionDuration),
|
||||
)
|
||||
if (enableMultipleDesktops(context)) {
|
||||
controller.notifyTaskbarDesktopModeListenersForExit(transitionDuration)
|
||||
} else if (controller.isInDesktopModeDeprecated) {
|
||||
// If shouldEndUpAtHome is true, desktop mode is ending from the user
|
||||
// closing/minimizing the last open window. If it's false, the display is
|
||||
// probably transitioning to an app's full screen mode instead so this metric
|
||||
// should not be logged.
|
||||
if (shouldEndUpAtHome) {
|
||||
LatencyTracker.getInstance(context)
|
||||
.onActionStart(
|
||||
LatencyTracker.ACTION_DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE
|
||||
)
|
||||
}
|
||||
if (controller.isInDesktopModeDeprecated) {
|
||||
controller.isInDesktopModeDeprecated = false
|
||||
controller.notifyTaskbarDesktopModeListenersForExit(transitionDuration)
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.launcher3.taskbar;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.graphics.Point;
|
||||
import android.os.UserHandle;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
@@ -32,13 +33,29 @@ import com.android.quickstep.SystemUiProxy;
|
||||
public abstract class BaseTaskbarContext extends BaseContext
|
||||
implements SystemShortcut.BubbleActivityStarter {
|
||||
|
||||
private final int mDisplayId;
|
||||
private final boolean mIsPrimaryDisplay;
|
||||
protected final LayoutInflater mLayoutInflater;
|
||||
|
||||
public BaseTaskbarContext(Context windowContext, boolean isPrimaryDisplay) {
|
||||
public BaseTaskbarContext(Context windowContext, int displayId, boolean isPrimaryDisplay) {
|
||||
super(windowContext, Themes.getActivityThemeRes(windowContext));
|
||||
mDisplayId = displayId;
|
||||
mIsPrimaryDisplay = isPrimaryDisplay;
|
||||
mLayoutInflater = LayoutInflater.from(this).cloneInContext(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDisplayId() {
|
||||
return mDisplayId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the taskbar is displayed on primary or external display.
|
||||
*/
|
||||
public final boolean isPrimaryDisplay() {
|
||||
return mIsPrimaryDisplay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether taskbar is transient or persistent. External displays will be persistent.
|
||||
*
|
||||
@@ -57,10 +74,17 @@ public abstract class BaseTaskbarContext extends BaseContext
|
||||
public abstract NavigationMode getNavigationMode();
|
||||
|
||||
/**
|
||||
* Returns whether the taskbar is in desktop mode.
|
||||
* Returns whether the taskbar is in desktop mode. Implies that some desktop tasks are currently
|
||||
* visible.
|
||||
*/
|
||||
public abstract boolean isInDesktopMode();
|
||||
|
||||
/**
|
||||
* Returns whether the taskbar is showing desktop tasks, which may happen even outside desktop
|
||||
* mode on freeform displays.
|
||||
*/
|
||||
public abstract boolean isTaskbarShowingDesktopTasks();
|
||||
|
||||
/**
|
||||
* Returns whether the taskbar is forced to be pinned when home is visible.
|
||||
*/
|
||||
@@ -73,9 +97,20 @@ public abstract class BaseTaskbarContext extends BaseContext
|
||||
public abstract boolean showDesktopTaskbarForFreeformDisplay();
|
||||
|
||||
/**
|
||||
* Returns whether the taskbar is displayed on primary or external display.
|
||||
* Returns screen size.
|
||||
*/
|
||||
public abstract boolean isPrimaryDisplay();
|
||||
public abstract Point getScreenSize();
|
||||
|
||||
/**
|
||||
* Returns display height.
|
||||
*/
|
||||
public abstract int getDisplayHeight();
|
||||
|
||||
/**
|
||||
* Notifies the context that the configuration has changed.
|
||||
*/
|
||||
public abstract void notifyConfigChanged();
|
||||
|
||||
|
||||
@Override
|
||||
public final LayoutInflater getLayoutInflater() {
|
||||
|
||||
@@ -88,10 +88,6 @@ public class FallbackTaskbarUIController
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
RecentsView recentsView = getRecentsView();
|
||||
if (recentsView != null) {
|
||||
recentsView.setTaskLaunchListener(null);
|
||||
}
|
||||
mRecentsContainer.setTaskbarUIController(null);
|
||||
mRecentsContainer.getStateManager().removeStateListener(mStateListener);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import static com.android.launcher3.Flags.enableAltTabKqsOnConnectedDisplays;
|
||||
import static android.window.DesktopModeFlags.ENABLE_TASKBAR_OVERFLOW;
|
||||
|
||||
import static com.android.launcher3.taskbar.TaskbarDesktopExperienceFlags.enableAltTabKqsFlatenning;
|
||||
import static com.android.launcher3.taskbar.TaskbarDesktopExperienceFlags.enableAltTabKqsOnConnectedDisplays;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.ComponentName;
|
||||
@@ -26,7 +29,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
|
||||
import com.android.launcher3.taskbar.overlay.TaskbarOverlayDragLayer;
|
||||
@@ -40,14 +42,17 @@ import com.android.quickstep.util.SingleTask;
|
||||
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.wm.shell.shared.desktopmode.DesktopState;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Handles initialization of the {@link KeyboardQuickSwitchViewController}.
|
||||
@@ -62,9 +67,6 @@ public final class KeyboardQuickSwitchController implements
|
||||
// Callback used to notify when the KQS view is closed.
|
||||
@Nullable private Runnable mOnClosed;
|
||||
|
||||
// Initialized on init
|
||||
@Nullable private RecentsModel mModel;
|
||||
|
||||
// Used to keep track of the last requested task list id, so that we do not request to load the
|
||||
// tasks again if we have already requested it and the task list has not changed
|
||||
private int mTaskListChangeId = -1;
|
||||
@@ -79,6 +81,8 @@ public final class KeyboardQuickSwitchController implements
|
||||
|
||||
// Initialized in init
|
||||
private TaskbarControllers mControllers;
|
||||
@Nullable private RecentsModel mModel;
|
||||
private boolean mIsProjectedMode;
|
||||
|
||||
@Nullable private KeyboardQuickSwitchViewController mQuickSwitchViewController;
|
||||
@Nullable private TaskbarOverlayContext mOverlayContext;
|
||||
@@ -90,6 +94,8 @@ public final class KeyboardQuickSwitchController implements
|
||||
public void init(@NonNull TaskbarControllers controllers) {
|
||||
mControllers = controllers;
|
||||
mModel = RecentsModel.INSTANCE.get(controllers.taskbarActivityContext);
|
||||
mIsProjectedMode = DesktopState.fromContext(
|
||||
mControllers.taskbarActivityContext).isProjectedMode();
|
||||
}
|
||||
|
||||
void onConfigurationChanged(@ActivityInfo.Config int configChanges) {
|
||||
@@ -161,16 +167,18 @@ public final class KeyboardQuickSwitchController implements
|
||||
final boolean shouldShowDesktopTasks = mControllers.taskbarDesktopModeController
|
||||
.shouldShowDesktopTasksInTaskbar();
|
||||
mExcludedTaskIds = taskIdsToExclude;
|
||||
mTaskListChangeId = mModel.getTasks((tasks) -> {
|
||||
processLoadedTasks(tasks, taskIdsToExclude);
|
||||
mQuickSwitchViewController.updateQuickSwitchView(
|
||||
mTasks,
|
||||
wasOpenedFromTaskbar ? 0 : mNumHiddenTasks,
|
||||
currentFocusIndexOverride,
|
||||
mHasDesktopTask,
|
||||
mWasDesktopTaskFilteredOut);
|
||||
}, shouldShowDesktopTasks ? RecentsFilterState.EMPTY_FILTER
|
||||
: RecentsFilterState.getDesktopTaskFilter());
|
||||
mTaskListChangeId = mModel.getTasks(
|
||||
shouldShowDesktopTasks ? RecentsFilterState.EMPTY_FILTER
|
||||
: RecentsFilterState.getDesktopTaskFilter(),
|
||||
(tasks) -> {
|
||||
processLoadedTasks(wasOpenedFromTaskbar, tasks, taskIdsToExclude);
|
||||
mQuickSwitchViewController.updateQuickSwitchView(
|
||||
mTasks,
|
||||
wasOpenedFromTaskbar ? 0 : mNumHiddenTasks,
|
||||
currentFocusIndexOverride,
|
||||
mHasDesktopTask,
|
||||
mWasDesktopTaskFilteredOut);
|
||||
});
|
||||
}
|
||||
|
||||
mQuickSwitchViewController.updateLayoutForSurface(wasOpenedFromTaskbar,
|
||||
@@ -184,7 +192,7 @@ public final class KeyboardQuickSwitchController implements
|
||||
}
|
||||
|
||||
mOverlayContext = mControllers.taskbarOverlayController.requestWindow();
|
||||
if (Flags.taskbarOverflow()) {
|
||||
if (ENABLE_TASKBAR_OVERFLOW.isTrue()) {
|
||||
mOverlayContext.getDragLayer().addTouchController(this);
|
||||
}
|
||||
KeyboardQuickSwitchView keyboardQuickSwitchView =
|
||||
@@ -217,46 +225,104 @@ public final class KeyboardQuickSwitchController implements
|
||||
}
|
||||
|
||||
mExcludedTaskIds = taskIdsToExclude;
|
||||
mTaskListChangeId = mModel.getTasks((tasks) -> {
|
||||
processLoadedTasks(tasks, taskIdsToExclude);
|
||||
// Check if the first task is running after the recents model has updated so that we use
|
||||
// the correct index.
|
||||
mQuickSwitchViewController.openQuickSwitchView(
|
||||
mTasks,
|
||||
wasOpenedFromTaskbar ? 0 : mNumHiddenTasks,
|
||||
/* updateTasks= */ true,
|
||||
currentFocusedIndex == -1 && !mControllerCallbacks.isFirstTaskRunning()
|
||||
? 0 : currentFocusedIndex,
|
||||
shouldShowDesktopTasks,
|
||||
mHasDesktopTask,
|
||||
mWasDesktopTaskFilteredOut,
|
||||
wasOpenedFromTaskbar);
|
||||
}, shouldShowDesktopTasks ? RecentsFilterState.EMPTY_FILTER
|
||||
: RecentsFilterState.getDesktopTaskFilter());
|
||||
mTaskListChangeId = mModel.getTasks(
|
||||
shouldShowDesktopTasks ? RecentsFilterState.EMPTY_FILTER
|
||||
: RecentsFilterState.getDesktopTaskFilter(),
|
||||
(tasks) -> {
|
||||
processLoadedTasks(wasOpenedFromTaskbar, tasks, taskIdsToExclude);
|
||||
// Check if the first task is running after the recents model has updated so
|
||||
// that we use the correct index.
|
||||
mQuickSwitchViewController.openQuickSwitchView(
|
||||
mTasks,
|
||||
wasOpenedFromTaskbar ? 0 : mNumHiddenTasks,
|
||||
/* updateTasks= */ true,
|
||||
currentFocusedIndex == -1 && !mControllerCallbacks.isFirstTaskRunning()
|
||||
? 0 : currentFocusedIndex,
|
||||
shouldShowDesktopTasks,
|
||||
mHasDesktopTask,
|
||||
mWasDesktopTaskFilteredOut,
|
||||
wasOpenedFromTaskbar);
|
||||
});
|
||||
}
|
||||
|
||||
private boolean shouldExcludeTask(GroupTask task, Set<Integer> taskIdsToExclude) {
|
||||
return Flags.taskbarOverflow() && task.getTasks().stream().anyMatch(
|
||||
t -> taskIdsToExclude.contains(t.key.id));
|
||||
private boolean shouldIncludeTask(GroupTask task, Set<Integer> taskIdsToExclude) {
|
||||
return !ENABLE_TASKBAR_OVERFLOW.isTrue()
|
||||
|| task.getTasks().stream().noneMatch(t -> taskIdsToExclude.contains(t.key.id));
|
||||
}
|
||||
|
||||
private void processLoadedTasks(List<GroupTask> tasks, Set<Integer> taskIdsToExclude) {
|
||||
private void processLoadedTasks(boolean openedFromTaskbar, List<GroupTask> tasks,
|
||||
Set<Integer> taskIdsToExclude) {
|
||||
mHasDesktopTask = false;
|
||||
mWasDesktopTaskFilteredOut = false;
|
||||
if (mControllers.taskbarDesktopModeController.shouldShowDesktopTasksInTaskbar()) {
|
||||
|
||||
if (enableAltTabKqsFlatenning.isTrue() && !openedFromTaskbar) {
|
||||
processLoadedTasksCombined(tasks, taskIdsToExclude);
|
||||
} else if (mControllers.taskbarDesktopModeController.shouldShowDesktopTasksInTaskbar()) {
|
||||
processLoadedTasksOnDesktop(tasks, taskIdsToExclude);
|
||||
} else {
|
||||
processLoadedTasksOutsideDesktop(tasks, taskIdsToExclude);
|
||||
}
|
||||
}
|
||||
|
||||
private void processLoadedTasksCombined(List<GroupTask> tasks, Set<Integer> taskIdsToExclude) {
|
||||
List<GroupTask> allTasks = tasks.stream()
|
||||
.flatMap(task -> {
|
||||
// In case of DesktopTasks, convert each contained task into a new DesktopTask
|
||||
// this way the view controller will be able to show a thumbnail in KQS view.
|
||||
if (task instanceof DesktopTask desktopTask) {
|
||||
return desktopTask.getTasks().stream()
|
||||
.map(singleTask -> new DesktopTask(desktopTask.getDeskId(),
|
||||
desktopTask.getDisplayId(), List.of(singleTask)));
|
||||
}
|
||||
|
||||
return Stream.of(task);
|
||||
})
|
||||
.filter(task -> shouldIncludeTask(task, taskIdsToExclude))
|
||||
.filter(this::shouldIncludeTaskBasedOnProjectedMode)
|
||||
.toList();
|
||||
|
||||
mTasks = allTasks.stream()
|
||||
.sorted(combinedTasksComparator())
|
||||
.limit(MAX_TASKS)
|
||||
.toList();
|
||||
mNumHiddenTasks = Math.max(0, allTasks.size() - MAX_TASKS);
|
||||
}
|
||||
|
||||
private boolean shouldIncludeTaskBasedOnProjectedMode(GroupTask task) {
|
||||
// When not in projected mode, include tasks from all displays
|
||||
if (!mIsProjectedMode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int primaryDisplayId = mControllers.taskbarActivityContext.getPrimaryDisplayId();
|
||||
|
||||
// When on primary device in projected mode, only show tasks from the primary device.
|
||||
if (mControllers.taskbarActivityContext.isPrimaryDisplay()) {
|
||||
return task.getDisplayId() == primaryDisplayId;
|
||||
}
|
||||
|
||||
// When on connected display with primary device in projected mode, only include tasks that
|
||||
// are not on primary device.
|
||||
return task.getDisplayId() != primaryDisplayId;
|
||||
}
|
||||
|
||||
private static Comparator<GroupTask> combinedTasksComparator() {
|
||||
return Comparator.comparingLong((GroupTask groupTask) ->
|
||||
groupTask.getTasks().stream()
|
||||
.map(task -> task.key.lastActiveTime)
|
||||
.max(Comparator.naturalOrder())
|
||||
// Empty tasks list shouldn't be possible so return -1 in that case.
|
||||
.orElse(-1L))
|
||||
.reversed();
|
||||
}
|
||||
|
||||
private void processLoadedTasksOutsideDesktop(List<GroupTask> tasks,
|
||||
Set<Integer> taskIdsToExclude) {
|
||||
// Only store MAX_TASK tasks, from most to least recent
|
||||
Collections.reverse(tasks);
|
||||
mTasks = tasks.stream()
|
||||
.filter(task -> !(task instanceof DesktopTask)
|
||||
&& !shouldExcludeTask(task, taskIdsToExclude))
|
||||
&& shouldIncludeTask(task, taskIdsToExclude))
|
||||
.limit(MAX_TASKS)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -285,18 +351,18 @@ public final class KeyboardQuickSwitchController implements
|
||||
// multiple desktops flag disabled. So, until multiple desktops is implemented the following
|
||||
// should help with team-fooding Alt+tab on connected displays. Post multiple desktop,
|
||||
// further changes maybe required to support launching selected desktops.
|
||||
if (enableAltTabKqsOnConnectedDisplays()) {
|
||||
if (enableAltTabKqsOnConnectedDisplays.isTrue()) {
|
||||
mTasks = desktopTasks.stream()
|
||||
.flatMap(t -> t.getTasks().stream())
|
||||
.map(SingleTask::new)
|
||||
.filter(task -> !shouldExcludeTask(task, taskIdsToExclude))
|
||||
.filter(task -> shouldIncludeTask(task, taskIdsToExclude))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
mNumHiddenTasks = Math.max(0, tasks.size() - desktopTasks.size());
|
||||
} else if (!desktopTasks.isEmpty()) {
|
||||
mTasks = desktopTasks.get(0).getTasks().stream()
|
||||
.map(SingleTask::new)
|
||||
.filter(task -> !shouldExcludeTask(task, taskIdsToExclude))
|
||||
.filter(task -> shouldIncludeTask(task, taskIdsToExclude))
|
||||
.collect(Collectors.toList());
|
||||
// All other tasks, apart from the grouped desktop task, are hidden
|
||||
mNumHiddenTasks = Math.max(0, tasks.size() - 1);
|
||||
@@ -337,7 +403,7 @@ public final class KeyboardQuickSwitchController implements
|
||||
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
|
||||
if (mQuickSwitchViewController == null
|
||||
|| mOverlayContext == null
|
||||
|| !Flags.taskbarOverflow()) {
|
||||
|| !ENABLE_TASKBAR_OVERFLOW.isTrue()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -433,7 +499,7 @@ public final class KeyboardQuickSwitchController implements
|
||||
}
|
||||
|
||||
void onCloseComplete() {
|
||||
if (Flags.taskbarOverflow() && mOverlayContext != null) {
|
||||
if (ENABLE_TASKBAR_OVERFLOW.isTrue() && mOverlayContext != null) {
|
||||
mOverlayContext.getDragLayer()
|
||||
.removeTouchController(KeyboardQuickSwitchController.this);
|
||||
}
|
||||
@@ -461,7 +527,7 @@ public final class KeyboardQuickSwitchController implements
|
||||
|
||||
boolean isAspectRatioSquare() {
|
||||
return mControllers != null && LayoutUtils.isAspectRatioSquare(
|
||||
mControllers.taskbarActivityContext.getDeviceProfile().aspectRatio);
|
||||
mControllers.taskbarActivityContext.getDeviceProfile().getDeviceProperties().getAspectRatio());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,12 +36,12 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.util.Preconditions;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitBounds;
|
||||
import com.android.quickstep.util.BorderAnimator;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.wm.shell.shared.TypefaceUtils;
|
||||
import com.android.wm.shell.shared.TypefaceUtils.FontFamily;
|
||||
import com.android.wm.shell.shared.split.SplitBounds;
|
||||
|
||||
import kotlin.Unit;
|
||||
|
||||
|
||||
@@ -17,14 +17,21 @@ package com.android.launcher3.taskbar;
|
||||
|
||||
import static androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.PARENT_ID;
|
||||
|
||||
import static com.android.launcher3.taskbar.TaskbarDesktopExperienceFlags.enableAltTabKqsFlatenning;
|
||||
import static com.android.launcher3.taskbar.TaskbarDesktopExperienceFlags.enableAltTabKqsOnConnectedDisplays;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.icu.text.MessageFormat;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
@@ -50,8 +57,12 @@ import com.android.internal.jank.Cuj;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatedFloat;
|
||||
import com.android.launcher3.icons.GraphicsUtils;
|
||||
import com.android.launcher3.testing.TestLogging;
|
||||
import com.android.launcher3.testing.shared.TestProtocol;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.util.DesktopTask;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.quickstep.util.SingleTask;
|
||||
import com.android.quickstep.util.SplitTask;
|
||||
@@ -98,6 +109,11 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
|
||||
private static final long CONTENT_ALPHA_ANIMATION_DURATION_MS = 83;
|
||||
private static final long CONTENT_ALPHA_ANIMATION_START_DELAY_MS = 83;
|
||||
|
||||
private static final int DARK_THEME_STROKE_ALPHA = 51;
|
||||
private static final int LIGHT_THEME_STROKE_ALPHA = 41;
|
||||
private static final int DARK_THEME_SHADOW_ALPHA = 51;
|
||||
private static final int LIGHT_THEME_SHADOW_ALPHA = 25;
|
||||
|
||||
private final AnimatedFloat mOutlineAnimationProgress = new AnimatedFloat(
|
||||
this::invalidateOutline);
|
||||
|
||||
@@ -117,6 +133,14 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
|
||||
private int mOutlineRadius;
|
||||
private boolean mIsRtl;
|
||||
|
||||
// Used to paint a background with a shadow.
|
||||
private final Paint mBackgroundPaint = new Paint();
|
||||
private float mBackgroundShadowBlur;
|
||||
private float mBackgroundShadowDistance;
|
||||
private final Paint mStrokePaint = new Paint();
|
||||
private final RectF mLastBackgroundRect = new RectF();
|
||||
|
||||
|
||||
private int mOverviewTaskIndex = -1;
|
||||
private int mDesktopTaskIndex = -1;
|
||||
|
||||
@@ -179,11 +203,47 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
|
||||
|
||||
mIsRtl = Utilities.isRtl(resources);
|
||||
|
||||
mBackgroundPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
|
||||
mBackgroundPaint.setStyle(Paint.Style.FILL);
|
||||
mBackgroundPaint.setColor(
|
||||
Themes.getAttrColor(getContext(), R.attr.overviewScrimColorFallback));
|
||||
mBackgroundShadowBlur = resources.getDimension(R.dimen.transient_taskbar_shadow_blur);
|
||||
mBackgroundShadowDistance = resources.getDimension(
|
||||
R.dimen.transient_taskbar_key_shadow_distance);
|
||||
|
||||
|
||||
mStrokePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
|
||||
mStrokePaint.setStyle(Paint.Style.STROKE);
|
||||
mStrokePaint.setStrokeWidth(
|
||||
getResources().getDimension(R.dimen.transient_taskbar_stroke_width));
|
||||
mStrokePaint.setColor(
|
||||
getResources().getColor(R.color.taskbar_stroke, getContext().getTheme()));
|
||||
|
||||
TypefaceUtils.setTypeface(
|
||||
mNoRecentItemsPane.findViewById(R.id.no_recent_items_text),
|
||||
FontFamily.GSF_LABEL_LARGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
boolean isDarkTheme = Utilities.isDarkTheme(getContext());
|
||||
mStrokePaint.setAlpha(isDarkTheme ? DARK_THEME_STROKE_ALPHA : LIGHT_THEME_STROKE_ALPHA);
|
||||
|
||||
// Draw shadow.
|
||||
mBackgroundPaint.setShadowLayer(
|
||||
mBackgroundShadowBlur,
|
||||
0,
|
||||
mBackgroundShadowDistance,
|
||||
GraphicsUtils.setColorAlphaBound(Color.BLACK,
|
||||
isDarkTheme ? DARK_THEME_SHADOW_ALPHA : LIGHT_THEME_SHADOW_ALPHA));
|
||||
mLastBackgroundRect.set(0, 0, getWidth(), getHeight());
|
||||
|
||||
canvas.drawRoundRect(mLastBackgroundRect, mOutlineRadius, mOutlineRadius, mBackgroundPaint);
|
||||
canvas.drawRoundRect(mLastBackgroundRect, mOutlineRadius, mOutlineRadius, mStrokePaint);
|
||||
}
|
||||
|
||||
private void registerOnBackInvokedCallback() {
|
||||
OnBackInvokedDispatcher dispatcher = findOnBackInvokedDispatcher();
|
||||
|
||||
@@ -285,6 +345,10 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
|
||||
} else if (groupTask instanceof SingleTask singleTask) {
|
||||
task1 = singleTask.getTask();
|
||||
task2 = null;
|
||||
} else if (enableAltTabKqsFlatenning.isTrue()
|
||||
&& groupTask instanceof DesktopTask desktopTask) {
|
||||
task1 = desktopTask.getTasks().get(0);
|
||||
task2 = null;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
@@ -443,6 +507,9 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
|
||||
// Unregister the back invoked callback after the view is closed and before the
|
||||
// mViewCallbacks is reset.
|
||||
unregisterOnBackInvokedCallback();
|
||||
if (enableAltTabKqsOnConnectedDisplays.isTrue()) {
|
||||
SystemUiProxy.INSTANCE.get(getContext()).getFocusState().removeListener(mViewCallbacks);
|
||||
}
|
||||
mViewCallbacks = null;
|
||||
}
|
||||
|
||||
@@ -609,6 +676,10 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
|
||||
displayedContent.setVisibility(VISIBLE);
|
||||
setVisibility(VISIBLE);
|
||||
requestFocus();
|
||||
if (enableAltTabKqsOnConnectedDisplays.isTrue()) {
|
||||
SystemUiProxy.INSTANCE.get(getContext()).getFocusState().addListener(
|
||||
mViewCallbacks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+76
-25
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import static android.window.DesktopModeFlags.ENABLE_TASKBAR_OVERFLOW;
|
||||
|
||||
import static com.android.launcher3.desktop.DesktopAppLaunchTransition.AppLaunchType.UNMINIMIZE;
|
||||
import static com.android.launcher3.taskbar.TaskbarDesktopExperienceFlags.enableAltTabKqsFlatenning;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
@@ -34,7 +37,6 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.internal.jank.Cuj;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
@@ -42,7 +44,9 @@ import com.android.launcher3.desktop.DesktopAppLaunchTransition;
|
||||
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
|
||||
import com.android.launcher3.taskbar.overlay.TaskbarOverlayDragLayer;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
import com.android.quickstep.FocusState;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.util.DesktopTask;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.quickstep.util.SingleTask;
|
||||
import com.android.quickstep.util.SlideInRemoteTransition;
|
||||
@@ -50,6 +54,7 @@ import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
import com.android.wm.shell.shared.desktopmode.DesktopModeTransitionSource;
|
||||
import com.android.wm.shell.shared.desktopmode.DesktopTaskToFrontReason;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
@@ -120,7 +125,7 @@ public class KeyboardQuickSwitchViewController {
|
||||
mWasDesktopTaskFilteredOut = wasDesktopTaskFilteredOut;
|
||||
mWasOpenedFromTaskbar = wasOpenedFromTaskbar;
|
||||
|
||||
if (Flags.taskbarOverflow() && wasOpenedFromTaskbar) {
|
||||
if (ENABLE_TASKBAR_OVERFLOW.isTrue() && wasOpenedFromTaskbar) {
|
||||
mKeyboardQuickSwitchView.enableScrollArrowSupport();
|
||||
}
|
||||
|
||||
@@ -167,8 +172,9 @@ public class KeyboardQuickSwitchViewController {
|
||||
// Calculate the additional margin space that the KQS should move up for the transient
|
||||
// taskbar. The value of spaceForTaskbar is the distance between the bottom of the KQS
|
||||
// view with 0 bottom margin to the top of the transient taskbar view.
|
||||
final int spaceForTaskbar = isTransientTaskbar ? dp.taskbarHeight + dp.taskbarBottomMargin
|
||||
- dp.stashedTaskbarHeight : 0;
|
||||
final int spaceForTaskbar = isTransientTaskbar ? dp.getTaskbarProfile().getHeight()
|
||||
+ dp.getTaskbarProfile().getBottomMargin()
|
||||
- dp.getTaskbarProfile().getStashedTaskbarHeight() : 0;
|
||||
final int marginBottom = spaceForTaskbar + resources.getDimensionPixelSize(
|
||||
R.dimen.keyboard_quick_switch_margin_bottom);
|
||||
|
||||
@@ -252,23 +258,19 @@ public class KeyboardQuickSwitchViewController {
|
||||
// first hidden non-desktop task view in recents view
|
||||
return mOnDesktop ? 1 : (mWasDesktopTaskFilteredOut ? index + 1 : index);
|
||||
}
|
||||
Runnable onStartCallback = () -> InteractionJankMonitorWrapper.begin(
|
||||
mKeyboardQuickSwitchView, Cuj.CUJ_LAUNCHER_KEYBOARD_QUICK_SWITCH_APP_LAUNCH);
|
||||
Runnable onFinishCallback = () -> InteractionJankMonitorWrapper.end(
|
||||
Cuj.CUJ_LAUNCHER_KEYBOARD_QUICK_SWITCH_APP_LAUNCH);
|
||||
TaskbarActivityContext context = mControllers.taskbarActivityContext;
|
||||
final RemoteTransition slideInTransition = new RemoteTransition(new SlideInRemoteTransition(
|
||||
Utilities.isRtl(mControllers.taskbarActivityContext.getResources()),
|
||||
context.getDeviceProfile().overviewPageSpacing,
|
||||
context.getDeviceProfile().getOverviewProfile().getPageSpacing(),
|
||||
QuickStepContract.getWindowCornerRadius(context),
|
||||
AnimationUtils.loadInterpolator(
|
||||
context, android.R.interpolator.fast_out_extra_slow_in),
|
||||
onStartCallback,
|
||||
onFinishCallback),
|
||||
context, android.R.interpolator.fast_out_extra_slow_in)),
|
||||
"SlideInTransition");
|
||||
SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.get(
|
||||
mKeyboardQuickSwitchView.getContext());
|
||||
if (index == mKeyboardQuickSwitchView.getDesktopTaskIndex()) {
|
||||
UI_HELPER_EXECUTOR.execute(() ->
|
||||
SystemUiProxy.INSTANCE.get(mKeyboardQuickSwitchView.getContext())
|
||||
systemUiProxy
|
||||
.showDesktopApps(
|
||||
mKeyboardQuickSwitchView.getDisplay().getDisplayId(),
|
||||
slideInTransition));
|
||||
@@ -280,35 +282,77 @@ public class KeyboardQuickSwitchViewController {
|
||||
if (task == null) {
|
||||
return mOnDesktop ? 1 : Math.max(0, index);
|
||||
}
|
||||
|
||||
if (enableAltTabKqsFlatenning.isTrue()
|
||||
&& tryLaunchingCombinedTask(task, slideInTransition, systemUiProxy)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// TODO b/414410702: move this check to before tryLaunchingCombinedTask() call.
|
||||
if (mControllerCallbacks.isTaskRunning(task)) {
|
||||
// Ignore attempts to run the selected task if it is already running.
|
||||
return -1;
|
||||
}
|
||||
|
||||
RemoteTransition remoteTransition = slideInTransition;
|
||||
boolean canUnminimizeDesktopTask = task instanceof SingleTask singleTask
|
||||
&& mControllers.taskbarActivityContext.canUnminimizeDesktopTask(
|
||||
singleTask.getTask().key.id);
|
||||
if (mOnDesktop && canUnminimizeDesktopTask) {
|
||||
// This app is being unminimized - use our own transition runner.
|
||||
remoteTransition = new RemoteTransition(
|
||||
new DesktopAppLaunchTransition(
|
||||
context,
|
||||
UNMINIMIZE,
|
||||
Cuj.CUJ_DESKTOP_MODE_KEYBOARD_QUICK_SWITCH_APP_LAUNCH,
|
||||
MAIN_EXECUTOR
|
||||
),
|
||||
"DesktopKeyboardQuickSwitchUnminimize");
|
||||
remoteTransition = getUnminimizeTransition();
|
||||
}
|
||||
mControllers.taskbarActivityContext.handleGroupTaskLaunch(
|
||||
task,
|
||||
remoteTransition,
|
||||
mOnDesktop,
|
||||
DesktopTaskToFrontReason.ALT_TAB,
|
||||
onStartCallback,
|
||||
onFinishCallback);
|
||||
DesktopTaskToFrontReason.ALT_TAB);
|
||||
return -1;
|
||||
}
|
||||
|
||||
private boolean tryLaunchingCombinedTask(GroupTask task, RemoteTransition slideInTransition,
|
||||
SystemUiProxy systemUiProxy) {
|
||||
TaskbarActivityContext context = mControllers.taskbarActivityContext;
|
||||
int taskId = task.getTasks().getFirst().key.id;
|
||||
|
||||
// All DesktopTasks, irrespective of whether desktop mode is active, are launched here as
|
||||
// the class DesktopTask is used in a special way by KQS view for showing thumbnails of
|
||||
// freeform tasks.
|
||||
if (task instanceof DesktopTask desktopTask) {
|
||||
boolean canUnminimizeDesktopTask = context.canUnminimizeDesktopTask(taskId);
|
||||
UI_HELPER_EXECUTOR.execute(() -> {
|
||||
if (!mOnDesktop) {
|
||||
systemUiProxy.activateDesk(desktopTask.getDeskId(), slideInTransition);
|
||||
}
|
||||
|
||||
systemUiProxy.showDesktopApp(taskId,
|
||||
canUnminimizeDesktopTask ? getUnminimizeTransition() : null,
|
||||
DesktopTaskToFrontReason.ALT_TAB);
|
||||
});
|
||||
return true;
|
||||
} else if (mOnDesktop && task instanceof SingleTask) {
|
||||
// Use the special API if user wants to switch to a fullscreen app while in desktop.
|
||||
UI_HELPER_EXECUTOR.execute(
|
||||
() -> systemUiProxy.moveToFullscreen(taskId,
|
||||
DesktopModeTransitionSource.KEYBOARD_SHORTCUT, slideInTransition));
|
||||
return true;
|
||||
}
|
||||
|
||||
// For all other cases, let TaskbarActivityContext handle launching the task.
|
||||
return false;
|
||||
}
|
||||
|
||||
private RemoteTransition getUnminimizeTransition() {
|
||||
return new RemoteTransition(
|
||||
new DesktopAppLaunchTransition(
|
||||
mControllers.taskbarActivityContext,
|
||||
UNMINIMIZE,
|
||||
Cuj.CUJ_DESKTOP_MODE_KEYBOARD_QUICK_SWITCH_APP_LAUNCH,
|
||||
MAIN_EXECUTOR
|
||||
),
|
||||
"DesktopKeyboardQuickSwitchUnminimize");
|
||||
}
|
||||
|
||||
private void onCloseComplete() {
|
||||
mCloseAnimation = null;
|
||||
// Reset the view callbacks to prevent `onDetachedFromWindow` getting called in response to
|
||||
@@ -343,7 +387,7 @@ public class KeyboardQuickSwitchViewController {
|
||||
return dl.isEventOverView(mKeyboardQuickSwitchView, ev);
|
||||
}
|
||||
|
||||
class ViewCallbacks {
|
||||
class ViewCallbacks implements FocusState.FocusChangeListener {
|
||||
public final OnBackInvokedCallback onBackInvokedCallback = () -> closeQuickSwitchView(true);
|
||||
|
||||
boolean onKeyUp(int keyCode, KeyEvent event, boolean isRTL, boolean allowTraversal) {
|
||||
@@ -414,5 +458,12 @@ public class KeyboardQuickSwitchViewController {
|
||||
closeQuickSwitchView(false);
|
||||
mDetachingFromWindow = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFocusedDisplayChanged(int displayId) {
|
||||
if (mControllers.taskbarActivityContext.getDisplayId() != displayId) {
|
||||
closeQuickSwitchView(/* animate= */ true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,19 +48,19 @@ import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.MultiPropertyFactory;
|
||||
import com.android.launcher3.util.OnboardingPrefs;
|
||||
import com.android.quickstep.BaseContainerInterface;
|
||||
import com.android.quickstep.GestureState;
|
||||
import com.android.quickstep.HomeVisibilityState;
|
||||
import com.android.quickstep.LauncherActivityInterface;
|
||||
import com.android.quickstep.OverviewComponentObserver;
|
||||
import com.android.quickstep.RecentsAnimationCallbacks;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.fallback.window.RecentsDisplayModel;
|
||||
import com.android.quickstep.fallback.window.RecentsWindowFlags;
|
||||
import com.android.quickstep.fallback.window.RecentsWindowManager;
|
||||
import com.android.quickstep.util.SplitTask;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.quickstep.views.RecentsViewContainer;
|
||||
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
|
||||
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Arrays;
|
||||
@@ -120,23 +120,21 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
mTaskbarLauncherStateController.init(mControllers, mLauncher,
|
||||
mControllers.getSharedState().sysuiStateFlags);
|
||||
final TaskbarActivityContext taskbarContext = mControllers.taskbarActivityContext;
|
||||
if (RecentsWindowFlags.getEnableOverviewInWindow()) {
|
||||
mRecentsViewContainer = RecentsDisplayModel.getINSTANCE()
|
||||
.get(taskbarContext).getRecentsWindowManager(taskbarContext.getDisplayId());
|
||||
}
|
||||
if (mRecentsViewContainer == null) {
|
||||
int displayId = taskbarContext.getDisplayId();
|
||||
BaseContainerInterface<?, ?> containerInterface = OverviewComponentObserver.INSTANCE.get(
|
||||
taskbarContext).getContainerInterface(displayId);
|
||||
if (containerInterface != null
|
||||
&& containerInterface.getCreatedContainer()
|
||||
instanceof RecentsWindowManager recentsWindowManager) {
|
||||
mRecentsViewContainer = recentsWindowManager;
|
||||
mRecentsViewContainer.setTaskbarUIController(this);
|
||||
} else {
|
||||
mRecentsViewContainer = mLauncher;
|
||||
}
|
||||
mLauncher.setTaskbarUIController(this);
|
||||
if (mRecentsViewContainer != mLauncher) {
|
||||
mRecentsViewContainer.setTaskbarUIController(this);
|
||||
}
|
||||
|
||||
mHomeState.addListener(mVisibilityChangeListener);
|
||||
onLauncherVisibilityChanged(
|
||||
Flags.useActivityOverlay()
|
||||
? mHomeState.isHomeVisible() : mLauncher.hasBeenResumed(),
|
||||
true /* fromInit */);
|
||||
onLauncherVisibilityChanged(mHomeState.isHomeVisible(), true /* fromInit */);
|
||||
|
||||
onStashedInAppChanged(mLauncher.getDeviceProfile());
|
||||
mLauncher.addOnDeviceProfileChangeListener(mOnDeviceProfileChangeListener);
|
||||
@@ -224,8 +222,10 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
*/
|
||||
@Override
|
||||
public void onLauncherVisibilityChanged(boolean isVisible) {
|
||||
if (DesktopModeStatus.enterDesktopByDefaultOnFreeformDisplay(mLauncher)
|
||||
&& mControllers.taskbarActivityContext.isPrimaryDisplay()) {
|
||||
final TaskbarActivityContext taskbarContext = mControllers.taskbarActivityContext;
|
||||
if (taskbarContext.showLockedTaskbarOnHome()
|
||||
&& !taskbarContext.showDesktopTaskbarForFreeformDisplay()
|
||||
&& taskbarContext.isPrimaryDisplay()) {
|
||||
DisplayController.INSTANCE.get(mLauncher).notifyConfigChange();
|
||||
}
|
||||
|
||||
@@ -273,8 +273,8 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
}
|
||||
|
||||
if (!ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY.isTrue()
|
||||
&& mControllers.taskbarDesktopModeController
|
||||
.isInDesktopModeAndNotInOverview(mLauncher.getDisplayId())) {
|
||||
&& mControllers.taskbarDesktopModeController.isInDesktopModeAndNotInOverview(
|
||||
mControllers.taskbarActivityContext.getDisplayId())) {
|
||||
// TODO: b/333533253 - Remove after flag rollout
|
||||
isVisible = false;
|
||||
}
|
||||
@@ -293,8 +293,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
|
||||
@Override
|
||||
public void refreshResumedState() {
|
||||
onLauncherVisibilityChanged(Flags.useActivityOverlay()
|
||||
? mHomeState.isHomeVisible() : mLauncher.hasBeenResumed());
|
||||
onLauncherVisibilityChanged(mHomeState.isHomeVisible());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -351,7 +350,9 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
* app launch animation.
|
||||
*/
|
||||
public void setIgnoreInAppFlagForSync(boolean enabled) {
|
||||
if (syncAppLaunchWithTaskbarStash()) {
|
||||
if (syncAppLaunchWithTaskbarStash()
|
||||
&& mControllers != null
|
||||
&& mControllers.taskbarStashController != null) {
|
||||
mControllers.taskbarStashController.updateStateForFlag(FLAG_IGNORE_IN_APP, enabled);
|
||||
}
|
||||
}
|
||||
@@ -361,15 +362,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
mTaskbarLauncherStateController.applyState();
|
||||
}
|
||||
|
||||
public boolean isDraggingItem() {
|
||||
boolean bubblesDragging = false;
|
||||
if (mControllers.bubbleControllers.isPresent()) {
|
||||
bubblesDragging =
|
||||
mControllers.bubbleControllers.get().bubbleDragController.isDragging();
|
||||
}
|
||||
return mControllers.taskbarDragController.isDragging() || bubblesDragging;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStashedInAppChanged() {
|
||||
onStashedInAppChanged(mLauncher.getDeviceProfile());
|
||||
|
||||
@@ -225,7 +225,7 @@ class ManageWindowsTaskbarShortcut<T>(
|
||||
|
||||
// Calculate the Y position to place the carousel above the taskbar
|
||||
menuView.rootView.y =
|
||||
deviceProfile.availableHeightPx -
|
||||
deviceProfile.deviceProperties.availableHeightPx -
|
||||
menuView.menuHeight -
|
||||
controllers.taskbarStashController.touchableHeight -
|
||||
margin
|
||||
@@ -234,9 +234,12 @@ class ManageWindowsTaskbarShortcut<T>(
|
||||
// but avoid clashing with the screen edge
|
||||
menuView.rootView.translationX =
|
||||
if (Utilities.isRtl(context.resources)) {
|
||||
-(deviceProfile.availableWidthPx - menuView.menuWidth) / 2f
|
||||
-(deviceProfile.deviceProperties.availableWidthPx - menuView.menuWidth) / 2f
|
||||
} else {
|
||||
val maxX = deviceProfile.availableWidthPx - menuView.menuWidth - margin
|
||||
val maxX =
|
||||
deviceProfile.deviceProperties.availableWidthPx -
|
||||
menuView.menuWidth -
|
||||
margin
|
||||
minOf(originalView.x, maxX)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISABLED;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISMISS_IME;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DISABLE_GESTURE_SPLIT_INVOCATION;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_VISIBLE;
|
||||
@@ -50,7 +51,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_Q
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SHORTCUT_HELPER_SHOWING;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING;
|
||||
import static com.android.window.flags.Flags.predictiveBackThreeButtonNav;
|
||||
import static com.android.window.flags2.Flags.predictiveBackThreeButtonNav;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ArgbEvaluator;
|
||||
@@ -72,7 +73,6 @@ import android.graphics.Region.Op;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.PaintDrawable;
|
||||
import android.graphics.drawable.RotateDrawable;
|
||||
import android.inputmethodservice.InputMethodService;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.SystemProperties;
|
||||
@@ -167,6 +167,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
FLAG_NOTIFICATION_SHADE_EXPANDED | FLAG_VOICE_INTERACTION_WINDOW_SHOWING;
|
||||
|
||||
private static final String NAV_BUTTONS_SEPARATE_WINDOW_TITLE = "Taskbar Nav Buttons";
|
||||
private static final String SUW_THEME_SYSTEM_PROPERTY = "setupwizard.theme";
|
||||
private static final String GLIF_EXPRESSIVE_THEME = "glif_expressive";
|
||||
private static final String GLIF_EXPRESSIVE_LIGHT_THEME = "glif_expressive_light";
|
||||
|
||||
private static final double SQUARE_ASPECT_RATIO_BOTTOM_BOUND = 0.95;
|
||||
private static final double SQUARE_ASPECT_RATIO_UPPER_BOUND = 1.05;
|
||||
@@ -278,9 +281,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
if (mContext.isPhoneMode()) {
|
||||
mTaskbarTransitions = new TaskbarTransitions(mContext, mNavButtonsView);
|
||||
}
|
||||
String SUWTheme = SystemProperties.get("setupwizard.theme", "");
|
||||
mIsExpressiveThemeEnabled = SUWTheme.equals("glif_expressive")
|
||||
|| SUWTheme.equals("glif_expressive_light");
|
||||
String SUWTheme = SystemProperties.get(SUW_THEME_SYSTEM_PROPERTY, "");
|
||||
mIsExpressiveThemeEnabled = SUWTheme.equals(GLIF_EXPRESSIVE_THEME)
|
||||
|| SUWTheme.equals(GLIF_EXPRESSIVE_LIGHT_THEME);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -310,13 +313,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
}
|
||||
mNavButtonsView.setLayoutParams(navButtonsViewLayoutParams);
|
||||
|
||||
try {
|
||||
mIsImeRenderingNavButtons =
|
||||
InputMethodService.canImeRenderGesturalNavButtons() && mContext.imeDrawsImeNavBar();
|
||||
} catch (NoSuchMethodError e) {
|
||||
// LC-Ignored: what?
|
||||
mIsImeRenderingNavButtons = false;
|
||||
}
|
||||
mIsImeRenderingNavButtons = mContext.imeDrawsImeNavBar();
|
||||
if (!mIsImeRenderingNavButtons) {
|
||||
// IME switcher
|
||||
final int switcherResId = Flags.imeSwitcherRevamp()
|
||||
@@ -350,8 +347,10 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
// Start at 1 because relevant flags are unset at init.
|
||||
mOnBackgroundNavButtonColorOverrideMultiplier.value = 1;
|
||||
|
||||
// Potentially force the back button to be visible during setup wizard.
|
||||
boolean shouldShowInSetup = !mContext.isUserSetupComplete() && !mIsExpressiveThemeEnabled;
|
||||
// Potentially force the back button to be visible during setup wizard. The back button
|
||||
// won't show up if the expressive theme is enabled and simple view is disabled
|
||||
boolean shouldShowInSetup = !mContext.isUserSetupComplete()
|
||||
&& (!mIsExpressiveThemeEnabled || mContext.isSimpleViewEnabled());
|
||||
boolean isInKidsMode = mContext.isNavBarKidsModeActive();
|
||||
boolean alwaysShowButtons = isThreeButtonNav || shouldShowInSetup;
|
||||
|
||||
@@ -367,7 +366,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
flags -> (flags & flagsToRemoveTranslation) != 0, AnimatedFloat.VALUE,
|
||||
1, 0));
|
||||
// Center nav buttons in new height for IME.
|
||||
float transForIme = (mContext.getDeviceProfile().taskbarHeight
|
||||
float transForIme = (mContext.getDeviceProfile().getTaskbarProfile().getHeight()
|
||||
- mControllers.taskbarInsetsController.getTaskbarHeightForIme()) / 2f;
|
||||
// For gesture nav, nav buttons only show for IME anyway so keep them translated down.
|
||||
float defaultButtonTransY = alwaysShowButtons ? 0 : transForIme;
|
||||
@@ -395,13 +394,6 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
mControllers.taskbarDragLayerController.getNavbarBackgroundAlpha(),
|
||||
flags -> (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0));
|
||||
}
|
||||
} else if (!mIsImeRenderingNavButtons) {
|
||||
View imeDownButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK,
|
||||
mStartContextualContainer, mControllers.navButtonController, R.id.back);
|
||||
imeDownButton.setRotation(Utilities.isRtl(resources) ? 90 : -90);
|
||||
// Only show when IME is visible.
|
||||
mPropertyHolders.add(new StatePropertyHolder(imeDownButton,
|
||||
flags -> (flags & FLAG_IME_VISIBLE) != 0));
|
||||
}
|
||||
mFloatingRotationButton = new FloatingRotationButton(
|
||||
ENABLE_TASKBAR_NAVBAR_UNIFICATION ? mNavigationBarPanelContext : mContext,
|
||||
@@ -428,6 +420,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
mSeparateWindowParent = new BaseDragLayer<>(mContext, null, 0) {
|
||||
@Override
|
||||
public void recreateControllers() {
|
||||
super.recreateControllers();
|
||||
mControllers = new TouchController[0];
|
||||
}
|
||||
|
||||
@@ -512,6 +505,13 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
navButtonController.onButtonClick(BUTTON_RECENTS, v);
|
||||
mHitboxExtender.onRecentsButtonClicked();
|
||||
});
|
||||
mRecentsButton.addOnLayoutChangeListener(
|
||||
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
|
||||
int[] location = v.getLocationOnScreen();
|
||||
Rect bounds = new Rect(location[0], location[1], location[0] + v.getWidth(),
|
||||
location[1] + v.getHeight());
|
||||
navButtonController.onRecentsButtonLayoutChanged(bounds);
|
||||
});
|
||||
mPropertyHolders.add(new StatePropertyHolder(mRecentsButton,
|
||||
flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0 && (flags & FLAG_DISABLE_RECENTS) == 0
|
||||
&& !mContext.isNavBarKidsModeActive() && !mContext.isGestureNav()));
|
||||
@@ -529,6 +529,20 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
navButtonController.onButtonLongClick(BUTTON_SPACE, view));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to determine whether the Navigation Bar is viewable in Setup Wizard
|
||||
*
|
||||
* @return {@code true} if the device is in Setup Wizard, the expressive theme is enabled,
|
||||
* and Simple View is NOT enabled
|
||||
*/
|
||||
boolean isNavbarHiddenInSUW() {
|
||||
if (mContext == null) {
|
||||
return false;
|
||||
}
|
||||
return !mContext.isUserSetupComplete() && mIsExpressiveThemeEnabled
|
||||
&& !mContext.isSimpleViewEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to determine whether to show the home button in lockscreen
|
||||
*
|
||||
@@ -552,7 +566,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
boolean isBackDismissIme = (sysUiStateFlags & SYSUI_STATE_BACK_DISMISS_IME) != 0;
|
||||
boolean a11yVisible = (sysUiStateFlags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0;
|
||||
boolean isHomeDisabled = (sysUiStateFlags & SYSUI_STATE_HOME_DISABLED) != 0;
|
||||
boolean isRecentsDisabled = (sysUiStateFlags & SYSUI_STATE_OVERVIEW_DISABLED) != 0;
|
||||
// TODO: b/409075366 - ensure this signal is correctly set for external displays.
|
||||
boolean isRecentsDisabled = mContext.isPrimaryDisplay()
|
||||
&& (sysUiStateFlags & SYSUI_STATE_OVERVIEW_DISABLED) != 0;
|
||||
boolean isBackDisabled = (sysUiStateFlags & SYSUI_STATE_BACK_DISABLED) != 0;
|
||||
long shadeExpandedFlags = SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED
|
||||
| SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
|
||||
@@ -562,7 +578,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
(sysUiStateFlags & SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING) != 0;
|
||||
boolean isKeyboardShortcutHelperShowing =
|
||||
(sysUiStateFlags & SYSUI_STATE_SHORTCUT_HELPER_SHOWING) != 0;
|
||||
|
||||
boolean splitAnimationRunning =
|
||||
(sysUiStateFlags & SYSUI_STATE_DISABLE_GESTURE_SPLIT_INVOCATION) != 0;
|
||||
updateStateForFlag(FLAG_IME_SWITCHER_BUTTON_VISIBLE, isImeSwitcherButtonVisible);
|
||||
updateStateForFlag(FLAG_IME_VISIBLE, isImeVisible);
|
||||
updateStateForFlag(FLAG_BACK_DISMISS_IME, isBackDismissIme);
|
||||
@@ -582,6 +599,12 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
mA11yButton.setLongClickable(a11yLongClickable);
|
||||
updateButtonLayoutSpacing();
|
||||
}
|
||||
|
||||
if (mNavButtonContainer.getChildCount() > 0) {
|
||||
for (int i = 0; i < mNavButtonContainer.getChildCount(); i++) {
|
||||
mNavButtonContainer.getChildAt(i).setEnabled(!splitAnimationRunning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateStateForSysuiFlags(@SystemUiStateFlags long systemUiStateFlags,
|
||||
@@ -649,7 +672,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
* Returns true if the recents (overview) button is disabled
|
||||
*/
|
||||
public boolean isRecentsDisabled() {
|
||||
return (mState & FLAG_DISABLE_RECENTS) != 0;
|
||||
// TODO: b/409075366 - ensure this signal is correctly set for external displays.
|
||||
return (mState & FLAG_DISABLE_RECENTS) != 0 && mContext.isPrimaryDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -925,7 +949,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
navButtonController.onButtonLongClick(buttonType, view));
|
||||
buttonView.setOnTouchListener((v, event) -> {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
buttonView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
|
||||
buttonView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
|
||||
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
@@ -969,7 +994,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
hasSentDownEvent.set(false);
|
||||
mHandler.postDelayed(longPressTimeout, PREDICTIVE_BACK_TIMEOUT_MS);
|
||||
rect.set(0, 0, v.getWidth(), v.getHeight());
|
||||
buttonView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
|
||||
buttonView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
|
||||
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
}
|
||||
boolean isCancelled = motionEventAction == MotionEvent.ACTION_CANCEL
|
||||
|| (!rect.contains(event.getX(), event.getY())
|
||||
@@ -1017,15 +1043,15 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
if (mFloatingRotationButton != null) {
|
||||
mFloatingRotationButton.onConfigurationChanged(configChanges);
|
||||
}
|
||||
if (!mContext.isUserSetupComplete()) {
|
||||
if (!mContext.isUserSetupComplete() && !ENABLE_TASKBAR_NAVBAR_UNIFICATION) {
|
||||
handleSetupUi();
|
||||
}
|
||||
updateButtonLayoutSpacing();
|
||||
}
|
||||
|
||||
private void handleSetupUi() {
|
||||
// Setup wizard handles the UI when the expressive theme is enabled.
|
||||
if (mIsExpressiveThemeEnabled) {
|
||||
// Setup wizard handles the UI when the expressive theme is enabled and Simple View isn't.
|
||||
if (mIsExpressiveThemeEnabled && !mContext.isSimpleViewEnabled()) {
|
||||
return;
|
||||
}
|
||||
// Since setup wizard only has back button enabled, it looks strange to be
|
||||
@@ -1044,9 +1070,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
|
||||
// If SUW is on a large screen device that is landscape (or has a square aspect
|
||||
// ratio) the back button has to be placed accordingly
|
||||
if ((deviceProfile.isTablet && deviceProfile.isLandscape)
|
||||
|| (deviceProfile.aspectRatio > SQUARE_ASPECT_RATIO_BOTTOM_BOUND
|
||||
&& deviceProfile.aspectRatio < SQUARE_ASPECT_RATIO_UPPER_BOUND)) {
|
||||
if ((deviceProfile.getDeviceProperties().isTablet() && deviceProfile.getDeviceProperties().isLandscape())
|
||||
|| (deviceProfile.getDeviceProperties().getAspectRatio() > SQUARE_ASPECT_RATIO_BOTTOM_BOUND
|
||||
&& deviceProfile.getDeviceProperties().getAspectRatio() < SQUARE_ASPECT_RATIO_UPPER_BOUND)) {
|
||||
navButtonsLayoutParams.setMarginStart(
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_back_button_suw_start_margin));
|
||||
navButtonsViewLayoutParams.bottomMargin = resources.getDimensionPixelSize(
|
||||
@@ -1057,7 +1083,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
int phoneOrPortraitSetupMargin = resources.getDimensionPixelSize(
|
||||
R.dimen.taskbar_contextual_button_suw_margin);
|
||||
navButtonsLayoutParams.setMarginStart(phoneOrPortraitSetupMargin);
|
||||
navButtonsLayoutParams.bottomMargin = !deviceProfile.isLandscape
|
||||
navButtonsLayoutParams.bottomMargin = !deviceProfile.getDeviceProperties().isLandscape()
|
||||
? 0
|
||||
: phoneOrPortraitSetupMargin - (resources.getDimensionPixelSize(
|
||||
R.dimen.taskbar_nav_buttons_size) / 2);
|
||||
@@ -1228,9 +1254,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
|
||||
public void onDestroy() {
|
||||
mPropertyHolders.clear();
|
||||
mControllers.rotationButtonController.unregisterListeners();
|
||||
if (mFloatingRotationButton != null) {
|
||||
mFloatingRotationButton.hide();
|
||||
mFloatingRotationButton = null;
|
||||
}
|
||||
|
||||
moveNavButtonsBackToTaskbarWindow();
|
||||
@@ -1419,11 +1445,11 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
// Skip additional translations on the nav bar container while in SUW layout
|
||||
return 0;
|
||||
} else if (mContext.shouldStartAlignTaskbar()) {
|
||||
int navBarSpacing = dp.inlineNavButtonsEndSpacingPx;
|
||||
int navBarSpacing = dp.getHotseatProfile().getInlineNavButtonsEndSpacingPx();
|
||||
// If the taskbar is start aligned the navigation bar is aligned to the start or end of
|
||||
// the container, depending on the bubble bar location
|
||||
if (isNavbarOnRight) {
|
||||
navBarTargetStartX = dp.widthPx - navBarSpacing - mNavButtonContainer.getWidth();
|
||||
navBarTargetStartX = dp.getDeviceProperties().getWidthPx() - navBarSpacing - mNavButtonContainer.getWidth();
|
||||
} else {
|
||||
navBarTargetStartX = navBarSpacing;
|
||||
}
|
||||
@@ -1436,7 +1462,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
if (isNavbarOnRight) {
|
||||
if (mNavButtonsView.isLayoutRtl()) {
|
||||
float taskBarEnd = taskbarBounds.right;
|
||||
navBarTargetStartX = (dp.widthPx + taskBarEnd - navbarWidth) / 2;
|
||||
navBarTargetStartX = (dp.getDeviceProperties().getWidthPx() + taskBarEnd - navbarWidth) / 2;
|
||||
} else {
|
||||
navBarTargetStartX = mNavButtonContainer.getLeft();
|
||||
}
|
||||
@@ -1454,7 +1480,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
// screen.
|
||||
Rect transientTaskbarIconLayoutBoundsInParent = mControllers.taskbarViewController
|
||||
.getTransientTaskbarIconLayoutBoundsInParent();
|
||||
if (mContext.getDeviceProfile().isPhone
|
||||
if (mContext.getDeviceProfile().getDeviceProperties().isPhone()
|
||||
|| transientTaskbarIconLayoutBoundsInParent.isEmpty()
|
||||
|| mNavButtonsView.getWidth() == 0) {
|
||||
return;
|
||||
|
||||
@@ -19,8 +19,11 @@ package com.android.launcher3.taskbar
|
||||
import android.content.Context
|
||||
import android.util.SparseArray
|
||||
import android.view.View
|
||||
import android.window.DesktopExperienceFlags
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.LauncherAppState
|
||||
import com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APPS
|
||||
import com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.model.BgDataModel
|
||||
@@ -37,7 +40,7 @@ class PinToTaskbarShortcut<T>(
|
||||
target: T,
|
||||
itemInfo: ItemInfo?,
|
||||
originalView: View,
|
||||
private val mIsPin: Boolean,
|
||||
@get:VisibleForTesting val mIsPin: Boolean,
|
||||
private val mPinnedInfoList: SparseArray<ItemInfo?>,
|
||||
) :
|
||||
SystemShortcut<T>(
|
||||
@@ -60,7 +63,18 @@ class PinToTaskbarShortcut<T>(
|
||||
.getWriter(true, mTarget!!.cellPosMapper, callbacks)
|
||||
|
||||
if (!mIsPin) {
|
||||
writer.deleteItemFromDatabase(mItemInfo, "item unpinned through long-press menu")
|
||||
var infoToUnpin = mItemInfo
|
||||
if (mItemInfo.container == CONTAINER_ALL_APPS) {
|
||||
for (i in 0..<mPinnedInfoList.size()) {
|
||||
if (
|
||||
mPinnedInfoList.valueAt(i)?.getComponentKey() == mItemInfo.getComponentKey()
|
||||
) {
|
||||
infoToUnpin = mPinnedInfoList.valueAt(i)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.deleteItemFromDatabase(infoToUnpin, "item unpinned through long-press menu")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -88,4 +102,10 @@ class PinToTaskbarShortcut<T>(
|
||||
|
||||
writer.addItemToDatabase(newInfo, CONTAINER_HOTSEAT, mItemInfo.screenId, cellX, cellY)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun isPinningAppWithContextMenuEnabled(context: TaskbarActivityContext): Boolean =
|
||||
DesktopExperienceFlags.ENABLE_PINNING_APP_WITH_CONTEXT_MENU.isTrue &&
|
||||
context.isTaskbarShowingDesktopTasks
|
||||
}
|
||||
}
|
||||
@@ -17,27 +17,30 @@ package com.android.launcher3.taskbar;
|
||||
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
import static com.android.launcher3.EncryptionType.ENCRYPTED;
|
||||
import static com.android.launcher3.LauncherPrefs.nonRestorableItem;
|
||||
import static com.android.launcher3.taskbar.Utilities.getShapedTaskbarRadius;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
import android.view.ViewOutlineProvider;
|
||||
|
||||
import com.android.launcher3.ConstantItem;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.AnimatedFloat;
|
||||
import com.android.launcher3.anim.RevealOutlineAnimation;
|
||||
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.launcher3.util.MultiPropertyFactory;
|
||||
import com.android.launcher3.util.MultiValueAlpha;
|
||||
import com.android.quickstep.NavHandle;
|
||||
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
|
||||
@@ -55,7 +58,8 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
public static final int ALPHA_INDEX_HOME_DISABLED = 1;
|
||||
public static final int ALPHA_INDEX_ASSISTANT_INVOKED = 2;
|
||||
public static final int ALPHA_INDEX_HIDDEN_WHILE_DREAMING = 3;
|
||||
private static final int NUM_ALPHA_CHANNELS = 4;
|
||||
public static final int ALPHA_INDEX_NUDGED = 4;
|
||||
private static final int NUM_ALPHA_CHANNELS = 5;
|
||||
|
||||
// Values for long press animations, picked to most closely match navbar spec.
|
||||
private static final float SCALE_TOUCH_ANIMATION_SHRINK = 0.85f;
|
||||
@@ -67,8 +71,11 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
private static final String SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY =
|
||||
"stashed_handle_region_is_dark";
|
||||
|
||||
private static final ConstantItem<Boolean> STASHED_HANDLE_REGION_IS_DARK =
|
||||
nonRestorableItem(SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY, false, ENCRYPTED);
|
||||
|
||||
private final TaskbarActivityContext mActivity;
|
||||
private final SharedPreferences mPrefs;
|
||||
private final LauncherPrefs mPrefs;
|
||||
private final StashedHandleView mStashedHandleView;
|
||||
private int mStashedHandleWidth;
|
||||
private final int mStashedHandleHeight;
|
||||
@@ -102,13 +109,12 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
public StashedHandleViewController(TaskbarActivityContext activity,
|
||||
StashedHandleView stashedHandleView) {
|
||||
mActivity = activity;
|
||||
mPrefs = LauncherPrefs.getPrefs(mActivity);
|
||||
mPrefs = LauncherPrefs.get(mActivity);
|
||||
mStashedHandleView = stashedHandleView;
|
||||
mTaskbarStashedHandleAlpha = new MultiValueAlpha(mStashedHandleView, NUM_ALPHA_CHANNELS);
|
||||
mTaskbarStashedHandleAlpha.setUpdateVisibility(true);
|
||||
mStashedHandleView.updateHandleColor(
|
||||
mPrefs.getBoolean(SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY, false),
|
||||
false /* animate */);
|
||||
mPrefs.get(STASHED_HANDLE_REGION_IS_DARK), false /* animate */);
|
||||
final Resources resources = mActivity.getResources();
|
||||
mStashedHandleHeight = resources.getDimensionPixelSize(
|
||||
R.dimen.taskbar_stashed_handle_height);
|
||||
@@ -124,11 +130,11 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
mStashedHandleWidth =
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_stashed_small_screen);
|
||||
} else {
|
||||
mTaskbarSize = deviceProfile.taskbarHeight;
|
||||
mTaskbarSize = deviceProfile.getTaskbarProfile().getHeight();
|
||||
mStashedHandleWidth = resources
|
||||
.getDimensionPixelSize(R.dimen.taskbar_stashed_handle_width);
|
||||
}
|
||||
int taskbarBottomMargin = deviceProfile.taskbarBottomMargin;
|
||||
int taskbarBottomMargin = deviceProfile.getTaskbarProfile().getBottomMargin();
|
||||
mStashedHandleView.getLayoutParams().height = mTaskbarSize + taskbarBottomMargin;
|
||||
|
||||
mTaskbarStashedHandleAlpha.get(ALPHA_INDEX_STASHED).setValue(
|
||||
@@ -147,7 +153,9 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
stashedCenterX + mStashedHandleWidth / 2,
|
||||
stashedCenterY + mStashedHandleHeight / 2);
|
||||
mStashedHandleView.updateSampledRegion(mStashedHandleBounds);
|
||||
mStashedHandleRadius = view.getHeight() / 2f;
|
||||
mStashedHandleRadius = Flags.enableLauncherIconShapes()
|
||||
? getShapedTaskbarRadius(mActivity)
|
||||
: view.getHeight() / 2f;
|
||||
outline.setRoundRect(mStashedHandleBounds, mStashedHandleRadius);
|
||||
}
|
||||
});
|
||||
@@ -167,6 +175,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
|
||||
/**
|
||||
* Returns the stashed handle bounds.
|
||||
*
|
||||
* @param out The destination rect.
|
||||
*/
|
||||
public void getStashedHandleBounds(Rect out) {
|
||||
@@ -179,8 +188,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
@Override
|
||||
public void onRegionDarknessChanged(boolean isRegionDark) {
|
||||
mStashedHandleView.updateHandleColor(isRegionDark, true /* animate */);
|
||||
mPrefs.edit().putBoolean(SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY,
|
||||
isRegionDark).apply();
|
||||
mPrefs.put(STASHED_HANDLE_REGION_IS_DARK, isRegionDark);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,7 +206,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
mRegionSamplingHelper = null;
|
||||
}
|
||||
|
||||
public MultiPropertyFactory<View> getStashedHandleAlpha() {
|
||||
public MultiValueAlpha getStashedHandleAlpha() {
|
||||
return mTaskbarStashedHandleAlpha;
|
||||
}
|
||||
|
||||
@@ -221,8 +229,9 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
int heightDiff = (mTaskbarSize - visualBounds.height()) / 2;
|
||||
visualBounds.top -= heightDiff;
|
||||
visualBounds.bottom += heightDiff;
|
||||
|
||||
startRadius = visualBounds.height() / 2f;
|
||||
startRadius = Flags.enableLauncherIconShapes()
|
||||
? getShapedTaskbarRadius(mActivity)
|
||||
: visualBounds.height() / 2f;
|
||||
}
|
||||
|
||||
final RevealOutlineAnimation handleRevealProvider = new RoundedRectRevealOutlineProvider(
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import static android.os.Trace.TRACE_TAG_APP;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||
@@ -33,7 +32,6 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_ON_BOARD_POPUP;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_OVERLAY_PROXY;
|
||||
import static com.android.launcher3.Flags.enableCursorHoverStates;
|
||||
import static com.android.launcher3.Flags.removeExcludeFromScreenMagnificationFlagUsage;
|
||||
import static com.android.launcher3.Utilities.calculateTextHeight;
|
||||
import static com.android.launcher3.Utilities.isRunningInTestHarness;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
|
||||
@@ -46,6 +44,7 @@ import static com.android.launcher3.taskbar.TaskbarStashController.SHOULD_BUBBLE
|
||||
import static com.android.launcher3.testing.shared.ResourceUtils.getBoolByName;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.quickstep.util.AnimUtils.completeRunnableListCallback;
|
||||
import static com.android.quickstep.util.ExternalDisplaysKt.isExternalDisplay;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING;
|
||||
import static com.android.wm.shell.Flags.enableBubbleBar;
|
||||
@@ -64,6 +63,7 @@ import android.content.pm.ActivityInfo.Config;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.hardware.display.DisplayManager;
|
||||
@@ -113,6 +113,7 @@ import com.android.launcher3.icons.BitmapRenderer;
|
||||
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||
import com.android.launcher3.logger.LauncherAtom;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.model.ModelWriter;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.AppPairInfo;
|
||||
import com.android.launcher3.model.data.FolderInfo;
|
||||
@@ -136,6 +137,7 @@ import com.android.launcher3.taskbar.bubbles.BubbleDismissController;
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleDragController;
|
||||
import com.android.launcher3.taskbar.bubbles.BubblePinController;
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleStashedHandleViewController;
|
||||
import com.android.launcher3.taskbar.bubbles.DragToBubbleController;
|
||||
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController;
|
||||
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController.TaskbarHotseatDimensionsProvider;
|
||||
import com.android.launcher3.taskbar.bubbles.stashing.DeviceProfileDimensionsProviderAdapter;
|
||||
@@ -206,6 +208,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
|
||||
private static final String WINDOW_TITLE = "Taskbar";
|
||||
|
||||
public static final String SIMPLE_VIEW_SETTINGS_KEY = "matcha_enable";
|
||||
|
||||
protected static final DesktopModeFlag ENABLE_TASKBAR_BEHIND_SHADE = new DesktopModeFlag(
|
||||
Flags::enableTaskbarBehindShade, false);
|
||||
|
||||
@@ -215,7 +219,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
private final TaskbarControllers mControllers;
|
||||
|
||||
private final WindowManager mWindowManager;
|
||||
private final boolean mIsPrimaryDisplay;
|
||||
private DeviceProfile mDeviceProfile;
|
||||
private WindowManager.LayoutParams mWindowLayoutParams;
|
||||
private WindowManager.LayoutParams mLastUpdatedLayoutParams;
|
||||
@@ -234,13 +237,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
private boolean mImeDrawsImeNavBar;
|
||||
|
||||
private final boolean mIsSafeModeEnabled;
|
||||
private final boolean mIsUserSetupComplete;
|
||||
private final boolean mIsNavBarForceVisible;
|
||||
private final boolean mIsNavBarKidsMode;
|
||||
private boolean mIsUserSetupComplete;
|
||||
private boolean mIsNavBarForceVisible;
|
||||
private boolean mIsNavBarKidsMode;
|
||||
|
||||
private boolean mIsDestroyed = false;
|
||||
// The flag to know if the window is excluded from magnification region computation.
|
||||
private boolean mIsExcludeFromMagnificationRegion = false;
|
||||
private boolean mAddedWindow = false;
|
||||
|
||||
// The bounds of the taskbar items relative to TaskbarDragLayer
|
||||
@@ -253,6 +254,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
private DeviceProfile mPersistentTaskbarDeviceProfile;
|
||||
|
||||
private final LauncherPrefs mLauncherPrefs;
|
||||
private final int mPrimaryDisplayId;
|
||||
private final SystemUiProxy mSysUiProxy;
|
||||
|
||||
private TaskbarFeatureEvaluator mTaskbarFeatureEvaluator;
|
||||
@@ -263,15 +265,15 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
private @Nullable View mTaskbarSnapshotView;
|
||||
private @Nullable TaskbarOverlayContext mTaskbarSnapshotOverlay;
|
||||
|
||||
public TaskbarActivityContext(Context windowContext,
|
||||
public TaskbarActivityContext(int displayId, Context windowContext,
|
||||
@Nullable Context navigationBarPanelContext, DeviceProfile launcherDp,
|
||||
TaskbarNavButtonController buttonController,
|
||||
ScopedUnfoldTransitionProgressProvider unfoldTransitionProgressProvider,
|
||||
boolean isPrimaryDisplay, SystemUiProxy sysUiProxy) {
|
||||
super(windowContext, isPrimaryDisplay);
|
||||
mIsPrimaryDisplay = isPrimaryDisplay;
|
||||
boolean isPrimaryDisplay, int primaryDisplayId, SystemUiProxy sysUiProxy) {
|
||||
super(windowContext, displayId, isPrimaryDisplay);
|
||||
mNavigationBarPanelContext = navigationBarPanelContext;
|
||||
mSysUiProxy = sysUiProxy;
|
||||
mPrimaryDisplayId = primaryDisplayId;
|
||||
applyDeviceProfile(launcherDp);
|
||||
final Resources resources = getResources();
|
||||
mTaskbarFeatureEvaluator = TaskbarFeatureEvaluator.getInstance(this);
|
||||
@@ -285,15 +287,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
mIsSafeModeEnabled = TraceHelper.allowIpcs("isSafeMode",
|
||||
() -> getPackageManager().isSafeMode());
|
||||
|
||||
// TODO(b/244231596) For shared Taskbar window, update this value in applyDeviceProfile()
|
||||
// instead so to get correct value when recreating the taskbar
|
||||
SettingsCache settingsCache = SettingsCache.INSTANCE.get(this);
|
||||
mIsUserSetupComplete = settingsCache.getValue(
|
||||
Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE), 0);
|
||||
mIsNavBarKidsMode = settingsCache.getValue(
|
||||
Settings.Secure.getUriFor(Settings.Secure.NAV_BAR_KIDS_MODE), 0);
|
||||
mIsNavBarForceVisible = mIsNavBarKidsMode;
|
||||
|
||||
// Get display and corners first, as views might use them in constructor.
|
||||
Context c = getApplicationContext();
|
||||
mWindowManager = c.getSystemService(WindowManager.class);
|
||||
@@ -306,6 +299,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
TaskbarScrimView taskbarScrimView = mDragLayer.findViewById(R.id.taskbar_scrim);
|
||||
NearestTouchFrame navButtonsView = mDragLayer.findViewById(R.id.navbuttons_view);
|
||||
StashedHandleView stashedHandleView = mDragLayer.findViewById(R.id.stashed_handle);
|
||||
NudgeView nudgeView = mDragLayer.findViewById(R.id.nudge_icon);
|
||||
BubbleBarView bubbleBarView = mDragLayer.findViewById(R.id.taskbar_bubbles);
|
||||
FrameLayout bubbleBarContainer = mDragLayer.findViewById(R.id.taskbar_bubbles_container);
|
||||
StashedHandleView bubbleHandleView = mDragLayer.findViewById(R.id.stashed_bubble_handle);
|
||||
@@ -316,12 +310,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
Optional<BubbleControllers> bubbleControllersOptional = Optional.empty();
|
||||
BubbleBarController.onTaskbarRecreated();
|
||||
final boolean deviceBubbleBarEnabled = enableBubbleBarOnPhones()
|
||||
|| (!mDeviceProfile.isPhone && !mDeviceProfile.isVerticalBarLayout());
|
||||
if (BubbleBarController.isBubbleBarEnabled()
|
||||
&& deviceBubbleBarEnabled
|
||||
&& bubbleBarView != null
|
||||
&& isPrimaryDisplay
|
||||
) {
|
||||
|| (!mDeviceProfile.getDeviceProperties().isPhone() && !mDeviceProfile.isVerticalBarLayout());
|
||||
if (BubbleBarController.isBubbleBarEnabled() && deviceBubbleBarEnabled
|
||||
&& bubbleBarView != null && isPrimaryDisplay) {
|
||||
Optional<BubbleStashedHandleViewController> bubbleHandleController = Optional.empty();
|
||||
Optional<BubbleBarSwipeController> bubbleBarSwipeController = Optional.empty();
|
||||
if (isTransientTaskbar) {
|
||||
@@ -343,11 +334,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
bubbleHandleController,
|
||||
new BubbleDragController(this, mDragLayer),
|
||||
new BubbleDismissController(this, mDragLayer),
|
||||
new BubbleBarPinController(this, bubbleBarContainer,
|
||||
() -> DisplayController.INSTANCE.get(this).getInfo().currentSize),
|
||||
new BubblePinController(this, bubbleBarContainer,
|
||||
() -> DisplayController.INSTANCE.get(this).getInfo().currentSize),
|
||||
new BubbleBarPinController(this, bubbleBarContainer, this::getScreenSize),
|
||||
new BubblePinController(this, bubbleBarContainer, this::getScreenSize),
|
||||
bubbleBarSwipeController,
|
||||
new DragToBubbleController(this, bubbleBarContainer),
|
||||
new BubbleCreator(this)
|
||||
));
|
||||
}
|
||||
@@ -395,13 +385,14 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
bubbleControllersOptional,
|
||||
new TaskbarDesktopModeController(this,
|
||||
DesktopVisibilityController.INSTANCE.get(this)),
|
||||
new NudgeController(this));
|
||||
new NudgeController(this),
|
||||
new NudgeViewController(this, nudgeView));
|
||||
|
||||
mLauncherPrefs = LauncherPrefs.get(this);
|
||||
onViewCreated();
|
||||
}
|
||||
|
||||
/** Updates {@link DeviceProfile} instances for any Taskbar windows. */
|
||||
/** Updates {@link deviceprofile} instances for any Taskbar windows. */
|
||||
public void updateDeviceProfile(DeviceProfile launcherDp) {
|
||||
applyDeviceProfile(launcherDp);
|
||||
mControllers.taskbarOverlayController.updateLauncherDeviceProfile(launcherDp);
|
||||
@@ -417,9 +408,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
dispatchDeviceProfileChanged();
|
||||
}
|
||||
|
||||
public final int getPrimaryDisplayId() {
|
||||
return mPrimaryDisplayId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransientTaskbar() {
|
||||
return DisplayController.isTransientTaskbar(this) && mIsPrimaryDisplay && !isPhoneMode();
|
||||
return DisplayController.isTransientTaskbar(this) && isPrimaryDisplay() && !isPhoneMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -439,6 +434,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
&& mControllers.taskbarDesktopModeController.isInDesktopMode(getDisplayId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTaskbarShowingDesktopTasks() {
|
||||
return mControllers != null
|
||||
&& mControllers.taskbarDesktopModeController.shouldShowDesktopTasksInTaskbar(
|
||||
getDisplayId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showLockedTaskbarOnHome() {
|
||||
return DisplayController.showLockedTaskbarOnHome(this);
|
||||
@@ -450,8 +452,18 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrimaryDisplay() {
|
||||
return mIsPrimaryDisplay;
|
||||
public Point getScreenSize() {
|
||||
return DisplayController.INSTANCE.get(this).getInfo().currentSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDisplayHeight() {
|
||||
return DisplayController.INSTANCE.get(this).getInfo().currentSize.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyConfigChanged() {
|
||||
DisplayController.INSTANCE.get(this).notifyConfigChange();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -466,7 +478,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
deviceProfile.hotseatQsbWidth = originDeviceProfile.hotseatQsbWidth;
|
||||
|
||||
// Update icon size
|
||||
deviceProfile.iconSizePx = deviceProfile.taskbarIconSize;
|
||||
deviceProfile.iconSizePx = deviceProfile.getTaskbarProfile().getIconSize();
|
||||
deviceProfile.updateIconSize(1f, this);
|
||||
};
|
||||
mDeviceProfile = originDeviceProfile.toBuilder(this)
|
||||
@@ -488,6 +500,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
.build();
|
||||
}
|
||||
mNavMode = getNavigationMode();
|
||||
|
||||
SettingsCache settingsCache = SettingsCache.INSTANCE.get(this);
|
||||
mIsUserSetupComplete = settingsCache.getValue(
|
||||
Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE), 0);
|
||||
mIsNavBarKidsMode = settingsCache.getValue(
|
||||
Settings.Secure.getUriFor(Settings.Secure.NAV_BAR_KIDS_MODE), 0);
|
||||
mIsNavBarForceVisible = mIsNavBarKidsMode;
|
||||
}
|
||||
|
||||
/** Called when the visibility of the bubble bar changed. */
|
||||
@@ -577,10 +596,14 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
*/
|
||||
public boolean isPhoneMode() {
|
||||
return ENABLE_TASKBAR_NAVBAR_UNIFICATION
|
||||
&& mDeviceProfile.isPhone
|
||||
&& mDeviceProfile.getDeviceProperties().isPhone()
|
||||
&& !mDeviceProfile.isTaskbarPresent;
|
||||
}
|
||||
|
||||
public boolean isTaskbarInMinimalState() {
|
||||
return mControllers.taskbarViewController.isTaskbarInMinimalState();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if {@link #isPhoneMode()} is true and we're using 3 button-nav
|
||||
*/
|
||||
@@ -595,13 +618,18 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return isPhoneMode() && !isThreeButtonNav();
|
||||
}
|
||||
|
||||
/** Returns whether Taskbar draws its own background, vs being translucent for apps to draw. */
|
||||
public boolean drawsTaskbarBackground() {
|
||||
return !isPhoneMode();
|
||||
}
|
||||
|
||||
/** Returns {@code true} iff a tiny version of taskbar is shown on phone. */
|
||||
public boolean isTinyTaskbar() {
|
||||
return enableTinyTaskbar() && mDeviceProfile.isPhone && mDeviceProfile.isTaskbarPresent;
|
||||
return enableTinyTaskbar() && mDeviceProfile.getDeviceProperties().isPhone() && mDeviceProfile.isTaskbarPresent;
|
||||
}
|
||||
|
||||
public boolean isBubbleBarOnPhone() {
|
||||
return enableBubbleBarOnPhones() && enableBubbleBar() && mDeviceProfile.isPhone;
|
||||
return enableBubbleBarOnPhones() && enableBubbleBar() && mDeviceProfile.getDeviceProperties().isPhone();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -729,7 +757,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
*/
|
||||
private WindowManager.LayoutParams createAllWindowParams() {
|
||||
final int windowType =
|
||||
(ENABLE_TASKBAR_NAVBAR_UNIFICATION && mIsPrimaryDisplay) ? TYPE_NAVIGATION_BAR
|
||||
(ENABLE_TASKBAR_NAVBAR_UNIFICATION && isPrimaryDisplay()) ? TYPE_NAVIGATION_BAR
|
||||
: TYPE_NAVIGATION_BAR_PANEL;
|
||||
WindowManager.LayoutParams windowLayoutParams =
|
||||
createDefaultWindowLayoutParams(windowType, TaskbarActivityContext.WINDOW_TITLE);
|
||||
@@ -794,7 +822,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
|
||||
/** Returns whether taskbar should start align. */
|
||||
public boolean shouldStartAlignTaskbar() {
|
||||
return isThreeButtonNav() && mDeviceProfile.startAlignTaskbar;
|
||||
return isThreeButtonNav() && mDeviceProfile.getTaskbarProfile().isStartAlignTaskbar();
|
||||
}
|
||||
|
||||
public boolean isGestureNav() {
|
||||
@@ -829,6 +857,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return mControllers.taskbarDragController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelWriter getModelWriter() {
|
||||
return mControllers.taskbarViewController.getModelWriter();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public BubbleControllers getBubbleControllers() {
|
||||
return mControllers.bubbleControllers.orElse(null);
|
||||
@@ -1029,6 +1062,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
*/
|
||||
public void onDestroy() {
|
||||
onViewDestroyed();
|
||||
removeTaskbarSnapshot();
|
||||
mIsDestroyed = true;
|
||||
mTaskbarFeatureEvaluator.onDestroy();
|
||||
setUIController(TaskbarUIController.DEFAULT);
|
||||
@@ -1037,8 +1071,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
mWindowManager.removeViewImmediate(mDragLayer);
|
||||
mAddedWindow = false;
|
||||
}
|
||||
mTaskbarSnapshotView = null;
|
||||
mTaskbarSnapshotOverlay = null;
|
||||
}
|
||||
|
||||
public boolean isDestroyed() {
|
||||
@@ -1115,7 +1147,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
}
|
||||
|
||||
private void updateTaskbarSnapshot(AnimatorSet anim, boolean isExpanded) {
|
||||
if (!ENABLE_TASKBAR_BEHIND_SHADE.isTrue()) {
|
||||
if (!ENABLE_TASKBAR_BEHIND_SHADE.isTrue()
|
||||
|| isPhoneMode()) {
|
||||
return;
|
||||
}
|
||||
if (mTaskbarSnapshotView == null) {
|
||||
@@ -1125,6 +1158,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
if (!mTaskbarSnapshotView.isAttachedToWindow()
|
||||
&& mDragLayer.isAttachedToWindow()
|
||||
&& mDragLayer.isLaidOut()
|
||||
&& mDragLayer.isVisibleToUser()
|
||||
&& mTaskbarSnapshotView.getParent() == null) {
|
||||
NearestTouchFrame navButtonsView = mDragLayer.findViewById(R.id.navbuttons_view);
|
||||
int oldNavButtonsVisibility = navButtonsView.getVisibility();
|
||||
@@ -1164,28 +1198,29 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
mTaskbarSnapshotOverlay.getDragLayer().addView(mTaskbarSnapshotView, layoutParams);
|
||||
}
|
||||
} else {
|
||||
Runnable removeSnapshotView = () -> {
|
||||
if (mTaskbarSnapshotOverlay != null) {
|
||||
mTaskbarSnapshotOverlay.getDragLayer().removeView(mTaskbarSnapshotView);
|
||||
mTaskbarSnapshotView = null;
|
||||
mTaskbarSnapshotOverlay = null;
|
||||
}
|
||||
};
|
||||
if (mTaskbarSnapshotView.isAttachedToWindow()) {
|
||||
mTaskbarSnapshotView.setAlpha(0f);
|
||||
anim.end();
|
||||
if (Utilities.isRunningInTestHarness()) {
|
||||
removeSnapshotView.run();
|
||||
removeTaskbarSnapshot();
|
||||
} else {
|
||||
ViewRootSync.synchronizeNextDraw(mDragLayer, mTaskbarSnapshotView,
|
||||
removeSnapshotView);
|
||||
this::removeTaskbarSnapshot);
|
||||
}
|
||||
} else {
|
||||
removeSnapshotView.run();
|
||||
removeTaskbarSnapshot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeTaskbarSnapshot() {
|
||||
if (mTaskbarSnapshotOverlay != null) {
|
||||
mTaskbarSnapshotOverlay.getDragLayer().removeView(mTaskbarSnapshotView);
|
||||
}
|
||||
mTaskbarSnapshotView = null;
|
||||
mTaskbarSnapshotOverlay = null;
|
||||
}
|
||||
|
||||
public void onRotationProposal(int rotation, boolean isValid) {
|
||||
mControllers.rotationButtonController.onRotationProposal(rotation, isValid);
|
||||
}
|
||||
@@ -1261,7 +1296,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
&& !AbstractFloatingView.hasOpenView(
|
||||
this, TYPE_ALL & ~TYPE_TASKBAR_OVERLAY_PROXY)) {
|
||||
// Reverts Taskbar window to its original size
|
||||
setTaskbarWindowFullscreen(false);
|
||||
Runnable resetTaskbarFullscreen = () -> setTaskbarWindowFullscreen(false);
|
||||
mControllers.bubbleControllers.ifPresentOrElse(
|
||||
bc -> bc.dragToBubbleController.runAfterDropTargetsHidden(
|
||||
resetTaskbarFullscreen), resetTaskbarFullscreen);
|
||||
}
|
||||
|
||||
setAutohideSuspendFlag(FLAG_AUTOHIDE_SUSPEND_DRAGGING, isDragInProgress);
|
||||
@@ -1277,13 +1315,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
public void setTaskbarWindowSize(int size) {
|
||||
// In landscape phone button nav mode, we should set the task bar width instead of height
|
||||
// because this is the only case in which the nav bar is not on the display bottom.
|
||||
boolean landscapePhoneButtonNav = isPhoneButtonNavMode() && mDeviceProfile.isLandscape;
|
||||
boolean landscapePhoneButtonNav = isPhoneButtonNavMode() && mDeviceProfile.getDeviceProperties().isLandscape();
|
||||
if ((landscapePhoneButtonNav ? mWindowLayoutParams.width : mWindowLayoutParams.height)
|
||||
== size || mIsDestroyed) {
|
||||
return;
|
||||
}
|
||||
if (size == MATCH_PARENT) {
|
||||
size = mDeviceProfile.heightPx;
|
||||
size = mDeviceProfile.getDeviceProperties().getHeightPx();
|
||||
} else {
|
||||
mLastRequestedNonFullscreenSize = size;
|
||||
if (mIsFullscreen || mIsTaskbarSizeFrozenForAnimatingBubble) {
|
||||
@@ -1335,7 +1373,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
).orElse(0);
|
||||
int taskbarWindowSize;
|
||||
boolean shouldTreatAsTransient =
|
||||
isTransientTaskbar() || (enableTaskbarPinning() && !isThreeButtonNav());
|
||||
isTransientTaskbar() || (enableTaskbarPinning()
|
||||
&& mTaskbarFeatureEvaluator.getSupportsTransitionToTransientTaskbar());
|
||||
|
||||
int extraHeightForTaskbarTooltips = enableCursorHoverStates()
|
||||
? resources.getDimensionPixelSize(R.dimen.arrow_toast_arrow_height)
|
||||
@@ -1350,15 +1389,15 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
DeviceProfile transientTaskbarDp = mDeviceProfile.toBuilder(this)
|
||||
.setIsTransientTaskbar(true).build();
|
||||
|
||||
taskbarWindowSize = transientTaskbarDp.taskbarHeight
|
||||
+ (2 * transientTaskbarDp.taskbarBottomMargin)
|
||||
taskbarWindowSize = transientTaskbarDp.getTaskbarProfile().getHeight()
|
||||
+ (2 * transientTaskbarDp.getTaskbarProfile().getBottomMargin())
|
||||
+ Math.max(extraHeightForTaskbarTooltips, resources.getDimensionPixelSize(
|
||||
R.dimen.transient_taskbar_shadow_blur));
|
||||
return Math.max(taskbarWindowSize, bubbleBarTop);
|
||||
}
|
||||
|
||||
|
||||
taskbarWindowSize = mDeviceProfile.taskbarHeight
|
||||
taskbarWindowSize = mDeviceProfile.getTaskbarProfile().getHeight()
|
||||
+ getCornerRadius()
|
||||
+ extraHeightForTaskbarTooltips;
|
||||
return Math.max(taskbarWindowSize, bubbleBarTop);
|
||||
@@ -1455,6 +1494,28 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
mControllers.uiController.startSplitSelection(splitSelectSource);
|
||||
}
|
||||
|
||||
// If in overview, and a desktop task is available, launches the overview desktop task and
|
||||
// schedules the provided runnable.
|
||||
// Returns whether the runnable has been posted.
|
||||
private boolean runAfterLaunchingDesktopTaskIfInOverview(
|
||||
RecentsView recents,
|
||||
Runnable runnableToRun) {
|
||||
if (recents == null || !isTaskbarShowingDesktopTasks()
|
||||
|| !mControllers.uiController.isInOverviewUi()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RunnableList runnableList = recents.launchRunningDesktopTaskView();
|
||||
// Wrapping it in runnable so we post after DW is ready for the app
|
||||
// launch.
|
||||
if (runnableList == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
runnableList.add(() -> UI_HELPER_EXECUTOR.execute(runnableToRun));
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void onTaskbarIconClicked(View view) {
|
||||
TaskbarUIController taskbarUIController = mControllers.uiController;
|
||||
RecentsView recents = taskbarUIController.getRecentsView();
|
||||
@@ -1466,25 +1527,17 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
// TODO: b/316004172, b/343289567: Handle `DesktopTask` and `SplitTask`.
|
||||
if (tag instanceof SingleTask singleTask) {
|
||||
RemoteTransition remoteTransition =
|
||||
(isInDesktopMode() && canUnminimizeDesktopTask(
|
||||
(isTaskbarShowingDesktopTasks() && canUnminimizeDesktopTask(
|
||||
singleTask.getTask().key.id))
|
||||
? createDesktopAppLaunchRemoteTransition(AppLaunchType.UNMINIMIZE,
|
||||
Cuj.CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_ICON)
|
||||
: null;
|
||||
if (isInDesktopMode() && mControllers.uiController.isInOverviewUi()) {
|
||||
RunnableList runnableList = recents.launchRunningDesktopTaskView();
|
||||
// Wrapping it in runnable so we post after DW is ready for the app
|
||||
// launch.
|
||||
if (runnableList != null) {
|
||||
runnableList.add(() -> UI_HELPER_EXECUTOR.execute(
|
||||
() -> handleGroupTaskLaunch(singleTask, remoteTransition,
|
||||
isInDesktopMode(),
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP)));
|
||||
}
|
||||
} else {
|
||||
handleGroupTaskLaunch(singleTask, remoteTransition, isInDesktopMode(),
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP);
|
||||
Runnable launchTask = () -> handleGroupTaskLaunch(singleTask, remoteTransition,
|
||||
isTaskbarShowingDesktopTasks(), DesktopTaskToFrontReason.TASKBAR_TAP);
|
||||
if (!runAfterLaunchingDesktopTaskIfInOverview(recents, launchTask)) {
|
||||
launchTask.run();
|
||||
}
|
||||
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
|
||||
} else if (tag instanceof FolderInfo) {
|
||||
// Tapping an expandable folder icon on Taskbar
|
||||
@@ -1507,24 +1560,12 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
AppLaunchType.UNMINIMIZE, Cuj.CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_ICON)
|
||||
: null;
|
||||
|
||||
|
||||
if (isInDesktopMode() && mControllers.uiController.isInOverviewUi()) {
|
||||
RunnableList runnableList = recents.launchRunningDesktopTaskView();
|
||||
if (runnableList != null) {
|
||||
runnableList.add(() ->
|
||||
// wrapped it in runnable here since we need the post for DW to be
|
||||
// ready. if we don't other DW will be gone and only the launched
|
||||
// task will show.
|
||||
UI_HELPER_EXECUTOR.execute(() ->
|
||||
SystemUiProxy.INSTANCE.get(this).showDesktopApp(
|
||||
info.getTaskId(), remoteTransition,
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP)));
|
||||
}
|
||||
} else {
|
||||
UI_HELPER_EXECUTOR.execute(() ->
|
||||
SystemUiProxy.INSTANCE.get(this).showDesktopApp(
|
||||
info.getTaskId(), remoteTransition,
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP));
|
||||
Runnable launchTask = () ->
|
||||
SystemUiProxy.INSTANCE.get(this).showDesktopApp(
|
||||
info.getTaskId(), remoteTransition,
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP);
|
||||
if (!runAfterLaunchingDesktopTaskIfInOverview(recents, launchTask)) {
|
||||
UI_HELPER_EXECUTOR.execute(launchTask);
|
||||
}
|
||||
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(
|
||||
@@ -1613,15 +1654,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
}
|
||||
}
|
||||
|
||||
public void handleGroupTaskLaunch(
|
||||
GroupTask task,
|
||||
@Nullable RemoteTransition remoteTransition,
|
||||
boolean onDesktop,
|
||||
DesktopTaskToFrontReason toFrontReason) {
|
||||
handleGroupTaskLaunch(task, remoteTransition, onDesktop, toFrontReason,
|
||||
/* onStartCallback= */ null, /* onFinishCallback= */ null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches the given GroupTask with the following behavior:
|
||||
* - If the GroupTask is a DesktopTask, launch the tasks in that Desktop.
|
||||
@@ -1637,26 +1669,18 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
GroupTask task,
|
||||
@Nullable RemoteTransition remoteTransition,
|
||||
boolean onDesktop,
|
||||
DesktopTaskToFrontReason toFrontReason,
|
||||
@Nullable Runnable onStartCallback,
|
||||
@Nullable Runnable onFinishCallback) {
|
||||
DesktopTaskToFrontReason toFrontReason) {
|
||||
if (task instanceof DesktopTask) {
|
||||
UI_HELPER_EXECUTOR.execute(() ->
|
||||
SystemUiProxy.INSTANCE.get(this).showDesktopApps(getDisplay().getDisplayId(),
|
||||
UI_HELPER_EXECUTOR.execute(
|
||||
() -> SystemUiProxy.INSTANCE.get(this).showDesktopApps(getDisplayId(),
|
||||
remoteTransition));
|
||||
return;
|
||||
}
|
||||
if (onDesktop && task instanceof SingleTask singleTask) {
|
||||
boolean useRemoteTransition = canUnminimizeDesktopTask(singleTask.getTask().key.id);
|
||||
UI_HELPER_EXECUTOR.execute(() -> {
|
||||
if (onStartCallback != null) {
|
||||
onStartCallback.run();
|
||||
}
|
||||
SystemUiProxy.INSTANCE.get(this).showDesktopApp(singleTask.getTask().key.id,
|
||||
useRemoteTransition ? remoteTransition : null, toFrontReason);
|
||||
if (onFinishCallback != null) {
|
||||
onFinishCallback.run();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -1716,7 +1740,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
@Nullable View launchingIconView, List<? extends ItemInfo> itemInfos) {
|
||||
boolean launchedFromExternalDisplay =
|
||||
DesktopExperienceFlags.ENABLE_TASKBAR_CONNECTED_DISPLAYS.isTrue()
|
||||
&& !mIsPrimaryDisplay;
|
||||
&& !isPrimaryDisplay();
|
||||
if (recents == null && !launchedFromExternalDisplay) {
|
||||
return;
|
||||
}
|
||||
@@ -1781,17 +1805,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
.launchAppPair((AppPairIcon) launchingIconView,
|
||||
-1 /*cuj*/)));
|
||||
} else {
|
||||
if (isInDesktopMode()
|
||||
&& mControllers.uiController.isInOverviewUi()) {
|
||||
RunnableList runnableList = recents.launchRunningDesktopTaskView();
|
||||
// Wrapping it in runnable so we post after DW is ready for the app
|
||||
// launch.
|
||||
if (runnableList != null) {
|
||||
runnableList.add(() -> UI_HELPER_EXECUTOR.execute(
|
||||
() -> startItemInfoActivity(itemInfos.get(0), foundTask)));
|
||||
}
|
||||
} else {
|
||||
startItemInfoActivity(itemInfos.get(0), foundTask);
|
||||
Runnable launchTask =
|
||||
() -> startItemInfoActivity(itemInfos.get(0), foundTask);
|
||||
if (!runAfterLaunchingDesktopTaskIfInOverview(recents, launchTask)) {
|
||||
launchTask.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1814,7 +1831,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
intent.getComponent(), info.user, intent.getSourceBounds(), null);
|
||||
return;
|
||||
}
|
||||
int displayId = getDisplay() == null ? DEFAULT_DISPLAY : getDisplay().getDisplayId();
|
||||
int displayId = getDisplayId();
|
||||
// TODO(b/216683257): Use startActivityForResult for search results that require it.
|
||||
if (taskInRecents != null) {
|
||||
// Re launch instance from recents
|
||||
@@ -1827,8 +1844,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (isInDesktopMode()
|
||||
&& DesktopModeFlags.ENABLE_DESKTOP_APP_LAUNCH_TRANSITIONS_BUGFIX.isTrue()) {
|
||||
if (shouldLaunchInDesktop(displayId, info)) {
|
||||
launchDesktopApp(intent, info, displayId);
|
||||
} else {
|
||||
startActivity(intent, null);
|
||||
@@ -1840,6 +1856,21 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldLaunchInDesktop(int displayId, ItemInfo info) {
|
||||
if (!DesktopModeFlags.ENABLE_DESKTOP_APP_LAUNCH_TRANSITIONS_BUGFIX.isTrue()) {
|
||||
return false;
|
||||
}
|
||||
if (DesktopExperienceFlags.ENABLE_DESKTOP_FIRST_FULLSCREEN_REFOCUS_BUGFIX.isTrue()
|
||||
&& DisplayController.isInDesktopFirstMode(this)
|
||||
&& mControllers.taskbarRecentAppsController.hasSingleTask(info)) {
|
||||
// Keep the fullscreen mode in desktop-first mode.
|
||||
return false;
|
||||
}
|
||||
// Always launch in freeform if in external display.
|
||||
return (DesktopExperienceFlags.ENABLE_FREEFORM_DISPLAY_LAUNCH_PARAMS.isTrue()
|
||||
&& isExternalDisplay(displayId)) || isTaskbarShowingDesktopTasks();
|
||||
}
|
||||
|
||||
private void launchDesktopApp(Intent intent, ItemInfo info, int displayId) {
|
||||
TaskbarRecentAppsController.TaskState taskState =
|
||||
mControllers.taskbarRecentAppsController.getDesktopItemState(info);
|
||||
@@ -1922,8 +1953,12 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
mControllers.uiController.onSwipeToUnstashTaskbar();
|
||||
|
||||
boolean wasStashed = mControllers.taskbarStashController.isStashed();
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(/* stash= */ false,
|
||||
SHOULD_BUBBLES_FOLLOW_DEFAULT_VALUE, delayTaskbarBackground);
|
||||
if (isTransientTaskbar()) {
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(/* stash= */ false,
|
||||
SHOULD_BUBBLES_FOLLOW_DEFAULT_VALUE, delayTaskbarBackground);
|
||||
} else if (shouldAllowTaskbarToAutoStash()) {
|
||||
mControllers.taskbarStashController.updateAndAnimatePinnedTaskbar(false);
|
||||
}
|
||||
boolean isStashed = mControllers.taskbarStashController.isStashed();
|
||||
if (isStashed != wasStashed) {
|
||||
VibratorWrapper.INSTANCE.get(this).vibrateForTaskbarUnstash();
|
||||
@@ -1978,6 +2013,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
mControllers.taskbarStashController.startUnstashHint(animateForward);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if we should allow taskbar to auto stash
|
||||
*/
|
||||
public boolean shouldAllowTaskbarToAutoStash() {
|
||||
return mControllers.taskbarStashController.shouldAllowTaskbarToAutoStash();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the auto timeout for taskbar stashing. This method should only be used for taskbar
|
||||
* testing.
|
||||
@@ -2011,6 +2053,18 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return mIsUserSetupComplete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the simple view mode is enabled.
|
||||
*
|
||||
* Since Simple View puts the device in 3 button nav mode, we use that as a precursor to
|
||||
* checking the actual value in Settings to avoid extra calls to Settings.
|
||||
*/
|
||||
public boolean isSimpleViewEnabled() {
|
||||
return isThreeButtonNav()
|
||||
&& Settings.Secure.getInt(getContentResolver(), SIMPLE_VIEW_SETTINGS_KEY, 0)
|
||||
> 0;
|
||||
}
|
||||
|
||||
public boolean isNavBarKidsModeActive() {
|
||||
return mIsNavBarKidsMode && isThreeButtonNav();
|
||||
}
|
||||
@@ -2063,31 +2117,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return AnimatorPlaybackController.wrap(fullAnimation, duration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when we determine the touchable region.
|
||||
*
|
||||
* @param exclude {@code true} then the magnification region computation will omit the window.
|
||||
*/
|
||||
public void excludeFromMagnificationRegion(boolean exclude) {
|
||||
if (mIsExcludeFromMagnificationRegion == exclude || isPhoneMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (removeExcludeFromScreenMagnificationFlagUsage()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mIsExcludeFromMagnificationRegion = exclude;
|
||||
if (exclude) {
|
||||
mWindowLayoutParams.privateFlags |=
|
||||
WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION;
|
||||
} else {
|
||||
mWindowLayoutParams.privateFlags &=
|
||||
~WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION;
|
||||
}
|
||||
notifyUpdateLayoutParams();
|
||||
}
|
||||
|
||||
void notifyUpdateLayoutParams() {
|
||||
if (mDragLayer.isAttachedToWindow()) {
|
||||
// Copy the current windowLayoutParams to mLastUpdatedLayoutParams and compare the diff.
|
||||
|
||||
@@ -53,6 +53,8 @@ public class TaskbarAutohideSuspendController implements
|
||||
public static final int FLAG_AUTOHIDE_SUSPEND_MULTI_INSTANCE_MENU_OPEN = 1 << 7;
|
||||
// User has taskbar overflow open.
|
||||
public static final int FLAG_AUTOHIDE_SUSPEND_TASKBAR_OVERFLOW = 1 << 8;
|
||||
// Growth Framework nudge overlay is open above the Taskbar.
|
||||
public static final int FLAG_AUTOHIDE_SUSPEND_GROWTH_NUDGE_OPEN = 1 << 9;
|
||||
|
||||
@IntDef(flag = true, value = {
|
||||
FLAG_AUTOHIDE_SUSPEND_FULLSCREEN,
|
||||
@@ -64,6 +66,7 @@ public class TaskbarAutohideSuspendController implements
|
||||
FLAG_AUTOHIDE_SUSPEND_HOVERING_ICONS,
|
||||
FLAG_AUTOHIDE_SUSPEND_MULTI_INSTANCE_MENU_OPEN,
|
||||
FLAG_AUTOHIDE_SUSPEND_TASKBAR_OVERFLOW,
|
||||
FLAG_AUTOHIDE_SUSPEND_GROWTH_NUDGE_OPEN,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface AutohideSuspendFlag {
|
||||
@@ -148,6 +151,8 @@ public class TaskbarAutohideSuspendController implements
|
||||
"FLAG_AUTOHIDE_SUSPEND_MULTI_INSTANCE_MENU_OPEN");
|
||||
appendFlag(str, flags, FLAG_AUTOHIDE_SUSPEND_TASKBAR_OVERFLOW,
|
||||
"FLAG_AUTOHIDE_SUSPEND_TASKBAR_OVERFLOW");
|
||||
appendFlag(str, flags, FLAG_AUTOHIDE_SUSPEND_GROWTH_NUDGE_OPEN,
|
||||
"FLAG_AUTOHIDE_SUSPEND_GROWTH_NUDGE_OPEN");
|
||||
return str.toString();
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import android.graphics.Paint
|
||||
import android.graphics.Path
|
||||
import android.graphics.RectF
|
||||
import com.android.app.animation.Interpolators
|
||||
import com.android.launcher3.Flags
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.Utilities
|
||||
import com.android.launcher3.Utilities.mapRange
|
||||
@@ -30,6 +31,7 @@ import com.android.launcher3.Utilities.mapToRange
|
||||
import com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound
|
||||
import com.android.launcher3.taskbar.TaskbarPinningController.Companion.PINNING_PERSISTENT
|
||||
import com.android.launcher3.taskbar.TaskbarPinningController.Companion.PINNING_TRANSIENT
|
||||
import com.android.launcher3.taskbar.Utilities.getShapedTaskbarRadius
|
||||
import kotlin.math.min
|
||||
|
||||
/** Helps draw the taskbar background, made up of a rectangle plus two inverted rounded corners. */
|
||||
@@ -38,9 +40,9 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
private val isInSetup: Boolean = !context.isUserSetupComplete
|
||||
|
||||
private val maxTransientTaskbarHeight =
|
||||
context.transientTaskbarDeviceProfile.taskbarHeight.toFloat()
|
||||
context.transientTaskbarDeviceProfile.taskbarProfile.height.toFloat()
|
||||
private val maxPersistentTaskbarHeight =
|
||||
context.persistentTaskbarDeviceProfile.taskbarHeight.toFloat()
|
||||
context.persistentTaskbarDeviceProfile.taskbarProfile.height.toFloat()
|
||||
var backgroundProgress =
|
||||
if (context.isTransientTaskbar) {
|
||||
PINNING_TRANSIENT
|
||||
@@ -55,7 +57,7 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
val paint = Paint()
|
||||
private val strokePaint = Paint()
|
||||
val lastDrawnTransientRect = RectF()
|
||||
var backgroundHeight = context.deviceProfile.taskbarHeight.toFloat()
|
||||
var backgroundHeight = context.deviceProfile.taskbarProfile.height.toFloat()
|
||||
var translationYForSwipe = 0f
|
||||
var translationYForStash = 0f
|
||||
var translationXForBubbleBar = 0f
|
||||
@@ -222,7 +224,12 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
|
||||
val newWidth = mapRange(progress, backgroundWidthWhileAnimating, fullWidth.toFloat())
|
||||
val halfWidthDelta = (fullWidth - newWidth) / 2f
|
||||
val radius = newBackgroundHeight / 2f
|
||||
val radius =
|
||||
if (Flags.enableLauncherIconShapes()) {
|
||||
getShapedTaskbarRadius(context)
|
||||
} else {
|
||||
newBackgroundHeight / 2f
|
||||
}
|
||||
val bottomMarginProgress = bottomMargin * ((1f - progress) / 2f)
|
||||
|
||||
// Aligns the bottom with the bottom of the stashed handle.
|
||||
|
||||
@@ -69,6 +69,7 @@ public class TaskbarControllers {
|
||||
public final Optional<BubbleControllers> bubbleControllers;
|
||||
public final TaskbarDesktopModeController taskbarDesktopModeController;
|
||||
public final NudgeController nudgeController;
|
||||
public final NudgeViewController nudgeViewController;
|
||||
|
||||
@Nullable private LoggableTaskbarController[] mControllersToLog = null;
|
||||
@Nullable private BackgroundRendererController[] mBackgroundRendererControllers = null;
|
||||
@@ -118,7 +119,8 @@ public class TaskbarControllers {
|
||||
TaskbarPinningController taskbarPinningController,
|
||||
Optional<BubbleControllers> bubbleControllers,
|
||||
TaskbarDesktopModeController taskbarDesktopModeController,
|
||||
NudgeController nudgeController) {
|
||||
NudgeController nudgeController,
|
||||
NudgeViewController nudgeViewController) {
|
||||
this.taskbarActivityContext = taskbarActivityContext;
|
||||
this.taskbarDragController = taskbarDragController;
|
||||
this.navButtonController = navButtonController;
|
||||
@@ -147,6 +149,7 @@ public class TaskbarControllers {
|
||||
this.bubbleControllers = bubbleControllers;
|
||||
this.taskbarDesktopModeController = taskbarDesktopModeController;
|
||||
this.nudgeController = nudgeController;
|
||||
this.nudgeViewController = nudgeViewController;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,10 +177,11 @@ public class TaskbarControllers {
|
||||
taskbarOverlayController.init(this);
|
||||
taskbarAllAppsController.init(this, sharedState.allAppsVisible);
|
||||
navButtonController.init(this);
|
||||
bubbleControllers.ifPresent(controllers -> controllers.init(sharedState, this));
|
||||
bubbleControllers.ifPresentOrElse(controllers -> controllers.init(sharedState, this),
|
||||
sharedState::clearBubbleData);
|
||||
taskbarInsetsController.init(this);
|
||||
voiceInteractionWindowController.init(this);
|
||||
taskbarRecentAppsController.init(this);
|
||||
taskbarRecentAppsController.init(this, sharedState.recentTasksBeforeTaskbarRecreate);
|
||||
taskbarTranslationController.init(this);
|
||||
taskbarEduTooltipController.init(this);
|
||||
keyboardQuickSwitchController.init(this);
|
||||
@@ -245,6 +249,7 @@ public class TaskbarControllers {
|
||||
}, () -> uiController.onBubbleBarLocationUpdated(null));
|
||||
// Notify that the ui controller has changed
|
||||
navbarButtonsViewController.onUiControllerChanged();
|
||||
taskbarViewController.onUiControllerChanged();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -264,7 +269,6 @@ public class TaskbarControllers {
|
||||
*/
|
||||
public void onDestroy() {
|
||||
mAreAllControllersInitialized = false;
|
||||
mSharedState = null;
|
||||
|
||||
taskbarDragController.onDestroy();
|
||||
navbarButtonsViewController.onDestroy();
|
||||
@@ -274,6 +278,7 @@ public class TaskbarControllers {
|
||||
taskbarUnfoldAnimationController.onDestroy();
|
||||
taskbarViewController.onDestroy();
|
||||
stashedHandleViewController.onDestroy();
|
||||
nudgeViewController.onDestroy();
|
||||
taskbarAutohideSuspendController.onDestroy();
|
||||
taskbarPopupController.onDestroy();
|
||||
taskbarForceVisibleImmersiveController.onDestroy();
|
||||
@@ -289,6 +294,7 @@ public class TaskbarControllers {
|
||||
taskbarDesktopModeController.onDestroy();
|
||||
mControllersToLog = null;
|
||||
mBackgroundRendererControllers = null;
|
||||
mSharedState = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,19 +16,21 @@
|
||||
|
||||
package com.android.launcher3.taskbar
|
||||
|
||||
import android.content.Context
|
||||
import com.android.launcher3.statehandlers.DesktopVisibilityController
|
||||
import com.android.launcher3.statehandlers.DesktopVisibilityController.TaskbarDesktopModeListener
|
||||
import com.android.launcher3.taskbar.TaskbarBackgroundRenderer.Companion.MAX_ROUNDNESS
|
||||
|
||||
/** Handles Taskbar in Desktop Windowing mode. */
|
||||
class TaskbarDesktopModeController(
|
||||
private val context: Context,
|
||||
private val taskbarActivityContext: TaskbarActivityContext,
|
||||
private val desktopVisibilityController: DesktopVisibilityController,
|
||||
) : TaskbarDesktopModeListener {
|
||||
private lateinit var taskbarControllers: TaskbarControllers
|
||||
private lateinit var taskbarSharedState: TaskbarSharedState
|
||||
|
||||
val isLauncherAnimationRunning: Boolean
|
||||
get() = desktopVisibilityController.launcherAnimationRunning
|
||||
|
||||
fun init(controllers: TaskbarControllers, sharedState: TaskbarSharedState) {
|
||||
taskbarControllers = controllers
|
||||
taskbarSharedState = sharedState
|
||||
@@ -48,10 +50,13 @@ class TaskbarDesktopModeController(
|
||||
}
|
||||
|
||||
fun shouldShowDesktopTasksInTaskbar(): Boolean {
|
||||
val activityContext = taskbarControllers.taskbarActivityContext
|
||||
return isInDesktopMode(context.displayId) ||
|
||||
activityContext.showDesktopTaskbarForFreeformDisplay() ||
|
||||
(activityContext.showLockedTaskbarOnHome() &&
|
||||
return shouldShowDesktopTasksInTaskbar(taskbarActivityContext.displayId)
|
||||
}
|
||||
|
||||
fun shouldShowDesktopTasksInTaskbar(displayId: Int): Boolean {
|
||||
return isInDesktopMode(displayId) ||
|
||||
taskbarActivityContext.showDesktopTaskbarForFreeformDisplay() ||
|
||||
(taskbarActivityContext.showLockedTaskbarOnHome() &&
|
||||
taskbarControllers.taskbarStashController.isOnHome)
|
||||
}
|
||||
|
||||
|
||||
@@ -29,14 +29,17 @@ import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.Switch
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.core.view.postDelayed
|
||||
import com.android.app.animation.Interpolators.EMPHASIZED_ACCELERATE
|
||||
import com.android.launcher3.Flags
|
||||
import com.android.launcher3.LauncherPrefs
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.popup.ArrowPopup
|
||||
import com.android.launcher3.popup.RoundedArrowDrawable
|
||||
import com.android.launcher3.util.Themes
|
||||
import com.android.launcher3.views.ActivityContext
|
||||
import com.android.wm.shell.Flags.enableGsf
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
@@ -79,8 +82,13 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
private val minPaddingFromScreenEdge =
|
||||
resources.getDimension(R.dimen.taskbar_pinning_popup_menu_min_padding_from_screen_edge)
|
||||
|
||||
// TODO: add test for isTransientTaskbar & long presses divider and ensures the popup shows up.
|
||||
private var alwaysShowTaskbarOn = !taskbarActivityContext.isTransientTaskbar
|
||||
private var alwaysShowTaskbarOn =
|
||||
if (taskbarActivityContext.isTaskbarShowingDesktopTasks) {
|
||||
LauncherPrefs.TASKBAR_PINNING_IN_DESKTOP_MODE.get(context)
|
||||
} else {
|
||||
!taskbarActivityContext.isTransientTaskbar
|
||||
}
|
||||
|
||||
private var didPreferenceChange = false
|
||||
private var verticalOffsetForPopupView =
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_pinning_popup_menu_vertical_margin)
|
||||
@@ -109,6 +117,15 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
val alwaysShowTaskbarSwitch = requireViewById<Switch>(R.id.taskbar_pinning_switch)
|
||||
val taskbarVisibilityIcon = requireViewById<View>(R.id.taskbar_pinning_visibility_icon)
|
||||
|
||||
if (enableGsf()) {
|
||||
taskbarVisibilityIcon.background =
|
||||
ResourcesCompat.getDrawable(
|
||||
context.resources,
|
||||
R.drawable.ic_visibility_filled,
|
||||
context.theme,
|
||||
)
|
||||
}
|
||||
|
||||
alwaysShowTaskbarSwitch.isChecked = alwaysShowTaskbarOn
|
||||
alwaysShowTaskbarSwitch.setOnTouchListener { view, event ->
|
||||
(view.parent as View).onTouchEvent(event)
|
||||
@@ -250,8 +267,8 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
}
|
||||
|
||||
override fun getExtraVerticalOffset(): Int {
|
||||
return (mActivityContext.deviceProfile.taskbarHeight -
|
||||
mActivityContext.deviceProfile.taskbarIconSize) / 2 + verticalOffsetForPopupView
|
||||
return (mActivityContext.deviceProfile.taskbarProfile.height -
|
||||
mActivityContext.deviceProfile.taskbarProfile.iconSize) / 2 + verticalOffsetForPopupView
|
||||
}
|
||||
|
||||
override fun onCreateCloseAnimation(anim: AnimatorSet?) {
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.android.launcher3.taskbar;
|
||||
import static com.android.app.animation.Interpolators.FAST_OUT_SLOW_IN;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_ALL_APPS;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APPS;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APPS_PREDICTION;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_SEARCH_ACTION;
|
||||
import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.EXTENDED_CONTAINERS;
|
||||
@@ -131,14 +131,14 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
|
||||
public void init(TaskbarControllers controllers) {
|
||||
mControllers = controllers;
|
||||
mControllers.bubbleControllers.ifPresent(
|
||||
c -> c.bubbleBarViewController.addBubbleBarDropTargets(this));
|
||||
mControllers.runAfterInit(() -> mControllers.bubbleControllers.ifPresent(
|
||||
c -> c.dragToBubbleController.addBubbleBarDropTargets(this)));
|
||||
}
|
||||
|
||||
/** Called when the controller is destroyed. */
|
||||
public void onDestroy() {
|
||||
mControllers.bubbleControllers.ifPresent(
|
||||
c -> c.bubbleBarViewController.removeBubbleBarDropTargets(this));
|
||||
c -> c.dragToBubbleController.removeBubbleBarDropTargets(this));
|
||||
}
|
||||
|
||||
public void setDisallowGlobalDrag(boolean disallowGlobalDrag) {
|
||||
@@ -685,7 +685,7 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
if (tag instanceof ItemInfo) {
|
||||
ItemInfo item = (ItemInfo) tag;
|
||||
if (item.container == CONTAINER_ALL_APPS
|
||||
|| item.container == CONTAINER_PREDICTION
|
||||
|| item.container == CONTAINER_ALL_APPS_PREDICTION
|
||||
|| isInSearchResultContainer(item)) {
|
||||
if (mDisallowGlobalDrag) {
|
||||
// We're dragging in taskbarAllApps, we don't have folders or shortcuts
|
||||
|
||||
@@ -127,6 +127,7 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
|
||||
|
||||
@Override
|
||||
public void recreateControllers() {
|
||||
super.recreateControllers();
|
||||
mControllers = mControllerCallbacks.getTouchControllers();
|
||||
}
|
||||
|
||||
|
||||
@@ -163,9 +163,14 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
|
||||
* @return Bounds (in TaskbarDragLayer coordinates) where an opened Folder can display.
|
||||
*/
|
||||
public Rect getFolderBoundingBox() {
|
||||
Rect boundingBox = new Rect(0, 0, mTaskbarDragLayer.getWidth(),
|
||||
mTaskbarDragLayer.getHeight() - mActivity.getDeviceProfile().taskbarHeight
|
||||
- mActivity.getDeviceProfile().taskbarBottomMargin);
|
||||
Rect boundingBox = new Rect(
|
||||
0,
|
||||
0,
|
||||
mTaskbarDragLayer.getWidth(),
|
||||
mTaskbarDragLayer.getHeight()
|
||||
- mActivity.getDeviceProfile().getTaskbarProfile().getHeight()
|
||||
- mActivity.getDeviceProfile().getTaskbarProfile().getBottomMargin()
|
||||
);
|
||||
boundingBox.inset(mFolderMargin, mFolderMargin);
|
||||
return boundingBox;
|
||||
}
|
||||
@@ -215,7 +220,7 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
|
||||
}
|
||||
|
||||
private void updateBackgroundAlpha() {
|
||||
if (mActivity.isPhoneMode() || mActivity.isDestroyed()) {
|
||||
if (!mActivity.drawsTaskbarBackground() || mActivity.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -352,7 +357,7 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
|
||||
deviceProfile.getDisplayInfo().currentSize.y :
|
||||
taskbarDimensions.y;
|
||||
} else {
|
||||
return deviceProfile.taskbarHeight;
|
||||
return deviceProfile.getTaskbarProfile().getHeight();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
// constraint to reduce the number of lines of text and hopefully free up some height.
|
||||
activityContext.dragLayer.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED)
|
||||
if (
|
||||
measuredHeight + activityContext.deviceProfile.taskbarHeight >=
|
||||
activityContext.deviceProfile.availableHeightPx
|
||||
measuredHeight + activityContext.deviceProfile.taskbarProfile.height >=
|
||||
activityContext.deviceProfile.deviceProperties.availableHeightPx
|
||||
) {
|
||||
updateLayoutParams { width = MATCH_PARENT }
|
||||
}
|
||||
|
||||
@@ -168,6 +168,8 @@ open class TaskbarEduTooltipController(context: Context) :
|
||||
FontFamily.GSF_HEADLINE_SMALL_EMPHASIZED,
|
||||
)
|
||||
val swipeAnimation = requireViewById<LottieAnimationView>(R.id.swipe_animation)
|
||||
swipeAnimation.contentDescription =
|
||||
context.getString(R.string.taskbar_edu_swipe_animation_description)
|
||||
swipeAnimation.supportLightTheme()
|
||||
handleEduAnimations(listOf(swipeAnimation))
|
||||
show()
|
||||
@@ -192,8 +194,14 @@ open class TaskbarEduTooltipController(context: Context) :
|
||||
tooltip?.run {
|
||||
allowTouchDismissal = false
|
||||
val splitscreenAnim = requireViewById<LottieAnimationView>(R.id.splitscreen_animation)
|
||||
splitscreenAnim.contentDescription =
|
||||
context.getString(R.string.taskbar_edu_split_screen_animation_description)
|
||||
val suggestionsAnim = requireViewById<LottieAnimationView>(R.id.suggestions_animation)
|
||||
suggestionsAnim.contentDescription =
|
||||
context.getString(R.string.taskbar_edu_suggested_app_animation_description)
|
||||
val pinningAnim = requireViewById<LottieAnimationView>(R.id.pinning_animation)
|
||||
pinningAnim.contentDescription =
|
||||
context.getString(R.string.taskbar_edu_pinning_animation_description)
|
||||
val pinningEdu = requireViewById<View>(R.id.pinning_edu)
|
||||
splitscreenAnim.supportLightTheme()
|
||||
suggestionsAnim.supportLightTheme()
|
||||
@@ -237,7 +245,7 @@ open class TaskbarEduTooltipController(context: Context) :
|
||||
else R.dimen.taskbar_edu_features_tooltip_width_with_two_features
|
||||
)
|
||||
|
||||
bottomMargin += activityContext.deviceProfile.taskbarHeight
|
||||
bottomMargin += activityContext.deviceProfile.taskbarProfile.height
|
||||
} else {
|
||||
width =
|
||||
resources.getDimensionPixelSize(
|
||||
@@ -285,11 +293,13 @@ open class TaskbarEduTooltipController(context: Context) :
|
||||
|
||||
val pinningAnim =
|
||||
requireViewById<LottieAnimationView>(R.id.standalone_pinning_animation)
|
||||
pinningAnim.contentDescription =
|
||||
context.getString(R.string.taskbar_edu_pinning_animation_description)
|
||||
pinningAnim.supportLightTheme()
|
||||
handleEduAnimations(listOf(pinningAnim))
|
||||
updateLayoutParams<BaseDragLayer.LayoutParams> {
|
||||
if (activityContext.isTransientTaskbar) {
|
||||
bottomMargin += activityContext.deviceProfile.taskbarHeight
|
||||
bottomMargin += activityContext.deviceProfile.taskbarProfile.height
|
||||
}
|
||||
// Unlike other tooltips, we want to align with taskbar divider rather than center.
|
||||
gravity = Gravity.BOTTOM
|
||||
@@ -331,6 +341,8 @@ open class TaskbarEduTooltipController(context: Context) :
|
||||
tooltip?.run {
|
||||
allowTouchDismissal = true
|
||||
val searchEdu = requireViewById<LottieAnimationView>(R.id.search_edu_animation)
|
||||
searchEdu.contentDescription =
|
||||
context.getString(R.string.taskbar_edu_suggested_search_animation_description)
|
||||
searchEdu.supportLightTheme()
|
||||
handleEduAnimations(listOf(searchEdu))
|
||||
val eduSubtitle: TextView = requireViewById(R.id.search_edu_text)
|
||||
@@ -344,7 +356,7 @@ open class TaskbarEduTooltipController(context: Context) :
|
||||
showDisclosureText(eduSubtitle)
|
||||
updateLayoutParams<BaseDragLayer.LayoutParams> {
|
||||
if (activityContext.isTransientTaskbar) {
|
||||
bottomMargin += activityContext.deviceProfile.taskbarHeight
|
||||
bottomMargin += activityContext.deviceProfile.taskbarProfile.height
|
||||
}
|
||||
// Unlike other tooltips, we want to align with the all apps button rather than
|
||||
// center.
|
||||
|
||||
@@ -26,6 +26,7 @@ import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLA
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.graphics.Rect;
|
||||
import android.text.TextUtils;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -50,7 +51,6 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
|
||||
private final TaskbarView mTaskbarView;
|
||||
private final View mHoverView;
|
||||
private final ArrowTipView mHoverToolTipView;
|
||||
private final String mToolTipText;
|
||||
private final int mYOffset;
|
||||
|
||||
public TaskbarHoverToolTipController(TaskbarActivityContext activity, TaskbarView taskbarView,
|
||||
@@ -59,17 +59,6 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
|
||||
mTaskbarView = taskbarView;
|
||||
mHoverView = hoverView;
|
||||
|
||||
if (mHoverView instanceof BubbleTextView) {
|
||||
mToolTipText = ((BubbleTextView) mHoverView).getText().toString();
|
||||
} else if (mHoverView instanceof FolderIcon
|
||||
&& ((FolderIcon) mHoverView).mInfo.title != null) {
|
||||
mToolTipText = ((FolderIcon) mHoverView).mInfo.title.toString();
|
||||
} else if (mHoverView instanceof AppPairIcon) {
|
||||
mToolTipText = ((AppPairIcon) mHoverView).getTitleTextView().getText().toString();
|
||||
} else {
|
||||
mToolTipText = null;
|
||||
}
|
||||
|
||||
ContextThemeWrapper arrowContextWrapper = new ContextThemeWrapper(mActivity,
|
||||
R.style.ArrowTipTaskbarStyle);
|
||||
mHoverToolTipView = new ArrowTipView(arrowContextWrapper, /* isPointingUp = */ false,
|
||||
@@ -111,9 +100,15 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
|
||||
}
|
||||
|
||||
private void maybeRevealHoverToolTip() {
|
||||
if (mHoverView == null || mToolTipText == null) {
|
||||
if (mHoverView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String toolTipText = getToolTipText();
|
||||
if (TextUtils.isEmpty(toolTipText)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not show tooltip if taskbar icons are transitioning to hotseat.
|
||||
if (mActivity.isIconAlignedWithHotseat()) {
|
||||
return;
|
||||
@@ -128,7 +123,21 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
|
||||
}
|
||||
|
||||
Rect iconViewBounds = Utilities.getViewBounds(mHoverView);
|
||||
mHoverToolTipView.showAtLocation(mToolTipText, iconViewBounds.centerX(),
|
||||
mHoverToolTipView.showAtLocation(toolTipText, iconViewBounds.centerX(),
|
||||
mTaskbarView.getTop() - mYOffset, /* shouldAutoClose= */ false);
|
||||
}
|
||||
|
||||
private String getToolTipText() {
|
||||
if (mHoverView instanceof BubbleTextView btv) {
|
||||
return btv.getText().toString();
|
||||
} else if (mHoverView instanceof FolderIcon icon && icon.mInfo.title != null) {
|
||||
return icon.mInfo.title.toString();
|
||||
} else if (mHoverView instanceof AppPairIcon icon) {
|
||||
return icon.getTitleTextView().getText().toString();
|
||||
} else if (mHoverView instanceof TaskbarOverflowView icon) {
|
||||
return icon.getTextForTooltipPopup();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,8 +32,10 @@ import android.view.InsetsSource.FLAG_INSETS_ROUNDED_CORNER
|
||||
import android.view.InsetsSource.FLAG_SUPPRESS_SCRIM
|
||||
import android.view.Surface
|
||||
import android.view.ViewTreeObserver
|
||||
import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT
|
||||
import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME
|
||||
import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION
|
||||
import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_VISIBLE
|
||||
import android.view.WindowInsets
|
||||
import android.view.WindowInsets.Type.mandatorySystemGestures
|
||||
import android.view.WindowInsets.Type.navigationBars
|
||||
@@ -42,7 +44,9 @@ import android.view.WindowInsets.Type.tappableElement
|
||||
import android.view.WindowManager
|
||||
import android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD
|
||||
import android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.core.graphics.toRegion
|
||||
|
||||
import com.android.internal.policy.GestureNavigationSettingsObserver
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.R
|
||||
@@ -50,6 +54,14 @@ import com.android.launcher3.anim.AlphaUpdateListener
|
||||
import com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION
|
||||
import com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate
|
||||
import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.DEFAULT_TOUCH_REGION
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.DRAG_LAYER_INVISIBLE
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.FULLSCREEN_TASKBAR_WINDOW
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.ICONS_INVISIBLE
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.PHONE_MODE
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.SYSTEM_DRAG_IN_PROGRESS
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.TRANSIENT_IN_OVERVIEW
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.UI_CONTROLLER_UNTOUCHABLE
|
||||
import com.android.launcher3.testing.shared.ResourceUtils
|
||||
import com.android.launcher3.util.Executors
|
||||
import java.io.PrintWriter
|
||||
@@ -61,6 +73,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
companion object {
|
||||
private const val INDEX_LEFT = 0
|
||||
private const val INDEX_RIGHT = 1
|
||||
private const val TAG = "TaskbarInsetsController"
|
||||
|
||||
private fun Region.addBoundsToRegion(bounds: Rect?) {
|
||||
bounds?.let { op(it, Region.Op.UNION) }
|
||||
@@ -82,7 +95,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
context,
|
||||
this::onTaskbarOrBubblebarWindowHeightOrInsetsChanged,
|
||||
)
|
||||
private val debugTouchableRegion = DebugTouchableRegion()
|
||||
@VisibleForTesting val debugTouchableRegion = DebugTouchableRegion()
|
||||
|
||||
// Initialized in init.
|
||||
private lateinit var controllers: TaskbarControllers
|
||||
@@ -103,75 +116,80 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
}
|
||||
|
||||
fun onTaskbarOrBubblebarWindowHeightOrInsetsChanged() {
|
||||
val taskbarStashController = controllers.taskbarStashController
|
||||
val tappableHeight = taskbarStashController.tappableHeightToReportToApps
|
||||
// We only report tappableElement height for unstashed, persistent taskbar,
|
||||
// which is also when we draw the rounded corners above taskbar.
|
||||
val insetsRoundedCornerFlag =
|
||||
if (tappableHeight > 0) {
|
||||
FLAG_INSETS_ROUNDED_CORNER
|
||||
} else {
|
||||
0
|
||||
val taskbarStashController = controllers.taskbarStashController
|
||||
val tappableHeight = taskbarStashController.tappableHeightToReportToApps
|
||||
// We only report tappableElement height for unstashed, persistent taskbar,
|
||||
// which is also when we draw the rounded corners above taskbar on tablets.
|
||||
val insetsRoundedCornerFlag =
|
||||
if (tappableHeight > 0 && context.drawsTaskbarBackground()) {
|
||||
FLAG_INSETS_ROUNDED_CORNER
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
||||
windowLayoutParams.providedInsets =
|
||||
if (enableTaskbarNoRecreate() && controllers.sharedState != null) {
|
||||
getProvidedInsets(
|
||||
controllers.sharedState!!.insetsFrameProviders,
|
||||
insetsRoundedCornerFlag,
|
||||
)
|
||||
} else {
|
||||
getProvidedInsets(insetsRoundedCornerFlag)
|
||||
}
|
||||
|
||||
if (windowLayoutParams.paramsForRotation != null) {
|
||||
for (layoutParams in windowLayoutParams.paramsForRotation) {
|
||||
layoutParams.providedInsets = getProvidedInsets(insetsRoundedCornerFlag)
|
||||
}
|
||||
}
|
||||
|
||||
windowLayoutParams.providedInsets =
|
||||
if (enableTaskbarNoRecreate() && controllers.sharedState != null) {
|
||||
getProvidedInsets(
|
||||
controllers.sharedState!!.insetsFrameProviders,
|
||||
insetsRoundedCornerFlag,
|
||||
)
|
||||
} else {
|
||||
getProvidedInsets(insetsRoundedCornerFlag)
|
||||
val bubbleControllers = controllers.bubbleControllers.getOrNull()
|
||||
val taskbarTouchableHeight = taskbarStashController.touchableHeight
|
||||
val bubblesTouchableHeight =
|
||||
bubbleControllers?.bubbleStashController?.getTouchableHeight() ?: 0
|
||||
// reset touch bounds
|
||||
defaultTouchableRegion.setEmpty()
|
||||
if (bubbleControllers != null) {
|
||||
val bubbleBarViewController = bubbleControllers.bubbleBarViewController
|
||||
val isBubbleBarVisible =
|
||||
bubbleControllers.bubbleStashController.isBubbleBarVisible()
|
||||
val isAnimatingNewBubble = bubbleBarViewController.isAnimatingNewBubble
|
||||
// if bubble bar is visible or animating new bubble, add bar bounds to the touch
|
||||
// region
|
||||
if (isBubbleBarVisible || isAnimatingNewBubble) {
|
||||
defaultTouchableRegion.addBoundsToRegion(
|
||||
bubbleBarViewController.bubbleBarBounds
|
||||
)
|
||||
defaultTouchableRegion.addBoundsToRegion(bubbleBarViewController.flyoutBounds)
|
||||
}
|
||||
}
|
||||
if (
|
||||
taskbarStashController.isInApp ||
|
||||
controllers.uiController.isInOverviewUi ||
|
||||
context.showLockedTaskbarOnHome()
|
||||
) {
|
||||
// only add the taskbar touch region if not on home
|
||||
val bottom = windowLayoutParams.height
|
||||
val top = bottom - taskbarTouchableHeight
|
||||
val right = context.deviceProfile.deviceProperties.widthPx
|
||||
defaultTouchableRegion.addBoundsToRegion(Rect(/* left= */ 0, top, right, bottom))
|
||||
}
|
||||
|
||||
if (windowLayoutParams.paramsForRotation != null) {
|
||||
for (layoutParams in windowLayoutParams.paramsForRotation) {
|
||||
layoutParams.providedInsets = getProvidedInsets(insetsRoundedCornerFlag)
|
||||
// Pre-calculate insets for different providers across different rotations for this
|
||||
// gravity
|
||||
for (rotation in Surface.ROTATION_0..Surface.ROTATION_270) {
|
||||
// Add insets for navbar rotated params
|
||||
val layoutParams = windowLayoutParams.paramsForRotation[rotation]
|
||||
for (provider in layoutParams.providedInsets) {
|
||||
setProviderInsets(provider, layoutParams.gravity, rotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val bubbleControllers = controllers.bubbleControllers.getOrNull()
|
||||
val taskbarTouchableHeight = taskbarStashController.touchableHeight
|
||||
val bubblesTouchableHeight =
|
||||
bubbleControllers?.bubbleStashController?.getTouchableHeight() ?: 0
|
||||
// reset touch bounds
|
||||
defaultTouchableRegion.setEmpty()
|
||||
if (bubbleControllers != null) {
|
||||
val bubbleBarViewController = bubbleControllers.bubbleBarViewController
|
||||
val isBubbleBarVisible = bubbleControllers.bubbleStashController.isBubbleBarVisible()
|
||||
val isAnimatingNewBubble = bubbleBarViewController.isAnimatingNewBubble
|
||||
// if bubble bar is visible or animating new bubble, add bar bounds to the touch region
|
||||
if (isBubbleBarVisible || isAnimatingNewBubble) {
|
||||
defaultTouchableRegion.addBoundsToRegion(bubbleBarViewController.bubbleBarBounds)
|
||||
defaultTouchableRegion.addBoundsToRegion(bubbleBarViewController.flyoutBounds)
|
||||
// Also set the parent providers (i.e. not in paramsForRotation).
|
||||
for (provider in windowLayoutParams.providedInsets) {
|
||||
setProviderInsets(provider, windowLayoutParams.gravity, context.display.rotation)
|
||||
}
|
||||
context.notifyUpdateLayoutParams()
|
||||
}
|
||||
if (
|
||||
taskbarStashController.isInApp ||
|
||||
controllers.uiController.isInOverviewUi ||
|
||||
context.showLockedTaskbarOnHome()
|
||||
) {
|
||||
// only add the taskbar touch region if not on home
|
||||
val bottom = windowLayoutParams.height
|
||||
val top = bottom - taskbarTouchableHeight
|
||||
val right = context.deviceProfile.widthPx
|
||||
defaultTouchableRegion.addBoundsToRegion(Rect(/* left= */ 0, top, right, bottom))
|
||||
}
|
||||
|
||||
// Pre-calculate insets for different providers across different rotations for this gravity
|
||||
for (rotation in Surface.ROTATION_0..Surface.ROTATION_270) {
|
||||
// Add insets for navbar rotated params
|
||||
val layoutParams = windowLayoutParams.paramsForRotation[rotation]
|
||||
for (provider in layoutParams.providedInsets) {
|
||||
setProviderInsets(provider, layoutParams.gravity, rotation)
|
||||
}
|
||||
}
|
||||
// Also set the parent providers (i.e. not in paramsForRotation).
|
||||
for (provider in windowLayoutParams.providedInsets) {
|
||||
setProviderInsets(provider, windowLayoutParams.gravity, context.display.rotation)
|
||||
}
|
||||
context.notifyUpdateLayoutParams()
|
||||
}
|
||||
|
||||
/**
|
||||
* This is for when ENABLE_TASKBAR_NO_RECREATION is enabled. We generate one instance of
|
||||
@@ -287,7 +305,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
)
|
||||
if (
|
||||
(context.isGestureNav || ENABLE_TASKBAR_NAVBAR_UNIFICATION) &&
|
||||
provider.type == tappableElement()
|
||||
provider.type == tappableElement()
|
||||
) {
|
||||
provider.insetsSizeOverrides = insetsSizeOverrideForTappableElement
|
||||
} else if (provider.type != systemGestures()) {
|
||||
@@ -344,10 +362,10 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
*/
|
||||
fun updateInsetsTouchability(insetsInfo: ViewTreeObserver.InternalInsetsInfo) {
|
||||
insetsInfo.touchableRegion.setEmpty()
|
||||
val touchableInsets: Int
|
||||
val bubbleBarVisible =
|
||||
controllers.bubbleControllers.isPresent &&
|
||||
controllers.bubbleControllers.get().bubbleBarViewController.isBubbleBarVisible()
|
||||
var insetsIsTouchableRegion = true
|
||||
// Prevents the taskbar from taking touches and conflicting with setup wizard
|
||||
if (
|
||||
context.isPhoneButtonNavMode &&
|
||||
@@ -355,34 +373,24 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
(!controllers.navbarButtonsViewController.isImeVisible ||
|
||||
!controllers.navbarButtonsViewController.isImeRenderingNavButtons)
|
||||
) {
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_FRAME)
|
||||
insetsIsTouchableRegion = false
|
||||
debugTouchableRegion.lastSetTouchableReason =
|
||||
"Phone button nav mode: Fullscreen touchable, IME not affecting nav buttons"
|
||||
touchableInsets = TOUCHABLE_INSETS_FRAME
|
||||
debugTouchableRegion.lastSetTouchableReason = PHONE_MODE
|
||||
} else if (context.dragLayer.alpha < AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD) {
|
||||
// Let touches pass through us.
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
|
||||
debugTouchableRegion.lastSetTouchableReason = "Taskbar is invisible"
|
||||
} else if (
|
||||
controllers.navbarButtonsViewController.isImeVisible &&
|
||||
controllers.taskbarStashController.isStashed
|
||||
) {
|
||||
// Let touches pass through us.
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
|
||||
debugTouchableRegion.lastSetTouchableReason = "Stashed over IME"
|
||||
touchableInsets = TOUCHABLE_INSETS_REGION
|
||||
debugTouchableRegion.lastSetTouchableReason = DRAG_LAYER_INVISIBLE
|
||||
} else if (!controllers.uiController.isTaskbarTouchable) {
|
||||
// Let touches pass through us.
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
|
||||
debugTouchableRegion.lastSetTouchableReason = "Taskbar is not touchable"
|
||||
touchableInsets = TOUCHABLE_INSETS_REGION
|
||||
debugTouchableRegion.lastSetTouchableReason = UI_CONTROLLER_UNTOUCHABLE
|
||||
} else if (controllers.taskbarDragController.isSystemDragInProgress) {
|
||||
// Let touches pass through us.
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
|
||||
debugTouchableRegion.lastSetTouchableReason = "System drag is in progress"
|
||||
touchableInsets = TOUCHABLE_INSETS_REGION
|
||||
debugTouchableRegion.lastSetTouchableReason = SYSTEM_DRAG_IN_PROGRESS
|
||||
} else if (context.isTaskbarWindowFullscreen) {
|
||||
// Intercept entire fullscreen window.
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_FRAME)
|
||||
insetsIsTouchableRegion = false
|
||||
debugTouchableRegion.lastSetTouchableReason = "Taskbar is fullscreen"
|
||||
touchableInsets = TOUCHABLE_INSETS_FRAME
|
||||
debugTouchableRegion.lastSetTouchableReason = FULLSCREEN_TASKBAR_WINDOW
|
||||
context.dragLayer.getBoundsInWindow(debugTouchableRegion.lastSetTouchableBounds, false)
|
||||
} else if (
|
||||
controllers.taskbarViewController.areIconsVisible() ||
|
||||
@@ -409,27 +417,27 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
region.addBoundsToRegion(bubbleBarBounds)
|
||||
}
|
||||
insetsInfo.touchableRegion.set(region)
|
||||
debugTouchableRegion.lastSetTouchableReason = "Transient Taskbar is in Overview"
|
||||
debugTouchableRegion.lastSetTouchableReason = TRANSIENT_IN_OVERVIEW
|
||||
debugTouchableRegion.lastSetTouchableBounds.set(region.bounds)
|
||||
} else {
|
||||
insetsInfo.touchableRegion.set(defaultTouchableRegion)
|
||||
debugTouchableRegion.lastSetTouchableReason = "Using default touchable region"
|
||||
debugTouchableRegion.lastSetTouchableReason = DEFAULT_TOUCH_REGION
|
||||
debugTouchableRegion.lastSetTouchableBounds.set(defaultTouchableRegion.bounds)
|
||||
}
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
|
||||
insetsIsTouchableRegion = false
|
||||
touchableInsets = TOUCHABLE_INSETS_REGION
|
||||
} else {
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION)
|
||||
debugTouchableRegion.lastSetTouchableReason =
|
||||
"Icons are not visible, but other components such as 3 buttons might be"
|
||||
touchableInsets = TOUCHABLE_INSETS_REGION
|
||||
debugTouchableRegion.lastSetTouchableReason = ICONS_INVISIBLE
|
||||
}
|
||||
// Always have nav buttons be touchable
|
||||
controllers.navbarButtonsViewController.addVisibleButtonsRegion(
|
||||
context.dragLayer,
|
||||
insetsInfo.touchableRegion,
|
||||
)
|
||||
|
||||
insetsInfo.setTouchableInsets(touchableInsets)
|
||||
debugTouchableRegion.lastSetTouchableInsets = touchableInsets
|
||||
debugTouchableRegion.lastSetTouchableBounds.set(insetsInfo.touchableRegion.bounds)
|
||||
context.excludeFromMagnificationRegion(insetsIsTouchableRegion)
|
||||
}
|
||||
|
||||
/** Draws the last set touchableRegion as a red rectangle onto the given Canvas. */
|
||||
@@ -460,12 +468,42 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
||||
}
|
||||
pw.println()
|
||||
}
|
||||
pw.println("$prefix\tlastSetTouchableBounds=${debugTouchableRegion.lastSetTouchableBounds}")
|
||||
pw.println("$prefix\tlastSetTouchableReason=${debugTouchableRegion.lastSetTouchableReason}")
|
||||
pw.println("$prefix\tdebugTouchableRegion=$debugTouchableRegion")
|
||||
}
|
||||
|
||||
class DebugTouchableRegion {
|
||||
|
||||
companion object {
|
||||
const val PHONE_MODE =
|
||||
"Phone button nav mode: Fullscreen touchable, IME not affecting nav buttons"
|
||||
const val DRAG_LAYER_INVISIBLE = "Taskbar is invisible"
|
||||
const val UI_CONTROLLER_UNTOUCHABLE = "Taskbar is not touchable"
|
||||
const val SYSTEM_DRAG_IN_PROGRESS = "System drag is in progress"
|
||||
const val FULLSCREEN_TASKBAR_WINDOW = "Taskbar is fullscreen"
|
||||
const val TRANSIENT_IN_OVERVIEW = "Transient Taskbar is in Overview"
|
||||
const val DEFAULT_TOUCH_REGION = "Using default touchable region"
|
||||
const val ICONS_INVISIBLE =
|
||||
"Icons are not visible, but other components such as 3 buttons might be"
|
||||
}
|
||||
|
||||
val lastSetTouchableBounds = Rect()
|
||||
var lastSetTouchableReason = ""
|
||||
var lastSetTouchableInsets = TOUCHABLE_INSETS_FRAME
|
||||
|
||||
override fun toString(): String {
|
||||
return "{lastSetTouchableBounds=$lastSetTouchableBounds" +
|
||||
", lastSetTouchableReason=\"$lastSetTouchableReason\"" +
|
||||
", lastSetTouchableInsets=${touchableInsetsToString()}"
|
||||
}
|
||||
|
||||
private fun touchableInsetsToString(): String {
|
||||
return when (lastSetTouchableInsets) {
|
||||
TOUCHABLE_INSETS_FRAME -> "TOUCHABLE_INSETS_FRAME"
|
||||
TOUCHABLE_INSETS_CONTENT -> "TOUCHABLE_INSETS_CONTENT"
|
||||
TOUCHABLE_INSETS_VISIBLE -> "TOUCHABLE_INSETS_VISIBLE"
|
||||
TOUCHABLE_INSETS_REGION -> "TOUCHABLE_INSETS_REGION"
|
||||
else -> "Unknown"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,11 +62,11 @@ import com.android.launcher3.statemanager.StateManager;
|
||||
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController.BubbleLauncherState;
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
|
||||
import com.android.quickstep.BaseContainerInterface;
|
||||
import com.android.quickstep.OverviewComponentObserver;
|
||||
import com.android.quickstep.RecentsAnimationCallbacks;
|
||||
import com.android.quickstep.RecentsAnimationController;
|
||||
import com.android.quickstep.fallback.RecentsState;
|
||||
import com.android.quickstep.fallback.window.RecentsDisplayModel;
|
||||
import com.android.quickstep.fallback.window.RecentsWindowFlags;
|
||||
import com.android.quickstep.fallback.window.RecentsWindowManager;
|
||||
import com.android.quickstep.util.ScalingWorkspaceRevealAnim;
|
||||
import com.android.quickstep.util.SystemUiFlagUtils;
|
||||
@@ -80,6 +80,7 @@ import java.io.PrintWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Track LauncherState, RecentsAnimation, resumed state for task bar in one place here and animate
|
||||
@@ -360,16 +361,16 @@ public class TaskbarLauncherStateController {
|
||||
|
||||
if (mTaskBarRecentsAnimationListener != null) {
|
||||
mTaskBarRecentsAnimationListener.endGestureStateOverride(
|
||||
!mLauncher.isInState(LauncherState.OVERVIEW), false /*canceled*/);
|
||||
!isStateManagerInState(LauncherState.OVERVIEW), /* canceled= */ false);
|
||||
}
|
||||
mTaskBarRecentsAnimationListener = new TaskBarRecentsAnimationListener(callbacks);
|
||||
callbacks.addListener(mTaskBarRecentsAnimationListener);
|
||||
RecentsView recentsView = mControllers.uiController.getRecentsView();
|
||||
if (recentsView != null) {
|
||||
recentsView.setTaskLaunchListener(() -> mTaskBarRecentsAnimationListener
|
||||
.endGestureStateOverride(true, false /*canceled*/));
|
||||
.endGestureStateOverride(/* finishedToApp= */ true, /* canceled= */ false));
|
||||
recentsView.setTaskLaunchCancelledRunnable(() -> {
|
||||
updateStateForUserFinishedToApp(false /* finishedToApp */);
|
||||
updateStateForUserFinishedToApp(/* finishedToApp= */ false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -506,6 +507,10 @@ public class TaskbarLauncherStateController {
|
||||
+ ", toAlignment: " + toAlignment);
|
||||
}
|
||||
mControllers.bubbleControllers.ifPresent(controllers -> {
|
||||
// Ignore state changes when taskbar is destroyed
|
||||
if (mControllers.taskbarActivityContext.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
// Show the bubble bar when on launcher home (hotseat icons visible) or in overview
|
||||
boolean onOverview = isInLauncher && mLauncherState == LauncherState.OVERVIEW;
|
||||
boolean hotseatIconsVisible = isInLauncher && mLauncherState.areElementsVisible(
|
||||
@@ -522,11 +527,22 @@ public class TaskbarLauncherStateController {
|
||||
stashController.updateStateForFlag(FLAG_IN_OVERVIEW,
|
||||
mLauncherState == LauncherState.OVERVIEW);
|
||||
|
||||
// Update taskbar stash flag here since we are skipping the playStateTransitionAnim below
|
||||
if (isPinnedTaskbar) {
|
||||
stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE,
|
||||
mLauncherState.isTaskbarStashed(mLauncher));
|
||||
}
|
||||
|
||||
AnimatorSet animatorSet = new AnimatorSet();
|
||||
|
||||
if (hasAnyFlag(changedFlags, FLAG_LAUNCHER_IN_STATE_TRANSITION)) {
|
||||
boolean launcherTransitionCompleted = !hasAnyFlag(FLAG_LAUNCHER_IN_STATE_TRANSITION);
|
||||
playStateTransitionAnim(animatorSet, duration, launcherTransitionCompleted);
|
||||
|
||||
// We are skipping the taskbar stash animation for pinned taskbar, as we handle that now
|
||||
// in setupPinnedTaskbarAnimation.
|
||||
if (!isPinnedTaskbar) {
|
||||
playStateTransitionAnim(animatorSet, duration, launcherTransitionCompleted);
|
||||
}
|
||||
|
||||
if (launcherTransitionCompleted
|
||||
&& mLauncherState == LauncherState.QUICK_SWITCH_FROM_HOME) {
|
||||
@@ -550,6 +566,8 @@ public class TaskbarLauncherStateController {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
mIsAnimatingToLauncher = isInLauncher;
|
||||
// updateOverviewDragState uses mIsAnimatingToLauncher as well, so poke it.
|
||||
updateOverviewDragState(mLauncherState);
|
||||
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onAnimationStart - FLAG_IN_APP: " + !isInLauncher);
|
||||
@@ -561,6 +579,8 @@ public class TaskbarLauncherStateController {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mIsAnimatingToLauncher = false;
|
||||
// updateOverviewDragState uses mIsAnimatingToLauncher as well, so poke it.
|
||||
updateOverviewDragState(mLauncherState);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -614,7 +634,7 @@ public class TaskbarLauncherStateController {
|
||||
AnimatedFloat taskbarBgOffset =
|
||||
mControllers.taskbarDragLayerController.getTaskbarBackgroundOffset();
|
||||
boolean showTaskbar = shouldShowTaskbar(mControllers.taskbarActivityContext, isInLauncher,
|
||||
isInOverview);
|
||||
isInOverview) && !mControllers.taskbarStashController.isStashed();
|
||||
float taskbarBgOffsetEnd = showTaskbar ? 0f : 1f;
|
||||
float taskbarBgOffsetStart = showTaskbar ? 1f : 0f;
|
||||
|
||||
@@ -763,6 +783,7 @@ public class TaskbarLauncherStateController {
|
||||
return !isInLauncher || isInOverview;
|
||||
}
|
||||
|
||||
// Used to stash/unstash pinned taskbar between home, overview, in app states.
|
||||
private void setupPinnedTaskbarAnimation(AnimatorSet animatorSet, boolean showTaskbar,
|
||||
AnimatedFloat taskbarBgOffset, float taskbarBgOffsetStart, float taskbarBgOffsetEnd,
|
||||
long duration, Animator taskbarBackgroundAlpha) {
|
||||
@@ -773,19 +794,26 @@ public class TaskbarLauncherStateController {
|
||||
ALPHA_CHANNEL_TASKBAR_ALIGNMENT);
|
||||
}
|
||||
|
||||
float targetTaskbarIconAlpha = showTaskbar ? 1f : 0f;
|
||||
if (mTaskbarAlphaForHome.getValue() != targetTaskbarIconAlpha) {
|
||||
animatorSet.play(mTaskbarAlphaForHome
|
||||
.animateToValue(targetTaskbarIconAlpha)
|
||||
.setDuration(duration));
|
||||
}
|
||||
if ((taskbarBgOffset.value != taskbarBgOffsetEnd && !taskbarBgOffset.isAnimating())
|
||||
|| taskbarBgOffset.isAnimatingToValue(taskbarBgOffsetStart)) {
|
||||
taskbarBgOffset.cancelAnimation();
|
||||
Animator taskbarIconAlpha = mTaskbarAlphaForHome.animateToValue(
|
||||
showTaskbar ? 1f : 0f);
|
||||
AnimatedFloat taskbarIconTranslationYForHome =
|
||||
mControllers.taskbarViewController.mTaskbarIconTranslationYForHome;
|
||||
ObjectAnimator taskbarBackgroundOffset = taskbarBgOffset.animateToValue(
|
||||
taskbarBgOffsetStart,
|
||||
taskbarBgOffsetEnd);
|
||||
ObjectAnimator taskbarIconsYTranslation = null;
|
||||
float taskbarHeight =
|
||||
mControllers.taskbarActivityContext.getDeviceProfile().taskbarHeight;
|
||||
float taskbarHeight = mControllers
|
||||
.taskbarActivityContext
|
||||
.getDeviceProfile()
|
||||
.getTaskbarProfile()
|
||||
.getHeight();
|
||||
if (showTaskbar) {
|
||||
taskbarIconsYTranslation = taskbarIconTranslationYForHome.animateToValue(
|
||||
taskbarHeight, 0);
|
||||
@@ -794,11 +822,9 @@ public class TaskbarLauncherStateController {
|
||||
taskbarHeight);
|
||||
}
|
||||
|
||||
taskbarIconAlpha.setDuration(duration);
|
||||
taskbarIconsYTranslation.setDuration(duration);
|
||||
taskbarBackgroundOffset.setDuration(duration);
|
||||
|
||||
animatorSet.play(taskbarIconAlpha);
|
||||
animatorSet.play(taskbarIconsYTranslation);
|
||||
animatorSet.play(taskbarBackgroundOffset);
|
||||
}
|
||||
@@ -1056,6 +1082,12 @@ public class TaskbarLauncherStateController {
|
||||
translationXAnimation.start();
|
||||
}
|
||||
|
||||
private boolean isStateManagerInState(@NonNull LauncherState state) {
|
||||
return mLauncher.isInState(state) || state == getFromRecentsWindowManager(
|
||||
recentsWindowManager ->
|
||||
toLauncherState(recentsWindowManager.getStateManager().getState()));
|
||||
}
|
||||
|
||||
private final class TaskBarRecentsAnimationListener implements
|
||||
RecentsAnimationCallbacks.RecentsAnimationListener {
|
||||
private final RecentsAnimationCallbacks mCallbacks;
|
||||
@@ -1066,18 +1098,13 @@ public class TaskbarLauncherStateController {
|
||||
|
||||
@Override
|
||||
public void onRecentsAnimationCanceled(HashMap<Integer, ThumbnailData> thumbnailDatas) {
|
||||
boolean isInOverview = mLauncher.isInState(LauncherState.OVERVIEW);
|
||||
endGestureStateOverride(!isInOverview, true /*canceled*/);
|
||||
boolean isInOverview = isStateManagerInState(LauncherState.OVERVIEW);
|
||||
endGestureStateOverride(!isInOverview, /* canceled= */ true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecentsAnimationFinished(RecentsAnimationController controller) {
|
||||
endGestureStateOverride(!controller.getFinishTargetIsLauncher(),
|
||||
controller.getLauncherIsVisibleAtFinish(), false /*canceled*/);
|
||||
}
|
||||
|
||||
private void endGestureStateOverride(boolean finishedToApp, boolean canceled) {
|
||||
endGestureStateOverride(finishedToApp, finishedToApp, canceled);
|
||||
endGestureStateOverride(!controller.getFinishTargetIsLauncher(), /* canceled= */ false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1087,45 +1114,35 @@ public class TaskbarLauncherStateController {
|
||||
*
|
||||
* @param finishedToApp {@code true} if the recents animation finished to showing an app and
|
||||
* not workspace or overview
|
||||
* @param launcherIsVisible {code true} if launcher is visible at finish
|
||||
* @param canceled {@code true} if the recents animation was canceled instead of
|
||||
* finishing
|
||||
* to completion
|
||||
*/
|
||||
private void endGestureStateOverride(boolean finishedToApp, boolean launcherIsVisible,
|
||||
boolean canceled) {
|
||||
private void endGestureStateOverride(boolean finishedToApp, boolean canceled) {
|
||||
mCallbacks.removeListener(this);
|
||||
mTaskBarRecentsAnimationListener = null;
|
||||
RecentsView recentsView = mControllers.uiController.getRecentsView();
|
||||
if (recentsView != null) {
|
||||
recentsView.setTaskLaunchListener(null);
|
||||
recentsView.setTaskLaunchCancelledRunnable(null);
|
||||
}
|
||||
|
||||
if (mSkipNextRecentsAnimEnd && !canceled) {
|
||||
mSkipNextRecentsAnimEnd = false;
|
||||
return;
|
||||
}
|
||||
updateStateForUserFinishedToApp(finishedToApp, launcherIsVisible);
|
||||
updateStateForUserFinishedToApp(finishedToApp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #updateStateForUserFinishedToApp(boolean, boolean)
|
||||
*/
|
||||
private void updateStateForUserFinishedToApp(boolean finishedToApp) {
|
||||
updateStateForUserFinishedToApp(finishedToApp, !finishedToApp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the visible state immediately to ensure a seamless handoff.
|
||||
*
|
||||
* @param finishedToApp True iff user is in an app.
|
||||
* @param launcherIsVisible True iff launcher is still visible (ie. transparent app)
|
||||
*/
|
||||
private void updateStateForUserFinishedToApp(boolean finishedToApp,
|
||||
boolean launcherIsVisible) {
|
||||
private void updateStateForUserFinishedToApp(boolean finishedToApp) {
|
||||
// Update the visible state immediately to ensure a seamless handoff
|
||||
boolean launcherVisible = !finishedToApp || launcherIsVisible;
|
||||
boolean launcherVisible = !finishedToApp;
|
||||
updateStateForFlag(FLAG_TRANSITION_TO_VISIBLE, false);
|
||||
updateStateForFlag(FLAG_VISIBLE, launcherVisible);
|
||||
applyState();
|
||||
@@ -1134,7 +1151,7 @@ public class TaskbarLauncherStateController {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "endGestureStateOverride - FLAG_IN_APP: " + finishedToApp);
|
||||
}
|
||||
controller.updateStateForFlag(FLAG_IN_APP, finishedToApp && !launcherIsVisible);
|
||||
controller.updateStateForFlag(FLAG_IN_APP, finishedToApp);
|
||||
controller.applyState();
|
||||
}
|
||||
|
||||
@@ -1142,14 +1159,24 @@ public class TaskbarLauncherStateController {
|
||||
* Helper function to run a callback on the RecentsWindowManager (if it exists).
|
||||
*/
|
||||
private void runForRecentsWindowManager(Consumer<RecentsWindowManager> callback) {
|
||||
if (RecentsWindowFlags.getEnableOverviewInWindow()) {
|
||||
final TaskbarActivityContext taskbarContext = mControllers.taskbarActivityContext;
|
||||
RecentsWindowManager recentsWindowManager = RecentsDisplayModel.getINSTANCE()
|
||||
.get(taskbarContext).getRecentsWindowManager(taskbarContext.getDisplayId());
|
||||
if (recentsWindowManager != null) {
|
||||
callback.accept(recentsWindowManager);
|
||||
}
|
||||
getFromRecentsWindowManager(recentsWindowManager -> {
|
||||
callback.accept(recentsWindowManager);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
private <T> @Nullable T getFromRecentsWindowManager(
|
||||
Function<RecentsWindowManager, T> function) {
|
||||
final TaskbarActivityContext taskbarContext = mControllers.taskbarActivityContext;
|
||||
int displayId = taskbarContext.getDisplayId();
|
||||
BaseContainerInterface<?, ?> containerInterface = OverviewComponentObserver.INSTANCE.get(
|
||||
taskbarContext).getContainerInterface(displayId);
|
||||
if (containerInterface == null
|
||||
|| !(containerInterface.getCreatedContainer() instanceof RecentsWindowManager
|
||||
recentsWindowManager)) {
|
||||
return null;
|
||||
}
|
||||
return function.apply(recentsWindowManager);
|
||||
}
|
||||
|
||||
private static String getStateString(int flags) {
|
||||
|
||||
@@ -15,20 +15,26 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APPS_PREDICTION;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
|
||||
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.UiThread;
|
||||
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.celllayout.CellInfo;
|
||||
import com.android.launcher3.model.BgDataModel;
|
||||
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.PredictedContainerInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceData;
|
||||
import com.android.launcher3.taskbar.TaskbarView.TaskbarLayoutParams;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.IntArray;
|
||||
import com.android.launcher3.util.IntSet;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
@@ -36,7 +42,6 @@ import com.android.launcher3.util.Preconditions;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -62,7 +67,6 @@ public class TaskbarModelCallbacks implements
|
||||
// Used to defer any UI updates during the SUW unstash animation.
|
||||
private boolean mDeferUpdatesForSUW;
|
||||
private Runnable mDeferredUpdates;
|
||||
private boolean mBindingItems = false;
|
||||
|
||||
public TaskbarModelCallbacks(
|
||||
TaskbarActivityContext context, TaskbarView container) {
|
||||
@@ -75,36 +79,25 @@ public class TaskbarModelCallbacks implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startBinding() {
|
||||
mBindingItems = true;
|
||||
public void bindCompleteModel(WorkspaceData itemIdMap, boolean isBindingSync) {
|
||||
mHotseatItems.clear();
|
||||
mPredictedItems = Collections.emptyList();
|
||||
}
|
||||
mPredictedItems = itemIdMap.getPredictedContents(CONTAINER_HOTSEAT_PREDICTION);
|
||||
handleItemsAdded(itemIdMap);
|
||||
|
||||
@Override
|
||||
public void finishBindingItems(IntSet pagesBoundFirst) {
|
||||
mBindingItems = false;
|
||||
if (itemIdMap.get(CONTAINER_ALL_APPS_PREDICTION) instanceof PredictedContainerInfo pci) {
|
||||
mControllers.taskbarAllAppsController.setPredictedApps(pci.getContents());
|
||||
}
|
||||
commitItemsToUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindAppsAdded(IntArray newScreens, ArrayList<ItemInfo> addNotAnimated,
|
||||
ArrayList<ItemInfo> addAnimated) {
|
||||
boolean add1 = handleItemsAdded(addNotAnimated);
|
||||
boolean add2 = handleItemsAdded(addAnimated);
|
||||
if (add1 || add2) {
|
||||
public void bindItemsAdded(List<ItemInfo> items) {
|
||||
if (handleItemsAdded(items)) {
|
||||
commitItemsToUI();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindItems(List<ItemInfo> shortcuts, boolean forceAnimateIcons) {
|
||||
if (handleItemsAdded(shortcuts)) {
|
||||
commitItemsToUI();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handleItemsAdded(List<ItemInfo> items) {
|
||||
private boolean handleItemsAdded(Iterable<ItemInfo> items) {
|
||||
boolean modified = false;
|
||||
for (ItemInfo item : items) {
|
||||
if (item.container == Favorites.CONTAINER_HOTSEAT) {
|
||||
@@ -116,8 +109,36 @@ public class TaskbarModelCallbacks implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindItemsUpdated(Set<ItemInfo> updates) {
|
||||
updateContainerItems(updates, mContext);
|
||||
public void bindItemsUpdated(@NonNull Set<ItemInfo> updates) {
|
||||
Set<ItemInfo> itemsToRebind = updateContainerItems(updates, mContext);
|
||||
boolean removed = handleItemsRemoved(ItemInfoMatcher.ofItems(itemsToRebind));
|
||||
boolean added = handleItemsAdded(itemsToRebind);
|
||||
|
||||
boolean predictionsUpdated = false;
|
||||
for (ItemInfo update: updates) {
|
||||
if (update instanceof PredictedContainerInfo pci) {
|
||||
if (pci.id == Favorites.CONTAINER_HOTSEAT_PREDICTION) {
|
||||
mPredictedItems = pci.getContents();
|
||||
predictionsUpdated = true;
|
||||
} else if (pci.id == CONTAINER_ALL_APPS_PREDICTION) {
|
||||
mControllers.taskbarAllAppsController.setPredictedApps(pci.getContents());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (removed || added || predictionsUpdated) {
|
||||
commitItemsToUI();
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CellInfo getCellInfoForView(@NonNull View view) {
|
||||
return view.getLayoutParams() instanceof TaskbarLayoutParams tlp ? tlp.bindInfo : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isContainerSupported(int container) {
|
||||
return container == CONTAINER_HOTSEAT || container == CONTAINER_HOTSEAT_PREDICTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,30 +171,7 @@ public class TaskbarModelCallbacks implements
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindItemsModified(List<ItemInfo> items) {
|
||||
boolean removed = handleItemsRemoved(ItemInfoMatcher.ofItems(items));
|
||||
boolean added = handleItemsAdded(items);
|
||||
if (removed || added) {
|
||||
commitItemsToUI();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindExtraContainerItems(FixedContainerItems item) {
|
||||
if (item.containerId == Favorites.CONTAINER_HOTSEAT_PREDICTION) {
|
||||
mPredictedItems = item.items;
|
||||
commitItemsToUI();
|
||||
} else if (item.containerId == Favorites.CONTAINER_PREDICTION) {
|
||||
mControllers.taskbarAllAppsController.setPredictedApps(item.items);
|
||||
}
|
||||
}
|
||||
|
||||
private void commitItemsToUI() {
|
||||
if (mBindingItems) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemInfo[] hotseatItemInfos =
|
||||
new ItemInfo[mContext.getDeviceProfile().numShownHotseatIcons];
|
||||
int predictionSize = mPredictedItems.size();
|
||||
|
||||
@@ -17,12 +17,11 @@
|
||||
package com.android.launcher3.taskbar
|
||||
|
||||
import android.content.Context
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.util.ResourceBasedOverride
|
||||
import com.android.launcher3.util.ResourceBasedOverride.Overrides
|
||||
import com.android.launcher3.dagger.LauncherComponentProvider
|
||||
import javax.inject.Inject
|
||||
|
||||
/** Creates [TaskbarModelCallbacks] instances. */
|
||||
open class TaskbarModelCallbacksFactory : ResourceBasedOverride {
|
||||
open class TaskbarModelCallbacksFactory @Inject constructor() {
|
||||
|
||||
open fun create(
|
||||
activityContext: TaskbarActivityContext,
|
||||
@@ -32,11 +31,7 @@ open class TaskbarModelCallbacksFactory : ResourceBasedOverride {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(context: Context): TaskbarModelCallbacksFactory {
|
||||
return Overrides.getObject(
|
||||
TaskbarModelCallbacksFactory::class.java,
|
||||
context,
|
||||
R.string.taskbar_model_callbacks_factory_class,
|
||||
)
|
||||
return LauncherComponentProvider.get(context).getTaskbarModelCallbacksFactory()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,9 +34,10 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
|
||||
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY;
|
||||
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
|
||||
import static com.android.window.flags.Flags.predictiveBackThreeButtonNav;
|
||||
import static com.android.window.flags2.Flags.predictiveBackThreeButtonNav;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
@@ -121,6 +122,7 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
|
||||
private final SystemUiProxy mSystemUiProxy;
|
||||
private final Handler mHandler;
|
||||
private final ContextualSearchInvoker mContextualSearchInvoker;
|
||||
private TaskbarControllers mControllers;
|
||||
@Nullable private StatsLogManager mStatsLogManager;
|
||||
|
||||
private final Runnable mResetLongPress = this::resetScreenUnpin;
|
||||
@@ -153,6 +155,8 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
|
||||
// prevent interactions with other buttons while back button is pressed
|
||||
return;
|
||||
}
|
||||
// Provide the same haptic feedback that the system offers for virtual keys.
|
||||
view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
|
||||
switch (buttonType) {
|
||||
case BUTTON_BACK:
|
||||
executeBack(/* keyEvent */ null);
|
||||
@@ -186,6 +190,9 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles long clicks and plays haptics for user visible actions.
|
||||
*/
|
||||
public boolean onButtonLongClick(@TaskbarButton int buttonType, View view) {
|
||||
if (buttonType == BUTTON_SPACE) {
|
||||
return false;
|
||||
@@ -204,34 +211,39 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
|
||||
return false;
|
||||
}
|
||||
|
||||
// Provide the same haptic feedback that the system offers for long press.
|
||||
// The haptic feedback from long pressing on the home button is handled by circle to search.
|
||||
// There are no haptics for long pressing the back button if predictive back is enabled
|
||||
if (buttonType != BUTTON_HOME
|
||||
&& (!predictiveBackThreeButtonNav || buttonType != BUTTON_BACK)) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||
}
|
||||
switch (buttonType) {
|
||||
case BUTTON_HOME:
|
||||
logEvent(LAUNCHER_TASKBAR_HOME_BUTTON_LONGPRESS);
|
||||
onLongPressHome();
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
|
||||
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
return true;
|
||||
case BUTTON_A11Y:
|
||||
logEvent(LAUNCHER_TASKBAR_A11Y_BUTTON_LONGPRESS);
|
||||
notifyA11yClick(true /* longClick */);
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
|
||||
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
return true;
|
||||
case BUTTON_BACK:
|
||||
logEvent(LAUNCHER_TASKBAR_BACK_BUTTON_LONGPRESS);
|
||||
backRecentsLongpress(buttonType);
|
||||
if (backRecentsLongpress(buttonType)) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
|
||||
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
}
|
||||
return true;
|
||||
case BUTTON_RECENTS:
|
||||
logEvent(LAUNCHER_TASKBAR_OVERVIEW_BUTTON_LONGPRESS);
|
||||
backRecentsLongpress(buttonType);
|
||||
if (backRecentsLongpress(buttonType)) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
|
||||
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
}
|
||||
return true;
|
||||
case BUTTON_IME_SWITCH:
|
||||
if (Flags.imeSwitcherRevamp()) {
|
||||
logEvent(LAUNCHER_TASKBAR_IME_SWITCHER_BUTTON_LONGPRESS);
|
||||
onImeSwitcherLongPress();
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
|
||||
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -261,6 +273,13 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies SystemUI of the new bounds of the recents button in screen coordinates.
|
||||
*/
|
||||
public void onRecentsButtonLayoutChanged(Rect bounds) {
|
||||
mSystemUiProxy.notifyRecentsButtonPositionChanged(bounds);
|
||||
}
|
||||
|
||||
private boolean backRecentsLongpress(@TaskbarButton int buttonType) {
|
||||
mLongPressedButtons |= buttonType;
|
||||
return determineScreenUnpin();
|
||||
@@ -317,7 +336,8 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
|
||||
}
|
||||
|
||||
public void init(TaskbarControllers taskbarControllers) {
|
||||
mStatsLogManager = taskbarControllers.getTaskbarActivityContext().getStatsLogManager();
|
||||
mControllers = taskbarControllers;
|
||||
mStatsLogManager = mControllers.getTaskbarActivityContext().getStatsLogManager();
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
@@ -338,7 +358,7 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
|
||||
|
||||
private void navigateHome() {
|
||||
TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY);
|
||||
mCallbacks.onNavigateHome();
|
||||
mCallbacks.onNavigateHome(mContext.getDisplayId());
|
||||
}
|
||||
|
||||
private void navigateToOverview() {
|
||||
@@ -347,11 +367,11 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
|
||||
}
|
||||
TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "onOverviewToggle");
|
||||
TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
|
||||
mCallbacks.onToggleOverview();
|
||||
mCallbacks.onToggleOverview(mContext.getDisplayId());
|
||||
}
|
||||
|
||||
public void hideOverview() {
|
||||
mCallbacks.onHideOverview();
|
||||
mCallbacks.onHideOverview(mContext.getDisplayId());
|
||||
}
|
||||
|
||||
void sendBackKeyEvent(int action, boolean cancelled) {
|
||||
@@ -361,6 +381,7 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
|
||||
}
|
||||
long time = SystemClock.uptimeMillis();
|
||||
KeyEvent keyEvent = new KeyEvent(time, time, action, KeyEvent.KEYCODE_BACK, 0);
|
||||
keyEvent.setDisplayId(mControllers.getTaskbarActivityContext().getDisplayId());
|
||||
if (cancelled) {
|
||||
keyEvent.cancel();
|
||||
}
|
||||
@@ -417,12 +438,12 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
|
||||
/** Callbacks for navigation buttons on Taskbar. */
|
||||
public interface TaskbarNavButtonCallbacks {
|
||||
/** Callback invoked when the home button is pressed. */
|
||||
default void onNavigateHome() {}
|
||||
default void onNavigateHome(int displayId) {}
|
||||
|
||||
/** Callback invoked when the overview button is pressed. */
|
||||
default void onToggleOverview() {}
|
||||
default void onToggleOverview(int displayId) {}
|
||||
|
||||
/** Callback invoken when a visible overview needs to be hidden. */
|
||||
default void onHideOverview() { }
|
||||
default void onHideOverview(int displayId) { }
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Reorderable;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.icons.IconNormalizer;
|
||||
@@ -339,6 +340,17 @@ public class TaskbarOverflowView extends FrameLayout implements Reorderable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Tooltip to be used for the taskbar overflow view - returns null if the view should
|
||||
* not have a tooltip.
|
||||
*/
|
||||
public String getTextForTooltipPopup() {
|
||||
if (mIsActive) {
|
||||
return null;
|
||||
}
|
||||
return getResources().getString(R.string.taskbar_overflow_a11y_title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the view's state (whether it shows a set of app icons or a leave-behind circle).
|
||||
*/
|
||||
|
||||
@@ -24,6 +24,8 @@ import com.android.app.animation.Interpolators
|
||||
import com.android.launcher3.LauncherPrefs
|
||||
import com.android.launcher3.LauncherPrefs.Companion.TASKBAR_PINNING
|
||||
import com.android.launcher3.LauncherPrefs.Companion.TASKBAR_PINNING_IN_DESKTOP_MODE
|
||||
import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_DESKTOP_MODE_TASKBAR_PINNED
|
||||
import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_DESKTOP_MODE_TASKBAR_UNPINNED
|
||||
import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_DIVIDER_MENU_CLOSE
|
||||
import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_DIVIDER_MENU_OPEN
|
||||
import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_PINNED
|
||||
@@ -56,16 +58,26 @@ class TaskbarPinningController(private val context: TaskbarActivityContext) :
|
||||
if (!didPreferenceChange) {
|
||||
return
|
||||
}
|
||||
val shouldPinTaskbar =
|
||||
if (
|
||||
controllers.taskbarDesktopModeController.isInDesktopModeAndNotInOverview(
|
||||
context.displayId
|
||||
)
|
||||
) {
|
||||
|
||||
if (
|
||||
controllers.taskbarDesktopModeController.shouldShowDesktopTasksInTaskbar(
|
||||
context.displayId
|
||||
)
|
||||
) {
|
||||
val shouldPinDesktopTaskbar =
|
||||
!launcherPrefs.get(TASKBAR_PINNING_IN_DESKTOP_MODE)
|
||||
} else {
|
||||
!launcherPrefs.get(TASKBAR_PINNING)
|
||||
}
|
||||
val logEvent =
|
||||
if (shouldPinDesktopTaskbar) {
|
||||
LAUNCHER_DESKTOP_MODE_TASKBAR_PINNED
|
||||
} else {
|
||||
LAUNCHER_DESKTOP_MODE_TASKBAR_UNPINNED
|
||||
}
|
||||
statsLogManager.logger().log(logEvent)
|
||||
launcherPrefs.put(TASKBAR_PINNING_IN_DESKTOP_MODE, shouldPinDesktopTaskbar)
|
||||
return
|
||||
}
|
||||
|
||||
val shouldPinTaskbar = !launcherPrefs.get(TASKBAR_PINNING)
|
||||
|
||||
val animateToValue =
|
||||
if (shouldPinTaskbar) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventFo
|
||||
import android.content.Intent;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.graphics.Point;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Pair;
|
||||
import android.util.SparseArray;
|
||||
import android.view.MotionEvent;
|
||||
@@ -30,6 +31,7 @@ import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.logging.InstanceId;
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
@@ -53,6 +55,7 @@ import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.util.LogUtils;
|
||||
import com.android.quickstep.util.SingleTask;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleAnythingFlagHelper;
|
||||
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
|
||||
|
||||
@@ -142,25 +145,35 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemInfo itemInfo;
|
||||
ItemInfo itemInfo = null;
|
||||
if (icon.getTag() instanceof ItemInfo item && ShortcutUtil.supportsShortcuts(item)) {
|
||||
itemInfo = item;
|
||||
} else if (icon.getTag() instanceof SingleTask task) {
|
||||
itemInfo = SingleTask.Companion.createTaskItemInfo(task);
|
||||
} else {
|
||||
} else if (PinToTaskbarShortcut.Companion.isPinningAppWithContextMenuEnabled(mContext)
|
||||
&& icon.getTag() instanceof SingleTask task) {
|
||||
Task.TaskKey key = task.getTask().getKey();
|
||||
AppInfo appInfo = getApp(
|
||||
new ComponentKey(key.getComponent(), UserHandle.of(key.userId)));
|
||||
if (appInfo != null) {
|
||||
WorkspaceItemInfo wif = appInfo.makeWorkspaceItem(icon.getContext());
|
||||
itemInfo = SingleTask.Companion.createTaskItemInfo(task, wif);
|
||||
}
|
||||
}
|
||||
|
||||
if (itemInfo == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PopupContainerWithArrow<BaseTaskbarContext> container;
|
||||
int deepShortcutCount = mPopupDataProvider.getShortcutCountForItem(itemInfo);
|
||||
// TODO(b/198438631): add support for INSTALL shortcut factory
|
||||
final ItemInfo finalInfo = itemInfo;
|
||||
List<SystemShortcut> systemShortcuts = getSystemShortcuts()
|
||||
.map(s -> s.getShortcut(context, itemInfo, icon))
|
||||
.map(s -> s.getShortcut(context, finalInfo, icon))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// TODO(b/375648361): Revisit to see if this can be implemented within getSystemShortcuts().
|
||||
if (Flags.enablePinningAppWithContextMenu()) {
|
||||
if (PinToTaskbarShortcut.Companion.isPinningAppWithContextMenuEnabled(mContext)) {
|
||||
SystemShortcut shortcut = createPinShortcut(context, itemInfo, icon);
|
||||
if (shortcut != null) {
|
||||
systemShortcuts.add(0, shortcut);
|
||||
@@ -168,7 +181,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
}
|
||||
|
||||
container = (PopupContainerWithArrow) context.getLayoutInflater().inflate(
|
||||
R.layout.popup_container, context.getDragLayer(), false);
|
||||
R.layout.popup_container, context.getDragLayer(), false);
|
||||
container.populateAndShowRows(icon, itemInfo, deepShortcutCount, systemShortcuts);
|
||||
|
||||
// TODO (b/198438631): configure for taskbar/context
|
||||
@@ -209,7 +222,8 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private SystemShortcut createPinShortcut(BaseTaskbarContext target, ItemInfo itemInfo,
|
||||
@VisibleForTesting
|
||||
SystemShortcut createPinShortcut(BaseTaskbarContext target, ItemInfo itemInfo,
|
||||
BubbleTextView originalView) {
|
||||
// Predicted items use {@code HotseatPredictionController.PinPrediction} shortcut to pin.
|
||||
if (itemInfo.isPredictedItem()) {
|
||||
@@ -219,6 +233,18 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
return new PinToTaskbarShortcut<>(target, itemInfo, originalView, false,
|
||||
mHotseatInfosList);
|
||||
}
|
||||
|
||||
if (itemInfo.container == CONTAINER_ALL_APPS) {
|
||||
// If the target ItemInfo is already pinned on taskbar. Show the unpin option instead.
|
||||
for (int i = 0; i < mHotseatInfosList.size(); i++) {
|
||||
if (Objects.equals(mHotseatInfosList.valueAt(i).getComponentKey(),
|
||||
itemInfo.getComponentKey())) {
|
||||
return new PinToTaskbarShortcut<>(target, itemInfo, originalView, false,
|
||||
mHotseatInfosList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mHotseatInfosList.size()
|
||||
< mContext.getTaskbarSpecsEvaluator().getNumShownHotseatIcons()) {
|
||||
return new PinToTaskbarShortcut<>(target, itemInfo, originalView, true,
|
||||
@@ -266,7 +292,10 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
// Move the icon to align with the center-top of the touch point
|
||||
Point iconShift = new Point();
|
||||
iconShift.x = mIconLastTouchPos.x - sv.getIconCenter().x;
|
||||
iconShift.y = mIconLastTouchPos.y - mContext.getDeviceProfile().taskbarIconSize;
|
||||
iconShift.y = mIconLastTouchPos.y
|
||||
- mContext.getDeviceProfile()
|
||||
.getTaskbarProfile()
|
||||
.getIconSize();
|
||||
|
||||
((TaskbarDragController) ActivityContext.lookupContext(
|
||||
v.getContext()).getDragController()).startDragOnLongClick(sv, iconShift);
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
package com.android.launcher3.taskbar
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.window.DesktopExperienceFlags
|
||||
import android.window.DesktopModeFlags
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import com.android.launcher3.BubbleTextView.RunningAppState
|
||||
@@ -24,6 +26,7 @@ import com.android.launcher3.Flags.enableRecentsInTaskbar
|
||||
import com.android.launcher3.model.data.ItemInfo
|
||||
import com.android.launcher3.model.data.TaskItemInfo
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo
|
||||
import com.android.launcher3.taskbar.PinToTaskbarShortcut.Companion.isPinningAppWithContextMenuEnabled
|
||||
import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController
|
||||
import com.android.launcher3.util.CancellableTask
|
||||
import com.android.quickstep.RecentsFilterState
|
||||
@@ -31,6 +34,7 @@ import com.android.quickstep.RecentsModel
|
||||
import com.android.quickstep.util.DesktopTask
|
||||
import com.android.quickstep.util.GroupTask
|
||||
import com.android.quickstep.util.SingleTask
|
||||
import com.android.systemui.shared.recents.model.Task
|
||||
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus
|
||||
import java.io.PrintWriter
|
||||
|
||||
@@ -39,8 +43,10 @@ import java.io.PrintWriter
|
||||
* - When in Fullscreen mode: show the N most recent Tasks
|
||||
* - When in Desktop Mode: show the currently running (open) Tasks
|
||||
*/
|
||||
class TaskbarRecentAppsController(context: Context, private val recentsModel: RecentsModel) :
|
||||
LoggableTaskbarController {
|
||||
class TaskbarRecentAppsController(
|
||||
private val context: Context,
|
||||
private val recentsModel: RecentsModel,
|
||||
) : LoggableTaskbarController {
|
||||
|
||||
var canShowRunningApps =
|
||||
DesktopModeStatus.canEnterDesktopMode(context) &&
|
||||
@@ -49,17 +55,20 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
set(isEnabledFromTest) {
|
||||
field = isEnabledFromTest
|
||||
if (!field && !canShowRecentApps) {
|
||||
recentsModel.unregisterRecentTasksChangedListener()
|
||||
recentsModel.unregisterRecentTasksChangedListener(recentTasksChangedListener)
|
||||
}
|
||||
}
|
||||
|
||||
val enableRecentTasksThrottle =
|
||||
DesktopExperienceFlags.ENABLE_TASKBAR_RECENT_TASKS_THROTTLE_BUGFIX.isTrue
|
||||
|
||||
// TODO(b/343532825): Add a setting to disable Recents even when the flag is on.
|
||||
var canShowRecentApps = enableRecentsInTaskbar()
|
||||
@VisibleForTesting
|
||||
set(isEnabledFromTest) {
|
||||
field = isEnabledFromTest
|
||||
if (!field && !canShowRunningApps) {
|
||||
recentsModel.unregisterRecentTasksChangedListener()
|
||||
recentsModel.unregisterRecentTasksChangedListener(recentTasksChangedListener)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +79,7 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
private set
|
||||
|
||||
private var allRecentTasks: List<GroupTask> = emptyList()
|
||||
private var desktopTask: DesktopTask? = null
|
||||
private var desktopTasks: List<Task> = emptyList()
|
||||
// Keeps track of the order in which running tasks appear.
|
||||
private var orderedRunningTaskIds = emptyList<Int>()
|
||||
var shownTasks: List<GroupTask> = emptyList()
|
||||
@@ -101,9 +110,11 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
}
|
||||
|
||||
private fun getDesktopTaskState(packageName: String, userId: Int): TaskState {
|
||||
val tasks = desktopTask?.tasks ?: return TaskState(RunningAppState.NOT_RUNNING)
|
||||
if (desktopTasks.isEmpty()) {
|
||||
return TaskState(RunningAppState.NOT_RUNNING)
|
||||
}
|
||||
val appTasks =
|
||||
tasks.filter { task ->
|
||||
desktopTasks.filter { task ->
|
||||
packageName == task.key.packageName && task.key.userId == userId
|
||||
}
|
||||
val runningTask = appTasks.find { getRunningAppState(it.key.id) == RunningAppState.RUNNING }
|
||||
@@ -127,6 +138,19 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if recents has the single task (i.e., fullscreen) represented by the given
|
||||
* [itemInfo].
|
||||
*/
|
||||
fun hasSingleTask(itemInfo: ItemInfo?): Boolean {
|
||||
val packageName = itemInfo?.targetPackage ?: return false
|
||||
return allRecentTasks.any { task ->
|
||||
task is SingleTask &&
|
||||
packageName == task.task.key.packageName &&
|
||||
task.task.key.userId == itemInfo.user.identifier
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
val runningTaskIds: Set<Int>
|
||||
/**
|
||||
@@ -140,8 +164,7 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
) {
|
||||
return emptySet()
|
||||
}
|
||||
val tasks = desktopTask?.tasks ?: return emptySet()
|
||||
return tasks.map { task -> task.key.id }.toSet()
|
||||
return desktopTasks.map { it.key.id }.toSet()
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -156,7 +179,6 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
) {
|
||||
return emptySet()
|
||||
}
|
||||
val desktopTasks = desktopTask?.tasks ?: return emptySet()
|
||||
return desktopTasks.filter { !it.isVisible }.map { task -> task.key.id }.toSet()
|
||||
}
|
||||
|
||||
@@ -171,8 +193,19 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
// tasks again if we have already requested it and the task list has not changed
|
||||
private var taskListChangeId = -1
|
||||
|
||||
fun init(taskbarControllers: TaskbarControllers) {
|
||||
// Whether we're currently loading recents tasks
|
||||
private var loadingRecentsTasks = false
|
||||
// Whether we need to reload recents tasks when the current loading operation is finished
|
||||
private var needsRecentsTasksReload = false
|
||||
// Whether we've loaded recents tasks at least once
|
||||
private var recentTasksLoaded = false
|
||||
|
||||
fun init(taskbarControllers: TaskbarControllers, previousShownTasks: List<GroupTask>) {
|
||||
controllers = taskbarControllers
|
||||
if (previousShownTasks.isNotEmpty()) {
|
||||
shownTasks = previousShownTasks
|
||||
fetchIcons()
|
||||
}
|
||||
if (canShowRunningApps || canShowRecentApps) {
|
||||
recentsModel.registerRecentTasksChangedListener(recentTasksChangedListener)
|
||||
controllers.runAfterInit { reloadRecentTasksIfNeeded() }
|
||||
@@ -180,7 +213,11 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
recentsModel.unregisterRecentTasksChangedListener()
|
||||
controllers.sharedState?.recentTasksBeforeTaskbarRecreate?.clear()
|
||||
if (shownTasks.isNotEmpty()) {
|
||||
controllers.sharedState?.recentTasksBeforeTaskbarRecreate?.addAll(shownTasks)
|
||||
}
|
||||
recentsModel.unregisterRecentTasksChangedListener(recentTasksChangedListener)
|
||||
iconLoadRequests.forEach { it.cancel() }
|
||||
iconLoadRequests.clear()
|
||||
}
|
||||
@@ -211,41 +248,53 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
)
|
||||
}
|
||||
|
||||
onRecentsOrHotseatChanged()
|
||||
if (recentTasksLoaded) {
|
||||
onRecentsOrHotseatChanged()
|
||||
}
|
||||
|
||||
return shownHotseatItems.toTypedArray()
|
||||
}
|
||||
|
||||
private fun getOrderedAndWrappedDesktopTasks(): List<SingleTask> {
|
||||
val tasks = desktopTask?.tasks ?: emptyList()
|
||||
// We wrap each task in the Desktop as a `SingleTask`.
|
||||
val orderFromId = orderedRunningTaskIds.withIndex().associate { (index, id) -> id to index }
|
||||
val sortedTasks = tasks.sortedWith(compareBy(nullsLast()) { orderFromId[it.key.id] })
|
||||
val sortedTasks = desktopTasks.sortedWith(compareBy(nullsLast()) { orderFromId[it.key.id] })
|
||||
return sortedTasks.map { SingleTask(it) }
|
||||
}
|
||||
|
||||
private fun reloadRecentTasksIfNeeded() {
|
||||
if (!recentsModel.isTaskListValid(taskListChangeId)) {
|
||||
taskListChangeId =
|
||||
recentsModel.getTasks(
|
||||
{ tasks ->
|
||||
allRecentTasks = tasks
|
||||
val oldRunningTaskdIds = runningTaskIds
|
||||
val oldMinimizedTaskIds = minimizedTaskIds
|
||||
desktopTask = allRecentTasks.filterIsInstance<DesktopTask>().firstOrNull()
|
||||
val runningTasksChanged = oldRunningTaskdIds != runningTaskIds
|
||||
val minimizedTasksChanged = oldMinimizedTaskIds != minimizedTaskIds
|
||||
if (
|
||||
onRecentsOrHotseatChanged() ||
|
||||
runningTasksChanged ||
|
||||
minimizedTasksChanged
|
||||
) {
|
||||
controllers.taskbarViewController.commitRunningAppsToUI()
|
||||
}
|
||||
},
|
||||
RecentsFilterState.EMPTY_FILTER,
|
||||
)
|
||||
if (recentsModel.isTaskListValid(taskListChangeId)) return
|
||||
if (enableRecentTasksThrottle && loadingRecentsTasks) {
|
||||
Log.v(TAG, "reloadRecentTasksIfNeeded: tried to reload while loading recents tasks")
|
||||
needsRecentsTasksReload = true
|
||||
return
|
||||
}
|
||||
Log.v(TAG, "reloadRecentTasksIfNeeded: load recents tasks")
|
||||
// Only indicate that recents tasks are loading if the enableRecentTasksThrottle flag is on
|
||||
loadingRecentsTasks = enableRecentTasksThrottle
|
||||
taskListChangeId =
|
||||
recentsModel.getTasks(RecentsFilterState.EMPTY_FILTER) { tasks ->
|
||||
loadingRecentsTasks = false
|
||||
recentTasksLoaded = true
|
||||
allRecentTasks = tasks
|
||||
val oldRunningTaskdIds = runningTaskIds
|
||||
val oldMinimizedTaskIds = minimizedTaskIds
|
||||
desktopTasks = allRecentTasks.filterIsInstance<DesktopTask>().flatMap { it.tasks }
|
||||
val runningTasksChanged = oldRunningTaskdIds != runningTaskIds
|
||||
val minimizedTasksChanged = oldMinimizedTaskIds != minimizedTaskIds
|
||||
|
||||
if (
|
||||
(onRecentsOrHotseatChanged() || runningTasksChanged || minimizedTasksChanged) &&
|
||||
!controllers.taskbarDesktopModeController.isLauncherAnimationRunning
|
||||
) {
|
||||
controllers.taskbarViewController.commitRunningAppsToUI()
|
||||
}
|
||||
if (needsRecentsTasksReload) {
|
||||
Log.v(TAG, "reloadRecentTasksIfNeeded: reload recents tasks")
|
||||
needsRecentsTasksReload = false
|
||||
reloadRecentTasksIfNeeded()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,7 +315,11 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
if (!shownTasksChanged) {
|
||||
return shownTasksChanged
|
||||
}
|
||||
fetchIcons()
|
||||
return shownTasksChanged
|
||||
}
|
||||
|
||||
private fun fetchIcons() {
|
||||
for (groupTask in shownTasks) {
|
||||
for (task in groupTask.tasks) {
|
||||
val cancellableTask =
|
||||
@@ -284,7 +337,6 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
}
|
||||
}
|
||||
}
|
||||
return shownTasksChanged
|
||||
}
|
||||
|
||||
private fun updateOrderedRunningTaskIds(): MutableList<Int> {
|
||||
@@ -314,11 +366,19 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
if (Flags.enableMultiInstanceMenuTaskbar()) {
|
||||
val deduplicatedDesktopTasks =
|
||||
desktopTasks.distinctBy { Pair(it.task.key.packageName, it.task.key.userId) }
|
||||
val activityContext = controllers.taskbarActivityContext
|
||||
|
||||
shownTasks
|
||||
.filter {
|
||||
it is SingleTask &&
|
||||
it.task.key.id in deduplicatedDesktopTasks.map { it.task.key.id }
|
||||
it.task.key.id in deduplicatedDesktopTasks.map { it.task.key.id } &&
|
||||
(!isPinningAppWithContextMenuEnabled(activityContext) ||
|
||||
shownHotseatItems.none { hotseatItem ->
|
||||
it.containsPackage(
|
||||
hotseatItem.targetPackage,
|
||||
hotseatItem.user.identifier,
|
||||
)
|
||||
})
|
||||
}
|
||||
.toMutableList()
|
||||
.apply {
|
||||
@@ -429,7 +489,7 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
pw.println("$prefix\tcanShowRecentApps=$canShowRecentApps")
|
||||
pw.println("$prefix\tshownHotseatItems=${shownHotseatItems.map{item->item.targetPackage}}")
|
||||
pw.println("$prefix\tallRecentTasks=${allRecentTasks.map { it.packageNames }}")
|
||||
pw.println("$prefix\tdesktopTask=${desktopTask?.packageNames}")
|
||||
pw.println("$prefix\tdesktopTask=${desktopTasks.map { it.key.packageName }}")
|
||||
pw.println("$prefix\tshownTasks=${shownTasks.map { it.packageNames }}")
|
||||
pw.println("$prefix\trunningTaskIds=$runningTaskIds")
|
||||
pw.println("$prefix\tminimizedTaskIds=$minimizedTaskIds")
|
||||
@@ -439,6 +499,8 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
get() = tasks.map { task -> task.key.packageName }
|
||||
|
||||
private companion object {
|
||||
private val TAG = "TaskbarRecentAppsController"
|
||||
|
||||
const val MAX_RECENT_TASKS = 2
|
||||
}
|
||||
}
|
||||
@@ -29,10 +29,12 @@ import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.view.InsetsFrameProvider;
|
||||
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -47,6 +49,8 @@ public class TaskbarSharedState {
|
||||
// TaskbarManager#onSystemUiFlagsChanged
|
||||
@SystemUiStateFlags
|
||||
public long sysuiStateFlags;
|
||||
// TaskBarStashController#init()
|
||||
public boolean isTaskbarOnOverview;
|
||||
|
||||
// TaskbarManager#disableNavBarElements()
|
||||
public int disableNavBarDisplayId;
|
||||
@@ -73,6 +77,12 @@ public class TaskbarSharedState {
|
||||
|
||||
public boolean allAppsVisible = false;
|
||||
|
||||
public boolean bubbleBarExpanded = false;
|
||||
|
||||
public boolean bubbleBarStashed = false;
|
||||
|
||||
public String selectedBubbleKey;
|
||||
|
||||
public BubbleBarLocation bubbleBarLocation;
|
||||
|
||||
public List<BubbleInfo> bubbleInfoItems;
|
||||
@@ -84,6 +94,16 @@ public class TaskbarSharedState {
|
||||
return bubbleInfoItems != null && !bubbleInfoItems.isEmpty();
|
||||
}
|
||||
|
||||
/** Clears stored bubble bar data. */
|
||||
public void clearBubbleData() {
|
||||
bubbleInfoItems = null;
|
||||
selectedBubbleKey = null;
|
||||
bubbleBarLocation = null;
|
||||
bubbleBarExpanded = false;
|
||||
bubbleBarStashed = false;
|
||||
suppressedBubbleInfoItems = null;
|
||||
}
|
||||
|
||||
// LauncherTaskbarUIController#mTaskbarInAppDisplayProgressMultiProp
|
||||
public float[] inAppDisplayProgressMultiPropValues = new float[DISPLAY_PROGRESS_COUNT];
|
||||
|
||||
@@ -121,4 +141,6 @@ public class TaskbarSharedState {
|
||||
|
||||
// should show corner radius on persistent taskbar when in desktop mode.
|
||||
public boolean showCornerRadiusInDesktopMode = false;
|
||||
|
||||
public List<GroupTask> recentTasksBeforeTaskbarRecreate = new ArrayList<>();
|
||||
}
|
||||
@@ -62,6 +62,7 @@ import androidx.annotation.VisibleForTesting;
|
||||
import com.android.internal.jank.InteractionJankMonitor;
|
||||
import com.android.launcher3.Alarm;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.AnimatedFloat;
|
||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||
@@ -73,6 +74,7 @@ import com.android.quickstep.util.SystemUiFlagUtils;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.Objects;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.function.LongPredicate;
|
||||
|
||||
@@ -294,6 +296,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
private boolean mIsTaskbarSystemActionRegistered = false;
|
||||
private TaskbarSharedState mTaskbarSharedState;
|
||||
|
||||
// Used to mark whether we are in test mode to mark whether the nav bar shows in SUW
|
||||
@VisibleForTesting
|
||||
Boolean mNavbarHiddenOverrideForTest = null;
|
||||
|
||||
public TaskbarStashController(TaskbarActivityContext activity) {
|
||||
mActivity = activity;
|
||||
mSystemUiProxy = SystemUiProxy.INSTANCE.get(activity);
|
||||
@@ -317,8 +323,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
mStashedHeight = mActivity.getResources().getDimensionPixelSize(
|
||||
R.dimen.taskbar_stashed_size);
|
||||
} else {
|
||||
mUnstashedHeight = mActivity.getDeviceProfile().taskbarHeight;
|
||||
mStashedHeight = mActivity.getDeviceProfile().stashedTaskbarHeight;
|
||||
mUnstashedHeight = mActivity.getDeviceProfile().getTaskbarProfile().getHeight();
|
||||
mStashedHeight = mActivity
|
||||
.getDeviceProfile()
|
||||
.getTaskbarProfile()
|
||||
.getStashedTaskbarHeight();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,6 +373,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
// For now, assume we're in an app, since LauncherTaskbarUIController won't be able to tell
|
||||
// us that we're paused until a bit later. This avoids flickering upon recreating taskbar.
|
||||
updateStateForFlag(FLAG_IN_APP, true);
|
||||
updateStateForFlag(FLAG_IN_OVERVIEW, mTaskbarSharedState.isTaskbarOnOverview);
|
||||
updateStateForFlag(FLAG_STASHED_BUBBLE_BAR_ON_PHONE, mActivity.isBubbleBarOnPhone());
|
||||
|
||||
applyState(/* duration = */ 0);
|
||||
@@ -374,11 +384,14 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
|
||||
mTaskbarBackgroundAlphaForStash.setValue(shouldHideTaskbarBackground ? 0 : 1);
|
||||
|
||||
if (mTaskbarSharedState.getTaskbarWasPinned()
|
||||
|| !mTaskbarSharedState.taskbarWasStashedAuto) {
|
||||
tryStartTaskbarTimeout();
|
||||
}
|
||||
notifyStashChange(/* visible */ false, /* stashed */ isStashedInApp());
|
||||
|
||||
mControllers.runAfterInit(() -> {
|
||||
// if taskbar should auto stash attempt to start timeout.
|
||||
if (shouldAllowTaskbarToAutoStash()) {
|
||||
tryStartTaskbarTimeout();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -503,7 +516,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
public int getTouchableHeight() {
|
||||
return mIsStashed
|
||||
? mStashedHeight
|
||||
: (mUnstashedHeight + mActivity.getDeviceProfile().taskbarBottomMargin);
|
||||
: (mUnstashedHeight
|
||||
+ mActivity.getDeviceProfile()
|
||||
.getTaskbarProfile()
|
||||
.getBottomMargin()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -520,11 +537,14 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
|
||||
if (supportsVisualStashing() && hasAnyFlag(FLAGS_REPORT_STASHED_INSETS_TO_APP)) {
|
||||
DeviceProfile dp = mActivity.getDeviceProfile();
|
||||
if (hasAnyFlag(FLAG_STASHED_IN_APP_SETUP) && (dp.isTaskbarPresent
|
||||
|| mActivity.isPhoneGestureNavMode())) {
|
||||
// We always show the back button in SUW but in portrait the SUW layout may not
|
||||
// be wide enough to support overlapping the nav bar with its content.
|
||||
// We're sending different res values in portrait vs landscape
|
||||
// If the navigation bar is hidden in SUW, we can draw the SUW content lower so we avoid
|
||||
// reporting a higher inset
|
||||
if (hasAnyFlag(FLAG_STASHED_IN_APP_SETUP)
|
||||
&& (dp.isTaskbarPresent || mActivity.isPhoneGestureNavMode())
|
||||
&& !isNavbarHiddeninSUW()) {
|
||||
// When we show the back button in SUW, the SUW layout may not be wide enough to
|
||||
// support overlapping the nav bar with its content in portrait. So we send
|
||||
// different res values in portrait vs landscape
|
||||
return mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_suw_insets);
|
||||
}
|
||||
boolean isAnimating = mAnimator != null && mAnimator.isStarted();
|
||||
@@ -542,6 +562,17 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
return mUnstashedHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the navigation bar is visible during the Setup Wizard.
|
||||
*
|
||||
* {@link #mNavbarHiddenOverrideForTest} is only used by tests
|
||||
*/
|
||||
private boolean isNavbarHiddeninSUW() {
|
||||
// Check if a test override is active
|
||||
return Objects.requireNonNullElseGet(mNavbarHiddenOverrideForTest,
|
||||
() -> mControllers.navbarButtonsViewController.isNavbarHiddenInSUW());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the height that taskbar will inset when inside apps.
|
||||
*
|
||||
@@ -647,10 +678,50 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
/* shouldBubblesFollow= */ !bubbleBarExpanded);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if we should allow taskbar to auto stash
|
||||
*/
|
||||
public boolean shouldAllowTaskbarToAutoStash() {
|
||||
if (mActivity.isTransientTaskbar()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean isTaskbarPinningOnInDesktopMode = LauncherPrefs.TASKBAR_PINNING_IN_DESKTOP_MODE.get(
|
||||
mActivity);
|
||||
return !isTaskbarPinningOnInDesktopMode && mActivity.isTaskbarShowingDesktopTasks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stashes pinned taskbar after it has timed out.
|
||||
*/
|
||||
public void updateAndAnimatePinnedTaskbarForTimeout() {
|
||||
updateAndAnimatePinnedTaskbar(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles stashing/un-stashing taskbar in desktop mode.
|
||||
*/
|
||||
public void updateAndAnimatePinnedTaskbar(boolean isStashed) {
|
||||
boolean shouldApplyState = false;
|
||||
if (hasAnyFlag(FLAG_STASHED_IN_APP_AUTO) != isStashed) {
|
||||
updateStateForFlag(FLAG_STASHED_IN_APP_AUTO, isStashed);
|
||||
shouldApplyState = true;
|
||||
}
|
||||
if (shouldApplyState) {
|
||||
applyState();
|
||||
}
|
||||
}
|
||||
|
||||
/** Toggles the Taskbar's stash state. */
|
||||
public void toggleTaskbarStash() {
|
||||
if (!mActivity.isTransientTaskbar() || !hasAnyFlag(FLAGS_IN_APP)) return;
|
||||
updateAndAnimateTransientTaskbar(!hasAnyFlag(FLAG_STASHED_IN_APP_AUTO));
|
||||
if (!shouldAllowTaskbarToAutoStash() || !hasAnyFlag(FLAGS_IN_APP)) {
|
||||
return;
|
||||
}
|
||||
if (mActivity.isTransientTaskbar()) {
|
||||
updateAndAnimateTransientTaskbar(!hasAnyFlag(FLAG_STASHED_IN_APP_AUTO));
|
||||
} else if (mActivity.isTaskbarShowingDesktopTasks()) {
|
||||
updateAndAnimatePinnedTaskbar(!hasAnyFlag(FLAG_STASHED_IN_APP_AUTO));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -727,6 +798,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
if (mActivity.isTransientTaskbar()) {
|
||||
createTransientAnimToIsStashed(mAnimator, isStashed, duration,
|
||||
shouldDelayBackground, animationType);
|
||||
} else if (shouldAllowTaskbarToAutoStash()) {
|
||||
createAnimToIsStashedPinnedTaskbar(mAnimator, isStashed, duration);
|
||||
} else {
|
||||
createAnimToIsStashed(mAnimator, isStashed, duration, stashTranslation, animationType);
|
||||
}
|
||||
@@ -756,6 +829,16 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
});
|
||||
}
|
||||
|
||||
private void createAnimToIsStashedPinnedTaskbar(AnimatorSet as, boolean isStashed,
|
||||
long duration) {
|
||||
int stashTranslation = !isStashed ? 0 : mUnstashedHeight;
|
||||
as.play(mIconTranslationYForStash.animateToValue(stashTranslation));
|
||||
as.play(mTaskbarBackgroundOffset.animateToValue(isStashed ? 1 : 0));
|
||||
as.play(mIconAlphaForStash.animateToValue(isStashed ? 0 : 1));
|
||||
as.play(mIconScaleForStash.animateToValue(1));
|
||||
as.setDuration(duration);
|
||||
}
|
||||
|
||||
private void createAnimToIsStashed(AnimatorSet as, boolean isStashed, long duration,
|
||||
float stashTranslation, @StashAnimation int animationType) {
|
||||
AnimatorSet fullLengthAnimatorSet = new AnimatorSet();
|
||||
@@ -1152,6 +1235,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
&& mActivity.isTransientTaskbar();
|
||||
updateStateForFlag(FLAG_STASHED_SYSUI,
|
||||
hasAnyFlag(systemUiStateFlags, SYSUI_STATE_SCREEN_PINNING) || stashForBubbles);
|
||||
|
||||
updateStateForFlag(FLAG_STASHED_DEVICE_LOCKED,
|
||||
SystemUiFlagUtils.isLocked(systemUiStateFlags));
|
||||
|
||||
@@ -1184,7 +1268,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
}
|
||||
// Do not stash if in small screen, with 3 button nav, and in landscape.
|
||||
if (mActivity.isPhoneMode() && mActivity.isThreeButtonNav()
|
||||
&& mActivity.getDeviceProfile().isLandscape) {
|
||||
&& mActivity.getDeviceProfile().getDeviceProperties().isLandscape()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1306,6 +1390,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
mAnimator.cancel();
|
||||
mAnimator = null;
|
||||
}
|
||||
mTaskbarSharedState.isTaskbarOnOverview = hasAnyFlag(FLAG_IN_OVERVIEW);
|
||||
UI_HELPER_EXECUTOR.execute(
|
||||
() -> mAccessibilityManager.unregisterSystemAction(SYSTEM_ACTION_ID_TASKBAR));
|
||||
}
|
||||
@@ -1326,7 +1411,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
* If false, attempts to re/start the timeout
|
||||
*/
|
||||
public void updateTaskbarTimeout(boolean isAutohideSuspended) {
|
||||
if (!mActivity.isTransientTaskbar()) {
|
||||
if (!shouldAllowTaskbarToAutoStash()) {
|
||||
return;
|
||||
}
|
||||
if (isAutohideSuspended) {
|
||||
@@ -1340,7 +1425,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
* Attempts to start timer to auto hide the taskbar based on time.
|
||||
*/
|
||||
private void tryStartTaskbarTimeout() {
|
||||
if (!mActivity.isTransientTaskbar() || mIsStashed || mEnableBlockingTimeoutDuringTests) {
|
||||
if (!shouldAllowTaskbarToAutoStash() || mIsStashed || mEnableBlockingTimeoutDuringTests) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1362,7 +1447,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
if (mControllers.taskbarAutohideSuspendController.isTransientTaskbarStashingSuspended()) {
|
||||
return;
|
||||
}
|
||||
updateAndAnimateTransientTaskbarForTimeout();
|
||||
if (mActivity.isTransientTaskbar()) {
|
||||
updateAndAnimateTransientTaskbarForTimeout();
|
||||
} else if (shouldAllowTaskbarToAutoStash()) {
|
||||
updateAndAnimatePinnedTaskbarForTimeout();
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -47,7 +47,8 @@ class TaskbarStashViaTouchController(val controllers: TaskbarControllers) : Touc
|
||||
private val maxVisualDisplacement =
|
||||
activity.resources.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin).toFloat()
|
||||
/** How far the swipe could go, if user swiped from the very top of TaskbarView. */
|
||||
private val maxTouchDisplacement = maxVisualDisplacement + activity.deviceProfile.taskbarHeight
|
||||
private val maxTouchDisplacement =
|
||||
maxVisualDisplacement + activity.deviceProfile.taskbarProfile.height
|
||||
private val touchDisplacementToStash =
|
||||
activity.resources.getDimensionPixelSize(R.dimen.taskbar_to_nav_threshold).toFloat()
|
||||
|
||||
@@ -68,7 +69,8 @@ class TaskbarStashViaTouchController(val controllers: TaskbarControllers) : Touc
|
||||
ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE,
|
||||
activity.resources,
|
||||
)
|
||||
gestureHeightYThreshold = (activity.deviceProfile.heightPx - gestureHeight).toFloat()
|
||||
gestureHeightYThreshold =
|
||||
(activity.deviceProfile.deviceProperties.heightPx - gestureHeight).toFloat()
|
||||
}
|
||||
|
||||
private fun createSwipeListener() =
|
||||
@@ -126,6 +128,14 @@ class TaskbarStashViaTouchController(val controllers: TaskbarControllers) : Touc
|
||||
if (ev.action == MotionEvent.ACTION_OUTSIDE) {
|
||||
controllers.taskbarStashController.updateAndAnimateTransientTaskbar(true)
|
||||
} else if (controllers.taskbarViewController.isEventOverAnyItem(screenCoordinatesEv)) {
|
||||
// TODO (b/411155437) remove this once BubbleDragController implements TouchController
|
||||
val bubbleBarDragInProgress =
|
||||
controllers.bubbleControllers
|
||||
.map { it.bubbleDragController.isDragging }
|
||||
.orElse(false)
|
||||
if (bubbleBarDragInProgress) {
|
||||
return false
|
||||
}
|
||||
swipeDownDetector.onTouchEvent(ev)
|
||||
if (swipeDownDetector.isDraggingState) {
|
||||
return true
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TaskbarThresholdUtils {
|
||||
|
||||
private static int getThreshold(Resources r, DeviceProfile dp, int thresholdDimen,
|
||||
int multiplierDimen) {
|
||||
float landscapeScreenHeight = dp.isLandscape ? dp.heightPx : dp.widthPx;
|
||||
float landscapeScreenHeight = dp.getDeviceProperties().isLandscape() ? dp.getDeviceProperties().getHeightPx() : dp.getDeviceProperties().getWidthPx();
|
||||
float screenPart = (landscapeScreenHeight * SCREEN_UNITS);
|
||||
float defaultDp = dpiFromPx(screenPart, DisplayMetrics.DENSITY_DEVICE_STABLE);
|
||||
float thisDp = dpToPx(defaultDp);
|
||||
|
||||
@@ -72,6 +72,11 @@ public class TaskbarUIController implements BubbleBarController.BubbleBarLocatio
|
||||
@CallSuper
|
||||
protected void onDestroy() {
|
||||
mControllers = null;
|
||||
RecentsView recentsView = getRecentsView();
|
||||
if (recentsView != null) {
|
||||
recentsView.setTaskLaunchListener(null);
|
||||
recentsView.setTaskLaunchCancelledRunnable(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isTaskbarTouchable() {
|
||||
@@ -162,6 +167,13 @@ public class TaskbarUIController implements BubbleBarController.BubbleBarLocatio
|
||||
mControllers.taskbarActivityContext.startTranslationSpring();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if we should allow taskbar to auto stash
|
||||
*/
|
||||
public boolean shouldAllowTaskbarToAutoStash() {
|
||||
return mControllers.taskbarActivityContext.shouldAllowTaskbarToAutoStash();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ev MotionEvent in screen coordinates.
|
||||
* @return Whether any Taskbar item could handle the given MotionEvent if given the chance.
|
||||
@@ -222,6 +234,15 @@ public class TaskbarUIController implements BubbleBarController.BubbleBarLocatio
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDraggingItem() {
|
||||
boolean bubblesDragging = false;
|
||||
if (mControllers.bubbleControllers.isPresent()) {
|
||||
bubblesDragging =
|
||||
mControllers.bubbleControllers.get().bubbleDragController.isDragging();
|
||||
}
|
||||
return mControllers.taskbarDragController.isDragging() || bubblesDragging;
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
protected void dumpLogs(String prefix, PrintWriter pw) {
|
||||
pw.println(String.format(
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;
|
||||
import static android.window.DesktopModeFlags.ENABLE_TASKBAR_OVERFLOW;
|
||||
import static android.window.DesktopModeFlags.ENABLE_TASKBAR_RECENTS_LAYOUT_TRANSITION;
|
||||
|
||||
import static com.android.launcher3.BubbleTextView.DISPLAY_TASKBAR;
|
||||
@@ -38,6 +39,7 @@ import android.view.InputDevice;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.LayoutRes;
|
||||
@@ -51,6 +53,7 @@ import com.android.launcher3.Insettable;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.apppairs.AppPairIcon;
|
||||
import com.android.launcher3.celllayout.CellInfo;
|
||||
import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.folder.PreviewBackground;
|
||||
import com.android.launcher3.model.data.AppPairInfo;
|
||||
@@ -117,6 +120,14 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
|
||||
private int mNextViewIndex;
|
||||
|
||||
public int getIgnoreTaskbarIconCount() {
|
||||
return mIgnoreTaskbarIconCount;
|
||||
}
|
||||
|
||||
// TODO: clean it up in follow up cl with removal of taskbar icon alignment.
|
||||
// Only used for edge of 3 button navigation mode, where we need to hide icons which go
|
||||
// beyond the bounds.
|
||||
private int mIgnoreTaskbarIconCount = 0;
|
||||
/**
|
||||
* Whether the divider is between Hotseat icons and Recents,
|
||||
* instead of between All Apps button and Hotseat.
|
||||
@@ -166,10 +177,11 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
onDeviceProfileChanged(mActivityContext.getDeviceProfile());
|
||||
|
||||
int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing);
|
||||
int actualIconSize = mActivityContext.getDeviceProfile().taskbarIconSize;
|
||||
if (enableTaskbarPinning() && !mActivityContext.isThreeButtonNav()) {
|
||||
int actualIconSize =
|
||||
mActivityContext.getDeviceProfile().getTaskbarProfile().getIconSize();
|
||||
if (enableTaskbarPinning() && canTransitionToTransientTaskbar()) {
|
||||
DeviceProfile deviceProfile = mActivityContext.getTransientTaskbarDeviceProfile();
|
||||
actualIconSize = deviceProfile.taskbarIconSize;
|
||||
actualIconSize = deviceProfile.getTaskbarProfile().getIconSize();
|
||||
}
|
||||
int visualIconSize = (int) (actualIconSize * ICON_VISIBLE_AREA_FACTOR);
|
||||
|
||||
@@ -182,7 +194,10 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
// We always layout taskbar as a transient taskbar when we have taskbar pinning feature on,
|
||||
// then we scale and translate the icons to match persistent taskbar designs, so we use
|
||||
// taskbar icon size from current device profile to calculate correct item padding.
|
||||
mItemPadding = (mIconTouchSize - mActivityContext.getDeviceProfile().taskbarIconSize) / 2;
|
||||
mItemPadding = (mIconTouchSize - mActivityContext
|
||||
.getDeviceProfile()
|
||||
.getTaskbarProfile()
|
||||
.getIconSize()) / 2;
|
||||
mFolderLeaveBehindColor = Themes.getAttrColor(mActivityContext,
|
||||
android.R.attr.textColorTertiary);
|
||||
|
||||
@@ -198,7 +213,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
mTaskbarDividerContainer = new TaskbarDividerContainer(context);
|
||||
}
|
||||
|
||||
if (Flags.taskbarOverflow()) {
|
||||
if (ENABLE_TASKBAR_OVERFLOW.isTrue()) {
|
||||
mTaskbarOverflowView = TaskbarOverflowView.inflateIcon(
|
||||
R.layout.taskbar_overflow_view, this,
|
||||
mIconTouchSize, mItemPadding);
|
||||
@@ -217,7 +232,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
*/
|
||||
private int calculateMaxNumIcons() {
|
||||
DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
|
||||
int availableWidth = deviceProfile.widthPx;
|
||||
int availableWidth = deviceProfile.getDeviceProperties().getWidthPx();
|
||||
int defaultEdgeMargin =
|
||||
(int) getResources().getDimension(deviceProfile.inv.inlineNavButtonsEndSpacing);
|
||||
int spaceForBubbleBar =
|
||||
@@ -225,11 +240,12 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
|
||||
// Reserve space required for edge margins, or for navbar if shown. If task bar needs to be
|
||||
// center aligned with nav bar shown, reserve space on both sides.
|
||||
availableWidth -=
|
||||
Math.max(defaultEdgeMargin + spaceForBubbleBar, deviceProfile.hotseatBarEndOffset);
|
||||
availableWidth -= Math.max(
|
||||
defaultEdgeMargin + spaceForBubbleBar,
|
||||
deviceProfile.getHotseatProfile().getBarEndOffset());
|
||||
availableWidth -= Math.max(
|
||||
defaultEdgeMargin + (mShouldTryStartAlign ? 0 : spaceForBubbleBar),
|
||||
mShouldTryStartAlign ? 0 : deviceProfile.hotseatBarEndOffset);
|
||||
mShouldTryStartAlign ? 0 : deviceProfile.getHotseatProfile().getBarEndOffset());
|
||||
|
||||
// The space taken by an item icon used during layout.
|
||||
int iconSize = 2 * mItemMarginLeftRight + mIconTouchSize;
|
||||
@@ -246,7 +262,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
// All apps icon takes less space compared to normal icon size, reserve space for the icon
|
||||
// separately.
|
||||
boolean forceTransientTaskbarSize =
|
||||
enableTaskbarPinning() && !mActivityContext.isThreeButtonNav();
|
||||
enableTaskbarPinning() && canTransitionToTransientTaskbar();
|
||||
availableWidth -= iconSize - (int) getResources().getDimension(
|
||||
mAllAppsButtonContainer.getAllAppsButtonTranslationXOffset(
|
||||
forceTransientTaskbarSize || mActivityContext.isTransientTaskbar()));
|
||||
@@ -255,13 +271,22 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
return Math.floorDiv(availableWidth, iconSize) + additionalIcons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the taskbar in the state context supports transition to a transient taskbar (e.g.
|
||||
* using a popup menu).
|
||||
*/
|
||||
boolean canTransitionToTransientTaskbar() {
|
||||
return mActivityContext.getTaskbarFeatureEvaluator()
|
||||
.getSupportsTransitionToTransientTaskbar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Recalculates the max number of icons the taskbar view can show without entering overflow.
|
||||
* Returns whether the max number of icons changed and the change affects the number of icons
|
||||
* that should be shown in the taskbar.
|
||||
*/
|
||||
boolean updateMaxNumIcons() {
|
||||
if (!Flags.taskbarOverflow()) {
|
||||
if (!ENABLE_TASKBAR_OVERFLOW.isTrue()) {
|
||||
return false;
|
||||
}
|
||||
int oldMaxNumIcons = mMaxNumIcons;
|
||||
@@ -354,26 +379,35 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
mIconLongClickListener = mControllerCallbacks.getIconOnLongClickListener();
|
||||
|
||||
mAllAppsButtonContainer.setUpCallbacks(callbacks);
|
||||
if (mTaskbarDividerContainer != null
|
||||
&& mActivityContext.getTaskbarFeatureEvaluator().getSupportsPinningPopup()) {
|
||||
mTaskbarDividerContainer.setUpCallbacks(callbacks);
|
||||
}
|
||||
if (mTaskbarOverflowView != null) {
|
||||
mTaskbarOverflowView.setOnClickListener(
|
||||
mControllerCallbacks.getOverflowOnClickListener());
|
||||
mTaskbarOverflowView.setOnLongClickListener(
|
||||
mControllerCallbacks.getOverflowOnLongClickListener());
|
||||
}
|
||||
if (Flags.showTaskbarPinningPopupFromAnywhere()
|
||||
&& mActivityContext.getTaskbarFeatureEvaluator().getSupportsPinningPopup()) {
|
||||
setOnTouchListener(mControllerCallbacks.getTaskbarTouchListener());
|
||||
if (enableCursorHoverStates()) {
|
||||
setHoverListenerForIcon(mTaskbarOverflowView);
|
||||
}
|
||||
}
|
||||
|
||||
if (Flags.taskbarOverflow()) {
|
||||
if (ENABLE_TASKBAR_OVERFLOW.isTrue()) {
|
||||
mMaxNumIcons = calculateMaxNumIcons();
|
||||
}
|
||||
}
|
||||
|
||||
void updatePinningPopupEventHandlers() {
|
||||
boolean supportsPinningPopup =
|
||||
mActivityContext.getTaskbarFeatureEvaluator().getSupportsPinningPopup();
|
||||
if (mTaskbarDividerContainer != null) {
|
||||
mTaskbarDividerContainer.setUpCallbacks(
|
||||
supportsPinningPopup ? mControllerCallbacks : null);
|
||||
}
|
||||
|
||||
if (Flags.showTaskbarPinningPopupFromAnywhere()) {
|
||||
setOnTouchListener(
|
||||
supportsPinningPopup ? mControllerCallbacks.getTaskbarTouchListener() : null);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeAndRecycle(View view) {
|
||||
removeView(view);
|
||||
view.setOnClickListener(null);
|
||||
@@ -399,6 +433,11 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
} else {
|
||||
updateItemsWithoutLayoutTransition(hotseatItemInfos, recentTasks);
|
||||
}
|
||||
mAllAppsButtonContainer.updateTaskbarMinimalState(isTaskbarInMinimalState());
|
||||
}
|
||||
|
||||
public boolean isTaskbarInMinimalState() {
|
||||
return getIconViews().length <= 1;
|
||||
}
|
||||
|
||||
private void updateItemsWithoutLayoutTransition(
|
||||
@@ -417,6 +456,9 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
}
|
||||
removeView(mQsb);
|
||||
|
||||
mIgnoreTaskbarIconCount = getIgnoreCountForTaskbarIcons(recentTasks.size(),
|
||||
hotseatItemInfos.length);
|
||||
|
||||
updateHotseatItems(hotseatItemInfos);
|
||||
|
||||
if (mTaskbarDividerContainer != null && !recentTasks.isEmpty()) {
|
||||
@@ -454,6 +496,9 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
mNextViewIndex++;
|
||||
}
|
||||
|
||||
mIgnoreTaskbarIconCount = getIgnoreCountForTaskbarIcons(recentTasks.size(),
|
||||
hotseatItemInfos.length);
|
||||
|
||||
// Update left section.
|
||||
if (mIsRtl) {
|
||||
updateRecents(recentTasks.reversed(), hotseatItemInfos.length);
|
||||
@@ -475,8 +520,14 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
}
|
||||
|
||||
// Recents divider takes priority.
|
||||
if (!mAddedDividerForRecents && !mActivityContext.isInDesktopMode()) {
|
||||
updateAllAppsDivider();
|
||||
if (!mAddedDividerForRecents) {
|
||||
boolean allAppsDividerAllowed = !mActivityContext.isTaskbarShowingDesktopTasks();
|
||||
if (allAppsDividerAllowed) {
|
||||
updateAllAppsDivider();
|
||||
} else if (getChildAt(getExpectedAllAppsDividerIndex()) == mTaskbarDividerContainer) {
|
||||
removeView(mTaskbarDividerContainer);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,8 +550,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
|
||||
private void updateAllAppsDivider() {
|
||||
// Index where All Apps divider would be if it is already in Taskbar.
|
||||
final int expectedAllAppsDividerIndex =
|
||||
mIsRtl ? getChildCount() - mNumStaticViews - 1 : mNumStaticViews;
|
||||
final int expectedAllAppsDividerIndex = getExpectedAllAppsDividerIndex();
|
||||
if (getChildAt(expectedAllAppsDividerIndex) == mTaskbarDividerContainer
|
||||
&& getChildCount() == mNumStaticViews + 1) {
|
||||
// Only static views with divider so remove divider.
|
||||
@@ -515,6 +565,57 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
}
|
||||
}
|
||||
|
||||
private int getExpectedAllAppsDividerIndex() {
|
||||
return mIsRtl ? getChildCount() - mNumStaticViews - 1 : mNumStaticViews;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate how many icon we need to not show in Taskbar that are present in hotseat.
|
||||
*/
|
||||
private int getIgnoreCountForTaskbarIcons(int recentsIcons, int hotseatIcons) {
|
||||
|
||||
if (!mActivityContext.isThreeButtonNav()
|
||||
|| mActivityContext.getTaskbarFeatureEvaluator().isRecentsEnabled()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
|
||||
|
||||
// Add icon for all apps.
|
||||
int icons = 1;
|
||||
|
||||
// Only include divider line in count if will be added to Taskbar view which is in
|
||||
// conditions below.
|
||||
if (mActivityContext.isInDesktopMode() && recentsIcons > 0) {
|
||||
icons += 1;
|
||||
} else if (recentsIcons + hotseatIcons != 0) {
|
||||
icons += 1;
|
||||
}
|
||||
int spaceNeeded = getIconLayoutWidth(icons + recentsIcons + hotseatIcons);
|
||||
|
||||
boolean areBubblesVisible =
|
||||
mControllerCallbacks.isBubbleBarEnabled() && mBubbleBarLocation != null;
|
||||
int screenWidth = this.getResources().getDisplayMetrics().widthPixels;
|
||||
int navSpaceNeeded = deviceProfile.getHotseatProfile().getBarEndOffset();
|
||||
|
||||
int ignoreCount = 0;
|
||||
//Screen Width - nav space
|
||||
int amountOfSpaceTaskbarIconsCanHave = screenWidth - navSpaceNeeded;
|
||||
if (areBubblesVisible) {
|
||||
// size of bubbles Icon and margin on the side.
|
||||
int bubbleBarMargin = getResources().getDimensionPixelSize(
|
||||
R.dimen.transient_taskbar_bottom_margin);
|
||||
amountOfSpaceTaskbarIconsCanHave -= (mIconTouchSize + bubbleBarMargin);
|
||||
}
|
||||
int taskbarIconSpaceNeeded = spaceNeeded;
|
||||
while (amountOfSpaceTaskbarIconsCanHave < taskbarIconSpaceNeeded) {
|
||||
ignoreCount++;
|
||||
int iconSpace = mIconTouchSize + (2 * mItemMarginLeftRight);
|
||||
taskbarIconSpaceNeeded -= iconSpace;
|
||||
}
|
||||
return ignoreCount;
|
||||
}
|
||||
|
||||
private void updateHotseatItems(ItemInfo[] hotseatItemInfos) {
|
||||
int numViewsAnimated = 0;
|
||||
|
||||
@@ -574,7 +675,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
} else {
|
||||
hotseatView = inflate(expectedLayoutResId);
|
||||
}
|
||||
LayoutParams lp = new LayoutParams(mIconTouchSize, mIconTouchSize);
|
||||
LayoutParams lp = new TaskbarLayoutParams(mIconTouchSize, mIconTouchSize);
|
||||
hotseatView.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding);
|
||||
addView(hotseatView, mNextViewIndex, lp);
|
||||
} else if (hotseatView instanceof FolderIcon fi) {
|
||||
@@ -582,6 +683,13 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
fi.getFolder().reapplyItemInfo();
|
||||
}
|
||||
|
||||
if (hotseatView.getLayoutParams() instanceof TaskbarLayoutParams tlp) {
|
||||
tlp.bindInfo = new CellInfo(hotseatView,
|
||||
hotseatItemInfo.screenId, hotseatItemInfo.container,
|
||||
hotseatItemInfo.cellX, hotseatItemInfo.cellY,
|
||||
hotseatItemInfo.spanX, hotseatItemInfo.spanY);
|
||||
}
|
||||
|
||||
// Apply the Hotseat ItemInfos, or hide the view if there is none for a given index.
|
||||
if (hotseatView instanceof BubbleTextView btv
|
||||
&& hotseatItemInfo instanceof WorkspaceItemInfo workspaceInfo) {
|
||||
@@ -606,7 +714,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
}
|
||||
|
||||
private void updateRecents(List<GroupTask> recentTasks, int hotseatSize) {
|
||||
boolean supportsOverflow = Flags.taskbarOverflow() && recentTasks.size() > 1;
|
||||
boolean supportsOverflow = ENABLE_TASKBAR_OVERFLOW.isTrue() && recentTasks.size() > 1;
|
||||
int overflowSize = 0;
|
||||
boolean hasOverflow = false;
|
||||
if (supportsOverflow && mTaskbarOverflowView != null) {
|
||||
@@ -700,7 +808,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
if (recentIcon == null) {
|
||||
// TODO(b/343289567 and b/316004172): support app pairs and desktop mode.
|
||||
recentIcon = inflate(expectedLayoutResId);
|
||||
LayoutParams lp = new LayoutParams(mIconTouchSize, mIconTouchSize);
|
||||
LayoutParams lp = new TaskbarLayoutParams(mIconTouchSize, mIconTouchSize);
|
||||
recentIcon.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding);
|
||||
addView(recentIcon, mNextViewIndex, lp);
|
||||
}
|
||||
@@ -749,7 +857,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
if (taskIcon != null) {
|
||||
taskIcon = taskIcon.getConstantState().newDrawable().mutate();
|
||||
}
|
||||
btv.applyIconAndLabel(taskIcon, task.titleDescription);
|
||||
btv.applyIconAndLabel(taskIcon, task.title, task.titleDescription);
|
||||
btv.setTag(singleTask);
|
||||
}
|
||||
|
||||
@@ -798,7 +906,15 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
return 0;
|
||||
}
|
||||
Rect iconsBounds = getTransientTaskbarIconLayoutBoundsInParent();
|
||||
return getTaskBarIconsEndForBubbleBarLocation(location) - iconsBounds.right;
|
||||
|
||||
int translateXFromIgnoredIcons =
|
||||
mIgnoreTaskbarIconCount * (mIconTouchSize + mItemMarginLeftRight);
|
||||
// If bubble bar or right translate in opposite direction.
|
||||
if (!location.isOnLeft(isLayoutRtl())) {
|
||||
translateXFromIgnoredIcons *= -1;
|
||||
}
|
||||
return getTaskBarIconsEndForBubbleBarLocation(location) - iconsBounds.right
|
||||
+ translateXFromIgnoredIcons;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -806,11 +922,12 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
int spaceNeeded = getIconLayoutWidth();
|
||||
boolean layoutRtl = isLayoutRtl();
|
||||
DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
|
||||
int navSpaceNeeded = deviceProfile.hotseatBarEndOffset;
|
||||
int navSpaceNeeded = deviceProfile.getHotseatProfile().getBarEndOffset();
|
||||
int centerAlignIconEnd = (right + left + spaceNeeded) / 2;
|
||||
int iconEnd = centerAlignIconEnd;
|
||||
if (mShouldTryStartAlign) {
|
||||
int startSpacingPx = deviceProfile.inlineNavButtonsEndSpacingPx;
|
||||
int startSpacingPx =
|
||||
deviceProfile.getHotseatProfile().getInlineNavButtonsEndSpacingPx();
|
||||
if (mControllerCallbacks.isBubbleBarEnabled()
|
||||
&& mBubbleBarLocation != null
|
||||
&& mActivityContext.shouldStartAlignTaskbar()) {
|
||||
@@ -872,6 +989,16 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
iconEnd += mAllAppsButtonTranslationOffset;
|
||||
}
|
||||
|
||||
if (mActivityContext.isThreeButtonNav()) {
|
||||
boolean navbarOnLeft = mBubbleBarLocation != null && !mBubbleBarLocation.isOnLeft(
|
||||
layoutRtl);
|
||||
if (navbarOnLeft && layoutRtl) {
|
||||
iconEnd -= (mIconTouchSize + mItemMarginLeftRight) * mIgnoreTaskbarIconCount;
|
||||
} else if (!navbarOnLeft && !layoutRtl) {
|
||||
iconEnd += (mIconTouchSize + mItemMarginLeftRight) * mIgnoreTaskbarIconCount;
|
||||
}
|
||||
}
|
||||
|
||||
mControllerCallbacks.onPreLayoutChildren();
|
||||
|
||||
int count = getChildCount();
|
||||
@@ -887,8 +1014,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
qsbEnd = iconEnd - mItemMarginLeftRight;
|
||||
qsbStart = qsbEnd - deviceProfile.hotseatQsbWidth;
|
||||
}
|
||||
int qsbTop = (bottom - top - deviceProfile.hotseatQsbHeight) / 2;
|
||||
int qsbBottom = qsbTop + deviceProfile.hotseatQsbHeight;
|
||||
int qsbTop = (bottom - top - deviceProfile.getHotseatProfile().getQsbHeight()) / 2;
|
||||
int qsbBottom = qsbTop + deviceProfile.getHotseatProfile().getQsbHeight();
|
||||
child.layout(qsbStart, qsbTop, qsbEnd, qsbBottom);
|
||||
} else if (child == mTaskbarDividerContainer) {
|
||||
iconEnd += mItemMarginLeftRight;
|
||||
@@ -974,10 +1101,17 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the space used by the icons
|
||||
* Returns the space used by the icons.
|
||||
*/
|
||||
private int getIconLayoutWidth() {
|
||||
int countExcludingQsb = getChildCount();
|
||||
return getIconLayoutWidth(getChildCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the space needed based on the number of taskbar icons supplied vs existing children.
|
||||
*/
|
||||
private int getIconLayoutWidth(int expectedNumberOfTaskbarIcons) {
|
||||
int countExcludingQsb = expectedNumberOfTaskbarIcons;
|
||||
DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
|
||||
if (deviceProfile.isQsbInline) {
|
||||
countExcludingQsb--;
|
||||
@@ -1092,6 +1226,12 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
if (mActivityContext.isDestroyed()) return;
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
|
||||
private View inflate(@LayoutRes int layoutResId) {
|
||||
return mActivityContext.getViewCache().getView(layoutResId, mActivityContext, this);
|
||||
}
|
||||
@@ -1121,11 +1261,43 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
private float getTaskBarIconsEndForBubbleBarLocation(BubbleBarLocation location) {
|
||||
DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
|
||||
boolean navbarOnRight = location.isOnLeft(isLayoutRtl());
|
||||
int navSpaceNeeded = deviceProfile.hotseatBarEndOffset;
|
||||
int navSpaceNeeded = deviceProfile.getHotseatProfile().getBarEndOffset();
|
||||
if (navbarOnRight) {
|
||||
return getWidth() - navSpaceNeeded;
|
||||
} else {
|
||||
return navSpaceNeeded + getIconLayoutWidth();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams lp) {
|
||||
return new TaskbarLayoutParams(lp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LayoutParams generateLayoutParams(AttributeSet attrs) {
|
||||
return new TaskbarLayoutParams(getContext(), attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
|
||||
return p instanceof TaskbarLayoutParams;
|
||||
}
|
||||
|
||||
public static class TaskbarLayoutParams extends FrameLayout.LayoutParams {
|
||||
|
||||
@Nullable public CellInfo bindInfo;
|
||||
|
||||
public TaskbarLayoutParams(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public TaskbarLayoutParams(ViewGroup.LayoutParams source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
public TaskbarLayoutParams(int width, int height) {
|
||||
super(width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public class TaskbarViewCallbacks {
|
||||
* Notifies launcher to update icon alignment.
|
||||
*/
|
||||
public void notifyIconLayoutBoundsChanged() {
|
||||
mControllers.uiController.onIconLayoutBoundsChanged();
|
||||
mControllers.taskbarViewController.notifyIconLayoutBoundsChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,7 +203,7 @@ public class TaskbarViewCallbacks {
|
||||
mTaskbarView.getTaskbarOverflowView().getIsActive());
|
||||
}
|
||||
mControllers.keyboardQuickSwitchController.toggleQuickSwitchViewForTaskbar(
|
||||
mControllers.taskbarViewController.getTaskIdsForPinnedApps(),
|
||||
mControllers.taskbarViewController.getShownTaskIds(),
|
||||
this::onKeyboardQuickSwitchViewClosed);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,15 +18,14 @@ package com.android.launcher3.taskbar
|
||||
|
||||
import android.app.contextualsearch.ContextualSearchManager.ENTRYPOINT_LONG_PRESS_META
|
||||
import android.content.Context
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.dagger.LauncherComponentProvider
|
||||
import com.android.launcher3.logging.StatsLogManager
|
||||
import com.android.launcher3.util.ResourceBasedOverride
|
||||
import com.android.launcher3.util.ResourceBasedOverride.Overrides
|
||||
import com.android.quickstep.TopTaskTracker
|
||||
import com.android.quickstep.util.ContextualSearchInvoker
|
||||
import javax.inject.Inject
|
||||
|
||||
/** Creates [TaskbarViewCallbacks] instances. */
|
||||
open class TaskbarViewCallbacksFactory : ResourceBasedOverride {
|
||||
open class TaskbarViewCallbacksFactory @Inject constructor() {
|
||||
|
||||
open fun create(
|
||||
activity: TaskbarActivityContext,
|
||||
@@ -43,7 +42,7 @@ open class TaskbarViewCallbacksFactory : ResourceBasedOverride {
|
||||
val runningPackage =
|
||||
TopTaskTracker.INSTANCE[activity].getCachedTopTask(
|
||||
/* filterOnlyVisibleRecents */ true,
|
||||
activity.display.displayId,
|
||||
activity.displayId,
|
||||
)
|
||||
.getPackageName()
|
||||
activity.statsLogManager
|
||||
@@ -65,11 +64,7 @@ open class TaskbarViewCallbacksFactory : ResourceBasedOverride {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(context: Context): TaskbarViewCallbacksFactory {
|
||||
return Overrides.getObject(
|
||||
TaskbarViewCallbacksFactory::class.java,
|
||||
context,
|
||||
R.string.taskbar_view_callbacks_factory_class,
|
||||
)
|
||||
return LauncherComponentProvider.get(context).getTaskbarViewCallbacksFactory()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,14 +20,13 @@ import static android.animation.LayoutTransition.CHANGE_APPEARING;
|
||||
import static android.animation.LayoutTransition.CHANGE_DISAPPEARING;
|
||||
import static android.animation.LayoutTransition.DISAPPEARING;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
import static android.window.DesktopModeFlags.ENABLE_TASKBAR_OVERFLOW;
|
||||
import static android.window.DesktopModeFlags.ENABLE_TASKBAR_RECENTS_LAYOUT_TRANSITION;
|
||||
|
||||
import static com.android.app.animation.Interpolators.EMPHASIZED;
|
||||
import static com.android.app.animation.Interpolators.FINAL_FRAME;
|
||||
import static com.android.app.animation.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.BubbleTextView.LINE_INDICATOR_ANIM_DURATION;
|
||||
import static com.android.launcher3.Flags.enableScalingRevealHomeAnimation;
|
||||
import static com.android.launcher3.Flags.taskbarOverflow;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
|
||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA;
|
||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
|
||||
@@ -81,6 +80,7 @@ import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.anim.RevealOutlineAnimation;
|
||||
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.model.ModelWriter;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.TaskItemInfo;
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarController;
|
||||
@@ -94,6 +94,7 @@ import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
|
||||
import com.android.launcher3.util.MultiTranslateDelegate;
|
||||
import com.android.launcher3.util.MultiValueAlpha;
|
||||
import com.android.launcher3.util.SandboxContext;
|
||||
import com.android.launcher3.views.IconButtonView;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.quickstep.util.SingleTask;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
@@ -136,11 +137,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
private static final float ERROR_POSITION_IN_HOTSEAT_NOT_FOUND = -100;
|
||||
|
||||
private static final int TRANSITION_DELAY = 50;
|
||||
private static final int TRANSITION_DEFAULT_DURATION = 500;
|
||||
static final int TRANSITION_DEFAULT_DURATION = 500;
|
||||
private static final int TRANSITION_FADE_IN_DURATION = 167;
|
||||
private static final int TRANSITION_FADE_OUT_DURATION = 83;
|
||||
private static final int APPEARING_LINE_INDICATOR_ANIM_DELAY =
|
||||
TRANSITION_DEFAULT_DURATION - LINE_INDICATOR_ANIM_DURATION;
|
||||
|
||||
private final TaskbarActivityContext mActivity;
|
||||
private @Nullable TaskbarDragLayerController mDragLayerController;
|
||||
@@ -164,6 +163,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
private final AnimatedFloat mTranslationXForBubbleBar = new AnimatedFloat(
|
||||
this::updateTranslationXForBubbleBar);
|
||||
|
||||
private final TransitionEndBoundsChangedNotifier mTransitionEndBoundsChangedNotifier =
|
||||
new TransitionEndBoundsChangedNotifier();
|
||||
|
||||
@Nullable
|
||||
private Animator mTaskbarShiftXAnim;
|
||||
@Nullable
|
||||
@@ -224,24 +226,27 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
|
||||
private final float mTaskbarLeftRightMargin;
|
||||
|
||||
private final TaskbarRunningAppStateAnimationController mRunningStateController;
|
||||
|
||||
public TaskbarViewController(TaskbarActivityContext activity, TaskbarView taskbarView) {
|
||||
mActivity = activity;
|
||||
mTransientTaskbarDp = mActivity.getTransientTaskbarDeviceProfile();
|
||||
mPersistentTaskbarDp = mActivity.getPersistentTaskbarDeviceProfile();
|
||||
mTransientIconSize = mTransientTaskbarDp.taskbarIconSize;
|
||||
mPersistentIconSize = mPersistentTaskbarDp.taskbarIconSize;
|
||||
mTransientIconSize = mTransientTaskbarDp.getTaskbarProfile().getIconSize();
|
||||
mPersistentIconSize = mPersistentTaskbarDp.getTaskbarProfile().getIconSize();
|
||||
mTaskbarView = taskbarView;
|
||||
mTaskbarIconAlpha = new MultiValueAlpha(mTaskbarView, NUM_ALPHA_CHANNELS);
|
||||
mTaskbarIconAlpha.setUpdateVisibility(true);
|
||||
mModelCallbacks = TaskbarModelCallbacksFactory.newInstance(mActivity)
|
||||
.create(mActivity, mTaskbarView);
|
||||
mTaskbarBottomMargin = activity.getDeviceProfile().taskbarBottomMargin;
|
||||
mTaskbarBottomMargin = activity.getDeviceProfile().getTaskbarProfile().getBottomMargin();
|
||||
mStashedHandleHeight = activity.getResources()
|
||||
.getDimensionPixelSize(R.dimen.taskbar_stashed_handle_height);
|
||||
|
||||
mIsRtl = Utilities.isRtl(mTaskbarView.getResources());
|
||||
mTaskbarLeftRightMargin = mActivity.getResources().getDimensionPixelSize(
|
||||
R.dimen.transient_taskbar_padding);
|
||||
mRunningStateController = new TaskbarRunningAppStateAnimationController(mActivity);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,9 +267,12 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
|
||||
mTaskbarView.init(TaskbarViewCallbacksFactory.newInstance(mActivity).create(
|
||||
mActivity, mControllers, mTaskbarView));
|
||||
// Pinning popup feature availability depends on taskbar controllers, wait for the
|
||||
// controllers state initialization before evaluating the feature.
|
||||
mControllers.runAfterInit(mTaskbarView::updatePinningPopupEventHandlers);
|
||||
mTaskbarView.getLayoutParams().height = mActivity.isPhoneMode()
|
||||
? mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_phone_size)
|
||||
: mActivity.getDeviceProfile().taskbarHeight;
|
||||
: mActivity.getDeviceProfile().getTaskbarProfile().getHeight();
|
||||
|
||||
mTaskbarIconScaleForStash.updateValue(1f);
|
||||
float pinningValue =
|
||||
@@ -298,6 +306,14 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever a new ui controller is set.
|
||||
*/
|
||||
public void onUiControllerChanged() {
|
||||
// Pinning availability may depend on UI state when home has "locked" pinned taskbar.
|
||||
mTaskbarView.updatePinningPopupEventHandlers();
|
||||
}
|
||||
|
||||
/** Adjusts start aligned taskbar layout accordingly to the bubble bar position. */
|
||||
@Override
|
||||
public void onBubbleBarLocationUpdated(BubbleBarLocation location) {
|
||||
@@ -395,6 +411,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
}
|
||||
LauncherAppState.getInstance(mActivity).getModel().removeCallbacks(mModelCallbacks);
|
||||
mActivity.removeOnDeviceProfileChangeListener(mDeviceProfileChangeListener);
|
||||
mRunningStateController.onDestroy();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -412,6 +429,12 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
return mTaskbarIconAlpha;
|
||||
}
|
||||
|
||||
/** Creates a ModelWriter for updating model properties */
|
||||
public ModelWriter getModelWriter() {
|
||||
return LauncherAppState.getInstance(mActivity).getModel()
|
||||
.getWriter(false, mActivity.getCellPosMapper(), mModelCallbacks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be called when the recents button is disabled, so we can hide Taskbar icons as well.
|
||||
*/
|
||||
@@ -563,7 +586,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
sizeDiffTranslationRange *= -1;
|
||||
}
|
||||
|
||||
if (mActivity.isThreeButtonNav()) {
|
||||
if (!mTaskbarView.canTransitionToTransientTaskbar()) {
|
||||
mTaskbarView.getAllAppsButtonContainer()
|
||||
.setTranslationXForTaskbarAllAppsIcon(allAppIconTranslateRange);
|
||||
return;
|
||||
@@ -665,17 +688,19 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
// finally placing the icon in the middle of new taskbar background height.
|
||||
if (mControllers.getSharedState().startTaskbarVariantIsTransient) {
|
||||
float transY =
|
||||
mTransientTaskbarDp.taskbarBottomMargin + (mTransientTaskbarDp.taskbarHeight
|
||||
mTransientTaskbarDp.getTaskbarProfile().getBottomMargin() + (
|
||||
mTransientTaskbarDp.getTaskbarProfile().getHeight()
|
||||
- mTaskbarView.getTransientTaskbarIconLayoutBounds().bottom)
|
||||
- (mPersistentTaskbarDp.taskbarHeight
|
||||
- mTransientTaskbarDp.taskbarIconSize) / 2f;
|
||||
- (mPersistentTaskbarDp.getTaskbarProfile().getHeight()
|
||||
- mTransientTaskbarDp.getTaskbarProfile().getIconSize()) / 2f;
|
||||
taskbarIconTranslationYForPinningValue = mapRange(scale, 0f, transY);
|
||||
} else {
|
||||
float transY =
|
||||
-mTransientTaskbarDp.taskbarBottomMargin + (mPersistentTaskbarDp.taskbarHeight
|
||||
-mTransientTaskbarDp.getTaskbarProfile().getBottomMargin() + (
|
||||
mPersistentTaskbarDp.getTaskbarProfile().getHeight()
|
||||
- mTaskbarView.getTransientTaskbarIconLayoutBounds().bottom)
|
||||
- (mTransientTaskbarDp.taskbarHeight
|
||||
- mTransientTaskbarDp.taskbarIconSize) / 2f;
|
||||
- (mTransientTaskbarDp.getTaskbarProfile().getHeight()
|
||||
- mTransientTaskbarDp.getTaskbarProfile().getIconSize()) / 2f;
|
||||
taskbarIconTranslationYForPinningValue = mapRange(scale, transY, 0f);
|
||||
}
|
||||
return taskbarIconTranslationYForPinningValue;
|
||||
@@ -748,33 +773,41 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
}
|
||||
|
||||
private boolean shouldUpdateIconContentDescription(BubbleTextView btv) {
|
||||
boolean isInDesktopMode = mControllers.taskbarDesktopModeController.isInDesktopMode(
|
||||
DEFAULT_DISPLAY);
|
||||
boolean isInDesktopMode =
|
||||
mControllers.taskbarDesktopModeController.shouldShowDesktopTasksInTaskbar(
|
||||
DEFAULT_DISPLAY);
|
||||
boolean isAllAppsButton = btv instanceof TaskbarAllAppsButtonContainer;
|
||||
boolean isDividerButton = btv instanceof TaskbarDividerContainer;
|
||||
return isInDesktopMode && !isAllAppsButton && !isDividerButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A set of Task ids of running apps that are pinned in the taskbar.
|
||||
* @return A set of Task ids shown in the taskbar - includes task ID for running tasks of pinned
|
||||
* apps, and standalone running tasks.
|
||||
*/
|
||||
protected Set<Integer> getTaskIdsForPinnedApps() {
|
||||
if (!taskbarOverflow()) {
|
||||
protected Set<Integer> getShownTaskIds() {
|
||||
if (!ENABLE_TASKBAR_OVERFLOW.isTrue()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
Set<Integer> pinnedAppsWithTasks = new HashSet<>();
|
||||
Set<Integer> shownTasks = new HashSet<>();
|
||||
for (View iconView : getIconViews()) {
|
||||
if (iconView instanceof BubbleTextView btv
|
||||
&& btv.getTag() instanceof TaskItemInfo itemInfo) {
|
||||
pinnedAppsWithTasks.add(itemInfo.getTaskId());
|
||||
if (iconView instanceof BubbleTextView btv) {
|
||||
if (btv.getTag() instanceof TaskItemInfo itemInfo) {
|
||||
shownTasks.add(itemInfo.getTaskId());
|
||||
} else if (btv.getTag() instanceof SingleTask task) {
|
||||
shownTasks.add(task.getTask().getKey().id);
|
||||
}
|
||||
}
|
||||
}
|
||||
return pinnedAppsWithTasks;
|
||||
return shownTasks;
|
||||
}
|
||||
|
||||
private void updateRunningState(BubbleTextView btv) {
|
||||
btv.updateRunningState(getRunningAppState(btv), mTaskbarView.getLayoutTransition() != null);
|
||||
mRunningStateController.updateRunningState(
|
||||
btv,
|
||||
getRunningAppState(btv),
|
||||
/* animate = */ mTaskbarView.getLayoutTransition() != null);
|
||||
}
|
||||
|
||||
private BubbleTextView.RunningAppState getRunningAppState(BubbleTextView btv) {
|
||||
@@ -875,6 +908,16 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
as.play(reveal);
|
||||
}
|
||||
|
||||
void notifyIconLayoutBoundsChanged() {
|
||||
final LayoutTransition layoutTransition = mTaskbarView.getLayoutTransition();
|
||||
if (layoutTransition != null && layoutTransition.isRunning()) {
|
||||
// Defers notify until after transitions finish.
|
||||
mTransitionEndBoundsChangedNotifier.mIsCanceled = false;
|
||||
} else {
|
||||
mControllers.uiController.onIconLayoutBoundsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Taskbar icon alignment relative to Launcher hotseat icons
|
||||
* @param alignmentRatio [0, 1]
|
||||
@@ -898,6 +941,12 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
mIsHotseatIconOnTopWhenAligned = isHotseatIconOnTopWhenAligned;
|
||||
mIsIconAlignedWithHotseat = isIconAlignedWithHotseat;
|
||||
mIsStashed = isStashed;
|
||||
|
||||
final LayoutTransition layoutTransition = mTaskbarView.getLayoutTransition();
|
||||
if (layoutTransition != null && layoutTransition.isRunning()) {
|
||||
mTransitionEndBoundsChangedNotifier.mIsCanceled = true;
|
||||
layoutTransition.cancel();
|
||||
}
|
||||
mIconAlignControllerLazy = createIconAlignmentController(launcherDp);
|
||||
}
|
||||
mIconAlignControllerLazy.setPlayFraction(alignmentRatio);
|
||||
@@ -940,12 +989,16 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
Rect hotseatPadding = launcherDp.getHotseatLayoutPadding(mActivity);
|
||||
boolean isTransientTaskbar = mActivity.isTransientTaskbar();
|
||||
|
||||
float scaleUp = ((float) launcherDp.iconSizePx) / taskbarDp.taskbarIconSize;
|
||||
float scaleUp = ((float) launcherDp.iconSizePx)
|
||||
/ taskbarDp.getTaskbarProfile().getIconSize();
|
||||
int borderSpacing = launcherDp.hotseatBorderSpace;
|
||||
int hotseatCellSize = DeviceProfile.calculateCellWidth(
|
||||
launcherDp.availableWidthPx - hotseatPadding.left - hotseatPadding.right,
|
||||
launcherDp.getDeviceProperties().getAvailableWidthPx()
|
||||
- hotseatPadding.left
|
||||
- hotseatPadding.right,
|
||||
borderSpacing,
|
||||
launcherDp.numShownHotseatIcons);
|
||||
launcherDp.numShownHotseatIcons
|
||||
);
|
||||
|
||||
boolean isToHome = mControllers.uiController.isIconAlignedWithHotseat();
|
||||
boolean isDeviceLocked = mControllers.taskbarStashController.isDeviceLocked();
|
||||
@@ -970,13 +1023,14 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
}
|
||||
}
|
||||
int collapsedHeight = mActivity.getDefaultTaskbarWindowSize();
|
||||
int expandedHeight = Math.max(collapsedHeight, taskbarDp.taskbarHeight + offsetY);
|
||||
int expandedHeight = Math.max(collapsedHeight,
|
||||
taskbarDp.getTaskbarProfile().getHeight() + offsetY);
|
||||
setter.addOnFrameListener(anim -> mActivity.setTaskbarWindowSize(
|
||||
anim.getAnimatedFraction() > 0 ? expandedHeight : collapsedHeight));
|
||||
|
||||
mTaskbarBottomMargin = isTransientTaskbar
|
||||
? mTransientTaskbarDp.taskbarBottomMargin
|
||||
: mPersistentTaskbarDp.taskbarBottomMargin;
|
||||
? mTransientTaskbarDp.getTaskbarProfile().getBottomMargin()
|
||||
: mPersistentTaskbarDp.getTaskbarProfile().getBottomMargin();
|
||||
|
||||
int firstRecentTaskIndex = -1;
|
||||
int hotseatNavBarTranslationX = 0;
|
||||
@@ -986,12 +1040,17 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
hotseatNavBarTranslationX = taskbarDp
|
||||
.getHotseatTranslationXForNavBar(mActivity, isBubblesOnLeft);
|
||||
}
|
||||
|
||||
int ignoreCount = mTaskbarView.getIgnoreTaskbarIconCount();
|
||||
|
||||
for (int i = 0; i < mTaskbarView.getChildCount(); i++) {
|
||||
View child = mTaskbarView.getChildAt(i);
|
||||
boolean isAllAppsButton = child == mTaskbarView.getAllAppsButtonContainer();
|
||||
boolean isTaskbarDividerView = child == mTaskbarView.getTaskbarDividerViewContainer();
|
||||
boolean isTaskbarOverflowView = child == mTaskbarView.getTaskbarOverflowView();
|
||||
boolean isRecentTask = child.getTag() instanceof GroupTask;
|
||||
boolean isRtl = Utilities.isRtl(child.getResources());
|
||||
|
||||
// TODO(b/343522351): show recents on the home screen.
|
||||
final boolean isRecentsInHotseat = false;
|
||||
if (!mIsHotseatIconOnTopWhenAligned) {
|
||||
@@ -1020,11 +1079,21 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
? Interpolators.clampToProgress(LINEAR, 0f, 0.17f)
|
||||
: Interpolators.clampToProgress(LINEAR, 0.72f, 0.84f));
|
||||
}
|
||||
} else if (((!isRtl && mTaskbarView.getChildCount() - i <= ignoreCount)
|
||||
|| (isRtl && i < ignoreCount))
|
||||
&& mIsHotseatIconOnTopWhenAligned
|
||||
&& !(child instanceof IconButtonView)) {
|
||||
setter.addFloat(child, VIEW_ALPHA, 0f, 1f,
|
||||
isToHome
|
||||
? Interpolators.clampToProgress(LINEAR, 0f, 0.35f)
|
||||
: mActivity.getDeviceProfile().isQsbInline
|
||||
? Interpolators.clampToProgress(LINEAR, 0f, 1f)
|
||||
: Interpolators.clampToProgress(LINEAR, 0.84f, 1f));
|
||||
setter.addOnFrameListener(animator -> AlphaUpdateListener.updateVisibility(child));
|
||||
}
|
||||
if (child == mTaskbarView.getQsb()) {
|
||||
boolean isRtl = Utilities.isRtl(child.getResources());
|
||||
float hotseatIconCenter = isRtl
|
||||
? launcherDp.widthPx - hotseatPadding.right + borderSpacing
|
||||
? launcherDp.getDeviceProperties().getWidthPx() - hotseatPadding.right + borderSpacing
|
||||
+ launcherDp.hotseatQsbWidth / 2f
|
||||
: hotseatPadding.left - borderSpacing - launcherDp.hotseatQsbWidth / 2f;
|
||||
if (taskbarDp.isQsbInline) {
|
||||
@@ -1036,9 +1105,10 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
INDEX_TASKBAR_PINNING_ANIM).getValue();
|
||||
}
|
||||
float halfQsbIconWidthDiff =
|
||||
(launcherDp.hotseatQsbWidth - taskbarDp.taskbarIconSize) / 2f;
|
||||
float scale = ((float) taskbarDp.taskbarIconSize)
|
||||
/ launcherDp.hotseatQsbVisualHeight;
|
||||
(launcherDp.hotseatQsbWidth - taskbarDp.getTaskbarProfile().getIconSize())
|
||||
/ 2f;
|
||||
float scale = ((float) taskbarDp.getTaskbarProfile().getIconSize())
|
||||
/ launcherDp.getHotseatProfile().getQsbVisualHeight();
|
||||
setter.addFloat(child, SCALE_PROPERTY, scale, 1f, interpolator);
|
||||
|
||||
float fromX = isRtl ? -halfQsbIconWidthDiff : halfQsbIconWidthDiff;
|
||||
@@ -1185,7 +1255,12 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
? R.dimen.taskbar_phone_size
|
||||
: R.dimen.taskbar_stashed_size);
|
||||
} else {
|
||||
taskbarWindowSize = deviceProfile.taskbarHeight + deviceProfile.getTaskbarOffsetY();
|
||||
taskbarWindowSize = mActivity.getDefaultTaskbarWindowSize();
|
||||
}
|
||||
if (mBubbleControllers != null) {
|
||||
int bubbleBarMaxHeight = mBubbleControllers.bubbleBarViewController
|
||||
.getBubbleBarWithFlyoutMaximumHeight();
|
||||
taskbarWindowSize = Math.max(taskbarWindowSize, bubbleBarMaxHeight);
|
||||
}
|
||||
mActivity.setTaskbarWindowSize(taskbarWindowSize);
|
||||
mTaskbarNavButtonTranslationY.updateValue(-deviceProfile.getTaskbarOffsetY());
|
||||
@@ -1237,10 +1312,6 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
view.setAlpha(0f);
|
||||
view.setScaleX(0f);
|
||||
view.setScaleY(0f);
|
||||
if (view instanceof BubbleTextView btv) {
|
||||
// Defer so that app is mostly scaled in before showing indicator.
|
||||
btv.setLineIndicatorAnimStartDelay(APPEARING_LINE_INDICATOR_ANIM_DELAY);
|
||||
}
|
||||
} else if (type == DISAPPEARING && view instanceof BubbleTextView btv) {
|
||||
// Running state updates happen after removing this view, so update it here.
|
||||
updateRunningState(btv);
|
||||
@@ -1250,11 +1321,10 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
@Override
|
||||
public void endTransition(
|
||||
LayoutTransition transition, ViewGroup container, View view, int type) {
|
||||
if (type == APPEARING && view instanceof BubbleTextView btv) {
|
||||
btv.setLineIndicatorAnimStartDelay(0);
|
||||
}
|
||||
// Do nothing.
|
||||
}
|
||||
});
|
||||
layoutTransition.addTransitionListener(mTransitionEndBoundsChangedNotifier);
|
||||
|
||||
// Appearing.
|
||||
AnimatorSet appearingSet = new AnimatorSet();
|
||||
@@ -1313,6 +1383,10 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
return layoutTransition;
|
||||
}
|
||||
|
||||
public boolean isTaskbarInMinimalState() {
|
||||
return mTaskbarView.isTaskbarInMinimalState();
|
||||
}
|
||||
|
||||
/**
|
||||
* To be called when the given Task is updated, so that we can tell TaskbarView to also update.
|
||||
* @param task The Task whose e.g. icon changed.
|
||||
@@ -1334,7 +1408,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
@Override
|
||||
public void dumpLogs(String prefix, PrintWriter pw) {
|
||||
pw.println(prefix + "TaskbarViewController:");
|
||||
|
||||
pw.println(prefix + "\tignoreTaskbarIconCount=" + mTaskbarView.getIgnoreTaskbarIconCount());
|
||||
mTaskbarIconAlpha.dump(
|
||||
prefix + "\t",
|
||||
pw,
|
||||
@@ -1357,4 +1431,22 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
animator.setInterpolator(EMPHASIZED);
|
||||
return animator;
|
||||
}
|
||||
|
||||
private class TransitionEndBoundsChangedNotifier implements TransitionListener {
|
||||
private boolean mIsCanceled;
|
||||
|
||||
@Override
|
||||
public void startTransition(
|
||||
LayoutTransition transition, ViewGroup container, View view, int type) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endTransition(
|
||||
LayoutTransition transition, ViewGroup container, View view, int type) {
|
||||
if (!transition.isRunning() && !mIsCanceled) {
|
||||
mControllers.uiController.onIconLayoutBoundsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,12 +16,18 @@
|
||||
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import static com.android.launcher3.Utilities.dpToPx;
|
||||
|
||||
import com.android.launcher3.graphics.ThemeManager;
|
||||
import com.android.launcher3.taskbar.customization.TaskbarIconSpecs;
|
||||
|
||||
/**
|
||||
* Various utilities shared amongst the Taskbar's classes.
|
||||
*/
|
||||
public final class Utilities {
|
||||
|
||||
private Utilities() {}
|
||||
private Utilities() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets drag, long-click, and split selection behavior on 1P and 3P launchers with Taskbar
|
||||
@@ -36,4 +42,22 @@ public final class Utilities {
|
||||
controllers.taskbarPopupController.setAllowInitialSplitSelection(
|
||||
allowInitialSplitSelection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives radius for Transient Taskbar based on selected Launcher Icon Shape.
|
||||
* Transient Taskbar radius = (icon shape radius * icon size ratio) + padding.
|
||||
*
|
||||
* @return The radius for Transient Taskbar.
|
||||
*/
|
||||
static float getShapedTaskbarRadius(TaskbarActivityContext activityContext) {
|
||||
float taskbarIconSize =
|
||||
activityContext.getTaskbarSpecsEvaluator().getTaskbarIconSize().getSize();
|
||||
float maxIconSize = TaskbarIconSpecs.INSTANCE.getIconSize52dp().getSize();
|
||||
float iconShapeRadius =
|
||||
ThemeManager.INSTANCE.get(activityContext).getIconState().getShapeRadius();
|
||||
float iconSizeRatio = taskbarIconSize / maxIconSize;
|
||||
return dpToPx((iconShapeRadius * iconSizeRatio)
|
||||
+ TaskbarIconSpecs.INSTANCE.getDefaultTransientIconMargin().getSize(),
|
||||
activityContext);
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,7 @@ class VoiceInteractionWindowController(val context: TaskbarActivityContext) :
|
||||
separateWindowForTaskbarBackground =
|
||||
object : BaseDragLayer<TaskbarActivityContext>(context, null, 0) {
|
||||
override fun recreateControllers() {
|
||||
super.recreateControllers()
|
||||
mControllers = emptyArray()
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +133,7 @@ public final class TaskbarAllAppsController {
|
||||
if (isOpen()) {
|
||||
mSlideInView.close(true);
|
||||
} else {
|
||||
mControllers.taskbarEduTooltipController.hide();
|
||||
mControllers.taskbarPopupController.maybeCloseMultiInstanceMenu();
|
||||
show(true, showKeyboard);
|
||||
}
|
||||
|
||||
@@ -15,11 +15,14 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar.allapps;
|
||||
|
||||
import static android.os.Trace.TRACE_TAG_APP;
|
||||
|
||||
import static com.android.app.animation.Interpolators.DECELERATED_EASE;
|
||||
import static com.android.app.animation.Interpolators.EMPHASIZED;
|
||||
import static com.android.app.animation.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.touch.AllAppsSwipeController.ALL_APPS_FADE_MANUAL;
|
||||
import static com.android.launcher3.touch.AllAppsSwipeController.SCRIM_FADE_MANUAL;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.content.Context;
|
||||
@@ -27,9 +30,13 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Trace;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.CrossWindowBlurListeners;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewRootImpl;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.window.OnBackInvokedDispatcher;
|
||||
|
||||
@@ -48,11 +55,16 @@ import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.views.AbstractSlideInView;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/** Wrapper for taskbar all apps with slide-in behavior. */
|
||||
public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverlayContext>
|
||||
implements Insettable, DeviceProfile.OnDeviceProfileChangeListener {
|
||||
private static final String TAG = "TaskbarAllAppsSlideInView";
|
||||
|
||||
private final Handler mHandler;
|
||||
private final int mMaxBlurRadius;
|
||||
private final Consumer<Boolean> mWindowBlurListener = blursEnabled -> invalidate();
|
||||
|
||||
private TaskbarAllAppsContainerView mAppsView;
|
||||
private float mShiftRange;
|
||||
@@ -103,6 +115,16 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
}
|
||||
|
||||
private void showOnFullyAttachedToWindow(boolean animate) {
|
||||
if (mActivityContext.isAllAppsBackgroundBlurEnabled()) {
|
||||
ViewRootImpl overlayVri = mActivityContext.getRootView().getViewRootImpl();
|
||||
if (overlayVri == null) {
|
||||
Log.w(TAG, "overlayVRI is null, cannot notifyRendererOfExpensiveFrame()");
|
||||
} else {
|
||||
Trace.instantForTrack(TRACE_TAG_APP, TAG, "notifyRendererForGpuLoadUp");
|
||||
overlayVri.notifyRendererForGpuLoadUp("opening taskbar all apps");
|
||||
overlayVri.notifyRendererOfExpensiveFrame();
|
||||
}
|
||||
}
|
||||
mAllAppsCallbacks.onAllAppsTransitionStart(true);
|
||||
if (!animate) {
|
||||
mAllAppsCallbacks.onAllAppsTransitionEnd(true);
|
||||
@@ -126,7 +148,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
protected void onOpenCloseAnimationPending(PendingAnimation animation) {
|
||||
final boolean isOpening = mToTranslationShift == TRANSLATION_SHIFT_OPENED;
|
||||
|
||||
if (mActivityContext.getDeviceProfile().isPhone) {
|
||||
if (mActivityContext.getDeviceProfile().getDeviceProperties().isPhone()) {
|
||||
final Interpolator allAppsFadeInterpolator =
|
||||
isOpening ? ALL_APPS_FADE_MANUAL : Interpolators.reverse(ALL_APPS_FADE_MANUAL);
|
||||
animation.setViewAlpha(mAppsView, 1 - mToTranslationShift, allAppsFadeInterpolator);
|
||||
@@ -147,7 +169,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
|
||||
@Override
|
||||
protected Interpolator getScrimInterpolator() {
|
||||
if (mActivityContext.getDeviceProfile().isTablet) {
|
||||
if (mActivityContext.getDeviceProfile().getDeviceProperties().isTablet()) {
|
||||
return super.getScrimInterpolator();
|
||||
}
|
||||
return mToTranslationShift == TRANSLATION_SHIFT_OPENED
|
||||
@@ -192,7 +214,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mAppsView = findViewById(R.id.apps_view);
|
||||
if (mActivityContext.getDeviceProfile().isPhone) {
|
||||
if (mActivityContext.getDeviceProfile().getDeviceProperties().isPhone()) {
|
||||
mAppsView.setAlpha(0);
|
||||
}
|
||||
mContent = mAppsView;
|
||||
@@ -216,6 +238,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
dispatcher.registerOnBackInvokedCallback(
|
||||
OnBackInvokedDispatcher.PRIORITY_DEFAULT, this);
|
||||
}
|
||||
CrossWindowBlurListeners.getInstance().addListener(MAIN_EXECUTOR, mWindowBlurListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -229,6 +252,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
if (dispatcher != null) {
|
||||
dispatcher.unregisterOnBackInvokedCallback(this);
|
||||
}
|
||||
CrossWindowBlurListeners.getInstance().removeListener(mWindowBlurListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -253,12 +277,13 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
@Override
|
||||
protected int getScrimColor(Context context) {
|
||||
if (!mActivityContext.getDeviceProfile().shouldShowAllAppsOnSheet()) {
|
||||
return Themes.getAttrColor(context, R.attr.allAppsScrimColor);
|
||||
// Always use an opaque scrim if there's no sheet.
|
||||
return context.getResources().getColor(R.color.materialColorSurfaceDim);
|
||||
} else if (!Flags.allAppsBlur()) {
|
||||
// If there's a sheet but no blur, use the old scrim color.
|
||||
return context.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
}
|
||||
if (Flags.allAppsBlur()) {
|
||||
return Themes.getAttrColor(context, R.attr.allAppsScrimColorOverBlur);
|
||||
}
|
||||
return context.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
return Themes.getAttrColor(context, R.attr.allAppsScrimColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,12 +35,12 @@ import android.os.Bundle;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.launcher3.taskbar.TaskbarSharedState;
|
||||
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController;
|
||||
import com.android.launcher3.util.Executors.SimpleThreadFactory;
|
||||
import com.android.launcher3.util.MultiPropertyFactory;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
|
||||
import com.android.wm.shell.Flags;
|
||||
@@ -100,7 +100,8 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
|
||||
private static final long MASK_HIDE_HANDLE_VIEW = SYSUI_STATE_BOUNCER_SHOWING
|
||||
| SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING
|
||||
| SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED;
|
||||
| SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED
|
||||
| SYSUI_STATE_IME_VISIBLE;
|
||||
|
||||
private static final long MASK_SYSUI_LOCKED = SYSUI_STATE_BOUNCER_SHOWING
|
||||
| SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING
|
||||
@@ -125,8 +126,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
private BubbleCreator mBubbleCreator;
|
||||
private BubbleBarLocationListener mBubbleBarLocationListener;
|
||||
|
||||
// Cache last sent top coordinate to avoid sending duplicate updates to shell
|
||||
private int mLastSentBubbleBarTop;
|
||||
private int mLastSentBubbleBarTopToScreenBottom;
|
||||
|
||||
private boolean mIsImeVisible = false;
|
||||
|
||||
@@ -181,6 +181,9 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
public void onDestroy() {
|
||||
mSystemUiProxy.setBubblesListener(null);
|
||||
// Saves bubble bar state
|
||||
mSharedState.bubbleBarExpanded = mBubbleBarViewController.isExpanded();
|
||||
mSharedState.bubbleBarStashed = mBubbleStashController.isStashed();
|
||||
mSharedState.selectedBubbleKey = mSelectedBubble != null ? mSelectedBubble.getKey() : null;
|
||||
BubbleInfo[] bubbleInfoItems = new BubbleInfo[mBubbles.size()];
|
||||
mBubbles.values().forEach(bubbleBarBubble -> {
|
||||
int index = mBubbleBarViewController.bubbleViewIndex(bubbleBarBubble.getView());
|
||||
@@ -223,6 +226,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
mBubbleBarViewController.getBubbleBarLocation());
|
||||
if (sBubbleBarEnabled) {
|
||||
mSystemUiProxy.setBubblesListener(this);
|
||||
mSystemUiProxy.setHasBubbleBar(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -235,8 +239,19 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
mBubbleBarViewController.setHiddenForSysui(hideBubbleBar);
|
||||
|
||||
boolean hideHandleView = (flags & MASK_HIDE_HANDLE_VIEW) != 0;
|
||||
mBubbleStashedHandleViewController.ifPresent(
|
||||
controller -> controller.setHiddenForSysui(hideHandleView));
|
||||
mBubbleStashedHandleViewController.ifPresent(controller -> {
|
||||
controller.setHiddenForSysui(hideHandleView);
|
||||
MultiPropertyFactory<View>.MultiProperty handleViewAlpha =
|
||||
mBubbleStashController.getHandleViewAlpha();
|
||||
boolean shouldShowHandleView = handleViewAlpha != null
|
||||
&& !hideHandleView
|
||||
&& mBubbleStashController.isStashed()
|
||||
&& mBubbleBarViewController.hasBubbles();
|
||||
if (shouldShowHandleView) {
|
||||
// TODO: (b/273592694) animate it?
|
||||
handleViewAlpha.setValue(1f);
|
||||
}
|
||||
});
|
||||
|
||||
boolean sysuiLocked = (flags & MASK_SYSUI_LOCKED) != 0;
|
||||
mBubbleStashController.setSysuiLocked(sysuiLocked);
|
||||
@@ -297,12 +312,29 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
if (sharedState.bubbleBarLocation != null) {
|
||||
updateBubbleBarLocationInternal(sharedState.bubbleBarLocation);
|
||||
}
|
||||
restoreSavedBubbles(sharedState.bubbleInfoItems);
|
||||
List<BubbleInfo> savedBubbles = sharedState.bubbleInfoItems;
|
||||
boolean hasSavedBubbles = savedBubbles != null && !savedBubbles.isEmpty();
|
||||
if (hasSavedBubbles) {
|
||||
restoreSavedBubbles(savedBubbles);
|
||||
}
|
||||
restoreSuppressed(sharedState.suppressedBubbleInfoItems);
|
||||
if (hasSavedBubbles) {
|
||||
setSelectedBubbleInternal(mBubbles.get(sharedState.selectedBubbleKey));
|
||||
if (sharedState.bubbleBarExpanded) {
|
||||
// We don't want state restore to have side effects which update the Shell state.
|
||||
// Use the method for setting expanded state from sysui as that won't trigger an
|
||||
// update back to Shell.
|
||||
mBubbleBarViewController.setExpandedFromSysui(/* isExpanded= */ true,
|
||||
/* animate= */ false);
|
||||
} else if (sharedState.bubbleBarStashed) {
|
||||
mBubbleStashController.stashBubbleBarImmediate();
|
||||
} else {
|
||||
mBubbleStashController.showBubbleBarImmediate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreSavedBubbles(List<BubbleInfo> bubbleInfos) {
|
||||
if (bubbleInfos == null || bubbleInfos.isEmpty()) return;
|
||||
// Iterate in reverse because new bubbles are added in front and the list is in order.
|
||||
for (int i = bubbleInfos.size() - 1; i >= 0; i--) {
|
||||
BubbleBarBubble bubble = mBubbleCreator.populateBubble(mContext,
|
||||
@@ -311,7 +343,8 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
Log.e(TAG, "Could not instantiate BubbleBarBubble for " + bubbleInfos.get(i));
|
||||
continue;
|
||||
}
|
||||
addBubbleInternally(bubble, /* isExpanding= */ false, /* suppressAnimation= */ true);
|
||||
mBubbles.put(bubble.getKey(), bubble);
|
||||
mBubbleBarViewController.restoreBubble(bubble);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,6 +361,11 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
}
|
||||
|
||||
private void applyViewChanges(BubbleBarViewUpdate update) {
|
||||
if (update.initialState) {
|
||||
// it is possible that we tried to notify shell too early with the bubble bar bounds,
|
||||
// so force update shell about the bubble bar bounds in the initial handshake.
|
||||
onBubbleBarBoundsChanged(/* forceUpdate= */ true);
|
||||
}
|
||||
final boolean isCollapsed = (update.expandedChanged && !update.expanded)
|
||||
|| (!update.expandedChanged && !mBubbleBarViewController.isExpanded());
|
||||
final boolean isExpanding = update.expandedChanged && update.expanded;
|
||||
@@ -354,9 +392,6 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
BubbleBarBubble newlySelected = mBubbles.get(update.selectedBubbleKey);
|
||||
if (newlySelected != null) {
|
||||
bubbleToSelect = newlySelected;
|
||||
} else {
|
||||
Log.w(TAG, "trying to select bubble that doesn't exist:"
|
||||
+ update.selectedBubbleKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -425,6 +460,9 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
for (int i = update.currentBubbles.size() - 1; i >= 0; i--) {
|
||||
BubbleBarBubble bubble = update.currentBubbles.get(i);
|
||||
if (bubble != null) {
|
||||
if (bubble.getKey().equals(update.selectedBubbleKey)) {
|
||||
bubbleToSelect = bubble;
|
||||
}
|
||||
addBubbleInternally(bubble, isExpanding, suppressAnimation);
|
||||
if (isCollapsed && bubbleToSelect == null) {
|
||||
// If we're collapsed, the most recently added bubble will be selected.
|
||||
@@ -495,13 +533,19 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
}
|
||||
if (bubbleToSelect != null) {
|
||||
setSelectedBubbleInternal(bubbleToSelect);
|
||||
} else if (update.initialState && BubbleBarOverflow.KEY.equals(update.selectedBubbleKey)) {
|
||||
// this is the initial update with the overflow selected which could happen after
|
||||
// unfolding with the overflow expanded
|
||||
setSelectedBubbleInternal(mBubbleBarViewController.getOverflowBubble());
|
||||
}
|
||||
if (update.shouldShowEducation) {
|
||||
mBubbleBarViewController.prepareToShowEducation();
|
||||
}
|
||||
if (update.expandedChanged) {
|
||||
if (update.expanded != mBubbleBarViewController.isExpanded()) {
|
||||
mBubbleBarViewController.setExpandedFromSysui(update.expanded);
|
||||
// If we start as expanded, show bar immediately without waiting for animation.
|
||||
boolean animate = !update.initialState;
|
||||
mBubbleBarViewController.setExpandedFromSysui(update.expanded, animate);
|
||||
} else {
|
||||
Log.w(TAG, "expansion was changed but is the same");
|
||||
}
|
||||
@@ -527,8 +571,8 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
/** Tells WMShell to show the currently selected bubble. */
|
||||
public void showSelectedBubble() {
|
||||
if (getSelectedBubbleKey() != null) {
|
||||
mLastSentBubbleBarTop = mBarView.getRestingTopPositionOnScreen();
|
||||
mSystemUiProxy.showBubble(getSelectedBubbleKey(), mLastSentBubbleBarTop);
|
||||
mLastSentBubbleBarTopToScreenBottom = mBarView.getTopToScreenBottom();
|
||||
mSystemUiProxy.showBubble(getSelectedBubbleKey(), mLastSentBubbleBarTopToScreenBottom);
|
||||
} else {
|
||||
Log.w(TAG, "Trying to show the selected bubble but it's null");
|
||||
}
|
||||
@@ -592,23 +636,9 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDragItemOverBubbleBarDragZone(@NonNull BubbleBarLocation bubbleBarLocation) {
|
||||
public void showBubbleBarPillowAt(@Nullable BubbleBarLocation location) {
|
||||
MAIN_EXECUTOR.execute(() -> {
|
||||
mBubbleBarViewController.onDragItemOverBubbleBarDragZone(bubbleBarLocation);
|
||||
if (mBubbleBarViewController.isLocationUpdatedForDropTarget()) {
|
||||
mBubbleBarLocationListener.onBubbleBarLocationAnimated(bubbleBarLocation);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDraggedOutsideBubbleBarDropZone() {
|
||||
MAIN_EXECUTOR.execute(() -> {
|
||||
if (mBubbleBarViewController.isLocationUpdatedForDropTarget()) {
|
||||
BubbleBarLocation original = mBubbleBarViewController.getBubbleBarLocation();
|
||||
mBubbleBarLocationListener.onBubbleBarLocationAnimated(original);
|
||||
}
|
||||
mBubbleBarViewController.onItemDraggedOutsideBubbleBarDropZone();
|
||||
//TODO(b/411505605) add logic to show pillow and update taskbar
|
||||
});
|
||||
}
|
||||
|
||||
@@ -622,10 +652,14 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
||||
//
|
||||
|
||||
private void onBubbleBarBoundsChanged() {
|
||||
int newTop = mBarView.getRestingTopPositionOnScreen();
|
||||
if (newTop != mLastSentBubbleBarTop) {
|
||||
mLastSentBubbleBarTop = newTop;
|
||||
mSystemUiProxy.updateBubbleBarTopOnScreen(newTop);
|
||||
onBubbleBarBoundsChanged(/* forceUpdate= */ false);
|
||||
}
|
||||
|
||||
private void onBubbleBarBoundsChanged(boolean forceUpdate) {
|
||||
int bubbleBarTopToScreenBottom = mBarView.getTopToScreenBottom();
|
||||
if (bubbleBarTopToScreenBottom != mLastSentBubbleBarTopToScreenBottom || forceUpdate) {
|
||||
mLastSentBubbleBarTopToScreenBottom = bubbleBarTopToScreenBottom;
|
||||
mSystemUiProxy.updateBubbleBarTopToScreenBottom(bubbleBarTopToScreenBottom);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+22
-37
@@ -21,72 +21,57 @@ import android.view.View
|
||||
import com.android.launcher3.DropTarget
|
||||
import com.android.launcher3.dragndrop.DragOptions
|
||||
import com.android.launcher3.model.data.ItemInfo
|
||||
import com.android.wm.shell.shared.bubbles.BubbleBarLocation
|
||||
import com.android.wm.shell.shared.bubbles.DragZoneFactory
|
||||
import com.android.wm.shell.shared.bubbles.DropTargetManager
|
||||
|
||||
/**
|
||||
* Implementation of the {@link DropTarget} that handles drag and drop events over the bubble bar
|
||||
* locations.
|
||||
*/
|
||||
class BubbleBarLocationDropTarget(
|
||||
private val bubbleBarLocation: BubbleBarLocation,
|
||||
private val bubbleBarDragListener: BubbleBarDragListener,
|
||||
private val bubbleBarDropTargetController: BubbleBarDropTargetController,
|
||||
dragZoneFactory: DragZoneFactory,
|
||||
private val dropTargetManager: DropTargetManager,
|
||||
private val isLeftDropTarget: Boolean,
|
||||
) : DropTarget {
|
||||
|
||||
/** Controller that takes care of the bubble bar drag events inside launcher process. */
|
||||
interface BubbleBarDragListener {
|
||||
interface BubbleBarDropTargetController {
|
||||
|
||||
/** Called when the drag event is over the bubble bar drop zone. */
|
||||
fun onLauncherItemDraggedOverBubbleBarDragZone(location: BubbleBarLocation)
|
||||
/** Return whether the item info can be dropped on the bubble bar drop target. */
|
||||
fun acceptDrop(itemInfo: ItemInfo): Boolean
|
||||
|
||||
/** Called when the drag event leaves the bubble bar drop zone. */
|
||||
fun onLauncherItemDraggedOutsideBubbleBarDropZone()
|
||||
|
||||
/** Called when the drop event happens over the bubble bar drop zone. */
|
||||
fun onLauncherItemDroppedOverBubbleBarDragZone(
|
||||
location: BubbleBarLocation,
|
||||
itemInfo: ItemInfo,
|
||||
)
|
||||
|
||||
/** Gets the hit [rect][android.graphics.Rect] of the bubble bar location. */
|
||||
fun getBubbleBarLocationHitRect(bubbleBarLocation: BubbleBarLocation, outRect: Rect)
|
||||
|
||||
/** Provides the view that will accept the drop. */
|
||||
fun getDropView(): View
|
||||
/** Called after dragged item info drop on the bubble bar drop target. */
|
||||
fun onDrop(itemInfo: ItemInfo, isLeftDropTarget: Boolean)
|
||||
}
|
||||
|
||||
private var isShowingDropTarget = false
|
||||
private val dropRect = dragZoneFactory.getBubbleBarDropRect(isLeftDropTarget)
|
||||
|
||||
override fun isDropEnabled(): Boolean = true
|
||||
|
||||
override fun onDrop(dragObject: DropTarget.DragObject, options: DragOptions) {
|
||||
val itemInfo = dragObject.dragInfo ?: return
|
||||
bubbleBarDragListener.onLauncherItemDroppedOverBubbleBarDragZone(
|
||||
bubbleBarLocation,
|
||||
itemInfo,
|
||||
)
|
||||
bubbleBarDropTargetController.onDrop(dragObject.dragInfo, isLeftDropTarget)
|
||||
}
|
||||
|
||||
override fun onDragEnter(dragObject: DropTarget.DragObject) {}
|
||||
override fun onDragEnter(dragObject: DropTarget.DragObject) {
|
||||
dropTargetManager.onDragUpdated(dragObject.x, dragObject.y)
|
||||
}
|
||||
|
||||
override fun onDragOver(dragObject: DropTarget.DragObject) {
|
||||
if (isShowingDropTarget) return
|
||||
isShowingDropTarget = true
|
||||
bubbleBarDragListener.onLauncherItemDraggedOverBubbleBarDragZone(bubbleBarLocation)
|
||||
dropTargetManager.onDragUpdated(dragObject.x, dragObject.y)
|
||||
}
|
||||
|
||||
override fun onDragExit(dragObject: DropTarget.DragObject) {
|
||||
if (!isShowingDropTarget) return
|
||||
isShowingDropTarget = false
|
||||
bubbleBarDragListener.onLauncherItemDraggedOutsideBubbleBarDropZone()
|
||||
dropTargetManager.onDragUpdated(dragObject.x, dragObject.y)
|
||||
}
|
||||
|
||||
override fun acceptDrop(dragObject: DropTarget.DragObject): Boolean = true
|
||||
override fun acceptDrop(dragObject: DropTarget.DragObject): Boolean =
|
||||
bubbleBarDropTargetController.acceptDrop(dragObject.dragInfo)
|
||||
|
||||
override fun prepareAccessibilityDrop() {}
|
||||
|
||||
override fun getHitRectRelativeToDragLayer(outRect: Rect) {
|
||||
bubbleBarDragListener.getBubbleBarLocationHitRect(bubbleBarLocation, outRect)
|
||||
outRect.set(dropRect)
|
||||
}
|
||||
|
||||
override fun getDropView(): View = bubbleBarDragListener.getDropView()
|
||||
override fun getDropView(): View? = null
|
||||
}
|
||||
@@ -210,7 +210,8 @@ class BubbleBarSwipeController {
|
||||
resources,
|
||||
taskbarActivityContext.deviceProfile,
|
||||
)
|
||||
maxOverscroll = taskbarActivityContext.deviceProfile.heightPx - unstashThreshold
|
||||
maxOverscroll =
|
||||
taskbarActivityContext.deviceProfile.deviceProperties.heightPx - unstashThreshold
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,6 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
import com.android.launcher3.taskbar.BarsLocationAnimatorHelper;
|
||||
import com.android.launcher3.taskbar.bubbles.animation.BubbleAnimator;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
@@ -146,7 +145,8 @@ public class BubbleBarView extends FrameLayout {
|
||||
|
||||
// An animator that represents the expansion state of the bubble bar, where 0 corresponds to the
|
||||
// collapsed state and 1 to the fully expanded state.
|
||||
private ValueAnimator mWidthAnimator = createExpansionAnimator(/* expanding = */ false);
|
||||
@Nullable
|
||||
private ValueAnimator mWidthAnimator;
|
||||
|
||||
@Nullable
|
||||
private ValueAnimator mDismissAnimator = null;
|
||||
@@ -652,13 +652,15 @@ public class BubbleBarView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bubble bar top coordinate on screen when bar is resting
|
||||
*/
|
||||
public int getRestingTopPositionOnScreen() {
|
||||
int displayHeight = DisplayController.INSTANCE.get(getContext()).getInfo().currentSize.y;
|
||||
/** Get the distance between the bubble bar top coordinate and the bottom of the screen */
|
||||
public int getTopToScreenBottom() {
|
||||
// the bottom of the bubble bar is aligned with the bottom of the screen. the distance
|
||||
// between the top of the bubble bar and the bottom of the screen is the height of the
|
||||
// bubble bar minus the y translation. since the bubble bar is always above the bottom of
|
||||
// the screen, the translation is negative and the overall result is a positive value that
|
||||
// represents the distance
|
||||
int bubbleBarHeight = getBubbleBarBounds().height();
|
||||
return displayHeight - bubbleBarHeight + (int) mController.getBubbleBarTranslationY();
|
||||
return bubbleBarHeight - (int) mController.getBubbleBarTranslationY();
|
||||
}
|
||||
|
||||
/** Returns the bounds with translation that may have been applied. */
|
||||
@@ -715,8 +717,8 @@ public class BubbleBarView extends FrameLayout {
|
||||
}
|
||||
|
||||
/** Add a new bubble to the bubble bar without updating the selected bubble. */
|
||||
public void addBubble(BubbleView bubble) {
|
||||
addBubble(bubble, /* bubbleToSelect = */ null);
|
||||
public void addBubble(BubbleView bubble, boolean suppressAnimation) {
|
||||
addBubble(bubble, /* bubbleToSelect = */ null, suppressAnimation);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -725,12 +727,13 @@ public class BubbleBarView extends FrameLayout {
|
||||
* @param bubble bubble to add
|
||||
* @param bubbleToSelect if {@code null}, then selected bubble does not change
|
||||
*/
|
||||
public void addBubble(BubbleView bubble, @Nullable BubbleView bubbleToSelect) {
|
||||
public void addBubble(BubbleView bubble, @Nullable BubbleView bubbleToSelect,
|
||||
boolean suppressAnimation) {
|
||||
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams((int) mIconSize, (int) mIconSize,
|
||||
Gravity.LEFT);
|
||||
final int index = bubble.isOverflow() ? getChildCount() : 0;
|
||||
|
||||
if (isExpanded()) {
|
||||
if (isExpanded() && !suppressAnimation) {
|
||||
// if we're expanded scale the new bubble in
|
||||
bubble.setScaleX(0f);
|
||||
bubble.setScaleY(0f);
|
||||
@@ -1008,7 +1011,12 @@ public class BubbleBarView extends FrameLayout {
|
||||
* on the expanded state.
|
||||
*/
|
||||
private void updateBubblesLayoutProperties(BubbleBarLocation bubbleBarLocation) {
|
||||
final float widthState = (float) mWidthAnimator.getAnimatedValue();
|
||||
final float widthState;
|
||||
if (mWidthAnimator == null) {
|
||||
widthState = mIsBarExpanded ? 1f : 0f;
|
||||
} else {
|
||||
widthState = (float) mWidthAnimator.getAnimatedValue();
|
||||
}
|
||||
final float currentWidth = getWidth();
|
||||
final float expandedWidth = expandedWidth();
|
||||
final float collapsedWidth = collapsedWidth();
|
||||
@@ -1045,7 +1053,7 @@ public class BubbleBarView extends FrameLayout {
|
||||
bv.setZ(fullElevationForChild * elevationState);
|
||||
|
||||
// only update the dot and badge scale if we're expanding or collapsing
|
||||
if (mWidthAnimator.isRunning()) {
|
||||
if (mWidthAnimator != null && mWidthAnimator.isRunning()) {
|
||||
// The dot for the selected bubble scales in the opposite direction of the expansion
|
||||
// animation.
|
||||
bv.showDotIfNeeded(bv == mSelectedBubbleView ? 1 - widthState : widthState);
|
||||
@@ -1161,7 +1169,7 @@ public class BubbleBarView extends FrameLayout {
|
||||
* Reorders the views to match the provided list.
|
||||
*/
|
||||
public void reorder(List<BubbleView> viewOrder) {
|
||||
if (isExpanded() || mWidthAnimator.isRunning()) {
|
||||
if (isExpanded() || (mWidthAnimator != null && mWidthAnimator.isRunning())) {
|
||||
mReorderRunnable = () -> doReorder(viewOrder);
|
||||
} else {
|
||||
doReorder(viewOrder);
|
||||
@@ -1192,7 +1200,7 @@ public class BubbleBarView extends FrameLayout {
|
||||
mUpdateSelectedBubbleAfterCollapse = updateSelectedBubbleAfterCollapse;
|
||||
}
|
||||
|
||||
void setController(Controller controller) {
|
||||
public void setController(Controller controller) {
|
||||
mController = controller;
|
||||
}
|
||||
|
||||
@@ -1310,20 +1318,38 @@ public class BubbleBarView extends FrameLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the bubble bar is expanded or collapsed.
|
||||
* Update bubble bar expanded state.
|
||||
*/
|
||||
public void setExpanded(boolean isBarExpanded) {
|
||||
if (mIsBarExpanded != isBarExpanded) {
|
||||
mIsBarExpanded = isBarExpanded;
|
||||
updateArrowForSelected(/* shouldAnimate= */ false);
|
||||
setOrUnsetClickListener();
|
||||
setExpandedInternal(isBarExpanded, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update bubble bar expanded state with animation.
|
||||
* <p>
|
||||
* Also triggers a talkback announcement for accessibility.
|
||||
*/
|
||||
public void animateExpanded(boolean isBarExpanded) {
|
||||
setExpandedInternal(isBarExpanded, true);
|
||||
}
|
||||
|
||||
private void setExpandedInternal(boolean isBarExpanded, boolean animate) {
|
||||
if (mIsBarExpanded == isBarExpanded) return;
|
||||
mIsBarExpanded = isBarExpanded;
|
||||
updateArrowForSelected(/* shouldAnimate= */ false);
|
||||
setOrUnsetClickListener();
|
||||
if (animate) {
|
||||
mWidthAnimator = createExpansionAnimator(isBarExpanded);
|
||||
mWidthAnimator.start();
|
||||
updateBubbleAccessibilityStates();
|
||||
announceExpandedStateChange();
|
||||
} else {
|
||||
onExpandedChanged();
|
||||
}
|
||||
updateBubbleAccessibilityStates();
|
||||
mController.onBubbleBarExpandedStateChanged(mIsBarExpanded);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the bubble bar is expanded.
|
||||
*/
|
||||
@@ -1335,7 +1361,7 @@ public class BubbleBarView extends FrameLayout {
|
||||
* Returns whether the bubble bar is expanding.
|
||||
*/
|
||||
public boolean isExpanding() {
|
||||
return mWidthAnimator.isRunning() && mIsBarExpanded;
|
||||
return mWidthAnimator != null && mWidthAnimator.isRunning() && mIsBarExpanded;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1584,26 +1610,7 @@ public class BubbleBarView extends FrameLayout {
|
||||
animator.setInterpolator(Interpolators.EMPHASIZED);
|
||||
addAnimationCallBacks(animator,
|
||||
/* onStart= */ () -> mBubbleBarBackground.showArrow(true),
|
||||
/* onEnd= */ () -> {
|
||||
mBubbleBarBackground.showArrow(mIsBarExpanded);
|
||||
if (!mIsBarExpanded && mReorderRunnable != null) {
|
||||
mReorderRunnable.run();
|
||||
mReorderRunnable = null;
|
||||
}
|
||||
// If the bar was just collapsed and the overflow was the last bubble that was
|
||||
// selected, set the first bubble as selected.
|
||||
if (!mIsBarExpanded && mUpdateSelectedBubbleAfterCollapse != null
|
||||
&& mSelectedBubbleView != null
|
||||
&& mSelectedBubbleView.getBubble() instanceof BubbleBarOverflow) {
|
||||
BubbleView firstBubble = (BubbleView) getChildAt(0);
|
||||
mUpdateSelectedBubbleAfterCollapse.accept(firstBubble.getBubble().getKey());
|
||||
}
|
||||
// If the bar was just expanded, remove the dot from the selected bubble.
|
||||
if (mIsBarExpanded && mSelectedBubbleView != null) {
|
||||
mSelectedBubbleView.markSeen();
|
||||
}
|
||||
updateLayoutParams();
|
||||
},
|
||||
/* onEnd= */ this::onExpandedChanged,
|
||||
/* onUpdate= */ anim -> {
|
||||
updateBubblesLayoutProperties(mBubbleBarLocation);
|
||||
invalidate();
|
||||
@@ -1611,6 +1618,27 @@ public class BubbleBarView extends FrameLayout {
|
||||
return animator;
|
||||
}
|
||||
|
||||
private void onExpandedChanged() {
|
||||
mBubbleBarBackground.showArrow(mIsBarExpanded);
|
||||
if (!mIsBarExpanded && mReorderRunnable != null) {
|
||||
mReorderRunnable.run();
|
||||
mReorderRunnable = null;
|
||||
}
|
||||
// If the bar was just collapsed and the overflow was the last bubble that was
|
||||
// selected, set the first bubble as selected.
|
||||
if (!mIsBarExpanded && mUpdateSelectedBubbleAfterCollapse != null
|
||||
&& mSelectedBubbleView != null
|
||||
&& mSelectedBubbleView.getBubble() instanceof BubbleBarOverflow) {
|
||||
BubbleView firstBubble = (BubbleView) getChildAt(0);
|
||||
mUpdateSelectedBubbleAfterCollapse.accept(firstBubble.getBubble().getKey());
|
||||
}
|
||||
// If the bar was just expanded, remove the dot from the selected bubble.
|
||||
if (mIsBarExpanded && mSelectedBubbleView != null) {
|
||||
mSelectedBubbleView.markSeen();
|
||||
}
|
||||
updateLayoutParams();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the distance between the top left corner of the bubble bar to the center of the dot
|
||||
* of the selected bubble.
|
||||
@@ -1644,7 +1672,7 @@ public class BubbleBarView extends FrameLayout {
|
||||
}
|
||||
|
||||
/** Interface for BubbleBarView to communicate with its controller. */
|
||||
interface Controller {
|
||||
public interface Controller {
|
||||
|
||||
/** Returns the translation Y that the bubble bar should have. */
|
||||
float getBubbleBarTranslationY();
|
||||
@@ -1664,5 +1692,8 @@ public class BubbleBarView extends FrameLayout {
|
||||
|
||||
/** Notifies the controller that bubble bar is being dragged */
|
||||
void setIsDragging(boolean dragging);
|
||||
|
||||
/** Notifies the controller that bubble bar expanded state changed */
|
||||
void onBubbleBarExpandedStateChanged(boolean expanded);
|
||||
}
|
||||
}
|
||||
@@ -43,33 +43,25 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.AnimatedFloat;
|
||||
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
|
||||
import com.android.launcher3.dragndrop.DragController;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.taskbar.TaskbarActivityContext;
|
||||
import com.android.launcher3.taskbar.TaskbarControllers;
|
||||
import com.android.launcher3.taskbar.TaskbarInsetsController;
|
||||
import com.android.launcher3.taskbar.TaskbarSharedState;
|
||||
import com.android.launcher3.taskbar.TaskbarStashController;
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarLocationDropTarget.BubbleBarDragListener;
|
||||
import com.android.launcher3.taskbar.bubbles.animation.BubbleBarViewAnimator;
|
||||
import com.android.launcher3.taskbar.bubbles.flyout.BubbleBarFlyoutController;
|
||||
import com.android.launcher3.taskbar.bubbles.flyout.BubbleBarFlyoutPositioner;
|
||||
import com.android.launcher3.taskbar.bubbles.flyout.FlyoutCallbacks;
|
||||
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.MultiPropertyFactory;
|
||||
import com.android.launcher3.util.MultiValueAlpha;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.wm.shell.Flags;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
|
||||
import com.android.wm.shell.shared.bubbles.DeviceConfig;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
@@ -128,60 +120,6 @@ public class BubbleBarViewController {
|
||||
updateTranslationY();
|
||||
setBubbleBarScaleAndPadding(pinningProgress);
|
||||
});
|
||||
private final BubbleBarDragListener mDragListener = new BubbleBarDragListener() {
|
||||
|
||||
@Override
|
||||
public void getBubbleBarLocationHitRect(@NonNull BubbleBarLocation bubbleBarLocation,
|
||||
Rect outRect) {
|
||||
Point screenSize = DisplayController.INSTANCE.get(mActivity).getInfo().currentSize;
|
||||
outRect.top = screenSize.y - mBubbleBarDropTargetSize;
|
||||
outRect.bottom = screenSize.y;
|
||||
if (bubbleBarLocation.isOnLeft(mBarView.isLayoutRtl())) {
|
||||
outRect.left = 0;
|
||||
outRect.right = mBubbleBarDropTargetSize;
|
||||
} else {
|
||||
outRect.left = screenSize.x - mBubbleBarDropTargetSize;
|
||||
outRect.right = screenSize.x;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLauncherItemDroppedOverBubbleBarDragZone(@NonNull BubbleBarLocation location,
|
||||
@NonNull ItemInfo itemInfo) {
|
||||
AbstractFloatingView.closeAllOpenViews(mActivity);
|
||||
if (itemInfo instanceof WorkspaceItemInfo) {
|
||||
ShortcutInfo shortcutInfo = ((WorkspaceItemInfo) itemInfo).getDeepShortcutInfo();
|
||||
if (shortcutInfo != null) {
|
||||
mSystemUiProxy.showShortcutBubble(shortcutInfo, location);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Intent itemIntent = itemInfo.getIntent();
|
||||
if (itemIntent != null && itemIntent.getComponent() != null) {
|
||||
itemIntent.setPackage(itemIntent.getComponent().getPackageName());
|
||||
mSystemUiProxy.showAppBubble(itemIntent, itemInfo.user, location);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLauncherItemDraggedOutsideBubbleBarDropZone() {
|
||||
onItemDraggedOutsideBubbleBarDropZone();
|
||||
mSystemUiProxy.showBubbleDropTarget(/* show = */ false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLauncherItemDraggedOverBubbleBarDragZone(
|
||||
@NonNull BubbleBarLocation location) {
|
||||
onDragItemOverBubbleBarDragZone(location);
|
||||
mSystemUiProxy.showBubbleDropTarget(/* show = */ true, location);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View getDropView() {
|
||||
return mBarView;
|
||||
}
|
||||
};
|
||||
|
||||
// Modified when swipe up is happening on the bubble bar or task bar.
|
||||
private float mBubbleBarSwipeUpTranslationY;
|
||||
@@ -207,11 +145,8 @@ public class BubbleBarViewController {
|
||||
private BubbleBarFlyoutController mBubbleBarFlyoutController;
|
||||
private BubbleBarPinController mBubbleBarPinController;
|
||||
private TaskbarSharedState mTaskbarSharedState;
|
||||
private final BubbleBarLocationDropTarget mBubbleBarLeftDropTarget;
|
||||
private final BubbleBarLocationDropTarget mBubbleBarRightDropTarget;
|
||||
private final TimeSource mTimeSource = System::currentTimeMillis;
|
||||
private final int mTaskbarTranslationDelta;
|
||||
private final int mBubbleBarDropTargetSize;
|
||||
|
||||
@Nullable
|
||||
private BubbleBarBoundsChangeListener mBoundsChangeListener;
|
||||
@@ -229,15 +164,6 @@ public class BubbleBarViewController {
|
||||
R.dimen.bubblebar_transient_taskbar_min_distance);
|
||||
mDragElevation = res.getDimensionPixelSize(R.dimen.dragged_bubble_elevation);
|
||||
mTaskbarTranslationDelta = getBubbleBarTranslationDeltaForTaskbar(activity);
|
||||
if (DeviceConfig.isSmallTablet(mActivity)) {
|
||||
mBubbleBarDropTargetSize = res.getDimensionPixelSize(com.android.wm.shell.R.dimen.drag_zone_bubble_fold);
|
||||
} else {
|
||||
mBubbleBarDropTargetSize = res.getDimensionPixelSize(com.android.wm.shell.R.dimen.drag_zone_bubble_tablet);
|
||||
}
|
||||
mBubbleBarLeftDropTarget = new BubbleBarLocationDropTarget(BubbleBarLocation.LEFT,
|
||||
mDragListener);
|
||||
mBubbleBarRightDropTarget = new BubbleBarLocationDropTarget(BubbleBarLocation.RIGHT,
|
||||
mDragListener);
|
||||
}
|
||||
|
||||
/** Initializes controller. */
|
||||
@@ -270,7 +196,7 @@ public class BubbleBarViewController {
|
||||
if (!mBubbleStashController.isTransientTaskBar()) {
|
||||
// TODO(b/380274085) for transient taskbar mode, the click is also handled by the input
|
||||
// consumer. This check can be removed once b/380274085 is fixed.
|
||||
mBarView.setOnClickListener(v -> setExpanded(!mBarView.isExpanded()));
|
||||
mBarView.setOnClickListener(v -> animateExpanded(!mBarView.isExpanded()));
|
||||
}
|
||||
mBarView.addOnLayoutChangeListener(
|
||||
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
|
||||
@@ -286,7 +212,7 @@ public class BubbleBarViewController {
|
||||
mBarView.setController(new BubbleBarView.Controller() {
|
||||
@Override
|
||||
public float getBubbleBarTranslationY() {
|
||||
return mBubbleStashController.getBubbleBarTranslationY();
|
||||
return mBubbleStashController.getTargetTranslationYForState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -298,7 +224,7 @@ public class BubbleBarViewController {
|
||||
|
||||
@Override
|
||||
public void expandBubbleBar() {
|
||||
BubbleBarViewController.this.setExpanded(
|
||||
BubbleBarViewController.this.animateExpanded(
|
||||
/* isExpanded= */ true, /* maybeShowEdu*/ true);
|
||||
}
|
||||
|
||||
@@ -317,6 +243,14 @@ public class BubbleBarViewController {
|
||||
public void setIsDragging(boolean dragging) {
|
||||
mBubbleBarContainer.setElevation(dragging ? mDragElevation : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBubbleBarExpandedStateChanged(boolean expanded) {
|
||||
if (expanded && !mTaskbarStashController.isStashed()) {
|
||||
mTaskbarStashController.updateAndAnimateTransientTaskbar(true /* stash */,
|
||||
false /* shouldBubblesFollow */);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mBubbleViewController = new BubbleView.Controller() {
|
||||
@@ -346,18 +280,6 @@ public class BubbleBarViewController {
|
||||
};
|
||||
}
|
||||
|
||||
/** Adds bubble bar locations drop zones to the drag controller. */
|
||||
public void addBubbleBarDropTargets(DragController<?> dragController) {
|
||||
dragController.addDropTarget(mBubbleBarLeftDropTarget);
|
||||
dragController.addDropTarget(mBubbleBarRightDropTarget);
|
||||
}
|
||||
|
||||
/** Removes bubble bar locations drop zones to the drag controller. */
|
||||
public void removeBubbleBarDropTargets(DragController<?> dragController) {
|
||||
dragController.removeDropTarget(mBubbleBarLeftDropTarget);
|
||||
dragController.removeDropTarget(mBubbleBarRightDropTarget);
|
||||
}
|
||||
|
||||
/** Returns animated float property responsible for pinning transition animation. */
|
||||
public AnimatedFloat getBubbleBarPinning() {
|
||||
return mBubbleBarPinning;
|
||||
@@ -424,7 +346,7 @@ public class BubbleBarViewController {
|
||||
@Override
|
||||
public void flyoutClicked() {
|
||||
interruptAnimationForTouch();
|
||||
setExpanded(/* isExpanded= */ true, /* maybeShowEdu*/ true);
|
||||
animateExpanded(/* isExpanded= */ true, /* maybeShowEdu*/ true);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -438,6 +360,11 @@ public class BubbleBarViewController {
|
||||
};
|
||||
}
|
||||
|
||||
/** Returns the overflow bubble. */
|
||||
public BubbleBarOverflow getOverflowBubble() {
|
||||
return mOverflowBubble;
|
||||
}
|
||||
|
||||
private void onBubbleClicked(BubbleView bubbleView) {
|
||||
if (mBubbleBarPinning.isAnimating()) return;
|
||||
bubbleView.markSeen();
|
||||
@@ -462,7 +389,7 @@ public class BubbleBarViewController {
|
||||
}
|
||||
|
||||
private void collapseBubbleBar() {
|
||||
setExpanded(false);
|
||||
animateExpanded(false);
|
||||
mBubbleStashController.stashBubbleBar();
|
||||
}
|
||||
|
||||
@@ -637,6 +564,12 @@ public class BubbleBarViewController {
|
||||
return mBarView.isShowingDropTarget();
|
||||
}
|
||||
|
||||
/** Tells bubble bar view if it should show the drop target. */
|
||||
public void setShowingDropTarget(boolean showingDropTarget) {
|
||||
mBarView.showDropTarget(showingDropTarget);
|
||||
}
|
||||
|
||||
//TODO(b/411505605) remove unused IPC calls and code
|
||||
/**
|
||||
* Notifies the controller that a drag event is over the Bubble Bar drop zone. The controller
|
||||
* will display the appropriate drop target and enter drop target mode. The controller will also
|
||||
@@ -732,7 +665,8 @@ public class BubbleBarViewController {
|
||||
public boolean isEventOverBubbleBar(MotionEvent event) {
|
||||
if (!isBubbleBarVisible()) return false;
|
||||
final Rect bounds = getBubbleBarBounds();
|
||||
final int bubbleBarTopOnScreen = mBarView.getRestingTopPositionOnScreen();
|
||||
final int bubbleBarTopOnScreen =
|
||||
mActivity.getScreenSize().y - mBarView.getTopToScreenBottom();
|
||||
final float x = event.getX();
|
||||
return event.getRawY() >= bubbleBarTopOnScreen && x >= bounds.left && x <= bounds.right;
|
||||
}
|
||||
@@ -807,7 +741,7 @@ public class BubbleBarViewController {
|
||||
if (hidden) {
|
||||
mBarView.dismiss(() -> {
|
||||
updateVisibilityForStateChange();
|
||||
mBarView.setExpanded(false);
|
||||
mBarView.animateExpanded(false);
|
||||
adjustTaskbarAndHotseatToBubbleBarState(/* isBubbleBarExpanded= */ false);
|
||||
mActivity.bubbleBarVisibilityChanged(/* isVisible= */ false);
|
||||
});
|
||||
@@ -930,7 +864,7 @@ public class BubbleBarViewController {
|
||||
float mediumIconSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
||||
APP_ICON_MEDIUM_DP, dm);
|
||||
float smallMediumThreshold = (smallIconSize + mediumIconSize) / 2f;
|
||||
int taskbarIconSize = deviceProfile.taskbarIconSize;
|
||||
int taskbarIconSize = deviceProfile.getTaskbarProfile().getIconSize();
|
||||
return taskbarIconSize <= smallMediumThreshold
|
||||
? res.getDimensionPixelSize(R.dimen.bubblebar_icon_size_small) :
|
||||
res.getDimensionPixelSize(R.dimen.bubblebar_icon_size);
|
||||
@@ -948,7 +882,7 @@ public class BubbleBarViewController {
|
||||
float largeIconSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
||||
APP_ICON_LARGE_DP, dm);
|
||||
float mediumLargeThreshold = (mediumIconSize + largeIconSize) / 2f;
|
||||
return deviceProfile.taskbarIconSize >= mediumLargeThreshold
|
||||
return deviceProfile.getTaskbarProfile().getIconSize() >= mediumLargeThreshold
|
||||
? res.getDimensionPixelSize(R.dimen.bubblebar_icon_spacing_large) :
|
||||
res.getDimensionPixelSize(R.dimen.bubblebar_icon_spacing);
|
||||
}
|
||||
@@ -1025,9 +959,11 @@ public class BubbleBarViewController {
|
||||
int persistentSpacingSize = res
|
||||
.getDimensionPixelSize(R.dimen.bubblebar_icon_spacing_persistent_taskbar);
|
||||
int persistentBubbleBarSize = persistentBubbleSize + persistentSpacingSize * 2;
|
||||
int persistentTaskbarHeight = activity.getPersistentTaskbarDeviceProfile().taskbarHeight;
|
||||
int persistentTaskbarHeight =
|
||||
activity.getPersistentTaskbarDeviceProfile().getTaskbarProfile().getHeight();
|
||||
int persistentBubbleBarY = (persistentTaskbarHeight - persistentBubbleBarSize) / 2;
|
||||
int transientBubbleBarY = activity.getTransientTaskbarDeviceProfile().taskbarBottomMargin;
|
||||
int transientBubbleBarY =
|
||||
activity.getTransientTaskbarDeviceProfile().getTaskbarProfile().getBottomMargin();
|
||||
return transientBubbleBarY - persistentBubbleBarY;
|
||||
}
|
||||
|
||||
@@ -1101,7 +1037,7 @@ public class BubbleBarViewController {
|
||||
if (mOverflowAdded == showOverflow) return;
|
||||
mOverflowAdded = showOverflow;
|
||||
if (mOverflowAdded) {
|
||||
mBarView.addBubble(mOverflowBubble.getView());
|
||||
mBarView.addBubble(mOverflowBubble.getView(), /* suppressAnimation= */ true);
|
||||
mOverflowBubble.getView().setOnClickListener(mBubbleClickListener);
|
||||
mOverflowBubble.getView().setController(mBubbleViewController);
|
||||
} else {
|
||||
@@ -1148,10 +1084,7 @@ public class BubbleBarViewController {
|
||||
if (b != null) {
|
||||
BubbleView bubbleToSelectView =
|
||||
bubbleToSelect == null ? null : bubbleToSelect.getView();
|
||||
mBarView.addBubble(b.getView(), bubbleToSelectView);
|
||||
b.getView().setOnClickListener(mBubbleClickListener);
|
||||
mBubbleDragController.setupBubbleView(b.getView());
|
||||
b.getView().setController(mBubbleViewController);
|
||||
addBubbleView(b.getView(), suppressAnimation, bubbleToSelectView);
|
||||
|
||||
if (suppressAnimation || !(b instanceof BubbleBarBubble bubble)) {
|
||||
// the bubble bar and handle are initialized as part of the first bubble animation.
|
||||
@@ -1159,7 +1092,8 @@ public class BubbleBarViewController {
|
||||
// ensure they've been initialized.
|
||||
if (mTaskbarStashController.isInApp()
|
||||
&& mBubbleStashController.isTransientTaskBar()
|
||||
&& mTaskbarStashController.isStashed()) {
|
||||
&& mTaskbarStashController.isStashed()
|
||||
&& !isExpanded()) {
|
||||
mBubbleStashController.stashBubbleBarImmediate();
|
||||
} else {
|
||||
mBubbleStashController.showBubbleBarImmediate();
|
||||
@@ -1172,6 +1106,21 @@ public class BubbleBarViewController {
|
||||
}
|
||||
}
|
||||
|
||||
private void addBubbleView(BubbleView bubbleView, boolean suppressAnimation,
|
||||
BubbleView selectedBubbleView) {
|
||||
mBarView.addBubble(bubbleView, selectedBubbleView, suppressAnimation);
|
||||
bubbleView.setOnClickListener(mBubbleClickListener);
|
||||
mBubbleDragController.setupBubbleView(bubbleView);
|
||||
bubbleView.setController(mBubbleViewController);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore a previous bubble that is stored in {@link TaskbarSharedState}.
|
||||
*/
|
||||
public void restoreBubble(BubbleBarItem b) {
|
||||
addBubbleView(b.getView(), /* suppressAnimation= */ true, /* bubbleToSelectView= */ null);
|
||||
}
|
||||
|
||||
/** Animates the bubble bar to notify the user about a bubble change. */
|
||||
public void animateBubbleNotification(BubbleBarBubble bubble, boolean isExpanding,
|
||||
boolean isUpdate) {
|
||||
@@ -1225,34 +1174,32 @@ public class BubbleBarViewController {
|
||||
mBarView.setSelectedBubble(newlySelected.getView());
|
||||
}
|
||||
|
||||
/** @see #setExpanded(boolean, boolean) */
|
||||
public void setExpanded(boolean isExpanded) {
|
||||
setExpanded(isExpanded, /* maybeShowEdu= */ false);
|
||||
/** @see #animateExpanded(boolean, boolean) */
|
||||
public void animateExpanded(boolean isExpanded) {
|
||||
animateExpanded(isExpanded, /* maybeShowEdu= */ false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the bubble bar should be expanded (not unstashed, but have the contents
|
||||
* within it expanded). This method notifies SystemUI that the bubble bar is expanded and
|
||||
* showing a selected bubble. This method should ONLY be called from UI events originating
|
||||
* from Launcher.
|
||||
* Sets whether the bubble bar should be animated to expanded state (not unstashed, but have
|
||||
* the contents within it expanded). This method notifies SystemUI that the bubble bar is
|
||||
* expanded and showing a selected bubble. This method should ONLY be called from UI events
|
||||
* originating from Launcher.
|
||||
*
|
||||
* @param isExpanded whether the bar should be expanded
|
||||
* @param maybeShowEdu whether we should show the edu view before expanding
|
||||
*/
|
||||
public void setExpanded(boolean isExpanded, boolean maybeShowEdu) {
|
||||
public void animateExpanded(boolean isExpanded, boolean maybeShowEdu) {
|
||||
// if we're trying to expand try showing the edu view instead
|
||||
if (maybeShowEdu && isExpanded && !mBarView.isExpanded() && maybeShowEduView()) {
|
||||
return;
|
||||
}
|
||||
if (!mBubbleBarPinning.isAnimating() && isExpanded != mBarView.isExpanded()) {
|
||||
mBarView.setExpanded(isExpanded);
|
||||
mBarView.animateExpanded(isExpanded);
|
||||
adjustTaskbarAndHotseatToBubbleBarState(isExpanded);
|
||||
if (!isExpanded) {
|
||||
mSystemUiProxy.collapseBubbles();
|
||||
} else {
|
||||
mBubbleBarController.showSelectedBubble();
|
||||
mTaskbarStashController.updateAndAnimateTransientTaskbar(true /* stash */,
|
||||
false /* shouldBubblesFollow */);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1291,15 +1238,25 @@ public class BubbleBarViewController {
|
||||
* Sets whether the bubble bar should be expanded. This method is used in response to UI events
|
||||
* from SystemUI.
|
||||
*/
|
||||
public void setExpandedFromSysui(boolean isExpanded) {
|
||||
public void setExpandedFromSysui(boolean isExpanded, boolean animate) {
|
||||
if (isNewBubbleAnimationRunningOrPending() && isExpanded) {
|
||||
mBubbleBarViewAnimator.expandedWhileAnimating();
|
||||
return;
|
||||
}
|
||||
if (!isExpanded) {
|
||||
mBubbleStashController.stashBubbleBar();
|
||||
if (animate) {
|
||||
if (!isExpanded) {
|
||||
mBubbleStashController.stashBubbleBar();
|
||||
} else {
|
||||
mBubbleStashController.showBubbleBar(true /* expand the bubbles */);
|
||||
}
|
||||
} else {
|
||||
mBubbleStashController.showBubbleBar(true /* expand the bubbles */);
|
||||
if (!isExpanded) {
|
||||
mBubbleStashController.stashBubbleBarImmediate();
|
||||
} else {
|
||||
mBubbleStashController.showBubbleBarImmediate();
|
||||
mBarView.setExpanded(true);
|
||||
adjustTaskbarAndHotseatToBubbleBarState(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1329,7 +1286,7 @@ public class BubbleBarViewController {
|
||||
* Notifies SystemUI to expand the selected bubble when the bubble is released.
|
||||
*/
|
||||
public void onBubbleDragRelease(BubbleBarLocation location) {
|
||||
mSystemUiProxy.stopBubbleDrag(location, mBarView.getRestingTopPositionOnScreen());
|
||||
mSystemUiProxy.stopBubbleDrag(location, mBarView.getTopToScreenBottom());
|
||||
}
|
||||
|
||||
/** Handle given bubble being dismissed */
|
||||
|
||||
@@ -27,6 +27,8 @@ import com.android.launcher3.taskbar.bubbles.stashing.BubbleBarLocationOnDemandL
|
||||
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController;
|
||||
import com.android.launcher3.util.MultiPropertyFactory;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.wm.shell.shared.bubbles.DragZoneFactory;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Optional;
|
||||
@@ -44,6 +46,7 @@ public class BubbleControllers {
|
||||
public final BubblePinController bubblePinController;
|
||||
public final Optional<BubbleBarSwipeController> bubbleBarSwipeController;
|
||||
public final BubbleCreator bubbleCreator;
|
||||
public final DragToBubbleController dragToBubbleController;
|
||||
|
||||
private final RunnableList mPostInitRunnables = new RunnableList();
|
||||
|
||||
@@ -62,6 +65,7 @@ public class BubbleControllers {
|
||||
BubbleBarPinController bubbleBarPinController,
|
||||
BubblePinController bubblePinController,
|
||||
Optional<BubbleBarSwipeController> bubbleBarSwipeController,
|
||||
DragToBubbleController dragToBubbleController,
|
||||
BubbleCreator bubbleCreator) {
|
||||
this.bubbleBarController = bubbleBarController;
|
||||
this.bubbleBarViewController = bubbleBarViewController;
|
||||
@@ -73,6 +77,7 @@ public class BubbleControllers {
|
||||
this.bubblePinController = bubblePinController;
|
||||
this.bubbleBarSwipeController = bubbleBarSwipeController;
|
||||
this.bubbleCreator = bubbleCreator;
|
||||
this.dragToBubbleController = dragToBubbleController;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,12 +120,30 @@ public class BubbleControllers {
|
||||
.get(ALPHA_INDEX_BUBBLE_BAR);
|
||||
}
|
||||
});
|
||||
bubbleDragController.init(/* bubbleControllers = */ this);
|
||||
bubbleDragController.init(/* bubbleControllers = */ this, bubbleBarLocationListeners);
|
||||
bubbleDismissController.init(/* bubbleControllers = */ this);
|
||||
bubbleBarPinController.init(this, bubbleBarLocationListeners);
|
||||
bubblePinController.init(this);
|
||||
bubbleBarSwipeController.ifPresent(c -> c.init(this));
|
||||
dragToBubbleController.init(bubbleBarViewController,
|
||||
new DragZoneFactory.BubbleBarPropertiesProvider() {
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return (int) bubbleBarViewController.getBubbleBarCollapsedHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return (int) bubbleBarViewController.getBubbleBarCollapsedWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBottomPadding() {
|
||||
return -(int) bubbleStashController.getBubbleBarTranslationY();
|
||||
}
|
||||
},
|
||||
bubbleBarLocationListeners,
|
||||
SystemUiProxy.INSTANCE.get(taskbarControllers.taskbarActivityContext));
|
||||
mPostInitRunnables.executeAllAndDestroy();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
package com.android.launcher3.taskbar.bubbles
|
||||
|
||||
import com.android.launcher3.R
|
||||
import com.android.wm.shell.R as SharedR
|
||||
import com.android.wm.shell.R as SharedR // WM and WMShared are "shared" or linked together.
|
||||
import com.android.wm.shell.shared.bubbles.DismissView
|
||||
|
||||
/**
|
||||
@@ -39,6 +39,7 @@ fun DismissView.setup() {
|
||||
floatingGradientColorResId = android.R.color.system_neutral1_900,
|
||||
backgroundResId = SharedR.drawable.floating_dismiss_background,
|
||||
iconResId = SharedR.drawable.floating_dismiss_ic_close,
|
||||
applyMarginOverNavBarInset = false,
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -30,12 +30,14 @@ import androidx.annotation.Nullable;
|
||||
import androidx.dynamicanimation.animation.FloatPropertyCompat;
|
||||
|
||||
import com.android.launcher3.taskbar.TaskbarActivityContext;
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarController.BubbleBarLocationListener;
|
||||
import com.android.wm.shell.shared.bubbles.BaseBubblePinController.LocationChangeListener;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleAnythingFlagHelper;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
|
||||
import com.android.wm.shell.shared.bubbles.DeviceConfig;
|
||||
import com.android.wm.shell.shared.bubbles.DragZone;
|
||||
import com.android.wm.shell.shared.bubbles.DragZoneFactory;
|
||||
import com.android.wm.shell.shared.bubbles.DragZoneFactory.BubbleBarPropertiesProvider;
|
||||
import com.android.wm.shell.shared.bubbles.DragZoneFactory.DesktopWindowModeChecker;
|
||||
import com.android.wm.shell.shared.bubbles.DragZoneFactory.SplitScreenModeChecker;
|
||||
import com.android.wm.shell.shared.bubbles.DraggedObject;
|
||||
@@ -88,6 +90,7 @@ public class BubbleDragController {
|
||||
private BubbleDismissController mBubbleDismissController;
|
||||
private BubbleBarPinController mBubbleBarPinController;
|
||||
private BubblePinController mBubblePinController;
|
||||
private BubbleBarLocationListener mBubbleBarLocationListener;
|
||||
private final DropTargetManager mDropTargetManager;
|
||||
private final DragZoneFactory mDragZoneFactory;
|
||||
private final BubbleDragZoneChangedListener mBubbleDragZoneChangedListener;
|
||||
@@ -113,8 +116,25 @@ public class BubbleDragController {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
BubbleBarPropertiesProvider bubbleBarPropertiesProvider =
|
||||
new BubbleBarPropertiesProvider() {
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return (int) mBubbleBarViewController.getBubbleBarCollapsedHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return (int) mBubbleBarViewController.getBubbleBarCollapsedWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBottomPadding() {
|
||||
return (int) -mBubbleBarViewController.getBubbleBarTranslationY().value;
|
||||
}
|
||||
};
|
||||
mDragZoneFactory = new DragZoneFactory(mActivity.getApplicationContext(), deviceConfig,
|
||||
splitScreenModeChecker, desktopWindowModeChecker);
|
||||
splitScreenModeChecker, desktopWindowModeChecker, bubbleBarPropertiesProvider);
|
||||
mBubbleDragZoneChangedListener = new BubbleDragZoneChangedListener();
|
||||
mDropTargetManager = new DropTargetManager(mActivity.getApplicationContext(),
|
||||
dropTargetParent, mBubbleDragZoneChangedListener);
|
||||
@@ -125,12 +145,14 @@ public class BubbleDragController {
|
||||
* Should be careful to only access things that were created in constructors for now, as some
|
||||
* controllers may still be waiting for init().
|
||||
*/
|
||||
public void init(@NonNull BubbleControllers bubbleControllers) {
|
||||
public void init(@NonNull BubbleControllers bubbleControllers,
|
||||
BubbleBarLocationListener bubbleBarLocationListener) {
|
||||
mBubbleBarController = bubbleControllers.bubbleBarController;
|
||||
mBubbleBarViewController = bubbleControllers.bubbleBarViewController;
|
||||
mBubbleDismissController = bubbleControllers.bubbleDismissController;
|
||||
mBubbleBarPinController = bubbleControllers.bubbleBarPinController;
|
||||
mBubblePinController = bubbleControllers.bubblePinController;
|
||||
mBubbleBarLocationListener = bubbleBarLocationListener;
|
||||
mBubbleDismissController.setListener(
|
||||
stuck -> {
|
||||
if (stuck) {
|
||||
@@ -194,9 +216,7 @@ public class BubbleDragController {
|
||||
protected void onDragUpdate(float x, float y, float newTx, float newTy) {
|
||||
bubbleView.setDragTranslationX(newTx);
|
||||
bubbleView.setTranslationY(newTy);
|
||||
if (BubbleAnythingFlagHelper.enableBubbleToFullscreen()) {
|
||||
mDropTargetManager.onDragUpdated((int) x, (int) y);
|
||||
} else {
|
||||
if (!BubbleAnythingFlagHelper.enableBubbleToFullscreen()) {
|
||||
mBubblePinController.onDragUpdate(x, y);
|
||||
}
|
||||
}
|
||||
@@ -305,9 +325,7 @@ public class BubbleDragController {
|
||||
protected void onDragUpdate(float x, float y, float newTx, float newTy) {
|
||||
bubbleBarView.setTranslationX(newTx);
|
||||
bubbleBarView.setTranslationY(newTy);
|
||||
if (BubbleAnythingFlagHelper.enableBubbleToFullscreen()) {
|
||||
mDropTargetManager.onDragUpdated((int) x, (int) y);
|
||||
} else {
|
||||
if (!BubbleAnythingFlagHelper.enableBubbleToFullscreen()) {
|
||||
mBubbleBarPinController.onDragUpdate(x, y);
|
||||
}
|
||||
}
|
||||
@@ -570,7 +588,17 @@ public class BubbleDragController {
|
||||
|
||||
private void drag(@NonNull View view, @NonNull MotionEvent event, float dx, float dy,
|
||||
float x, float y) {
|
||||
if (mBubbleDismissController.handleTouchEvent(event)) return;
|
||||
if (BubbleAnythingFlagHelper.enableBubbleToFullscreen()) {
|
||||
// notify drop target manager about the new drag location regardless of whether we
|
||||
// are in the dismiss zone so that it can keep track of the current zone and update
|
||||
// the drop target view
|
||||
mDropTargetManager.onDragUpdated((int) x, (int) y);
|
||||
}
|
||||
if (mBubbleDismissController.handleTouchEvent(event)) {
|
||||
// if we're dragging within the dismiss target, return immediately; the dragged
|
||||
// object is manipulated by the dismiss target
|
||||
return;
|
||||
}
|
||||
final float newTx = mViewInitialPosition.x + dx;
|
||||
final float newTy = mViewInitialPosition.y + dy;
|
||||
onDragUpdate(x, y, newTx, newTy);
|
||||
@@ -598,7 +626,7 @@ public class BubbleDragController {
|
||||
}
|
||||
} else {
|
||||
mAnimator.animateToRestingState(getRestingPosition(), getCurrentVelocity(),
|
||||
onComplete);
|
||||
onComplete);
|
||||
}
|
||||
}
|
||||
mBubbleDismissController.hideDismissView();
|
||||
@@ -650,7 +678,7 @@ public class BubbleDragController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitialDragZoneSet(@NonNull DragZone dragZone) {
|
||||
public void onInitialDragZoneSet(@Nullable DragZone dragZone) {
|
||||
mDragZone = dragZone;
|
||||
if (dragZone instanceof DragZone.Bubble.Left) {
|
||||
mBubbleBarLocation = BubbleBarLocation.LEFT;
|
||||
@@ -660,25 +688,31 @@ public class BubbleDragController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDragZoneChanged(@NonNull DraggedObject draggedObject, @NonNull DragZone from,
|
||||
@NonNull DragZone to) {
|
||||
public void onDragZoneChanged(@NonNull DraggedObject draggedObject, @Nullable DragZone from,
|
||||
@Nullable DragZone to) {
|
||||
mDragZone = to;
|
||||
if (to instanceof DragZone.Bubble.Left
|
||||
&& mBubbleBarLocation != BubbleBarLocation.LEFT) {
|
||||
if (draggedObject instanceof DraggedObject.Bubble) {
|
||||
// listener will be notified by BubbleBarController
|
||||
mBubbleBarController.animateBubbleBarLocation(BubbleBarLocation.LEFT);
|
||||
} else {
|
||||
// otherwise notify listener manually
|
||||
mBubbleBarLocationListener.onBubbleBarLocationAnimated(BubbleBarLocation.LEFT);
|
||||
}
|
||||
mBubbleBarLocation = BubbleBarLocation.LEFT;
|
||||
} else if (to instanceof DragZone.Bubble.Right
|
||||
&& mBubbleBarLocation != BubbleBarLocation.RIGHT) {
|
||||
if (draggedObject instanceof DraggedObject.Bubble) {
|
||||
mBubbleBarController.animateBubbleBarLocation(BubbleBarLocation.RIGHT);
|
||||
} else {
|
||||
mBubbleBarLocationListener.onBubbleBarLocationAnimated(BubbleBarLocation.RIGHT);
|
||||
}
|
||||
mBubbleBarLocation = BubbleBarLocation.RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDragEnded(@NonNull DragZone zone) {}
|
||||
public void onDragEnded(@Nullable DragZone zone) {}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -85,7 +85,6 @@ public class BubbleStashedHandleViewController {
|
||||
mActivity = activity;
|
||||
mStashedHandleView = stashedHandleView;
|
||||
mStashedHandleAlpha = new MultiValueAlpha(mStashedHandleView, 1);
|
||||
mStashedHandleAlpha.setUpdateVisibility(true);
|
||||
}
|
||||
|
||||
/** Initialize controller. */
|
||||
@@ -105,7 +104,7 @@ public class BubbleStashedHandleViewController {
|
||||
// Use values directly from device profile to avoid referencing other bubble controllers
|
||||
// during init flow.
|
||||
int maxTy = Math.max(deviceProfile.hotseatBarBottomSpacePx,
|
||||
deviceProfile.taskbarBottomMargin);
|
||||
deviceProfile.getTaskbarProfile().getBottomMargin());
|
||||
// Adjust handle view size to accommodate the handle morphing into the bubble bar
|
||||
mStashedHandleView.getLayoutParams().height = barSize + maxTy;
|
||||
|
||||
@@ -349,7 +348,7 @@ public class BubbleStashedHandleViewController {
|
||||
|
||||
// the bounds of the handle only include the visible part, so we check that the Y coordinate
|
||||
// is anywhere within the stashed height of bubble bar (same as taskbar stashed height).
|
||||
final int top = mActivity.getDeviceProfile().heightPx - mStashedBubbleBarHeight;
|
||||
final int top = mActivity.getDeviceProfile().getDeviceProperties().getHeightPx() - mStashedBubbleBarHeight;
|
||||
final float x = ev.getRawX();
|
||||
return ev.getRawY() >= top && x >= mStashedHandleBounds.left
|
||||
&& x <= mStashedHandleBounds.right;
|
||||
|
||||
+1
-1
@@ -728,7 +728,7 @@ constructor(
|
||||
}
|
||||
|
||||
private fun expandBubbleBar() {
|
||||
bubbleBarView.isExpanded = true
|
||||
bubbleBarView.animateExpanded(true)
|
||||
onExpanded.run()
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -64,6 +64,7 @@ constructor(
|
||||
}
|
||||
|
||||
fun setUpAndShowFlyout(message: BubbleBarFlyoutMessage, onInit: () -> Unit, onEnd: () -> Unit) {
|
||||
animator?.cancel()
|
||||
flyout?.let(container::removeView)
|
||||
val flyout = BubbleBarFlyoutView(container.context, positioner, flyoutScheduler)
|
||||
|
||||
|
||||
+6
-4
@@ -186,12 +186,14 @@ interface BubbleStashController {
|
||||
fun getHandleViewAlpha(): MultiPropertyFactory<View>.MultiProperty? = null
|
||||
|
||||
/**
|
||||
* Returns bubble bar Y position according to [isBubblesShowingOnHome] and
|
||||
* [isBubblesShowingOnOverview] values. Default implementation only analyse
|
||||
* [isBubblesShowingOnHome] and return translationY to align with the hotseat vertical center.
|
||||
* For Other cases align bubbles with the taskbar.
|
||||
* Default implementation only analyse [isBubblesShowingOnHome] and return value is equal to
|
||||
* [targetTranslationYForState].
|
||||
*/
|
||||
val bubbleBarTranslationY: Float
|
||||
get() = targetTranslationYForState
|
||||
|
||||
/** Returns bubble bar Y target position according to [isBubblesShowingOnHome] value. */
|
||||
val targetTranslationYForState: Float
|
||||
get() =
|
||||
if (isBubblesShowingOnHome) {
|
||||
bubbleBarTranslationYForHotseat
|
||||
|
||||
+2
-2
@@ -27,9 +27,9 @@ import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController.Task
|
||||
class DeviceProfileDimensionsProviderAdapter(
|
||||
private val taskbarActivityContext: TaskbarActivityContext
|
||||
) : TaskbarHotseatDimensionsProvider {
|
||||
override fun getTaskbarBottomSpace(): Int = taskbarDp().taskbarBottomMargin
|
||||
override fun getTaskbarBottomSpace(): Int = taskbarDp().taskbarProfile.bottomMargin
|
||||
|
||||
override fun getTaskbarHeight(): Int = taskbarDp().taskbarHeight
|
||||
override fun getTaskbarHeight(): Int = taskbarDp().taskbarProfile.height
|
||||
|
||||
private fun taskbarDp(): DeviceProfile = taskbarActivityContext.deviceProfile
|
||||
}
|
||||
+10
-2
@@ -60,6 +60,10 @@ class PersistentBubbleStashController(
|
||||
// if there are no bubbles, there's nothing to show, so just return.
|
||||
return
|
||||
}
|
||||
if (transitionFromHome && inAppDisplayOverrideProgress != 0f) {
|
||||
// was on -1 page and leaving it, - reset the inAppDisplayOverrideProgress
|
||||
inAppDisplayOverrideProgress = 0f
|
||||
}
|
||||
// If we're transitioning anywhere, bubble bar should be collapsed
|
||||
updateExpandedState(expand = false)
|
||||
if (transitionFromHome || field == BubbleLauncherState.HOME) {
|
||||
@@ -100,6 +104,10 @@ class PersistentBubbleStashController(
|
||||
return -bubbleBarVerticalCenterForHome + bubbleBarHeight / 2
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns bubble bar Y target position according to [isBubblesShowingOnHome] value. Value could
|
||||
* be adjusted to the display override progress.
|
||||
*/
|
||||
override val bubbleBarTranslationY: Float
|
||||
get() =
|
||||
if (inAppDisplayOverrideProgress > 0f && launcherState == BubbleLauncherState.HOME) {
|
||||
@@ -112,7 +120,7 @@ class PersistentBubbleStashController(
|
||||
Interpolators.LINEAR,
|
||||
)
|
||||
} else {
|
||||
super.bubbleBarTranslationY
|
||||
targetTranslationYForState
|
||||
}
|
||||
|
||||
override var inAppDisplayOverrideProgress: Float = 0f
|
||||
@@ -238,7 +246,7 @@ class PersistentBubbleStashController(
|
||||
}
|
||||
if (bubbleBarViewController.isExpanded != expand) {
|
||||
val maybeShowEdu = expand && bubbleBarGesture
|
||||
bubbleBarViewController.setExpanded(expand, maybeShowEdu)
|
||||
bubbleBarViewController.animateExpanded(expand, maybeShowEdu)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-3
@@ -115,7 +115,16 @@ class TransientBubbleStashController(
|
||||
}
|
||||
// Only stash if we're in an app, otherwise we're in home or overview where we should
|
||||
// be un-stashed
|
||||
updateStashedAndExpandedState(field == BubbleLauncherState.IN_APP, expand = false)
|
||||
val stash = field == BubbleLauncherState.IN_APP
|
||||
val expand =
|
||||
if (stash) {
|
||||
// Always collapse when we are stashing
|
||||
false
|
||||
} else {
|
||||
// If unstashing, keep the current state
|
||||
bubbleBarViewController.isExpanded
|
||||
}
|
||||
updateStashedAndExpandedState(stash, expand)
|
||||
}
|
||||
|
||||
override var isSysuiLocked: Boolean = false
|
||||
@@ -468,7 +477,7 @@ class TransientBubbleStashController(
|
||||
// reset stash translation
|
||||
translationYDuringStash.updateValue(0f)
|
||||
bubbleBarBubbleTranslationY.updateValue(0f)
|
||||
bubbleBarViewController.isExpanded = false
|
||||
bubbleBarViewController.animateExpanded(false)
|
||||
}
|
||||
taskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged()
|
||||
}
|
||||
@@ -556,6 +565,7 @@ class TransientBubbleStashController(
|
||||
) {
|
||||
if (bubbleBarViewController.isHiddenForNoBubbles) {
|
||||
// If there are no bubbles the bar and handle are invisible, nothing to do here.
|
||||
cancelAnimation()
|
||||
return
|
||||
}
|
||||
val isStashed = stash && !isBubblesShowingOnHome && !isBubblesShowingOnOverview
|
||||
@@ -577,7 +587,7 @@ class TransientBubbleStashController(
|
||||
}
|
||||
if (bubbleBarViewController.isExpanded != expand) {
|
||||
val maybeShowEdu = expand && bubbleBarGesture
|
||||
bubbleBarViewController.setExpanded(expand, maybeShowEdu)
|
||||
bubbleBarViewController.animateExpanded(expand, maybeShowEdu)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+26
-12
@@ -49,11 +49,15 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
private var allAppsTouchTriggered = false
|
||||
private var allAppsTouchRunnable: Runnable? = null
|
||||
private var allAppsButtonTouchDelayMs: Long = ViewConfiguration.getLongPressTimeout().toLong()
|
||||
private var isTaskbarInMinimalState = false
|
||||
private lateinit var taskbarViewCallbacks: TaskbarViewCallbacks
|
||||
|
||||
override val spaceNeeded: Int
|
||||
get() {
|
||||
return dpToPx(activityContext.taskbarSpecsEvaluator.taskbarIconSize.size.toFloat())
|
||||
return dpToPx(
|
||||
activityContext.taskbarSpecsEvaluator.taskbarIconSize.size.toFloat(),
|
||||
activityContext,
|
||||
)
|
||||
}
|
||||
|
||||
init {
|
||||
@@ -70,7 +74,12 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
backgroundTintList = ColorStateList.valueOf(TRANSPARENT)
|
||||
setIconDrawable(drawable)
|
||||
if (!activityContext.isTransientTaskbar) {
|
||||
setPadding(dpToPx(activityContext.taskbarSpecsEvaluator.taskbarIconPadding.toFloat()))
|
||||
setPadding(
|
||||
dpToPx(
|
||||
(activityContext.taskbarSpecsEvaluator.taskbarIconPadding).toFloat(),
|
||||
activityContext,
|
||||
)
|
||||
)
|
||||
}
|
||||
setForegroundTint(activityContext.getColor(R.color.all_apps_button_color))
|
||||
}
|
||||
@@ -102,29 +111,26 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
return getAllAppsButtonForExpressiveTheme()
|
||||
}
|
||||
val shouldSelectTransientIcon =
|
||||
isTransientTaskbar || (enableTaskbarPinning() && !activityContext.isThreeButtonNav)
|
||||
isTransientTaskbar ||
|
||||
(enableTaskbarPinning() &&
|
||||
activityContext.taskbarFeatureEvaluator.supportsTransitionToTransientTaskbar)
|
||||
return if (shouldSelectTransientIcon) R.drawable.ic_transient_taskbar_all_apps_search_button
|
||||
else R.drawable.ic_taskbar_all_apps_search_button
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
private fun getAllAppsButtonForExpressiveTheme(): Int {
|
||||
return R.drawable.ic_taskbar_all_apps_search_button_expressive_theme
|
||||
}
|
||||
|
||||
@DimenRes
|
||||
fun getAllAppsButtonTranslationXOffsetForExpressiveTheme(isTransientTaskbar: Boolean): Int {
|
||||
return if (isTransientTaskbar) {
|
||||
R.dimen.transient_taskbar_all_apps_button_translation_x_offset_for_expressive_theme
|
||||
return if (isTaskbarInMinimalState) {
|
||||
R.drawable.ic_taskbar_minimal_state_all_apps_search_button_expressive_theme
|
||||
} else {
|
||||
R.dimen.taskbar_all_apps_search_button_translation_x_offset_for_expressive_theme
|
||||
R.drawable.ic_taskbar_all_apps_search_button_expressive_theme
|
||||
}
|
||||
}
|
||||
|
||||
@DimenRes
|
||||
fun getAllAppsButtonTranslationXOffset(isTransientTaskbar: Boolean): Int {
|
||||
if (Flags.enableGsf()) {
|
||||
return getAllAppsButtonTranslationXOffsetForExpressiveTheme(isTransientTaskbar)
|
||||
return R.dimen.taskbar_all_apps_search_button_translation_x_offset_for_expressive_theme
|
||||
}
|
||||
return if (isTransientTaskbar) {
|
||||
R.dimen.transient_taskbar_all_apps_button_translation_x_offset
|
||||
@@ -133,6 +139,14 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
}
|
||||
}
|
||||
|
||||
/** Taskbar minimal state is that taskbar does not host anything other than all apps button. */
|
||||
fun updateTaskbarMinimalState(isInMinimalState: Boolean) {
|
||||
if (isTaskbarInMinimalState != isInMinimalState) {
|
||||
isTaskbarInMinimalState = isInMinimalState
|
||||
setUpIcon()
|
||||
}
|
||||
}
|
||||
|
||||
private fun onAllAppsButtonTouch(view: View, ev: MotionEvent): Boolean {
|
||||
when (ev.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
|
||||
+13
-5
@@ -40,7 +40,10 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
|
||||
override val spaceNeeded: Int
|
||||
get() {
|
||||
return dpToPx(activityContext.taskbarSpecsEvaluator.taskbarIconSize.size.toFloat())
|
||||
return dpToPx(
|
||||
activityContext.taskbarSpecsEvaluator.taskbarIconSize.size.toFloat(),
|
||||
activityContext,
|
||||
)
|
||||
}
|
||||
|
||||
init {
|
||||
@@ -53,7 +56,12 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
val drawable = getTaskbarDividerIcon()
|
||||
setIconDrawable(drawable)
|
||||
if (!activityContext.isTransientTaskbar) {
|
||||
setPadding(dpToPx(activityContext.taskbarSpecsEvaluator.taskbarIconPadding.toFloat()))
|
||||
setPadding(
|
||||
dpToPx(
|
||||
activityContext.taskbarSpecsEvaluator.taskbarIconPadding.toFloat(),
|
||||
activityContext,
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,8 +75,8 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
fun setUpCallbacks(callbacks: TaskbarViewCallbacks) {
|
||||
setOnLongClickListener(callbacks.taskbarDividerLongClickListener)
|
||||
setOnTouchListener(callbacks.taskbarDividerRightClickListener)
|
||||
fun setUpCallbacks(callbacks: TaskbarViewCallbacks?) {
|
||||
setOnLongClickListener(callbacks?.taskbarDividerLongClickListener)
|
||||
setOnTouchListener(callbacks?.taskbarDividerRightClickListener)
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -38,11 +38,17 @@ private constructor(private val taskbarActivityContext: TaskbarActivityContext)
|
||||
get() = taskbarActivityContext.isTransientTaskbar
|
||||
|
||||
val isLandscape: Boolean
|
||||
get() = taskbarActivityContext.deviceProfile.isLandscape
|
||||
get() = taskbarActivityContext.deviceProfile.deviceProperties.isLandscape
|
||||
|
||||
val isTnMinimalState: Boolean
|
||||
get() = taskbarActivityContext.isTaskbarInMinimalState
|
||||
|
||||
val supportsPinningPopup: Boolean
|
||||
get() = !hasNavButtons
|
||||
|
||||
val supportsTransitionToTransientTaskbar: Boolean
|
||||
get() = !hasNavButtons && !taskbarActivityContext.showDesktopTaskbarForFreeformDisplay()
|
||||
|
||||
fun onDestroy() {
|
||||
taskbarFeatureEvaluator = null
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class TaskbarSpecsEvaluator(
|
||||
val taskbarIconPadding: Int =
|
||||
if (
|
||||
TaskbarIconSpecs.transientOrPinnedTaskbarIconPaddingSize.size > taskbarIconSize.size &&
|
||||
!taskbarFeatureEvaluator.hasNavButtons
|
||||
taskbarFeatureEvaluator.supportsTransitionToTransientTaskbar
|
||||
) {
|
||||
(TaskbarIconSpecs.iconSize52dp.size - taskbarIconSize.size) / 2
|
||||
} else {
|
||||
|
||||
@@ -16,15 +16,34 @@
|
||||
package com.android.launcher3.taskbar.growth
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||
import android.view.ViewGroup.MarginLayoutParams
|
||||
import android.view.accessibility.AccessibilityEvent
|
||||
import android.view.accessibility.AccessibilityNodeInfo
|
||||
import android.widget.Button
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import com.airbnb.lottie.LottieAnimationView
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.Utilities
|
||||
import com.android.launcher3.taskbar.TaskbarActivityContext
|
||||
import com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_GROWTH_NUDGE_OPEN
|
||||
import com.android.launcher3.taskbar.TaskbarControllers
|
||||
import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController
|
||||
import com.android.launcher3.util.DisplayController
|
||||
import com.android.launcher3.views.ActivityContext
|
||||
import com.android.quickstep.util.LottieAnimationColorUtils
|
||||
import java.io.PrintWriter
|
||||
|
||||
/** Controls nudge lifecycles. */
|
||||
/**
|
||||
* Controls nudge lifecycles.
|
||||
*
|
||||
* TODO: b/413718172 - Refactor to reduce code duplication with [TaskbarEduTooltipController].
|
||||
*/
|
||||
class NudgeController(context: Context) : LoggableTaskbarController {
|
||||
|
||||
protected val activityContext: TaskbarActivityContext = ActivityContext.lookupContext(context)
|
||||
@@ -36,26 +55,184 @@ class NudgeController(context: Context) : LoggableTaskbarController {
|
||||
!activityContext.isTinyTaskbar
|
||||
}
|
||||
|
||||
val isNudgeOpen: Boolean
|
||||
get() = nudgeView?.isOpen == true
|
||||
|
||||
private lateinit var controllers: TaskbarControllers
|
||||
|
||||
private var nudgeView: NudgeView? = null
|
||||
|
||||
fun init(controllers: TaskbarControllers) {
|
||||
this.controllers = controllers
|
||||
}
|
||||
|
||||
fun maybeShow(payload: NudgePayload) {
|
||||
if (!isNudgeEnabled || !DisplayController.isTransientTaskbar(activityContext)) {
|
||||
fun maybeShow(model: NudgePayload) {
|
||||
if (!isNudgeEnabled || !activityContext.isTransientTaskbar) {
|
||||
return
|
||||
}
|
||||
// TODO: b/398033012 - create and show nudge view based on the payload.
|
||||
|
||||
inflateNudgeContent(R.layout.growth_nudge)
|
||||
nudgeView?.run {
|
||||
allowTouchDismissal = false
|
||||
|
||||
fun updateButton(button: Button, buttonPayload: ButtonPayload?) {
|
||||
if (buttonPayload != null) {
|
||||
button.apply {
|
||||
text = buttonPayload.label
|
||||
setOnClickListener {
|
||||
ActionPerformers.performActions(
|
||||
/*actions=*/ buttonPayload.actions,
|
||||
/*context=*/ activityContext,
|
||||
/*dismissCallback=*/ ::hide,
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
button.visibility = GONE
|
||||
}
|
||||
}
|
||||
|
||||
fun updateImage(image: Image?) {
|
||||
val imageView = requireViewById<ImageView>(R.id.image_view)
|
||||
when (image) {
|
||||
is Image.ResourceId -> {
|
||||
imageView.setImageDrawable(context.getDrawable(image.resId))
|
||||
}
|
||||
null -> imageView.visibility = GONE
|
||||
}
|
||||
}
|
||||
|
||||
fun updateContent() {
|
||||
// Update content.
|
||||
val title = requireViewById<TextView>(R.id.title)
|
||||
title.text = model.titleText
|
||||
val body = requireViewById<TextView>(R.id.body)
|
||||
body.text = model.bodyText
|
||||
updateButton(requireViewById(R.id.primary_button), model.primaryButton)
|
||||
updateButton(requireViewById(R.id.secondary_button), model.secondaryButton)
|
||||
updateImage(model.image)
|
||||
}
|
||||
|
||||
fun updateLayout() {
|
||||
content.updateLayoutParams { width = MATCH_PARENT }
|
||||
val sideSpacing =
|
||||
resources.getDimensionPixelSize(R.dimen.nudge_default_position_side_spacing)
|
||||
updateLayoutParams<MarginLayoutParams> {
|
||||
if (Utilities.isRtl(context.getResources())) {
|
||||
rightMargin = sideSpacing
|
||||
} else {
|
||||
leftMargin = sideSpacing
|
||||
}
|
||||
width = resources.getDimensionPixelSize(R.dimen.nudge_width)
|
||||
}
|
||||
}
|
||||
|
||||
updateContent()
|
||||
updateLayout()
|
||||
show()
|
||||
}
|
||||
}
|
||||
|
||||
/** Closes the current [nudgeView]. */
|
||||
fun hide() {
|
||||
// TODO: b/398033012 - hide the nudge view.
|
||||
nudgeView?.close(true)
|
||||
}
|
||||
|
||||
/** Initializes [nudgeView] with content from [contentResId]. */
|
||||
private fun inflateNudgeContent(@LayoutRes contentResId: Int) {
|
||||
val overlayContext = controllers.taskbarOverlayController.requestWindow()
|
||||
val nudgeView =
|
||||
overlayContext.layoutInflater.inflate(
|
||||
R.layout.taskbar_nudge_container,
|
||||
overlayContext.dragLayer,
|
||||
false,
|
||||
) as NudgeView
|
||||
|
||||
controllers.taskbarAutohideSuspendController.updateFlag(
|
||||
FLAG_AUTOHIDE_SUSPEND_GROWTH_NUDGE_OPEN,
|
||||
true,
|
||||
)
|
||||
|
||||
nudgeView.onCloseCallback = {
|
||||
this.nudgeView = null
|
||||
controllers.taskbarAutohideSuspendController.updateFlag(
|
||||
FLAG_AUTOHIDE_SUSPEND_GROWTH_NUDGE_OPEN,
|
||||
false,
|
||||
)
|
||||
controllers.taskbarStashController.updateAndAnimateTransientTaskbar(true)
|
||||
}
|
||||
nudgeView.accessibilityDelegate = createAccessibilityDelegate()
|
||||
|
||||
overlayContext.layoutInflater.inflate(contentResId, nudgeView.content, true)
|
||||
this.nudgeView = nudgeView
|
||||
}
|
||||
|
||||
private fun createAccessibilityDelegate() =
|
||||
object : View.AccessibilityDelegate() {
|
||||
override fun performAccessibilityAction(
|
||||
host: View,
|
||||
action: Int,
|
||||
args: Bundle?,
|
||||
): Boolean {
|
||||
if (action == R.id.close) {
|
||||
hide()
|
||||
return true
|
||||
}
|
||||
return super.performAccessibilityAction(host, action, args)
|
||||
}
|
||||
|
||||
override fun onPopulateAccessibilityEvent(host: View, event: AccessibilityEvent) {
|
||||
super.onPopulateAccessibilityEvent(host, event)
|
||||
if (event.eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
|
||||
event.text.add(host.context?.getText(R.string.nudge_a11y_title))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onInitializeAccessibilityNodeInfo(
|
||||
host: View,
|
||||
info: AccessibilityNodeInfo,
|
||||
) {
|
||||
super.onInitializeAccessibilityNodeInfo(host, info)
|
||||
info.addAction(
|
||||
AccessibilityNodeInfo.AccessibilityAction(
|
||||
R.id.close,
|
||||
host.context?.getText(R.string.nudge_a11y_close),
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun dumpLogs(prefix: String?, pw: PrintWriter?) {
|
||||
pw?.println(prefix + "NudgeController:")
|
||||
pw?.println("$prefix\tisNudgeEnabled=$isNudgeEnabled")
|
||||
pw?.println("$prefix\tisOpen=$isNudgeOpen")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps colors in the dark-themed Lottie assets to their light-themed equivalents.
|
||||
*
|
||||
* For instance, `".blue100" to R.color.lottie_blue400` means objects that are material blue100 in
|
||||
* dark theme should be changed to material blue400 in light theme.
|
||||
*/
|
||||
private val DARK_TO_LIGHT_COLORS =
|
||||
mapOf(
|
||||
".blue100" to R.color.lottie_blue400,
|
||||
".blue400" to R.color.lottie_blue600,
|
||||
".green100" to R.color.lottie_green400,
|
||||
".green400" to R.color.lottie_green600,
|
||||
".grey300" to R.color.lottie_grey600,
|
||||
".grey400" to R.color.lottie_grey700,
|
||||
".grey800" to R.color.lottie_grey200,
|
||||
".red400" to R.color.lottie_red600,
|
||||
".yellow100" to R.color.lottie_yellow400,
|
||||
".yellow400" to R.color.lottie_yellow600,
|
||||
)
|
||||
|
||||
private fun LottieAnimationView.supportLightTheme() {
|
||||
if (Utilities.isDarkTheme(context)) {
|
||||
return
|
||||
}
|
||||
|
||||
LottieAnimationColorUtils.updateToColorResources(this, DARK_TO_LIGHT_COLORS, context.theme)
|
||||
}
|
||||
@@ -26,8 +26,6 @@ sealed interface Action {
|
||||
|
||||
sealed class Image {
|
||||
data class ResourceId(val resId: Int) : Image()
|
||||
|
||||
data class Url(val url: String) : Image()
|
||||
}
|
||||
|
||||
data class ButtonPayload(val label: String, val actions: List<Action>)
|
||||
|
||||
@@ -90,7 +90,7 @@ abstract class AbstractNavButtonLayoutter(
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_contextual_button_suw_margin)
|
||||
nearestTouchFrameLayoutParams.marginStart = phoneOrPortraitSetupMargin
|
||||
nearestTouchFrameLayoutParams.bottomMargin =
|
||||
if (!deviceProfile.isLandscape) 0
|
||||
if (!deviceProfile.deviceProperties.isLandscape) 0
|
||||
else
|
||||
phoneOrPortraitSetupMargin -
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size) / 2
|
||||
|
||||
@@ -90,7 +90,7 @@ class NavButtonLayoutFactory {
|
||||
)
|
||||
}
|
||||
isPhoneNavMode -> {
|
||||
if (!deviceProfile.isLandscape) {
|
||||
if (!deviceProfile.deviceProperties.isLandscape) {
|
||||
navButtonsView.setIsVertical(false)
|
||||
PhonePortraitNavLayoutter(
|
||||
resources,
|
||||
|
||||
+16
-9
@@ -25,6 +25,7 @@ import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.Space
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.Utilities
|
||||
import com.android.launcher3.taskbar.TaskbarActivityContext
|
||||
|
||||
open class PhoneLandscapeNavLayoutter(
|
||||
@@ -34,7 +35,7 @@ open class PhoneLandscapeNavLayoutter(
|
||||
startContextualContainer: ViewGroup,
|
||||
imeSwitcher: ImageView?,
|
||||
a11yButton: ImageView?,
|
||||
space: Space?
|
||||
space: Space?,
|
||||
) :
|
||||
AbstractNavButtonLayoutter(
|
||||
resources,
|
||||
@@ -43,11 +44,11 @@ open class PhoneLandscapeNavLayoutter(
|
||||
startContextualContainer,
|
||||
imeSwitcher,
|
||||
a11yButton,
|
||||
space
|
||||
space,
|
||||
) {
|
||||
|
||||
override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) {
|
||||
val totalHeight = context.deviceProfile.heightPx
|
||||
val totalHeight = context.deviceProfile.deviceProperties.heightPx
|
||||
val homeButtonHeight =
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_phone_home_button_size)
|
||||
val roundedCornerContentMargin =
|
||||
@@ -112,9 +113,15 @@ open class PhoneLandscapeNavLayoutter(
|
||||
|
||||
open fun addThreeButtons() {
|
||||
// Swap recents and back button
|
||||
navButtonContainer.addView(recentsButton)
|
||||
navButtonContainer.addView(homeButton)
|
||||
navButtonContainer.addView(backButton)
|
||||
if (Utilities.isRtl(resources)) {
|
||||
navButtonContainer.addView(backButton)
|
||||
navButtonContainer.addView(homeButton)
|
||||
navButtonContainer.addView(recentsButton)
|
||||
} else {
|
||||
navButtonContainer.addView(recentsButton)
|
||||
navButtonContainer.addView(homeButton)
|
||||
navButtonContainer.addView(backButton)
|
||||
}
|
||||
}
|
||||
|
||||
open fun repositionContextualButtons(buttonSize: Int) {
|
||||
@@ -129,14 +136,14 @@ open class PhoneLandscapeNavLayoutter(
|
||||
buttonSize,
|
||||
roundedCornerContentMargin + contentPadding,
|
||||
0,
|
||||
Gravity.TOP
|
||||
Gravity.TOP,
|
||||
)
|
||||
repositionContextualContainer(
|
||||
endContextualContainer,
|
||||
buttonSize,
|
||||
0,
|
||||
roundedCornerContentMargin + contentPadding,
|
||||
Gravity.BOTTOM
|
||||
Gravity.BOTTOM,
|
||||
)
|
||||
|
||||
if (imeSwitcher != null) {
|
||||
@@ -155,7 +162,7 @@ open class PhoneLandscapeNavLayoutter(
|
||||
buttonSize: Int,
|
||||
barAxisMarginTop: Int,
|
||||
barAxisMarginBottom: Int,
|
||||
gravity: Int
|
||||
gravity: Int,
|
||||
) {
|
||||
val contextualContainerParams = FrameLayout.LayoutParams(MATCH_PARENT, buttonSize)
|
||||
contextualContainerParams.apply {
|
||||
|
||||
@@ -34,7 +34,7 @@ class PhonePortraitNavLayoutter(
|
||||
startContextualContainer: ViewGroup,
|
||||
imeSwitcher: ImageView?,
|
||||
a11yButton: ImageView?,
|
||||
space: Space?
|
||||
space: Space?,
|
||||
) :
|
||||
AbstractNavButtonLayoutter(
|
||||
resources,
|
||||
@@ -43,11 +43,11 @@ class PhonePortraitNavLayoutter(
|
||||
startContextualContainer,
|
||||
imeSwitcher,
|
||||
a11yButton,
|
||||
space
|
||||
space,
|
||||
) {
|
||||
|
||||
override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) {
|
||||
val totalWidth = context.deviceProfile.widthPx
|
||||
val totalWidth = context.deviceProfile.deviceProperties.widthPx
|
||||
val homeButtonWidth =
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_phone_home_button_size)
|
||||
val roundedCornerContentMargin =
|
||||
@@ -63,7 +63,7 @@ class PhonePortraitNavLayoutter(
|
||||
val navContainerParams =
|
||||
FrameLayout.LayoutParams(
|
||||
navButtonContainerWidth.toInt(),
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
)
|
||||
navContainerParams.apply {
|
||||
topMargin = 0
|
||||
@@ -120,14 +120,14 @@ class PhonePortraitNavLayoutter(
|
||||
contextualButtonWidth.toInt(),
|
||||
roundedCornerContentMargin + contentPadding,
|
||||
0,
|
||||
Gravity.START
|
||||
Gravity.START,
|
||||
)
|
||||
repositionContextualContainer(
|
||||
endContextualContainer,
|
||||
contextualButtonWidth.toInt(),
|
||||
0,
|
||||
roundedCornerContentMargin + contentPadding,
|
||||
Gravity.END
|
||||
Gravity.END,
|
||||
)
|
||||
|
||||
startContextualContainer.addView(space, MATCH_PARENT, MATCH_PARENT)
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.Space
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.Utilities
|
||||
|
||||
class PhoneSeascapeNavLayoutter(
|
||||
resources: Resources,
|
||||
@@ -32,7 +33,7 @@ class PhoneSeascapeNavLayoutter(
|
||||
startContextualContainer: ViewGroup,
|
||||
imeSwitcher: ImageView?,
|
||||
a11yButton: ImageView?,
|
||||
space: Space?
|
||||
space: Space?,
|
||||
) :
|
||||
PhoneLandscapeNavLayoutter(
|
||||
resources,
|
||||
@@ -41,14 +42,20 @@ class PhoneSeascapeNavLayoutter(
|
||||
startContextualContainer,
|
||||
imeSwitcher,
|
||||
a11yButton,
|
||||
space
|
||||
space,
|
||||
) {
|
||||
|
||||
override fun addThreeButtons() {
|
||||
// Flip ordering of back and recents buttons
|
||||
navButtonContainer.addView(backButton)
|
||||
navButtonContainer.addView(homeButton)
|
||||
navButtonContainer.addView(recentsButton)
|
||||
if (Utilities.isRtl(resources)) {
|
||||
navButtonContainer.addView(recentsButton)
|
||||
navButtonContainer.addView(homeButton)
|
||||
navButtonContainer.addView(backButton)
|
||||
} else {
|
||||
navButtonContainer.addView(backButton)
|
||||
navButtonContainer.addView(homeButton)
|
||||
navButtonContainer.addView(recentsButton)
|
||||
}
|
||||
}
|
||||
|
||||
override fun repositionContextualButtons(buttonSize: Int) {
|
||||
@@ -63,14 +70,14 @@ class PhoneSeascapeNavLayoutter(
|
||||
buttonSize,
|
||||
roundedCornerContentMargin + contentPadding,
|
||||
0,
|
||||
Gravity.TOP
|
||||
Gravity.TOP,
|
||||
)
|
||||
repositionContextualContainer(
|
||||
endContextualContainer,
|
||||
buttonSize,
|
||||
0,
|
||||
roundedCornerContentMargin + contentPadding,
|
||||
Gravity.BOTTOM
|
||||
Gravity.BOTTOM,
|
||||
)
|
||||
|
||||
startContextualContainer.addView(space, MATCH_PARENT, MATCH_PARENT)
|
||||
|
||||
@@ -59,7 +59,9 @@ class SetupNavLayoutter(
|
||||
|
||||
override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) {
|
||||
val SUWTheme = SystemProperties.get(SUW_THEME_SYSTEM_PROPERTY, "")
|
||||
if (SUWTheme == GLIF_EXPRESSIVE_THEME || SUWTheme == GLIF_EXPRESSIVE_LIGHT_THEME) {
|
||||
val expressiveThemeEnabled =
|
||||
SUWTheme == GLIF_EXPRESSIVE_THEME || SUWTheme == GLIF_EXPRESSIVE_LIGHT_THEME
|
||||
if (expressiveThemeEnabled && !context.isSimpleViewEnabled) {
|
||||
return
|
||||
}
|
||||
// Since setup wizard only has back button enabled, it looks strange to be
|
||||
@@ -70,15 +72,15 @@ class SetupNavLayoutter(
|
||||
val deviceProfile: DeviceProfile = context.deviceProfile
|
||||
|
||||
navButtonsLayoutParams.marginEnd = 0
|
||||
navButtonsLayoutParams.gravity = Gravity.START
|
||||
navButtonsLayoutParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL
|
||||
context.setTaskbarWindowSize(context.setupWindowSize)
|
||||
|
||||
// If SUW is on a large screen device that is landscape (or has a square aspect
|
||||
// ratio) the back button has to be placed accordingly
|
||||
if (
|
||||
deviceProfile.isTablet && deviceProfile.isLandscape ||
|
||||
(deviceProfile.aspectRatio > SQUARE_ASPECT_RATIO_BOTTOM_BOUND &&
|
||||
deviceProfile.aspectRatio < SQUARE_ASPECT_RATIO_UPPER_BOUND)
|
||||
deviceProfile.deviceProperties.isTablet && deviceProfile.deviceProperties.isLandscape ||
|
||||
(deviceProfile.deviceProperties.aspectRatio > SQUARE_ASPECT_RATIO_BOTTOM_BOUND &&
|
||||
deviceProfile.deviceProperties.aspectRatio < SQUARE_ASPECT_RATIO_UPPER_BOUND)
|
||||
) {
|
||||
navButtonsLayoutParams.marginStart =
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_back_button_suw_start_margin)
|
||||
|
||||
@@ -35,7 +35,7 @@ class TaskbarNavLayoutter(
|
||||
startContextualContainer: ViewGroup,
|
||||
imeSwitcher: ImageView?,
|
||||
a11yButton: ImageView?,
|
||||
space: Space?
|
||||
space: Space?,
|
||||
) :
|
||||
AbstractNavButtonLayoutter(
|
||||
resources,
|
||||
@@ -44,7 +44,7 @@ class TaskbarNavLayoutter(
|
||||
startContextualContainer,
|
||||
imeSwitcher,
|
||||
a11yButton,
|
||||
space
|
||||
space,
|
||||
) {
|
||||
|
||||
override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) {
|
||||
@@ -69,7 +69,7 @@ class TaskbarNavLayoutter(
|
||||
val navButtonParams =
|
||||
FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
)
|
||||
navButtonParams.apply {
|
||||
gravity = Gravity.END or Gravity.CENTER_VERTICAL
|
||||
@@ -101,7 +101,7 @@ class TaskbarNavLayoutter(
|
||||
endContextualContainer.removeAllViews()
|
||||
startContextualContainer.removeAllViews()
|
||||
|
||||
if (!context.deviceProfile.isGestureMode) {
|
||||
if (!context.deviceProfile.deviceProperties.isGestureMode) {
|
||||
val contextualMargin =
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_contextual_button_padding)
|
||||
repositionContextualContainer(endContextualContainer, WRAP_CONTENT, 0, 0, Gravity.END)
|
||||
@@ -110,7 +110,7 @@ class TaskbarNavLayoutter(
|
||||
WRAP_CONTENT,
|
||||
contextualMargin,
|
||||
contextualMargin,
|
||||
Gravity.START
|
||||
Gravity.START,
|
||||
)
|
||||
|
||||
if (imeSwitcher != null) {
|
||||
@@ -122,7 +122,7 @@ class TaskbarNavLayoutter(
|
||||
val imeSwitcherButtonParams =
|
||||
FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
)
|
||||
imeSwitcherButtonParams.apply {
|
||||
marginStart = imeStartMargin
|
||||
|
||||
@@ -16,12 +16,14 @@
|
||||
package com.android.launcher3.taskbar.overlay;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.popup.PopupDataProvider;
|
||||
import com.android.launcher3.taskbar.BaseTaskbarContext;
|
||||
@@ -57,13 +59,14 @@ public class TaskbarOverlayContext extends BaseTaskbarContext {
|
||||
Context windowContext,
|
||||
TaskbarActivityContext taskbarContext,
|
||||
TaskbarControllers controllers) {
|
||||
super(windowContext, taskbarContext.isPrimaryDisplay());
|
||||
super(windowContext, taskbarContext.getDisplayId(), taskbarContext.isPrimaryDisplay());
|
||||
mTaskbarContext = taskbarContext;
|
||||
mOverlayController = controllers.taskbarOverlayController;
|
||||
mDragController = new TaskbarDragController(this);
|
||||
mDragController.init(controllers);
|
||||
mDragLayer = new TaskbarOverlayDragLayer(this);
|
||||
mStashedTaskbarHeight = controllers.taskbarStashController.getStashedHeight();
|
||||
updateBlurStyle();
|
||||
|
||||
mUiController = controllers.uiController;
|
||||
onViewCreated();
|
||||
@@ -125,6 +128,20 @@ public class TaskbarOverlayContext extends BaseTaskbarContext {
|
||||
return mDragLayer.findViewById(R.id.apps_view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllAppsBackgroundBlurEnabled() {
|
||||
return Flags.allAppsBlur() && mOverlayController != null
|
||||
&& mOverlayController.isBackgroundBlurEnabled();
|
||||
}
|
||||
|
||||
/** Apply the blur or blur fallback style to the current theme. */
|
||||
private void updateBlurStyle() {
|
||||
if (!Flags.allAppsBlur()) {
|
||||
return;
|
||||
}
|
||||
getTheme().applyStyle(getAllAppsBlurStyleResId(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View.OnClickListener getItemOnClickListener() {
|
||||
return mTaskbarContext.getItemOnClickListener();
|
||||
@@ -166,6 +183,11 @@ public class TaskbarOverlayContext extends BaseTaskbarContext {
|
||||
return mTaskbarContext.isInDesktopMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTaskbarShowingDesktopTasks() {
|
||||
return mTaskbarContext.isTaskbarShowingDesktopTasks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showLockedTaskbarOnHome() {
|
||||
return mTaskbarContext.showLockedTaskbarOnHome();
|
||||
@@ -177,8 +199,18 @@ public class TaskbarOverlayContext extends BaseTaskbarContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrimaryDisplay() {
|
||||
return mTaskbarContext.isPrimaryDisplay();
|
||||
public Point getScreenSize() {
|
||||
return mTaskbarContext.getScreenSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDisplayHeight() {
|
||||
return mTaskbarContext.getDisplayHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyConfigChanged() {
|
||||
mTaskbarContext.notifyConfigChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar.overlay;
|
||||
|
||||
import static android.os.Trace.TRACE_TAG_APP;
|
||||
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
||||
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_CONSUME_IME_INSETS;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
import static android.window.DesktopModeFlags.ENABLE_TASKBAR_OVERFLOW;
|
||||
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE;
|
||||
@@ -26,8 +28,12 @@ import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.gui.EarlyWakeupInfo;
|
||||
import android.os.Binder;
|
||||
import android.os.Trace;
|
||||
import android.util.Log;
|
||||
import android.view.AttachedSurfaceControl;
|
||||
import android.view.CrossWindowBlurListeners;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceControl;
|
||||
@@ -98,6 +104,10 @@ public final class TaskbarOverlayController {
|
||||
private TaskbarControllers mControllers; // Initialized in init.
|
||||
// True if we have alerted surface flinger of an expensive call for blur.
|
||||
private boolean mInEarlyWakeUp;
|
||||
/**
|
||||
* Token for early wakeup requests to SurfaceFlinger.
|
||||
*/
|
||||
private EarlyWakeupInfo mEarlyWakeupInfo = new EarlyWakeupInfo();
|
||||
|
||||
public TaskbarOverlayController(
|
||||
TaskbarActivityContext taskbarContext, DeviceProfile launcherDeviceProfile) {
|
||||
@@ -108,6 +118,8 @@ public final class TaskbarOverlayController {
|
||||
mLauncherDeviceProfile = launcherDeviceProfile;
|
||||
mMaxBlurRadius = mTaskbarContext.getResources().getDimensionPixelSize(
|
||||
R.dimen.max_depth_blur_radius_enhanced);
|
||||
mEarlyWakeupInfo.token = new Binder();
|
||||
mEarlyWakeupInfo.trace = TaskbarOverlayController.class.getName();
|
||||
}
|
||||
|
||||
/** Initialize the controller. */
|
||||
@@ -121,7 +133,7 @@ public final class TaskbarOverlayController {
|
||||
*/
|
||||
public TaskbarOverlayContext requestWindow() {
|
||||
if (mOverlayContext == null) {
|
||||
mOverlayContext = new TaskbarOverlayContext(
|
||||
mOverlayContext = TaskbarOverlayContextFactory.newInstance(mWindowContext).create(
|
||||
mWindowContext, mTaskbarContext, mControllers);
|
||||
}
|
||||
|
||||
@@ -177,7 +189,7 @@ public final class TaskbarOverlayController {
|
||||
return mLauncherDeviceProfile;
|
||||
}
|
||||
|
||||
/** Updates {@link DeviceProfile} instance for Taskbar's overlay window. */
|
||||
/** Updates {@link deviceprofile} instance for Taskbar's overlay window. */
|
||||
public void updateLauncherDeviceProfile(DeviceProfile dp) {
|
||||
mLauncherDeviceProfile = dp;
|
||||
Optional.ofNullable(mOverlayContext).ifPresent(c -> {
|
||||
@@ -227,6 +239,11 @@ public final class TaskbarOverlayController {
|
||||
radius = 0;
|
||||
// intentionally falling through in case a non-0 blur was previously set.
|
||||
}
|
||||
if (!CrossWindowBlurListeners.getInstance().isCrossWindowBlurEnabled()) {
|
||||
Log.d(TAG, "setBackgroundBlurRadius: disabled, setting to 0");
|
||||
radius = 0;
|
||||
// intentionally falling through in case a non-0 blur was previously set.
|
||||
}
|
||||
if (mOverlayContext == null) {
|
||||
Log.w(TAG, "setBackgroundBlurRadius: no overlay context");
|
||||
return;
|
||||
@@ -252,31 +269,42 @@ public final class TaskbarOverlayController {
|
||||
return;
|
||||
}
|
||||
Log.v(TAG, "setBackgroundBlurRadius: " + radius);
|
||||
SurfaceControl.Transaction transaction =
|
||||
final SurfaceControl.Transaction transaction =
|
||||
new SurfaceControl.Transaction().setBackgroundBlurRadius(surfaceControl, radius);
|
||||
|
||||
// Set early wake-up flags when we know we're executing an expensive operation, this way
|
||||
// SurfaceFlinger will adjust its internal offsets to avoid jank.
|
||||
boolean wantsEarlyWakeUp = radius > 0 && radius < mMaxBlurRadius;
|
||||
if (wantsEarlyWakeUp && !mInEarlyWakeUp) {
|
||||
Log.d(TAG, "setBackgroundBlurRadius: setting early wakeup");
|
||||
try {
|
||||
transaction.setEarlyWakeupStart();
|
||||
} catch (NoSuchMethodError e) {
|
||||
// LC-Ignored: wtf?
|
||||
try (transaction) {
|
||||
// Set early wake-up flags when we know we're executing an expensive operation, this way
|
||||
// SurfaceFlinger will adjust its internal offsets to avoid jank.
|
||||
boolean wantsEarlyWakeUp = radius > 0 && radius < mMaxBlurRadius;
|
||||
if (wantsEarlyWakeUp && !mInEarlyWakeUp) {
|
||||
Log.d(TAG, "setBackgroundBlurRadius: setting early wakeup with token "
|
||||
+ mEarlyWakeupInfo);
|
||||
Trace.instantForTrack(TRACE_TAG_APP, TAG, "notifyRendererForGpuLoadUp");
|
||||
dragLayerViewRoot.notifyRendererForGpuLoadUp("setBackgroundBlurRadius");
|
||||
try {
|
||||
transaction.setEarlyWakeupStart(mEarlyWakeupInfo);
|
||||
} catch (NoSuchMethodError e) {
|
||||
// LC-Ignored: wtf?
|
||||
}
|
||||
mInEarlyWakeUp = true;
|
||||
} else if (!wantsEarlyWakeUp && mInEarlyWakeUp) {
|
||||
Log.d(TAG, "setBackgroundBlurRadius: clearing early wakeup with token "
|
||||
+ mEarlyWakeupInfo);
|
||||
try {
|
||||
transaction.setEarlyWakeupEnd(mEarlyWakeupInfo);
|
||||
} catch (NoSuchMethodError e) {
|
||||
// LC-Ignored: wtf?
|
||||
}
|
||||
mInEarlyWakeUp = false;
|
||||
}
|
||||
mInEarlyWakeUp = true;
|
||||
} else if (!wantsEarlyWakeUp && mInEarlyWakeUp) {
|
||||
Log.d(TAG, "setBackgroundBlurRadius: clearing early wakeup");
|
||||
try {
|
||||
transaction.setEarlyWakeupEnd();
|
||||
} catch (NoSuchMethodError e) {
|
||||
// LC-Ignored: wtf?
|
||||
}
|
||||
mInEarlyWakeUp = false;
|
||||
}
|
||||
|
||||
rootSurfaceControl.applyTransactionOnDraw(transaction);
|
||||
rootSurfaceControl.applyTransactionOnDraw(transaction);
|
||||
}
|
||||
}
|
||||
|
||||
boolean isBackgroundBlurEnabled() {
|
||||
return BlurUtils.supportsBlursOnWindows()
|
||||
&& CrossWindowBlurListeners.getInstance().isCrossWindowBlurEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,7 +328,7 @@ public final class TaskbarOverlayController {
|
||||
@Override
|
||||
protected void handleClose(boolean animate) {
|
||||
if (!mIsOpen) return;
|
||||
if (Flags.taskbarOverflow()) {
|
||||
if (ENABLE_TASKBAR_OVERFLOW.isTrue()) {
|
||||
// Mark the view closed before attempting to remove it, so the drag layer does not
|
||||
// schedule another call to close. Needed for taskbar overflow in case the KQS
|
||||
// view shown for taskbar overflow needs to be reshown - delayed close call would
|
||||
|
||||
@@ -71,6 +71,7 @@ public class TaskbarOverlayDragLayer extends
|
||||
|
||||
@Override
|
||||
public void recreateControllers() {
|
||||
super.recreateControllers();
|
||||
List<TouchController> controllers = new ArrayList<>();
|
||||
controllers.add(mContainer.getDragController());
|
||||
controllers.addAll(mTouchControllers);
|
||||
|
||||
@@ -39,14 +39,11 @@ import android.util.AttributeSet;
|
||||
import android.util.FloatProperty;
|
||||
import android.util.Log;
|
||||
import android.util.Property;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.AnimatedFloat;
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
@@ -94,7 +91,7 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
|
||||
private final Paint mIconRingPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Path mRingPath = new Path();
|
||||
private final int mNormalizedIconSize;
|
||||
private final Path mShapePath;
|
||||
private Path mShapePath;
|
||||
private final Matrix mTmpMatrix = new Matrix();
|
||||
|
||||
private final BlurMaskFilter mShadowFilter;
|
||||
@@ -281,16 +278,6 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* prepares prediction icon for usage after bind
|
||||
*/
|
||||
public void finishBinding(OnLongClickListener longClickListener) {
|
||||
setOnLongClickListener(longClickListener);
|
||||
((CellLayoutLayoutParams) getLayoutParams()).canReorder = false;
|
||||
setTextVisibility(false);
|
||||
verifyHighRes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIconBounds(Rect outBounds) {
|
||||
super.getIconBounds(outBounds);
|
||||
@@ -339,6 +326,9 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
|
||||
}
|
||||
|
||||
private void updateRingPath() {
|
||||
mShapePath = ThemeManager.INSTANCE.get(mContext)
|
||||
.getIconShape()
|
||||
.getPath(mNormalizedIconSize);
|
||||
mRingPath.reset();
|
||||
mTmpMatrix.reset();
|
||||
mTmpMatrix.setTranslate(getOutlineOffsetX(), getOutlineOffsetY());
|
||||
@@ -457,19 +447,6 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a new instance of PredictedAppIcon from WorkspaceItemInfo
|
||||
*/
|
||||
public static PredictedAppIcon createIcon(ViewGroup parent, WorkspaceItemInfo info) {
|
||||
PredictedAppIcon icon = (PredictedAppIcon) LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.predicted_app_icon, parent, false);
|
||||
icon.applyFromWorkspaceItem(info);
|
||||
Launcher launcher = Launcher.getLauncher(parent.getContext());
|
||||
icon.setOnClickListener(launcher.getItemOnClickListener());
|
||||
icon.setOnFocusChangeListener(launcher.getFocusHandler());
|
||||
return icon;
|
||||
}
|
||||
|
||||
private class AnimColorHolder {
|
||||
|
||||
public final AnimatedFloat progress = new AnimatedFloat(this::onUpdate, 1);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.android.launcher3.uioverrides;
|
||||
|
||||
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OPTIMIZE_MEASURE;
|
||||
import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED;
|
||||
import static android.window.DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY;
|
||||
@@ -23,15 +24,18 @@ import static android.window.DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_WALLPAPER
|
||||
import static com.android.app.animation.Interpolators.EMPHASIZED;
|
||||
import static com.android.internal.jank.Cuj.CUJ_LAUNCHER_LAUNCH_APP_PAIR_FROM_WORKSPACE;
|
||||
import static com.android.launcher3.Flags.enableExpressiveDismissTaskMotion;
|
||||
import static com.android.launcher3.Flags.enableOverviewBackgroundWallpaperBlur;
|
||||
import static com.android.launcher3.Flags.enableUnfoldStateAnimation;
|
||||
import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.PENDING_SPLIT_SELECT_INFO;
|
||||
import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.RUNTIME_STATE;
|
||||
import static com.android.launcher3.LauncherSettings.Animation.DEFAULT_NO_ICON;
|
||||
import static com.android.launcher3.LauncherSettings.Animation.VIEW_BACKGROUND;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.LauncherState.FLAG_SKIP_STATE_ANNOUNCEMENT;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.NO_OFFSET;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
@@ -51,6 +55,7 @@ import static com.android.launcher3.popup.SystemShortcut.BUBBLE_SHORTCUT;
|
||||
import static com.android.launcher3.popup.SystemShortcut.DONT_SUGGEST_APP;
|
||||
import static com.android.launcher3.popup.SystemShortcut.INSTALL;
|
||||
import static com.android.launcher3.popup.SystemShortcut.PRIVATE_PROFILE_INSTALL;
|
||||
import static com.android.launcher3.popup.SystemShortcut.REMOVE;
|
||||
import static com.android.launcher3.popup.SystemShortcut.UNINSTALL_APP;
|
||||
import static com.android.launcher3.popup.SystemShortcut.WIDGETS;
|
||||
import static com.android.launcher3.taskbar.LauncherTaskbarUIController.ALL_APPS_PAGE_PROGRESS_INDEX;
|
||||
@@ -66,6 +71,7 @@ import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.quickstep.util.AnimUtils.completeRunnableListCallback;
|
||||
import static com.android.quickstep.util.SplitAnimationTimings.TABLET_HOME_TO_SPLIT;
|
||||
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY;
|
||||
import static com.android.wm.shell.shared.split.SplitScreenConstants.SNAP_TO_2_50_50;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
@@ -81,15 +87,12 @@ import android.graphics.RectF;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.media.permission.SafeCloseable;
|
||||
import android.os.Build;
|
||||
import android.os.Build.VERSION;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.os.Bundle;
|
||||
import android.os.IRemoteCallback;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Display;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
@@ -110,6 +113,7 @@ import com.android.app.viewcapture.ViewCaptureFactory;
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.GestureNavContract;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
@@ -131,9 +135,9 @@ import com.android.launcher3.hybridhotseat.HotseatPredictionController;
|
||||
import com.android.launcher3.logging.InstanceId;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
|
||||
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
||||
import com.android.launcher3.model.WellbeingModel;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.PredictedContainerInfo;
|
||||
import com.android.launcher3.popup.SystemShortcut;
|
||||
import com.android.launcher3.proxy.ProxyActivityStarter;
|
||||
import com.android.launcher3.statehandlers.DepthController;
|
||||
@@ -163,6 +167,7 @@ import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.IntSet;
|
||||
import com.android.launcher3.util.NavigationMode;
|
||||
import com.android.launcher3.util.ObjectWrapper;
|
||||
import com.android.launcher3.util.OverviewCommandHelperProtoLogProxy;
|
||||
import com.android.launcher3.util.PendingRequestArgs;
|
||||
import com.android.launcher3.util.PendingSplitSelectInfo;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
@@ -173,6 +178,7 @@ import com.android.launcher3.util.StableViewInfo;
|
||||
import com.android.launcher3.util.StartActivityParams;
|
||||
import com.android.launcher3.util.TouchController;
|
||||
import com.android.launcher3.views.FloatingIconView;
|
||||
import com.android.quickstep.LauncherActivityInterface;
|
||||
import com.android.quickstep.OverviewCommandHelper;
|
||||
import com.android.quickstep.OverviewComponentObserver;
|
||||
import com.android.quickstep.OverviewComponentObserver.OverviewChangeListener;
|
||||
@@ -180,6 +186,8 @@ import com.android.quickstep.RecentsModel;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.TaskUtils;
|
||||
import com.android.quickstep.TouchInteractionService.TISBinder;
|
||||
import com.android.quickstep.fallback.window.RecentsWindowFlags;
|
||||
import com.android.quickstep.fallback.window.RecentsWindowManager;
|
||||
import com.android.quickstep.util.ActiveGestureProtoLogProxy;
|
||||
import com.android.quickstep.util.AsyncClockEventDelegate;
|
||||
import com.android.quickstep.util.LauncherUnfoldAnimationController;
|
||||
@@ -198,6 +206,7 @@ import com.android.quickstep.views.RecentsViewContainer;
|
||||
import com.android.quickstep.views.TaskView;
|
||||
import com.android.systemui.animation.back.FlingOnBackAnimationCallback;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.unfold.RemoteUnfoldSharedComponent;
|
||||
import com.android.systemui.unfold.UnfoldTransitionFactory;
|
||||
import com.android.systemui.unfold.UnfoldTransitionProgressProvider;
|
||||
@@ -209,6 +218,7 @@ import com.android.systemui.unfold.updates.RotationChangeProvider;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleAnythingFlagHelper;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
|
||||
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
|
||||
import com.android.wm.shell.shared.desktopmode.DesktopState;
|
||||
|
||||
import kotlin.Unit;
|
||||
|
||||
@@ -236,7 +246,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
|
||||
protected static final String RING_APPEAR_ANIMATION_PREFIX = "RingAppearAnimation\t";
|
||||
|
||||
private FixedContainerItems mAllAppsPredictions;
|
||||
private PredictedContainerInfo mAllAppsPredictions;
|
||||
private HotseatPredictionController mHotseatPredictionController;
|
||||
private DepthController mDepthController;
|
||||
private QuickstepTransitionManager mAppTransitionManager;
|
||||
@@ -274,6 +284,8 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
|
||||
private final OverviewChangeListener mOverviewChangeListener = this::onOverviewTargetChanged;
|
||||
|
||||
private boolean mOverviewBlurEnabled;
|
||||
|
||||
private final TaskViewRecentsTouchContext mTaskViewRecentsTouchContext =
|
||||
new TaskViewRecentsTouchContext() {
|
||||
@Override
|
||||
@@ -293,17 +305,16 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
}
|
||||
};
|
||||
|
||||
public static QuickstepLauncher getLauncher(Context context) {
|
||||
return fromContext(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupViews() {
|
||||
getAppWidgetHolder().setOnViewCreationCallback(new QuickstepInteractionHandler(this));
|
||||
mDepthController = new DepthController(this);
|
||||
mOverviewBlurEnabled = isOverviewBackgroundBlurEnabled();
|
||||
getTheme().applyStyle(getOverviewBlurStyleResId(), true);
|
||||
super.setupViews();
|
||||
|
||||
mActionsView = findViewById(R.id.overview_actions_view);
|
||||
RecentsView<?,?> overviewPanel = getOverviewPanel();
|
||||
RecentsView<?, LauncherState> overviewPanel = getOverviewPanel();
|
||||
SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.get(this);
|
||||
mSplitSelectStateController =
|
||||
new SplitSelectStateController(this, getStateManager(),
|
||||
@@ -331,7 +342,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
}
|
||||
|
||||
mTISBindHelper = new TISBindHelper(this, this::onTISConnected);
|
||||
mDepthController = new DepthController(this);
|
||||
|
||||
if (DesktopModeStatus.canEnterDesktopModeOrShowAppHandle(this)) {
|
||||
mSplitSelectStateController.initSplitFromDesktopController(this);
|
||||
}
|
||||
@@ -360,16 +371,16 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
if (mAllAppsPredictions != null
|
||||
&& (info.itemType == ITEM_TYPE_APPLICATION
|
||||
|| info.itemType == ITEM_TYPE_DEEP_SHORTCUT)) {
|
||||
int count = mAllAppsPredictions.items.size();
|
||||
List<ItemInfo> items = mAllAppsPredictions.getContents();
|
||||
int count = items.size();
|
||||
for (int i = 0; i < count; i++) {
|
||||
ItemInfo targetInfo = mAllAppsPredictions.items.get(i);
|
||||
ItemInfo targetInfo = items.get(i);
|
||||
if (targetInfo.itemType == info.itemType
|
||||
&& targetInfo.user.equals(info.user)
|
||||
&& Objects.equals(targetInfo.getIntent(), info.getIntent())) {
|
||||
logger.withRank(i);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
logger.log(LAUNCHER_APP_LAUNCH_TAP);
|
||||
@@ -419,31 +430,19 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
|
||||
@Override
|
||||
public RunnableList startActivitySafely(View v, Intent intent, ItemInfo item) {
|
||||
// Only pause is taskbar controller is not present until the transition (if it exists) ends
|
||||
mHotseatPredictionController.setPauseUIUpdate(getTaskbarUIController() == null);
|
||||
PredictionRowView<?> predictionRowView =
|
||||
getAppsView().getFloatingHeaderView().findFixedRowByType(PredictionRowView.class);
|
||||
// Pause the prediction row updates until the transition (if it exists) ends.
|
||||
predictionRowView.setPredictionUiUpdatePaused(true);
|
||||
RunnableList result = super.startActivitySafely(v, intent, item);
|
||||
if (result == null) {
|
||||
mHotseatPredictionController.setPauseUIUpdate(false);
|
||||
predictionRowView.setPredictionUiUpdatePaused(false);
|
||||
} else {
|
||||
result.add(() -> {
|
||||
mHotseatPredictionController.setPauseUIUpdate(false);
|
||||
predictionRowView.setPredictionUiUpdatePaused(false);
|
||||
});
|
||||
result.add(() -> predictionRowView.setPredictionUiUpdatePaused(false));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startBinding() {
|
||||
super.startBinding();
|
||||
mHotseatPredictionController.verifyUIUpdateNotPaused();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityFlagsChanged(int changeBits) {
|
||||
if ((changeBits & ACTIVITY_STATE_STARTED) != 0) {
|
||||
@@ -469,6 +468,31 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
super.showAllAppsFromIntent(alreadyOnHome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllAppsBackgroundBlurEnabled() {
|
||||
return mDepthController != null && mDepthController.isCrossWindowBlursEnabled()
|
||||
&& Flags.allAppsBlur();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverviewBackgroundBlurEnabled() {
|
||||
return mDepthController != null && mDepthController.isCrossWindowBlursEnabled()
|
||||
&& enableOverviewBackgroundWallpaperBlur();
|
||||
}
|
||||
|
||||
/** Apply the blur or blur fallback style to the current theme. */
|
||||
public void updateBlurStyle() {
|
||||
if (enableOverviewBackgroundWallpaperBlur()) {
|
||||
if (isOverviewBackgroundBlurEnabled() != mOverviewBlurEnabled) {
|
||||
mWallpaperThemeManager.recreateToUpdateTheme();
|
||||
}
|
||||
} else if (Flags.allAppsBlur()) {
|
||||
// For all apps, we only need to update the scrim, which draws the panel. But if the
|
||||
// activity was recreated above, this is unnecessary.
|
||||
getAppsView().invalidateHeader();
|
||||
}
|
||||
}
|
||||
|
||||
protected void onItemClicked(View view) {
|
||||
if (!mSplitToWorkspaceController.handleSecondAppSelectionForSplit(view)) {
|
||||
super.getItemOnClickListener().onClick(view);
|
||||
@@ -481,7 +505,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<SystemShortcut.Factory> getSupportedShortcuts() {
|
||||
public Stream<SystemShortcut.Factory> getSupportedShortcuts(int container) {
|
||||
// Order matters as it affects order of appearance in popup container
|
||||
List<SystemShortcut.Factory> shortcuts = new ArrayList(Arrays.asList(
|
||||
APP_INFO, WellbeingModel.SHORTCUT_FACTORY, mHotseatPredictionController));
|
||||
@@ -489,12 +513,15 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
shortcuts.addAll(getSplitShortcuts());
|
||||
shortcuts.add(WIDGETS);
|
||||
shortcuts.add(INSTALL);
|
||||
if (Flags.enableLongPressRemoveShortcut()
|
||||
&& (container == CONTAINER_HOTSEAT || container == CONTAINER_DESKTOP
|
||||
|| /* Folder */ container > 0)) {
|
||||
shortcuts.add(REMOVE);
|
||||
}
|
||||
shortcuts.add(DONT_SUGGEST_APP);
|
||||
if (Flags.enablePrivateSpaceInstallShortcut()) {
|
||||
shortcuts.add(PRIVATE_PROFILE_INSTALL);
|
||||
}
|
||||
if (Flags.enableShortcutDontSuggestApp()) {
|
||||
shortcuts.add(DONT_SUGGEST_APP);
|
||||
}
|
||||
if (Flags.enablePrivateSpace()) {
|
||||
shortcuts.add(UNINSTALL_APP);
|
||||
}
|
||||
@@ -505,7 +532,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
}
|
||||
|
||||
private List<SystemShortcut.Factory<QuickstepLauncher>> getSplitShortcuts() {
|
||||
if (!mDeviceProfile.isTablet || mSplitSelectStateController.isSplitSelectActive()) {
|
||||
if (!mDeviceProfile.getDeviceProperties().isTablet() || mSplitSelectStateController.isSplitSelectActive()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
RecentsView recentsView = getOverviewPanel();
|
||||
@@ -547,17 +574,20 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindExtraContainerItems(FixedContainerItems item) {
|
||||
if (item.containerId == Favorites.CONTAINER_PREDICTION) {
|
||||
mAllAppsPredictions = item;
|
||||
PredictionRowView<?> predictionRowView =
|
||||
getAppsView().getFloatingHeaderView().findFixedRowByType(
|
||||
PredictionRowView.class);
|
||||
predictionRowView.setPredictedApps(item.items);
|
||||
} else if (item.containerId == Favorites.CONTAINER_HOTSEAT_PREDICTION) {
|
||||
mHotseatPredictionController.setPredictedItems(item);
|
||||
} else if (item.containerId == Favorites.CONTAINER_WIDGETS_PREDICTION) {
|
||||
getWidgetPickerDataProvider().setWidgetRecommendations(item.items);
|
||||
public void bindPredictedContainerInfo(PredictedContainerInfo info) {
|
||||
super.bindPredictedContainerInfo(info);
|
||||
switch (info.id) {
|
||||
case Favorites.CONTAINER_ALL_APPS_PREDICTION:
|
||||
mAllAppsPredictions = info;
|
||||
getAppsView().getFloatingHeaderView().findFixedRowByType(
|
||||
PredictionRowView.class).setPredictedApps(info.getContents());
|
||||
break;
|
||||
case Favorites.CONTAINER_HOTSEAT_PREDICTION:
|
||||
mHotseatPredictionController.setPredictedItems(info);
|
||||
break;
|
||||
case Favorites.CONTAINER_WIDGETS_PREDICTION:
|
||||
getWidgetPickerDataProvider().setWidgetRecommendations(info.getContents());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -659,6 +689,15 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setTitle(@NonNull LauncherState state) {
|
||||
if (state.hasFlag(FLAG_SKIP_STATE_ANNOUNCEMENT)) {
|
||||
// Prevent accessibility title update announcement
|
||||
getWindow().getAttributes().accessibilityTitle = getString(state.getTitle());
|
||||
}
|
||||
super.setTitle(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TouchController[] createTouchControllers() {
|
||||
NavigationMode mode = DisplayController.getNavigationMode(this);
|
||||
@@ -693,8 +732,9 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
break;
|
||||
}
|
||||
|
||||
if (!getDeviceProfile().isMultiWindowMode) {
|
||||
list.add(new StatusBarTouchController(this));
|
||||
if (!getDeviceProfile().getDeviceProperties().isMultiWindowMode()) {
|
||||
list.add(new StatusBarTouchController(
|
||||
this, () -> this.isInState(LauncherState.NORMAL)));
|
||||
}
|
||||
|
||||
if (enableExpressiveDismissTaskMotion()) {
|
||||
@@ -874,11 +914,26 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
boolean intentHasGnc = GestureNavContract.canBuildFromIntent(intent);
|
||||
super.onNewIntent(intent);
|
||||
OverviewCommandHelper overviewCommandHelper = mTISBindHelper.getOverviewCommandHelper();
|
||||
if (overviewCommandHelper != null) {
|
||||
overviewCommandHelper.clearPendingCommands();
|
||||
}
|
||||
if (RecentsWindowFlags.getEnableOverviewInWindow() && !intentHasGnc) {
|
||||
RecentsWindowManager defaultRecentsWindowManager =
|
||||
RecentsWindowManager.REPOSITORY_INSTANCE.get(this).get(DEFAULT_DISPLAY);
|
||||
if (defaultRecentsWindowManager != null) {
|
||||
defaultRecentsWindowManager.cleanupRecentsWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void logOnNewIntent(boolean alreadyOnHome, boolean shouldMoveToDefaultScreen,
|
||||
String action, boolean internalStateHandled) {
|
||||
OverviewCommandHelperProtoLogProxy.logOnNewIntent(alreadyOnHome, shouldMoveToDefaultScreen,
|
||||
action, internalStateHandled);
|
||||
}
|
||||
|
||||
public QuickstepTransitionManager getAppTransitionManager() {
|
||||
@@ -897,7 +952,9 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
|
||||
@Override
|
||||
protected void handleGestureContract(Intent intent) {
|
||||
if (FeatureFlags.SEPARATE_RECENTS_ACTIVITY.get()) {
|
||||
if (GestureNavContract.isContractEnabled(intent)
|
||||
&& (FeatureFlags.SEPARATE_RECENTS_ACTIVITY.get()
|
||||
|| RecentsWindowFlags.getEnableOverviewInWindow())) {
|
||||
super.handleGestureContract(intent);
|
||||
}
|
||||
}
|
||||
@@ -927,7 +984,8 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
onTaskbarInAppDisplayProgressUpdate(progress, WIDGETS_PAGE_PROGRESS_INDEX);
|
||||
if (mEnableWidgetDepth) {
|
||||
getDepthController().widgetDepth.setValue(Utilities.mapToRange(
|
||||
progress, 0f, 1f, 0f, getDeviceProfile().bottomSheetDepth, EMPHASIZED));
|
||||
progress, 0f, 1f, 0f,
|
||||
getDeviceProfile().getBottomSheetProfile().getBottomSheetDepth(), EMPHASIZED));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -971,6 +1029,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
mActiveOnBackAnimationCallback.onBackStarted(backEvent);
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
||||
@Override
|
||||
public void onBackInvokedCompat() {
|
||||
// Recreate mActiveOnBackAnimationCallback if necessary to avoid NPE
|
||||
@@ -1273,7 +1332,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
}
|
||||
activityOptions.options.setLaunchDisplayId(
|
||||
(v != null && v.getDisplay() != null) ? v.getDisplay().getDisplayId()
|
||||
: Display.DEFAULT_DISPLAY);
|
||||
: DEFAULT_DISPLAY);
|
||||
Utilities.allowBGLaunch(activityOptions.options);
|
||||
return activityOptions;
|
||||
}
|
||||
@@ -1294,8 +1353,8 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
|
||||
@Override
|
||||
@BinderThread
|
||||
public void enterStageSplitFromRunningApp(boolean leftOrTop) {
|
||||
mSplitWithKeyboardShortcutController.enterStageSplit(leftOrTop);
|
||||
public void enterStageSplitFromRunningApp(boolean leftOrTop, int displayId) {
|
||||
mSplitWithKeyboardShortcutController.enterStageSplit(leftOrTop, displayId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1384,6 +1443,11 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
.isInDesktopModeAndNotInOverview(getDisplayId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldShowHomeBehindDesktop() {
|
||||
return DesktopState.fromContext(this).getShouldShowHomeBehindDesktop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispatchDeviceProfileChanged() {
|
||||
super.dispatchDeviceProfileChanged();
|
||||
@@ -1406,7 +1470,9 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT,
|
||||
/* callback= */ success -> mSplitSelectStateController.resetState(),
|
||||
/* freezeTaskList= */ false,
|
||||
splitTask.getSplitBounds().snapPosition,
|
||||
splitTask.getSplitBounds() == null
|
||||
? SNAP_TO_2_50_50
|
||||
: splitTask.getSplitBounds().snapPosition,
|
||||
remoteTransition);
|
||||
}
|
||||
|
||||
@@ -1563,4 +1629,20 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
public void returnToHomescreen() {
|
||||
getStateManager().goToState(LauncherState.NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOverviewBlurStyleResId() {
|
||||
return isOverviewBackgroundBlurEnabled() ? R.style.OverviewBlurStyle
|
||||
: R.style.OverviewBlurFallbackStyle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LauncherActivityInterface getContainerInterface() {
|
||||
return LauncherActivityInterface.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SplitSelectStateController getSplitSelectStateController() {
|
||||
return mSplitSelectStateController;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import static com.android.launcher3.uioverrides.QuickstepAppWidgetHostProvider.g
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.widget.ListenableAppWidgetHost.getWidgetHolderExecutor;
|
||||
|
||||
import android.appwidget.AppWidgetEvent;
|
||||
import android.appwidget.AppWidgetHost;
|
||||
import android.appwidget.AppWidgetHostView;
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
@@ -44,6 +45,8 @@ import dagger.assisted.AssistedInject;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
@@ -57,6 +60,10 @@ public final class QuickstepWidgetHolder extends LauncherWidgetHolder {
|
||||
AppWidgetHostView::updateAppWidget;
|
||||
private static final UpdateKey<Integer> KEY_VIEW_DATA_CHANGED =
|
||||
AppWidgetHostView::onViewDataChanged;
|
||||
private static final UpdateKey<AppWidgetEvent.Builder> KEY_COLLECT_WIDGET_EVENT =
|
||||
(view, event) -> {
|
||||
event.merge(view.collectWidgetEvent());
|
||||
};
|
||||
|
||||
private static final SparseArray<QuickstepWidgetHolderListener> sListeners =
|
||||
new SparseArray<>();
|
||||
@@ -266,6 +273,25 @@ public final class QuickstepWidgetHolder extends LauncherWidgetHolder {
|
||||
executeOnMainExecutor(KEY_VIEW_DATA_CHANGED, viewId);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AppWidgetEvent collectWidgetEvent() {
|
||||
if (!android.appwidget.flags.Flags.engagementMetrics()) return null;
|
||||
|
||||
CompletableFuture<AppWidgetEvent> future = new CompletableFuture<>();
|
||||
MAIN_EXECUTOR.execute(() -> {
|
||||
AppWidgetEvent.Builder event = new AppWidgetEvent.Builder();
|
||||
mListeningHolders.forEach(holder ->
|
||||
holder.onWidgetUpdate(mWidgetId, KEY_COLLECT_WIDGET_EVENT, event));
|
||||
future.complete(event.isEmpty() ? null : event.build());
|
||||
});
|
||||
try {
|
||||
return future.get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private <T> void executeOnMainExecutor(UpdateKey<T> key, T data) {
|
||||
MAIN_EXECUTOR.execute(() -> mListeningHolders.forEach(holder ->
|
||||
holder.onWidgetUpdate(mWidgetId, key, data)));
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.android.app.animation.Interpolators.FINAL_FRAME
|
||||
import com.android.app.animation.Interpolators.INSTANT
|
||||
import com.android.app.animation.Interpolators.LINEAR
|
||||
import com.android.launcher3.Flags.enableDesktopExplodedView
|
||||
import com.android.launcher3.Flags.enableGridOnlyOverview
|
||||
import com.android.launcher3.Flags.enableLargeDesktopWindowingTile
|
||||
import com.android.launcher3.LauncherState
|
||||
import com.android.launcher3.anim.AnimatedFloat
|
||||
@@ -37,6 +36,7 @@ import com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE
|
||||
import com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X
|
||||
import com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y
|
||||
import com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW
|
||||
import com.android.launcher3.util.OverviewReleaseFlags.enableGridOnlyOverview
|
||||
import com.android.quickstep.util.AnimUtils
|
||||
import com.android.quickstep.views.AddDesktopButton
|
||||
import com.android.quickstep.views.ClearAllButton
|
||||
@@ -246,7 +246,10 @@ class RecentsViewStateController(private val launcher: QuickstepLauncher) :
|
||||
launcher.deviceProfile,
|
||||
)
|
||||
|
||||
val timings = AnimUtils.getDeviceOverviewToSplitTimings(launcher.deviceProfile.isTablet)
|
||||
val timings =
|
||||
AnimUtils.getDeviceOverviewToSplitTimings(
|
||||
launcher.deviceProfile.getDeviceProperties().isTablet
|
||||
)
|
||||
if (!goingToOverviewFromWorkspaceContextual) {
|
||||
// This animation is already done for the contextual case, don't redo it
|
||||
recentsView.createSplitSelectInitAnimation(
|
||||
|
||||
@@ -23,10 +23,11 @@ import android.content.IIntentReceiver
|
||||
import android.content.IIntentSender
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.LauncherActivityInfo
|
||||
import android.content.pm.LauncherApps
|
||||
import android.content.pm.ShortcutInfo
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Rect
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Flags.allowPrivateProfile
|
||||
@@ -34,23 +35,26 @@ import android.os.IBinder
|
||||
import android.os.UserHandle
|
||||
import android.os.UserManager
|
||||
import android.util.ArrayMap
|
||||
import android.view.SurfaceControlViewHost
|
||||
import android.widget.Toast
|
||||
import android.window.RemoteTransition
|
||||
import android.window.ScreenCapture
|
||||
import com.android.launcher3.BaseActivity
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.android.launcher3.Flags.enablePrivateSpace
|
||||
import com.android.launcher3.Flags.enablePrivateSpaceInstallShortcut
|
||||
import com.android.launcher3.Flags.privateSpaceAppInstallerButton
|
||||
import com.android.launcher3.Flags.privateSpaceSysAppsSeparation
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.Utilities
|
||||
import com.android.launcher3.dagger.ApplicationContext
|
||||
import com.android.launcher3.dagger.LauncherAppSingleton
|
||||
import com.android.launcher3.proxy.ProxyActivityStarter
|
||||
import com.android.launcher3.uioverrides.touchcontrollers.StatusBarTouchController
|
||||
import com.android.launcher3.util.ApiWrapper
|
||||
import com.android.launcher3.util.Executors
|
||||
import com.android.launcher3.util.StartActivityParams
|
||||
import com.android.launcher3.util.UserIconInfo
|
||||
import com.android.quickstep.util.FadeOutRemoteTransition
|
||||
import java.util.function.Supplier
|
||||
import javax.inject.Inject
|
||||
|
||||
import app.lawnchair.LawnchairApp
|
||||
@@ -123,10 +127,7 @@ open class SystemApiWrapper @Inject constructor(@ApplicationContext context: Con
|
||||
|
||||
override fun getAppMarketActivityIntent(packageName: String, user: UserHandle): Intent {
|
||||
return try {
|
||||
if (
|
||||
enablePrivateSpace() &&
|
||||
(privateSpaceAppInstallerButton() || enablePrivateSpaceInstallShortcut())
|
||||
)
|
||||
if (allowPrivateProfile() && enablePrivateSpace())
|
||||
ProxyActivityStarter.getLaunchIntent(
|
||||
mContext,
|
||||
StartActivityParams(null as PendingIntent?, 0).apply {
|
||||
@@ -152,7 +153,7 @@ open class SystemApiWrapper @Inject constructor(@ApplicationContext context: Con
|
||||
/** Returns an intent which can be used to open Private Space Settings. */
|
||||
override fun getPrivateSpaceSettingsIntent(): Intent? {
|
||||
return try {
|
||||
if (enablePrivateSpace())
|
||||
if (allowPrivateProfile() && enablePrivateSpace())
|
||||
ProxyActivityStarter.getLaunchIntent(
|
||||
mContext,
|
||||
StartActivityParams(null as PendingIntent?, 0).apply {
|
||||
@@ -241,11 +242,24 @@ open class SystemApiWrapper @Inject constructor(@ApplicationContext context: Con
|
||||
}
|
||||
}
|
||||
|
||||
override fun getApplicationInfoHash(appInfo: ApplicationInfo): String =
|
||||
(appInfo.sourceDir?.hashCode() ?: 0).toString() + " " + appInfo.longVersionCode
|
||||
|
||||
override fun getRoundIconRes(appInfo: ApplicationInfo) = appInfo.roundIconRes
|
||||
override fun createStatusBarTouchController(
|
||||
launcher: BaseActivity,
|
||||
isEnabledCheck: Supplier<Boolean>,
|
||||
): StatusBarTouchController? {
|
||||
return StatusBarTouchController(launcher, isEnabledCheck)
|
||||
}
|
||||
|
||||
override fun isFileDrawable(shortcutInfo: ShortcutInfo) =
|
||||
shortcutInfo.hasIconFile() || shortcutInfo.hasIconUri()
|
||||
|
||||
override fun captureSnapshot(host: SurfaceControlViewHost, width: Int, height: Int): Bitmap =
|
||||
ScreenCapture.captureLayers(
|
||||
ScreenCapture.LayerCaptureArgs.Builder(host.surfacePackage!!.surfaceControl)
|
||||
.setSourceCrop(Rect(0, 0, width, height))
|
||||
.setAllowProtected(true)
|
||||
.setHintForSeamlessTransition(true)
|
||||
.build()
|
||||
)
|
||||
.asBitmap()
|
||||
.copy(Bitmap.Config.ARGB_8888, true)
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import static com.android.launcher3.Flags.enableScalingRevealHomeAnimation;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.android.internal.jank.Cuj;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
@@ -29,6 +30,7 @@ import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.launcher3.views.ScrimColors;
|
||||
import com.android.quickstep.util.BaseDepthController;
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||
|
||||
@@ -137,7 +139,7 @@ public class AllAppsState extends LauncherState {
|
||||
protected <DEVICE_PROFILE_CONTEXT extends Context & ActivityContext>
|
||||
float getDepthUnchecked(DEVICE_PROFILE_CONTEXT context) {
|
||||
if (context.getDeviceProfile().shouldShowAllAppsOnSheet()) {
|
||||
return context.getDeviceProfile().bottomSheetDepth;
|
||||
return context.getDeviceProfile().getBottomSheetProfile().getBottomSheetDepth();
|
||||
} else {
|
||||
// The scrim fades in at approximately 50% of the swipe gesture.
|
||||
if (enableScalingRevealHomeAnimation()) {
|
||||
@@ -151,6 +153,11 @@ public class AllAppsState extends LauncherState {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBlurWorkspace(LauncherState targetState) {
|
||||
return targetState == ALL_APPS || targetState == NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageAlphaProvider getWorkspacePageAlphaProvider(Launcher launcher) {
|
||||
PageAlphaProvider superPageAlphaProvider = super.getWorkspacePageAlphaProvider(launcher);
|
||||
@@ -174,8 +181,7 @@ public class AllAppsState extends LauncherState {
|
||||
}
|
||||
|
||||
private static boolean isWorkspaceVisible(DeviceProfile deviceProfile) {
|
||||
// Currently we hide the workspace with the all apps blur flag for simplicity.
|
||||
return deviceProfile.isTablet && !Flags.allAppsBlur();
|
||||
return deviceProfile.getDeviceProperties().isTablet() || (Flags.allAppsSheetForHandheld() && Flags.allAppsBlur());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,26 +204,24 @@ public class AllAppsState extends LauncherState {
|
||||
@Override
|
||||
public boolean shouldFloatingSearchBarUsePillWhenUnfocused(Launcher launcher) {
|
||||
DeviceProfile dp = launcher.getDeviceProfile();
|
||||
return dp.isPhone && !dp.isLandscape;
|
||||
return dp.getDeviceProperties().isPhone() && !dp.getDeviceProperties().isLandscape();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LauncherState getHistoryForState(LauncherState previousState) {
|
||||
return previousState == BACKGROUND_APP ? QUICK_SWITCH_FROM_HOME
|
||||
: previousState == OVERVIEW ? OVERVIEW : NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWorkspaceScrimColor(Launcher launcher) {
|
||||
public ScrimColors getWorkspaceScrimColor(Launcher launcher) {
|
||||
int backgroundColor;
|
||||
if (!launcher.getDeviceProfile().shouldShowAllAppsOnSheet()) {
|
||||
// Lawnchair-TODO-Colour: LawnchairUtilsKt.getAllAppsScrimColor(launcher) + materialColorSurfaceDim
|
||||
// Always use an opaque scrim if there's no sheet.
|
||||
backgroundColor = launcher.getResources().getColor(R.color.materialColorSurfaceDim);
|
||||
} else if (!Flags.allAppsBlur()) {
|
||||
// Lawnchair-TODO-Colour: LawnchairUtilsKt.getAllAppsScrimColor(launcher) + widgets_picker_scrim
|
||||
// If there's a sheet but no blur, use the old scrim color.
|
||||
backgroundColor = launcher.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
} else {
|
||||
// Lawnchair-TODO-Colour: LawnchairUtilsKt.getAllAppsScrimColor(launcher) + allAppsScrimColor
|
||||
return Themes.getAttrColor(launcher, R.attr.allAppsScrimColor);
|
||||
backgroundColor = Themes.getAttrColor(launcher, R.attr.allAppsScrimColor);
|
||||
}
|
||||
if (Flags.allAppsBlur()) {
|
||||
// Lawnchair-TODO-Colour: LawnchairUtilsKt.getAllAppsScrimColor(launcher) + allAppsScrimColorOverBlur
|
||||
return Themes.getAttrColor(launcher, R.attr.allAppsScrimColorOverBlur);
|
||||
}
|
||||
// Lawnchair-TODO-Colour: LawnchairUtilsKt.getAllAppsScrimColor(launcher) + widgets_picker_scrim
|
||||
return launcher.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
return new ScrimColors(backgroundColor, /* foregroundColor */ Color.TRANSPARENT);
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.android.launcher3.uioverrides.states;
|
||||
|
||||
import static com.android.launcher3.Flags.enableDesktopWindowingCarouselDetach;
|
||||
import static com.android.launcher3.Flags.enableScalingRevealHomeAnimation;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
|
||||
|
||||
@@ -25,6 +24,7 @@ import android.graphics.Color;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.allapps.AllAppsTransitionController;
|
||||
import com.android.launcher3.views.ScrimColors;
|
||||
import com.android.quickstep.util.BaseDepthController;
|
||||
import com.android.quickstep.util.LayoutUtils;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
@@ -35,7 +35,8 @@ import com.android.quickstep.views.RecentsView;
|
||||
public class BackgroundAppState extends OverviewState {
|
||||
|
||||
private static final int STATE_FLAGS = FLAG_DISABLE_RESTORE | FLAG_RECENTS_VIEW_VISIBLE
|
||||
| FLAG_WORKSPACE_INACCESSIBLE | FLAG_NON_INTERACTIVE | FLAG_CLOSE_POPUPS;
|
||||
| FLAG_WORKSPACE_INACCESSIBLE | FLAG_NON_INTERACTIVE | FLAG_CLOSE_POPUPS
|
||||
| FLAG_SKIP_STATE_ANNOUNCEMENT;
|
||||
|
||||
public BackgroundAppState(int id) {
|
||||
this(id, LAUNCHER_STATE_BACKGROUND);
|
||||
@@ -55,7 +56,7 @@ public class BackgroundAppState extends OverviewState {
|
||||
launcher,
|
||||
launcher.getDeviceProfile(),
|
||||
recentsView.getPagedOrientationHandler(),
|
||||
recentsView.getSizeStrategy());
|
||||
recentsView.getContainerInterface());
|
||||
AllAppsTransitionController controller = launcher.getAllAppsController();
|
||||
float scrollRange = Math.max(controller.getShiftRange(), 1);
|
||||
float progressDelta = (transitionLength / scrollRange);
|
||||
@@ -91,11 +92,6 @@ public class BackgroundAppState extends OverviewState {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean detachDesktopCarousel() {
|
||||
return enableDesktopWindowingCarouselDetach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showExplodedDesktopView() {
|
||||
return false;
|
||||
@@ -114,8 +110,10 @@ public class BackgroundAppState extends OverviewState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWorkspaceScrimColor(Launcher launcher) {
|
||||
return Color.TRANSPARENT;
|
||||
public ScrimColors getWorkspaceScrimColor(Launcher launcher) {
|
||||
return new ScrimColors(
|
||||
/* backgroundColor= */ Color.TRANSPARENT,
|
||||
/* foregroundColor= */ Color.TRANSPARENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loaded 100 of 1726 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user