Skip to content

Commit

Permalink
TouchGestures: Switch to (ctx).getSystemService(x.class) everywhere
Browse files Browse the repository at this point in the history
Change-Id: I16ae2a1c92ced93a3e34c18d90e59ac5ca14c319
  • Loading branch information
luk1337 authored and SKULSHADY committed Feb 20, 2020
1 parent b8cfe86 commit 1499ee5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/com/android/touch/gestures/KeyHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 1499ee5

Please sign in to comment.