Fix Non-builtin Uncached Vibrator Getter

If a non-builtin vibrator was attempted to be fetched, it'd insert it in the vibrator cache and return directly as opposed to playing the vibration on it prior to returning. This has now been fixed, the value is both put into the cache and the vibration is played on it.
This commit is contained in:
PixelyIon 2021-10-26 21:54:00 +05:30
parent dc3f7f1ab4
commit cfdb2abf9e

View File

@ -486,17 +486,18 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
for (id in InputDevice.getDeviceIds()) {
val device = InputDevice.getDevice(id)
if (device.descriptor == inputManager.controllers[index]!!.rumbleDeviceDescriptor) {
vibrators[index] = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
val vibrator = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
device.vibratorManager.defaultVibrator
} else {
@Suppress("DEPRECATION")
device.vibrator
device.vibrator!!
}
vibrators[index] = vibrator
return@let vibrator
}
}
}
}
}
return
} as Vibrator
}
val effect = VibrationEffect.createWaveform(timing, amplitude, 0)