diff options
-rw-r--r-- | services/java/com/android/server/LightsService.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/services/java/com/android/server/LightsService.java b/services/java/com/android/server/LightsService.java index e057f33..7c0a80e 100644 --- a/services/java/com/android/server/LightsService.java +++ b/services/java/com/android/server/LightsService.java @@ -23,7 +23,6 @@ import android.os.IHardwareService; import android.os.ServiceManager; import android.os.Message; import android.util.Slog; -import android.util.Log; import java.io.File; import java.io.FileInputStream; @@ -62,6 +61,17 @@ public class LightsService { private final Light mLights[] = new Light[LIGHT_ID_COUNT]; + private static final String FLASHLIGHT_FILE; + private static final String FLASHLIGHT_FILE_SPOTLIGHT = "/sys/class/leds/spotlight/brightness"; + static { + File ff = new File(FLASHLIGHT_FILE_SPOTLIGHT); + if (ff.exists()) { + FLASHLIGHT_FILE = FLASHLIGHT_FILE_SPOTLIGHT; + } else { + FLASHLIGHT_FILE = "/sys/class/leds/flashlight/brightness"; + } + } + public final class Light { private Light(int id) { @@ -149,8 +159,6 @@ public class LightsService { */ private final IHardwareService.Stub mLegacyFlashlightHack = new IHardwareService.Stub() { - private static final String FLASHLIGHT_FILE = "/sys/class/leds/spotlight/brightness"; - public boolean getFlashlightEnabled() { try { FileInputStream fis = new FileInputStream(FLASHLIGHT_FILE); |