由于为了设备流畅把所有动画效果设置为0.5,不设置为0是因为锁屏在开机时会有闪黑屏的现象。在此背景下,测试发现在拖动桌面图标时,在图标动画过程中错位时释放图标,则图标会留在错位的位置,不会自动对齐。
原因就是动画导致的,追踪动画的代码非常困难,只能通过各种anima关键词添加log,找到触发的位置进行逻辑修改。
最终发现是拖动时会有上下振动的动画效果,去掉即可。
标志位FeatureFlags.REMOVE_DRAWER控制,默认true。
Index: packages/apps/Launcher3/src/com/android/launcher3/CellLayout.java
===================================================================
--- packages/apps/Launcher3/src/com/android/launcher3/CellLayout.java (版本 4536)
+++ packages/apps/Launcher3/src/com/android/launcher3/CellLayout.java (版本 4537)
@@ -2210,7 +2210,7 @@
// Animations are disabled in power save mode, causing the repeated animation to jump
// spastically between beginning and end states. Since this looks bad, we don't repeat
// the animation in power save mode.
- if (areAnimatorsEnabled()) {
+ if (areAnimatorsEnabled() && !FeatureFlags.REMOVE_DRAWER) { // @ modify for BUG #
va.setRepeatMode(ValueAnimator.REVERSE);
va.setRepeatCount(ValueAnimator.INFINITE);
}