在frameworks/base/libs/androidfw/VelocityTracker.cpp VelocityTrackerStrategy* VelocityTracker::createStrategy(const char* strategy) {     if (!strcmp("lsq1", strategy)) {         // 1st order least squares.  Quality: POOR.         // Frequently underfits the touch data especially when the finger accelerates         // or changes direction.  Often underestimates velocity.  The direction         // is overly influenced by historical touch points.         return new LeastSquaresVelocityTrackerStrategy(1);     }     if (!strcmp("lsq2", strategy)) {         // 2nd order least squares.  Quality: VERY GOOD.         // Pretty much ideal, but can be confused by certain kinds of touch data,         // particularly if the panel has a tendency to generate delayed,         // duplicate or jittery touch coordinates when the finger is released.         return new LeastSquaresVelocityTrackerStrategy(2);     }     if (!strcmp("lsq3", strategy)) {         // 3rd order least squares.  Quality: UNUSABLE.         // Frequently overfits the touch data yielding wildly divergent estimates         // of the velocity when the finger is released.         return new LeastSquaresVelocityTrackerStrategy(3);     }     if (!strcmp("wlsq2-delta", strategy)) {         // 2nd order weighted least squares, delta weighting.  Quality: EXPERIMENTAL         return new LeastSquaresVelocityTrackerStrategy(2,                 LeastSquaresVelocityTrackerStrategy::WEIGHTING_DELTA);     }     if (!strcmp("wlsq2-central", strategy)) {         // 2nd order weighted least squares, central weighting.  Quality: EXPERIMENTAL         return new LeastSquaresVelocityTrackerStrategy(2,                 LeastSquaresVelocityTrackerStrategy::WEIGHTING_CENTRAL);     }     if (!strcmp("wlsq2-recent", strategy)) {         // 2nd order weighted least squares, recent weighting.  Quality: EXPERIMENTAL         return new LeastSquaresVelocityTrackerStrategy(2,                 LeastSquaresVelocityTrackerStrategy::WEIGHTING_RECENT);     }     if (!strcmp("int1", strategy)) {         // 1st order integrating filter.  Quality: GOOD.         // Not as good as 'lsq2' because it cannot estimate acceleration but it is         // more tolerant of errors.  Like 'lsq1', this strategy tends to underestimate         // the velocity of a fling but this strategy tends to respond to changes in         // direction more quickly and accurately.         return new IntegratingVelocityTrackerStrategy(1);     }     if (!strcmp("int2", strategy)) {         // 2nd order integrating filter.  Quality: EXPERIMENTAL.         // For comparison purposes only.  Unlike 'int1' this strategy can compensate         // for acceleration but it typically overestimates the effect.         return new IntegratingVelocityTrackerStrategy(2);     }     if (!strcmp("legacy", strategy)) {         // Legacy velocity tracker algorithm.  Quality: POOR.         // For comparison purposes only.  This algorithm is strongly influenced by         // old data points, consistently underestimates velocity and takes a very long         // time to adjust to changes in direction.         return new LegacyVelocityTrackerStrategy();     }     return NULL; }
默认策略是: const char* VelocityTracker::DEFAULT_STRATEGY = "lsq2";
可通过 property "debug.velocitytracker.strategy" 修改。如修改为lsq1 。这个需要和kernel中的TP驱动一起调试, lsq2是最优效果,表示上报的速度是一个抛物线;lsq1上报的速度是一个加速度直线。这个需要和kernel上报一致。才能触动流畅。
 VelocityTracker::VelocityTracker(const char* strategy) :          mLastEventTime(0), mCurrentPointerIdBits(0), mActivePointerId(-1) {      char value[PROPERTY_VALUE_MAX];        // Allow the default strategy to be overridden using a system property for debugging.      if (!strategy) {          int length = property_get("debug.velocitytracker.strategy", value, NULL);          if (length > 0) {              strategy = value;          } else {              strategy = DEFAULT_STRATEGY;          }      }        // Configure the strategy.      if (!configureStrategy(strategy)) {          ALOGD("Unrecognized velocity tracker strategy name '%s'.", strategy);          if (!configureStrategy(DEFAULT_STRATEGY)) {              LOG_ALWAYS_FATAL("Could not create the default velocity tracker strategy '%s'!",                      strategy);          }      }  }  

更多相关文章

  1. 浅谈Android开机启动速度优化(含应用程序启动速度优化)
  2. android sdk 更新速度慢的解决办法
  3. Android_开发 Android传感器(加速度传感器,磁场传感器,光线传感器,方
  4. Android官方离线文档(API文档)打开速度慢的解决方法
  5. android视频开发倍速播放,调整视频播放速度
  6. Android 中支持的几种传感器(加速度、陀螺仪、亮度、地磁、方向
  7. 解决官网下载Android Studio速度过慢

随机推荐

  1. (lintcode)第463题整数排序
  2. (lintcode)第8题旋转字符串
  3. (lintcode)第20题 骰子求和
  4. (六)高并发redis学习笔记:redis的RDB持久化
  5. (lintcode)第7题二叉树的序列化和反序列
  6. (lintcode)第22题 平面列表
  7. Mybatis创建SqlSession的源码分析
  8. (lintcode)第15题 全排列(没有重复数字)
  9. (lintcode)第17题 子集
  10. (lintcode)第9题Fizz Buee问题