Fix issue with onPause trying to cancel vibration when user has not defined Vibration Service permission in manifest.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9716 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
5a71423624
commit
d2b97fb422
@ -87,6 +87,7 @@ public class AndroidSensorJoyInput implements JoyInput, SensorEventListener {
|
||||
private InputManager inputManager = null;
|
||||
private SensorManager sensorManager = null;
|
||||
private Vibrator vibrator = null;
|
||||
private boolean vibratorActive = false;
|
||||
private long maxRumbleTime = 250; // 250ms
|
||||
private RawInputListener listener = null;
|
||||
private IntMap<SensorData> sensors = new IntMap<SensorData>();
|
||||
@ -299,7 +300,7 @@ public class AndroidSensorJoyInput implements JoyInput, SensorEventListener {
|
||||
for (Entry entry: sensors) {
|
||||
unRegisterListener(entry.getKey());
|
||||
}
|
||||
if (vibrator != null) {
|
||||
if (vibrator != null && vibratorActive) {
|
||||
vibrator.cancel();
|
||||
}
|
||||
}
|
||||
@ -546,8 +547,10 @@ public class AndroidSensorJoyInput implements JoyInput, SensorEventListener {
|
||||
|
||||
if (rumbleOnDur > 0) {
|
||||
vibrator.vibrate(rumblePattern, rumbleRepeatFrom);
|
||||
vibratorActive = true;
|
||||
} else {
|
||||
vibrator.cancel();
|
||||
vibratorActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user