Merge tag 'android-16.0.0_r3' into 16-dev
Android 16.0.0 Release 3 (BP3A.250905.014) Signed-off-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
commit
dd4a08be61
2757 files changed
+260625
-114908
No files matched your search
+79
-48
@@ -15,10 +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.launcher3.Flags.enablePredictiveBackGesture;
|
||||
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;
|
||||
@@ -26,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;
|
||||
|
||||
@@ -36,24 +44,31 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.Insettable;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.taskbar.allapps.TaskbarAllAppsViewController.TaskbarAllAppsCallbacks;
|
||||
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;
|
||||
private int mBlurRadius;
|
||||
private @Nullable Runnable mShowOnFullyAttachedToWindowRunnable;
|
||||
|
||||
// Initialized in init.
|
||||
@@ -67,6 +82,8 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mHandler = new Handler(Looper.myLooper());
|
||||
mMaxBlurRadius = getResources().getDimensionPixelSize(
|
||||
R.dimen.max_depth_blur_radius_enhanced);
|
||||
}
|
||||
|
||||
void init(TaskbarAllAppsCallbacks callbacks) {
|
||||
@@ -98,10 +115,21 @@ 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);
|
||||
setTranslationShift(TRANSLATION_SHIFT_OPENED);
|
||||
mBlurRadius = mMaxBlurRadius;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -120,18 +148,28 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
protected void onOpenCloseAnimationPending(PendingAnimation animation) {
|
||||
final boolean isOpening = mToTranslationShift == TRANSLATION_SHIFT_OPENED;
|
||||
|
||||
if (mActivityContext.getDeviceProfile().isPhone) {
|
||||
final Interpolator allAppsFadeInterpolator = isOpening ? ALL_APPS_FADE_MANUAL
|
||||
: Interpolators.reverse(ALL_APPS_FADE_MANUAL);
|
||||
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);
|
||||
}
|
||||
|
||||
if (Flags.allAppsBlur()) {
|
||||
Interpolator blurInterpolator = isOpening ? LINEAR : DECELERATED_EASE;
|
||||
animation.addOnFrameListener(a -> {
|
||||
float blurProgress =
|
||||
isOpening ? a.getAnimatedFraction() : 1 - a.getAnimatedFraction();
|
||||
mBlurRadius =
|
||||
(int) (mMaxBlurRadius * blurInterpolator.getInterpolation(blurProgress));
|
||||
});
|
||||
}
|
||||
|
||||
mAllAppsCallbacks.onAllAppsAnimationPending(animation, isOpening);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Interpolator getScrimInterpolator() {
|
||||
if (mActivityContext.getDeviceProfile().isTablet) {
|
||||
if (mActivityContext.getDeviceProfile().getDeviceProperties().isTablet()) {
|
||||
return super.getScrimInterpolator();
|
||||
}
|
||||
return mToTranslationShift == TRANSLATION_SHIFT_OPENED
|
||||
@@ -176,15 +214,13 @@ 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;
|
||||
|
||||
// Setup header protection for search bar, if enabled.
|
||||
if (FeatureFlags.ENABLE_ALL_APPS_SEARCH_IN_TASKBAR.get()) {
|
||||
mAppsView.setOnInvalidateHeaderListener(this::invalidate);
|
||||
}
|
||||
mAppsView.setOnInvalidateHeaderListener(this::invalidate);
|
||||
|
||||
DeviceProfile dp = mActivityContext.getDeviceProfile();
|
||||
setShiftRange(dp.allAppsShiftRange);
|
||||
@@ -194,49 +230,41 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
mActivityContext.addOnDeviceProfileChangeListener(this);
|
||||
if (enablePredictiveBackGesture()) {
|
||||
mAppsView.getAppsRecyclerViewContainer().setOutlineProvider(mViewOutlineProvider);
|
||||
mAppsView.getAppsRecyclerViewContainer().setClipToOutline(true);
|
||||
OnBackInvokedDispatcher dispatcher;
|
||||
if (!Utilities.ATLEAST_U) return;
|
||||
dispatcher = findOnBackInvokedDispatcher();
|
||||
if (dispatcher != null) {
|
||||
dispatcher.registerOnBackInvokedCallback(
|
||||
OnBackInvokedDispatcher.PRIORITY_DEFAULT, null);
|
||||
}
|
||||
mAppsView.getAppsRecyclerViewContainer().setOutlineProvider(mViewOutlineProvider);
|
||||
mAppsView.getAppsRecyclerViewContainer().setClipToOutline(true);
|
||||
if (!Utilities.ATLEAST_U) return;
|
||||
OnBackInvokedDispatcher dispatcher = findOnBackInvokedDispatcher();
|
||||
if (dispatcher != null) {
|
||||
dispatcher.registerOnBackInvokedCallback(
|
||||
OnBackInvokedDispatcher.PRIORITY_DEFAULT, this);
|
||||
}
|
||||
CrossWindowBlurListeners.getInstance().addListener(MAIN_EXECUTOR, mWindowBlurListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
mActivityContext.removeOnDeviceProfileChangeListener(this);
|
||||
if (enablePredictiveBackGesture()) {
|
||||
mAppsView.getAppsRecyclerViewContainer().setOutlineProvider(null);
|
||||
mAppsView.getAppsRecyclerViewContainer().setClipToOutline(false);
|
||||
OnBackInvokedDispatcher dispatcher;
|
||||
if (!Utilities.ATLEAST_U) return;
|
||||
dispatcher = findOnBackInvokedDispatcher();
|
||||
if (dispatcher != null && Utilities.ATLEAST_T) {
|
||||
dispatcher.unregisterOnBackInvokedCallback(null);
|
||||
}
|
||||
mAppsView.getAppsRecyclerViewContainer().setOutlineProvider(null);
|
||||
mAppsView.getAppsRecyclerViewContainer().setClipToOutline(false);
|
||||
if (!Utilities.ATLEAST_U) return;
|
||||
OnBackInvokedDispatcher dispatcher = findOnBackInvokedDispatcher();
|
||||
if (dispatcher != null) {
|
||||
dispatcher.unregisterOnBackInvokedCallback(this);
|
||||
}
|
||||
CrossWindowBlurListeners.getInstance().removeListener(mWindowBlurListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
// We should call drawOnScrimWithBottomOffset() rather than
|
||||
// drawOnScrimWithScale(). Because
|
||||
// for taskbar all apps, the scrim view is a child view of AbstractSlideInView.
|
||||
// Thus scaling
|
||||
// down in AbstractSlideInView#onScaleProgressChanged() with SCALE_PROPERTY has
|
||||
// already
|
||||
// done the job - there is no need to re-apply scale effect here. But it also
|
||||
// means we need
|
||||
// to pass extra bottom offset to background scrim to fill the bottom gap during
|
||||
// predictive
|
||||
// We should call drawOnScrimWithBottomOffset() rather than drawOnScrimWithScale(). Because
|
||||
// for taskbar all apps, the scrim view is a child view of AbstractSlideInView. Thus scaling
|
||||
// down in AbstractSlideInView#onScaleProgressChanged() with SCALE_PROPERTY has already
|
||||
// done the job - there is no need to re-apply scale effect here. But it also means we need
|
||||
// to pass extra bottom offset to background scrim to fill the bottom gap during predictive
|
||||
// back swipe.
|
||||
mAppsView.drawOnScrimWithBottomOffset(canvas, getBottomOffsetPx());
|
||||
mActivityContext.getOverlayController().setBackgroundBlurRadius(mBlurRadius);
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
|
||||
@@ -248,9 +276,14 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
|
||||
@Override
|
||||
protected int getScrimColor(Context context) {
|
||||
return mActivityContext.getDeviceProfile().isPhone
|
||||
? Themes.getAttrColor(context, R.attr.allAppsScrimColor)
|
||||
: context.getColor(R.color.widgets_picker_scrim);
|
||||
if (!mActivityContext.getDeviceProfile().shouldShowAllAppsOnSheet()) {
|
||||
// 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);
|
||||
}
|
||||
return Themes.getAttrColor(context, R.attr.allAppsScrimColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -272,6 +305,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
public void onDeviceProfileChanged(DeviceProfile dp) {
|
||||
setShiftRange(dp.allAppsShiftRange);
|
||||
setTranslationShift(TRANSLATION_SHIFT_OPENED);
|
||||
mBlurRadius = mMaxBlurRadius;
|
||||
}
|
||||
|
||||
private void setShiftRange(float shiftRange) {
|
||||
@@ -289,10 +323,8 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
}
|
||||
|
||||
/**
|
||||
* In taskbar all apps search mode, we should scale down content inside all
|
||||
* apps, rather
|
||||
* than the whole all apps bottom sheet, to indicate we will navigate back
|
||||
* within the all apps.
|
||||
* In taskbar all apps search mode, we should scale down content inside all apps, rather
|
||||
* than the whole all apps bottom sheet, to indicate we will navigate back within the all apps.
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldAnimateContentViewInBackSwipe() {
|
||||
@@ -309,8 +341,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarOverla
|
||||
@Override
|
||||
public void onBackInvoked() {
|
||||
if (mAllAppsCallbacks.handleSearchBackInvoked()) {
|
||||
// We need to scale back taskbar all apps if we navigate back within search
|
||||
// inside all
|
||||
// We need to scale back taskbar all apps if we navigate back within search inside all
|
||||
// apps
|
||||
post(this::animateSwipeToDismissProgressToStart);
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user