|
|
|
@ -72,6 +72,7 @@ local Device = {
|
|
|
|
|
isGSensorLocked = no,
|
|
|
|
|
canToggleMassStorage = no,
|
|
|
|
|
canToggleChargingLED = no,
|
|
|
|
|
_updateChargingLED = nil,
|
|
|
|
|
canUseWAL = yes, -- requires mmap'ed I/O on the target FS
|
|
|
|
|
canRestart = yes,
|
|
|
|
|
canSuspend = no,
|
|
|
|
@ -1002,6 +1003,9 @@ function Device:_UIManagerReady(uimgr)
|
|
|
|
|
-- Setup PM event handlers
|
|
|
|
|
-- NOTE: We keep forwarding the uimgr reference because some implementations don't actually have a module-local UIManager ref to update
|
|
|
|
|
self:_setEventHandlers(uimgr)
|
|
|
|
|
|
|
|
|
|
-- Returns a self-debouncing scheduling call (~4s to give some leeway to the kernel, and debounce to deal with potential chattering)
|
|
|
|
|
self._updateChargingLED = UIManager:debounce(4, false, function() self:setupChargingLED() end)
|
|
|
|
|
end
|
|
|
|
|
-- In case implementations *also* need a reference to UIManager, *this* is the one to implement!
|
|
|
|
|
function Device:UIManagerReady(uimgr) end
|
|
|
|
@ -1105,15 +1109,16 @@ end
|
|
|
|
|
|
|
|
|
|
-- The common operations that should be performed when the device is plugged to a power source.
|
|
|
|
|
function Device:_beforeCharging()
|
|
|
|
|
-- Leave the kernel some time to figure it out ;o).
|
|
|
|
|
UIManager:scheduleIn(1, function() self:setupChargingLED() end)
|
|
|
|
|
-- Invalidate the capacity cache to make sure we poll up-to-date values for the LED check
|
|
|
|
|
self.powerd:invalidateCapacityCache()
|
|
|
|
|
self:_updateChargingLED()
|
|
|
|
|
UIManager:broadcastEvent(Event:new("Charging"))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- The common operations that should be performed when the device is unplugged from a power source.
|
|
|
|
|
function Device:_afterNotCharging()
|
|
|
|
|
-- Leave the kernel some time to figure it out ;o).
|
|
|
|
|
UIManager:scheduleIn(1, function() self:setupChargingLED() end)
|
|
|
|
|
self.powerd:invalidateCapacityCache()
|
|
|
|
|
self:_updateChargingLED()
|
|
|
|
|
UIManager:broadcastEvent(Event:new("NotCharging"))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|