在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
  2. android 自定义toggle Button按钮
  3. Android4.0中修改挂断键(ENDCALL)的默认行为
  4. android 源码的一些修改定制方案
  5. 更换工程的sdk或者google apis
  6. Android(安卓)Studio 编译 ApiDemos
  7. android充电指示灯颜色修改
  8. Android_开发 Android传感器(加速度传感器,磁场传感器,光线传感器,方
  9. Android(安卓)Studio中实战演练——绿豆通讯录

随机推荐

  1. Android(安卓)判断网络类型2G,3G,4G,WIFI
  2. Android(安卓)UI开发第四十一篇——墨迹
  3. Android开发中如何使用绘制图表
  4. Android学习笔记(1)——什么是Android
  5. 基于 Android NDK 的学习之旅-----HelloW
  6. android:handler
  7. Android(安卓)样式的开发
  8. Android NDK简介
  9. Android中实现用命令行同步网络时间
  10. Android(安卓)6.0动态获取权限开源项目