Fix All Apps interpolators and blur.
Fixes an issue where leaving All Apps did not reverse interpolators, causing blur to disappear too quickly. In addition, the logic in BaseDepthController is updated to ensure 100% blur is applied upon reaching max depth. Previously we were multiplying the depth by 3, but the intention was to reach 1 when depth reached 0.3. So the blur was only at 90% the intended value in All Apps (which has a depth of 0.3). Finally, related to the 100% blur, we correctly end early wakeup when that is reached, which means we also start it again when the blur starts changing back towards 0 again. This spins up the GPU, CPU, and SurfaceFlinger and should help avoid missed frames. In order to avoid negative performance hits, reducing the max blur radius from 34dp to 30dp, so that it matches what we were hitting previously. (The full 34dp unfortunately does cause some regressions). Bug: 415247657 Test: Open all apps, drag back down, view animation. Also try other Launcher state transitions. Flag: com.android.launcher3.all_apps_blur Change-Id: Ia5daa07525ac96c0597a25bb4320348f27a4ee56
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
<string name="wellbeing_provider_pkg" translatable="false"/>
|
||||
|
||||
<integer name="max_depth_blur_radius">23</integer>
|
||||
<dimen name="max_depth_blur_radius_enhanced">34dp</dimen>
|
||||
<dimen name="max_depth_blur_radius_enhanced">30dp</dimen>
|
||||
|
||||
<!-- If predicted widgets from prediction service are less than this number, additional
|
||||
eligible widgets may be added locally by launcher. When set to 0, no widgets will be added
|
||||
|
||||
@@ -37,6 +37,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
@@ -250,7 +251,8 @@ public class BaseDepthController {
|
||||
int previousBlur = mCurrentBlur;
|
||||
int newBlur = mBlursEnabled && !hasOpaqueBg ? (int) (blurAmount * mMaxBlurRadius) : 0;
|
||||
int delta = Math.abs(newBlur - previousBlur);
|
||||
if (skipSimilarBlur && delta < Utilities.dpToPx(1) && newBlur != 0 && previousBlur != 0) {
|
||||
if (skipSimilarBlur && delta < Utilities.dpToPx(1) && newBlur != 0 && previousBlur != 0
|
||||
&& blurAmount != 1f) {
|
||||
Log.d(TAG, "Skipping small blur delta. newBlur: " + newBlur + " previousBlur: "
|
||||
+ previousBlur + " delta: " + delta + " surface: " + blurSurface);
|
||||
return;
|
||||
@@ -265,7 +267,7 @@ public class BaseDepthController {
|
||||
.setOpaque(blurSurface, isSurfaceOpaque);
|
||||
// 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 = depth > 0 && depth < 1;
|
||||
boolean wantsEarlyWakeUp = blurAmount > 0 && blurAmount < 1;
|
||||
if (wantsEarlyWakeUp && !mInEarlyWakeUp) {
|
||||
setEarlyWakeup(finalTransaction, true);
|
||||
} else if (!wantsEarlyWakeUp && mInEarlyWakeUp) {
|
||||
@@ -311,6 +313,7 @@ public class BaseDepthController {
|
||||
if (mInEarlyWakeUp == start) {
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "setEarlyWakeup: " + start);
|
||||
if (start) {
|
||||
Trace.instantForTrack(TRACE_TAG_APP, TAG, "notifyRendererForGpuLoadUp");
|
||||
mLauncher.getRootView().getViewRootImpl().notifyRendererForGpuLoadUp("applyBlur");
|
||||
@@ -341,9 +344,18 @@ public class BaseDepthController {
|
||||
|
||||
private void setDepth(float depth) {
|
||||
depth = Utilities.boundToRange(depth, 0, 1);
|
||||
// Round out the depth to dedupe frequent, non-perceptable updates
|
||||
int depthI = (int) (depth * 256);
|
||||
float depthF = depthI / 256f;
|
||||
// Depth of the Launcher state we are in or transitioning to.
|
||||
float targetStateDepth = mLauncher.getStateManager().getState().getDepth(mLauncher);
|
||||
|
||||
float depthF;
|
||||
if (depth == targetStateDepth) {
|
||||
// Always apply the target state depth.
|
||||
depthF = depth;
|
||||
} else {
|
||||
// Round out the depth to dedupe frequent, non-perceptable updates
|
||||
int depthI = (int) (depth * 256);
|
||||
depthF = depthI / 256f;
|
||||
}
|
||||
if (Float.compare(mDepth, depthF) == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -416,7 +428,7 @@ public class BaseDepthController {
|
||||
* The blur percentage grows linearly with depth, and maxes out at 30% depth.
|
||||
*/
|
||||
private static float mapDepthToBlur(float depth) {
|
||||
return Math.min(3 * depth, 1f);
|
||||
return Interpolators.clampToProgress(depth, 0, 0.3f);
|
||||
}
|
||||
|
||||
private SurfaceControl.Transaction createTransaction() {
|
||||
|
||||
@@ -209,9 +209,10 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController {
|
||||
if (!config.isUserControlled()) {
|
||||
config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED);
|
||||
}
|
||||
config.setInterpolator(ANIM_WORKSPACE_SCALE, ALL_APPS_SHEET_DEPTH);
|
||||
config.setInterpolator(ANIM_HOTSEAT_SCALE, ALL_APPS_SHEET_DEPTH);
|
||||
config.setInterpolator(ANIM_DEPTH, ALL_APPS_SHEET_DEPTH);
|
||||
config.setInterpolator(ANIM_WORKSPACE_SCALE,
|
||||
Interpolators.reverse(ALL_APPS_SHEET_DEPTH));
|
||||
config.setInterpolator(ANIM_HOTSEAT_SCALE, Interpolators.reverse(ALL_APPS_SHEET_DEPTH));
|
||||
config.setInterpolator(ANIM_DEPTH, Interpolators.reverse(ALL_APPS_SHEET_DEPTH));
|
||||
if (!Flags.allAppsBlur() && launcher.getDeviceProfile().isPhone) {
|
||||
// On phones without blur, reveal the workspace and hotseat when leaving All Apps.
|
||||
config.setInterpolator(ANIM_WORKSPACE_FADE, INSTANT);
|
||||
|
||||
Reference in New Issue
Block a user