example.platform.power/src/example/platform/power/ExamplePlatformPowerManager.java
@Override
    public long activateWakeLock(WakeLock lock, long startLockTimeMs, long stopLockTimeMs)
    {
        ExamplePowerManagerMethodLog methodLog = new ExamplePowerManagerMethodLog();
        methodLog.setWakeLockId(lock.getId());
        methodLog.setStartTimeMs(startLockTimeMs);
        methodLog.setEndtimeMs(stopLockTimeMs);                
        logMethodCall(lock.getId(), methodLog, ExamplePowerManagerMethodLog.MethodCalled.Activate);

        Calendar calendar = Calendar.getInstance();        
        long currentTimeMs = calendar.getTimeInMillis();
        long duration = stopLockTimeMs - startLockTimeMs;
        
        if (duration < 0)
        {
            duration = PlatformPowerManager.INDEFINITE;
        }
        
        if (duration < m_MinWakeTimeMs && duration > 0)
        {
            duration = m_MinWakeTimeMs;
        }
        
        if(startLockTimeMs <= currentTimeMs)
        {
            m_Logging.debug("Start time [%s] less than current time [%s]. Activating lock now.", 
                    startLockTimeMs, currentTimeMs);
            m_ExamplePlatformKernel.activateWakelock(lock, duration);
        }
        else
        {
            m_Logging.debug("Start time [%s] is in the future. Scheduling lock activation for the future.", 
                    startLockTimeMs);
            m_ExamplePlatformKernel.scheduleWakelock(lock, startLockTimeMs, duration);
        }
        
        m_Logging.log(LogService.LOG_INFO, "WakeLock [%s] will be active for %d ms.", lock.getId(), duration);
        return duration;
    }
/**
     * Calls the OS/hardware code to activate a WakeLock for a given time, preventing the system from going into low
     * powered more. Having one or more WakeLoacks active will prevent the OS/hardware from going into low power 
     * standby mode.
     */
Calls the OS/hardware code to activate a WakeLock for a given time, preventing the system from going into low
powered more. Having one or more WakeLoacks active will prevent the OS/hardware from going into low power
standby mode.
Calls the OS / hardware code to activate a WakeLock for a given time preventing the system from going into low powered more . Having one or more WakeLoacks active will prevent the OS / hardware from going into low power standby mode .
@Override
    public long activateWakeLock(WakeLock lock, long startLockTimeMs, long stopLockTimeMs)
    {
        ExamplePowerManagerMethodLog methodLog = new ExamplePowerManagerMethodLog();
        methodLog.setWakeLockId(lock.getId());
        methodLog.setStartTimeMs(startLockTimeMs);
        methodLog.setEndtimeMs(stopLockTimeMs);                
        logMethodCall(lock.getId(), methodLog, ExamplePowerManagerMethodLog.MethodCalled.Activate);
        Calendar calendar = Calendar.getInstance();        
        long currentTimeMs = calendar.getTimeInMillis();
        long duration = stopLockTimeMs - startLockTimeMs;
        if (duration < 0)
        {
            duration = PlatformPowerManager.INDEFINITE;
        }
        if (duration < m_MinWakeTimeMs && duration > 0)
        {
            duration = m_MinWakeTimeMs;
        }
        if(startLockTimeMs <= currentTimeMs)
        {
            m_Logging.debug("Start time [%s] less than current time [%s]. Activating lock now.", 
                    startLockTimeMs, currentTimeMs);
            m_ExamplePlatformKernel.activateWakelock(lock, duration);
        }
        else
        {
            m_Logging.debug("Start time [%s] is in the future. Scheduling lock activation for the future.", 
                    startLockTimeMs);
            m_ExamplePlatformKernel.scheduleWakelock(lock, startLockTimeMs, duration);
        }
        m_Logging.log(LogService.LOG_INFO, "WakeLock [%s] will be active for %d ms.", lock.getId(), duration);
        return duration;
    }
@ Override public long activateWakeLock ( WakeLock lock , long startLockTimeMs , long stopLockTimeMs ) { ExamplePowerManagerMethodLog methodLog = new ExamplePowerManagerMethodLog ( ) ; methodLog . setWakeLockId ( lock . getId ( ) ) ; methodLog . setStartTimeMs ( startLockTimeMs ) ; methodLog . setEndtimeMs ( stopLockTimeMs ) ; logMethodCall ( lock . getId ( ) , methodLog , ExamplePowerManagerMethodLog . MethodCalled . Activate ) ; Calendar calendar = Calendar . getInstance ( ) ; long currentTimeMs = calendar . getTimeInMillis ( ) ; long duration = stopLockTimeMs - startLockTimeMs ; if ( duration < 0 ) { duration = PlatformPowerManager . INDEFINITE ; } if ( duration < m_MinWakeTimeMs && duration > 0 ) { duration = m_MinWakeTimeMs ; } if ( startLockTimeMs <= currentTimeMs ) { m_Logging . debug ( "Start time [%s] less than current time [%s]. Activating lock now." , startLockTimeMs , currentTimeMs ) ; m_ExamplePlatformKernel . activateWakelock ( lock , duration ) ; } else { m_Logging . debug ( "Start time [%s] is in the future. Scheduling lock activation for the future." , startLockTimeMs ) ; m_ExamplePlatformKernel . scheduleWakelock ( lock , startLockTimeMs , duration ) ; } m_Logging . log ( LogService . LOG_INFO , "WakeLock [%s] will be active for %d ms." , lock . getId ( ) , duration ) ; return duration ; }
Calls the OS/hardware code to activate a WakeLock for a given time, preventing the system from going into low
 powered more.
Calls the OS / hardware code to activate a WakeLock for a given time preventing the system from going into low powered more .