Merge "Fix jank when launching the All set page on devices that support vibrations" into tm-dev am: 160b18ab57 am: d8e7c1acdd
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/18310268 Change-Id: Idd2f7d5d560d4acb9214b55d454295d874c89703 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
2d623277ea
1 file changed
+9
-4
@@ -54,6 +54,7 @@ import androidx.core.graphics.ColorUtils;
|
|||||||
import com.android.launcher3.InvariantDeviceProfile;
|
import com.android.launcher3.InvariantDeviceProfile;
|
||||||
import com.android.launcher3.R;
|
import com.android.launcher3.R;
|
||||||
import com.android.launcher3.Utilities;
|
import com.android.launcher3.Utilities;
|
||||||
|
import com.android.launcher3.util.Executors;
|
||||||
import com.android.quickstep.AnimatedFloat;
|
import com.android.quickstep.AnimatedFloat;
|
||||||
import com.android.quickstep.GestureState;
|
import com.android.quickstep.GestureState;
|
||||||
import com.android.quickstep.TouchInteractionService.TISBinder;
|
import com.android.quickstep.TouchInteractionService.TISBinder;
|
||||||
@@ -136,6 +137,10 @@ public class AllSetActivity extends Activity {
|
|||||||
startBackgroundAnimation();
|
startBackgroundAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void runOnUiHelperThread(Runnable runnable) {
|
||||||
|
Executors.UI_HELPER_EXECUTOR.execute(runnable);
|
||||||
|
}
|
||||||
|
|
||||||
private void startBackgroundAnimation() {
|
private void startBackgroundAnimation() {
|
||||||
if (Utilities.ATLEAST_S && mVibrator != null && mVibrator.areAllPrimitivesSupported(
|
if (Utilities.ATLEAST_S && mVibrator != null && mVibrator.areAllPrimitivesSupported(
|
||||||
VibrationEffect.Composition.PRIMITIVE_THUD)) {
|
VibrationEffect.Composition.PRIMITIVE_THUD)) {
|
||||||
@@ -144,22 +149,22 @@ public class AllSetActivity extends Activity {
|
|||||||
new Animator.AnimatorListener() {
|
new Animator.AnimatorListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(Animator animation) {
|
public void onAnimationStart(Animator animation) {
|
||||||
mVibrator.vibrate(getVibrationEffect());
|
runOnUiHelperThread(() -> mVibrator.vibrate(getVibrationEffect()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationRepeat(Animator animation) {
|
public void onAnimationRepeat(Animator animation) {
|
||||||
mVibrator.vibrate(getVibrationEffect());
|
runOnUiHelperThread(() -> mVibrator.vibrate(getVibrationEffect()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
mVibrator.cancel();
|
runOnUiHelperThread(mVibrator::cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationCancel(Animator animation) {
|
public void onAnimationCancel(Animator animation) {
|
||||||
mVibrator.cancel();
|
runOnUiHelperThread(mVibrator::cancel);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user