@@ -144,10 +144,10 @@ public void systemReady() {
144144 new ContentObserver (mH ) {
145145 @ Override
146146 public void onChange (boolean selfChange ) {
147- updateVibrateInputDevicesSetting ();
147+ updateInputDeviceVibrators ();
148148 }
149149 });
150- updateVibrateInputDevicesSetting ();
150+ updateInputDeviceVibrators ();
151151 }
152152
153153 public boolean hasVibrator () {
@@ -334,36 +334,30 @@ private void unlinkVibration(Vibration vib) {
334334 }
335335 }
336336
337- private void updateVibrateInputDevicesSetting () {
338- synchronized (mInputDeviceVibrators ) {
339- mVibrateInputDevicesSetting = false ;
340- try {
341- mVibrateInputDevicesSetting = Settings .System .getInt (mContext .getContentResolver (),
342- Settings .System .VIBRATE_INPUT_DEVICES ) > 0 ;
343- } catch (SettingNotFoundException snfe ) {
344- }
345-
346- if (mVibrateInputDevicesSetting ) {
347- if (!mInputDeviceListenerRegistered ) {
348- mInputDeviceListenerRegistered = true ;
349- mIm .registerInputDeviceListener (this , mH );
350- }
351- } else {
352- if (mInputDeviceListenerRegistered ) {
353- mInputDeviceListenerRegistered = false ;
354- mIm .unregisterInputDeviceListener (this );
355- }
356- }
357-
358- updateInputDeviceVibrators ();
359- }
360- }
361-
362337 private void updateInputDeviceVibrators () {
363338 synchronized (mVibrations ) {
364339 doCancelVibrateLocked ();
365340
366341 synchronized (mInputDeviceVibrators ) {
342+ mVibrateInputDevicesSetting = false ;
343+ try {
344+ mVibrateInputDevicesSetting = Settings .System .getInt (mContext .getContentResolver (),
345+ Settings .System .VIBRATE_INPUT_DEVICES ) > 0 ;
346+ } catch (SettingNotFoundException snfe ) {
347+ }
348+
349+ if (mVibrateInputDevicesSetting ) {
350+ if (!mInputDeviceListenerRegistered ) {
351+ mInputDeviceListenerRegistered = true ;
352+ mIm .registerInputDeviceListener (this , mH );
353+ }
354+ } else {
355+ if (mInputDeviceListenerRegistered ) {
356+ mInputDeviceListenerRegistered = false ;
357+ mIm .unregisterInputDeviceListener (this );
358+ }
359+ }
360+
367361 mInputDeviceVibrators .clear ();
368362 if (mVibrateInputDevicesSetting ) {
369363 int [] ids = mIm .getInputDeviceIds ();
0 commit comments