diff --git a/src/mahomaps/DeviceControlInvoker.java b/src/mahomaps/DeviceControlInvoker.java index a5912c4..fa6cf15 100644 --- a/src/mahomaps/DeviceControlInvoker.java +++ b/src/mahomaps/DeviceControlInvoker.java @@ -4,21 +4,30 @@ public class DeviceControlInvoker { - public static boolean supported; + public static boolean screenSaverPreventionSupported; + public static boolean setLightsSupported; static { try { + Class.forName("com.nokia.mid.ui.DeviceControl"); + setLightsSupported = true; if (System.getProperty("com.nokia.mid.ui.version") != null && System.getProperty("com.nokia.mid.ui.screensaverprevention") != null) { - Class.forName("com.nokia.mid.ui.DeviceControl"); - supported = true; + screenSaverPreventionSupported = true; } } catch (Exception e) { } } public static void resetUserInactivityTime() { - if (!supported) return; + if (!screenSaverPreventionSupported) { + if(!setLightsSupported) return; + try { + DeviceControl.setLights(0, 100); + } catch (Throwable e) { + } + return; + } try { DeviceControl.resetUserInactivityTime(); } catch (Throwable e) {