From 1499ee577a958dbcdb870664fece24f615e68fae Mon Sep 17 00:00:00 2001 From: LuK1337 Date: Mon, 13 Jan 2020 23:37:42 +0100 Subject: [PATCH] TouchGestures: Switch to (ctx).getSystemService(x.class) everywhere Change-Id: I16ae2a1c92ced93a3e34c18d90e59ac5ca14c319 --- src/com/android/touch/gestures/KeyHandler.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/com/android/touch/gestures/KeyHandler.java b/src/com/android/touch/gestures/KeyHandler.java index 467d68c..cf6bbc8 100644 --- a/src/com/android/touch/gestures/KeyHandler.java +++ b/src/com/android/touch/gestures/KeyHandler.java @@ -98,21 +98,21 @@ public void onReceive(Context context, Intent intent) { public KeyHandler(final Context context) { mContext = context; - mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); + mAudioManager = mContext.getSystemService(AudioManager.class); - mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); + mPowerManager = context.getSystemService(PowerManager.class); mGestureWakeLock = mPowerManager.newWakeLock( PowerManager.PARTIAL_WAKE_LOCK, "TouchscreenGestureWakeLock"); mEventHandler = new EventHandler(); - mCameraManager = (CameraManager) mContext.getSystemService(Context.CAMERA_SERVICE); + mCameraManager = mContext.getSystemService(CameraManager.class); mCameraManager.registerTorchCallback(new TorchModeCallback(), mEventHandler); - mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); + mVibrator = context.getSystemService(Vibrator.class); if (mProximitySensor != null) { - mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); + mSensorManager = context.getSystemService(SensorManager.class); mProximitySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); mProximityWakeLock = mPowerManager.newWakeLock( PowerManager.PARTIAL_WAKE_LOCK, "TouchscreenGestureProximityWakeLock");