android: vibrate out of the synchronized section

This commit is contained in:
Flyinghead 2019-04-03 18:49:40 +02:00
parent 2d03662a9a
commit cc26e255e0
1 changed files with 5 additions and 1 deletions

View File

@ -415,16 +415,20 @@ public class VirtualJoystickDelegate {
@Override
public void run() {
while (!stopping) {
boolean doVibrate;
synchronized (this) {
doVibrate = false;
try {
this.wait();
} catch (InterruptedException e) {
}
if (vibrate) {
vibrator.vibrate(Emulator.vibrationDuration);
doVibrate = true;
vibrate = false;
}
}
if (doVibrate)
vibrator.vibrate(Emulator.vibrationDuration);
}
}