From 20aeddd853c3681ee31a34a7228979689eda5b63 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 17 Apr 2020 16:16:44 -0700 Subject: [PATCH] Dedupe non-perceptable depth updates Bug: 154304487 Change-Id: I6d96aca555932f4a51aed576d25f7150952bb562 --- .../android/launcher3/statehandlers/DepthController.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java index f83737ef9f..5f5d6dc1f9 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java @@ -177,7 +177,14 @@ public class DepthController implements LauncherStateManager.StateHandler { } private void setDepth(float depth) { - mDepth = depth; + // Round out the depth to dedupe frequent, non-perceptable updates + int depthI = (int) (depth * 256); + float depthF = depthI / 256f; + if (Float.compare(mDepth, depthF) == 0) { + return; + } + + mDepth = depthF; if (mSurface == null || !mSurface.isValid()) { return; }