Cache result from VibratorService.hasVibrator in SystemVibrator

The existing implementation of performHapticFeedback in
PhoneWindowManager uses both hasVibrator and vibrate methods from
Vibrator class. The implementation of VibratorService.hasVibrator is
already constant, returning true if the device has a built in vibrator.

This adds a cache for this value to SystemVibrator, to avoid binder
calls to system_server after the first one.

Bug: 170127981
Test: manual
Change-Id: I68934a41068f4388449321d08a42d8bf890ea91e
1 file changed