Fix several crash errors triggered by legacy code (#2962)

pull/2965/head
Hzj_jie 7 years ago committed by GitHub
parent 53eb4dee50
commit 63f2284f21

@ -9,8 +9,8 @@ local AndroidPowerD = BasePowerD:new{
function AndroidPowerD:init()
end
function AndroidPowerD:setIntensityHW()
android.setScreenBrightness(math.floor(255 * self.fl_intensity / 25))
function AndroidPowerD:setIntensityHW(intensity)
android.setScreenBrightness(math.floor(255 * intensity / 25))
end
function AndroidPowerD:getCapacityHW()

@ -29,7 +29,7 @@ function KindlePowerD:setIntensityHW(intensity)
if self.lipc_handle ~= nil and intensity > 0 then
-- NOTE: We want to bypass setIntensity's shenanigans and simply restore the light as-is
self.lipc_handle:set_int_property(
"com.lab126.powerd", "flIntensity", self.fronglightIntensity())
"com.lab126.powerd", "flIntensity", intensity)
else
-- NOTE: when intensity is 0, We want to really kill the light, so do it manually
-- (asking lipc to set it to 0 would in fact set it to 1)...
@ -73,7 +73,7 @@ function KindlePowerD:afterResume()
if self:isFrontlightOn() then
-- Kindle stock software should turn on the front light automatically. The follow statement
-- ensure the consistency of intensity.
self:setIntensityHW()
self:turnOnFrontlightHW()
else
self:turnOffFrontlightHW()
end

@ -45,7 +45,7 @@ end
function KoboPowerD:setIntensityHW(intensity)
if self.fl == nil then return end
self.fl:setBrightness(self.frontlightIntensity())
self.fl:setBrightness(intensity)
self:_syncNickelConf()
end

Loading…
Cancel
Save