Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec3482c3 authored by LuK1337's avatar LuK1337
Browse files

LineageParts: Switch to (ctx).getSystemService(x.class) everywhere

Change-Id: I16ae2a1c92ced93a3e34c18d90e59ac5ca14c319
parent 703039b4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -772,7 +772,7 @@ public class ContributorsCloudFragment extends Fragment implements SearchView.On
    }

    private boolean hasLargeHeap() {
        ActivityManager am = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE);
        ActivityManager am = getActivity().getSystemService(ActivityManager.class);
        return am.getMemoryClass() >= 96;
    }

+5 −5
Original line number Diff line number Diff line
@@ -101,18 +101,18 @@ public class KeyHandler implements DeviceKeyHandler {
    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, "LineagePartsGestureWakeLock");

        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);

        final Resources resources = mContext.getResources();
        mProximityWakeSupported = resources.getBoolean(
@@ -124,7 +124,7 @@ public class KeyHandler implements DeviceKeyHandler {
            mDefaultProximity = mContext.getResources().getBoolean(
                    org.lineageos.platform.internal.R.bool.config_proximityCheckOnWakeEnabledByDefault);

            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, "LineagePartsProximityWakeLock");
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ public class ReportingService extends IntentService {

    @Override
    protected void onHandleIntent(Intent intent) {
        JobScheduler js = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
        JobScheduler js = getSystemService(JobScheduler.class);

        String deviceId = Utilities.getUniqueID(getApplicationContext());
        String deviceName = Utilities.getDevice();
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public class ReportingServiceManager extends BroadcastReceiver {
        Intent intent = new Intent(ACTION_LAUNCH_SERVICE);
        intent.setClass(context, ReportingServiceManager.class);

        AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        AlarmManager alarmManager = context.getSystemService(AlarmManager.class);
        alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + millisFromNow,
                PendingIntent.getBroadcast(context, 0, intent, 0));
        Log.d(TAG, "Next sync attempt in : "
+3 −3
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ public class Utilities {
    }

    public static String getCarrier(Context context) {
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        TelephonyManager tm = context.getSystemService(TelephonyManager.class);
        String carrier = tm.getNetworkOperatorName();
        if (TextUtils.isEmpty(carrier)) {
            carrier = "Unknown";
@@ -45,7 +45,7 @@ public class Utilities {
    }

    public static String getCarrierId(Context context) {
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        TelephonyManager tm = context.getSystemService(TelephonyManager.class);
        String carrierId = tm.getNetworkOperator();
        if (TextUtils.isEmpty(carrierId)) {
            carrierId = "0";
@@ -54,7 +54,7 @@ public class Utilities {
    }

    public static String getCountryCode(Context context) {
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        TelephonyManager tm = context.getSystemService(TelephonyManager.class);
        String countryCode = tm.getNetworkCountryIso();
        if (TextUtils.isEmpty(countryCode)) {
            countryCode = "Unknown";
Loading