diff --git a/sdk/src/java/org/lineageos/internal/notification/LineageNotificationLights.java b/sdk/src/java/org/lineageos/internal/notification/LineageNotificationLights.java index 73377543..75a325fb 100644 --- a/sdk/src/java/org/lineageos/internal/notification/LineageNotificationLights.java +++ b/sdk/src/java/org/lineageos/internal/notification/LineageNotificationLights.java @@ -1,6 +1,6 @@ /** * Copyright (C) 2015 The CyanogenMod Project - * Copyright (C) 2017 The LineageOS Project + * Copyright (C) 2017-2018 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,9 +77,6 @@ public final class LineageNotificationLights { private int mZenMode; - // For checking lockscreen status - private KeyguardManager mKeyguardManager; - private final SettingsObserver mSettingsObserver; private final Context mContext; @@ -122,9 +119,6 @@ public final class LineageNotificationLights { mPackageNameMappings.put(map[0], map[1]); } - mKeyguardManager = - (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE); - mSettingsObserver = new SettingsObserver(new Handler()); mSettingsObserver.observe(); } @@ -138,7 +132,8 @@ public final class LineageNotificationLights { // when lights should / should not be cleared. // TODO: put this somewhere else public boolean isKeyguardLocked() { - return mKeyguardManager != null && mKeyguardManager.isKeyguardLocked(); + KeyguardManager keyguardManager = mContext.getSystemService(KeyguardManager.class); + return keyguardManager != null && keyguardManager.isKeyguardLocked(); } private void parseNotificationPulseCustomValuesString(String customLedValuesString) {