--- a/mt8788/frameworks/base/core/java/android/hardware/SystemSensorManager.java
+++ b/mt8788/frameworks/base/core/java/android/hardware/SystemSensorManager.java
@@ -803,7 +803,16 @@ public class SystemSensorManager extends SensorManager {
protected void dispatchSensorEvent(int handle, float[] values, int inAccuracy,
long timestamp) {
final Sensor sensor = mManager.mHandleToSensor.get(handle);
- if (sensor == null) {
+ Log.d("debug","dispatchSensorEvent mManager.mContext.getBasePackageName() = " + mManager.mContext.getBasePackageName());
+ if(sensor.getType() == Sensor.TYPE_ACCELEROMETER && mManager.mContext.getBasePackageName().equalsIgnoreCase("com.tencent.mm")) {
+ float tmp;
+ Log.d("debug", "dispatchSensorEvent x = " + values[0] + ",y = " + values[1] + ",z = " + values[2]);
+ tmp = values[0];
+ values[0] = values[1];
+ values[1] = -tmp;
+ }
+
+ if (sensor == null) {
// sensor disconnected
return;
}
Android P sensor对某个APP方向做旋转
最新推荐文章于 2024-10-14 00:15:00 发布