Create a hidden Vibrator API for haptic feedback.
Haptic feedbacks are played on a View (via the performHapticFeedback API in the View class). This API used to go through the window manager code space to derive the vibration effect/attribute for a given haptic feedback ID, and use the vibrator to play the corresponding vibration. To remove dependency on window manager, we are creating a hidden API in Vibrator that will handle performing haptic feedback. View can pass a haptic feedback request directly to this new Vibrator API (after making sure that the View is attached to a window), and this API will handle creating the vibration effect/attribute for the haptic feedback and playing it, all without requiring the VIBRATE permission. We are guarding View's direct call to the Vibrator API with a new vibrator flag. Once this implementation has been seen to be stable, we will remove the haptic feedback code in the window manager code space. Test: atest VibratorManagerServiceTest Test: atest HapticFeedbackVibrationProviderTest Test: sample test app without VIBRATE permission plays haptic feedback Bug: 295459081 Change-Id: Ic4d226f724bf0591bad9f465a4872a41ddca2c60
Loading
Please register or sign in to comment