Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Handle special sensor delay values
Browse files Browse the repository at this point in the history
Refs #1878
  • Loading branch information
M66B committed Aug 15, 2014
1 parent 37df583 commit c97bf84
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/biz/bokhorst/xprivacy/XSensorManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.List;

import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.util.Log;

public class XSensorManager extends XHook {
Expand Down Expand Up @@ -78,7 +79,18 @@ else if (param.args.length > 0 && param.args[0] instanceof Integer)
int type = ((Sensor) param.args[1]).getType();
if (type == Sensor.TYPE_GYROSCOPE || type == Sensor.TYPE_GYROSCOPE_UNCALIBRATED) {
int rateUs = (Integer) param.args[2];
if (rateUs < cMaxRateUs)

// http://developer.android.com/guide/topics/sensors/sensors_overview.html
if (rateUs == SensorManager.SENSOR_DELAY_NORMAL)
return; // 200,000 us
else if (rateUs == SensorManager.SENSOR_DELAY_UI)
return; // 60,000 us
else if (rateUs == SensorManager.SENSOR_DELAY_GAME)
return; // 20,000 us
else if (rateUs == SensorManager.SENSOR_DELAY_FASTEST)
; // 0 us

if (rateUs < cMaxRateUs) // 10,000 us
if (isRestricted(param))
param.args[2] = cMaxRateUs;
}
Expand Down

0 comments on commit c97bf84

Please sign in to comment.