OSDN Git Service

Use Context.getSystemService(Class<T>) for InputManager.
authorYohei Yukawa <yukawa@google.com>
Thu, 26 Nov 2015 04:35:04 +0000 (20:35 -0800)
committerYohei Yukawa <yukawa@google.com>
Thu, 26 Nov 2015 08:02:11 +0000 (00:02 -0800)
This is a mechanical replacement of Context.getSystemService(String)
with Context.getSystemService(Class<T>) when retrieving InputManager.
Note those are bundled code.  Hence we don't need to make sure
Build.VERSION.SDK_INT >= 23.

Change-Id: Iee47e374e1349720e3100bab33ed139e1f47c169

core/java/com/android/internal/widget/PointerLocationView.java
packages/SystemUI/src/com/android/systemui/keyboard/KeyboardUI.java
services/core/java/com/android/server/VibratorService.java

index e339c44..592576b 100644 (file)
@@ -137,7 +137,7 @@ public class PointerLocationView extends View implements InputDeviceListener,
         super(c);
         setFocusableInTouchMode(true);
 
-        mIm = (InputManager)c.getSystemService(Context.INPUT_SERVICE);
+        mIm = c.getSystemService(InputManager.class);
 
         mVC = ViewConfiguration.get(c);
         mTextPaint = new Paint();
index 96ee397..d931856 100644 (file)
@@ -180,7 +180,7 @@ public class KeyboardUI extends SystemUI implements InputManager.OnTabletModeCha
         mProfileManager = bluetoothManager.getProfileManager();
         bluetoothManager.getEventManager().registerCallback(new BluetoothCallbackHandler());
 
-        InputManager im = (InputManager) context.getSystemService(Context.INPUT_SERVICE);
+        InputManager im = context.getSystemService(InputManager.class);
         im.registerOnTabletModeChangedListener(this, mHandler);
         mInTabletMode = im.isInTabletMode();
 
index 9eb66dd..2924cef 100644 (file)
@@ -223,7 +223,7 @@ public class VibratorService extends IVibratorService.Stub
     }
 
     public void systemReady() {
-        mIm = (InputManager)mContext.getSystemService(Context.INPUT_SERVICE);
+        mIm = mContext.getSystemService(InputManager.class);
         mSettingObserver = new SettingsObserver(mH);
 
         mPowerManagerInternal = LocalServices.getService(PowerManagerInternal.class);