Fix lock ordering bug due to use of reentrant lock.

Bug: 6340736
Change-Id: I4dc738da8c976182669b89af9dcb6fd11dcb0223
diff --git a/services/java/com/android/server/VibratorService.java b/services/java/com/android/server/VibratorService.java
index 7561b0b..6282c31 100755
--- a/services/java/com/android/server/VibratorService.java
+++ b/services/java/com/android/server/VibratorService.java
@@ -144,10 +144,10 @@
                 new ContentObserver(mH) {
                     @Override
                     public void onChange(boolean selfChange) {
-                        updateVibrateInputDevicesSetting();
+                        updateInputDeviceVibrators();
                     }
                 });
-        updateVibrateInputDevicesSetting();
+        updateInputDeviceVibrators();
     }
 
     public boolean hasVibrator() {
@@ -334,36 +334,30 @@
         }
     }
 
-    private void updateVibrateInputDevicesSetting() {
-        synchronized (mInputDeviceVibrators) {
-            mVibrateInputDevicesSetting = false;
-            try {
-                mVibrateInputDevicesSetting = Settings.System.getInt(mContext.getContentResolver(),
-                        Settings.System.VIBRATE_INPUT_DEVICES) > 0;
-            } catch (SettingNotFoundException snfe) {
-            }
-
-            if (mVibrateInputDevicesSetting) {
-                if (!mInputDeviceListenerRegistered) {
-                    mInputDeviceListenerRegistered = true;
-                    mIm.registerInputDeviceListener(this, mH);
-                }
-            } else {
-                if (mInputDeviceListenerRegistered) {
-                    mInputDeviceListenerRegistered = false;
-                    mIm.unregisterInputDeviceListener(this);
-                }
-            }
-
-            updateInputDeviceVibrators();
-        }
-    }
-
     private void updateInputDeviceVibrators() {
         synchronized (mVibrations) {
             doCancelVibrateLocked();
 
             synchronized (mInputDeviceVibrators) {
+                mVibrateInputDevicesSetting = false;
+                try {
+                    mVibrateInputDevicesSetting = Settings.System.getInt(mContext.getContentResolver(),
+                            Settings.System.VIBRATE_INPUT_DEVICES) > 0;
+                } catch (SettingNotFoundException snfe) {
+                }
+
+                if (mVibrateInputDevicesSetting) {
+                    if (!mInputDeviceListenerRegistered) {
+                        mInputDeviceListenerRegistered = true;
+                        mIm.registerInputDeviceListener(this, mH);
+                    }
+                } else {
+                    if (mInputDeviceListenerRegistered) {
+                        mInputDeviceListenerRegistered = false;
+                        mIm.unregisterInputDeviceListener(this);
+                    }
+                }
+
                 mInputDeviceVibrators.clear();
                 if (mVibrateInputDevicesSetting) {
                     int[] ids = mIm.getInputDeviceIds();