Skip to content

Commit

Permalink
Support older nokiaui versions
Browse files Browse the repository at this point in the history
  • Loading branch information
shinovon committed Apr 7, 2024
1 parent 7982234 commit 2975c76
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/mahomaps/DeviceControlInvoker.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2975c76

Please sign in to comment.