PowerManager.isPowerSaveMode

This hook prevents apps from detecting that the Android battery saver mode is engaged (Settings > Battery > Battery Saver). It fakes the Battery Saver status to false for any app querying it. Applying this hook to an app will prevent it from engaging in any power saving strategy it may apply when the Power Saver is on because it won't be able to detect it anymore. Use it with extra caution. Instructions: 1. Download this hook. 2. Make sure that the Fif collection is enabled in XPL Pro. 3.a. In XPL, enable the (new) "Read battery saver" group for apps for which you want to fake the battery saver status. 3.b. Or, in XPL Pro, enable the "PowerManager.isPowerSaveMode" hook. Changelog: v1a - 2019-09-03 Corrected documentation - no Lua code changes. v1 - 2019-08-31 First public release.

CollectionFif
GroupRead battery saver
NamePowerManager.isPowerSaveMode
AuthorFif
Version1
Updated (UTC)2019-09-03 19:09:44
Created (UTC)2019-08-31 19:51:24
Downloads816
Class nameandroid.os.PowerManager
Method nameisPowerSaveMode
Parameter types
Return typeboolean
Min SDK21
Max SDK999
Min APK0
Max APK2147483647
Excluded packages-
EnabledYes
OptionalNo
UsageYes
NotifyNo
Settings-
-- PowerManager.isPowerSaveMode is a Lua hook definition designed to work                     
-- with XPrivacyLua.

-- PowerManager.isPowerSaveMode is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.

-- PowerManager.isPowerSaveMode is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.

function after(hook, param)
  local result = param:getResult()

  if result == false then
    return false
  end
  
  local fake = false
  param:setResult(fake)
  return true, tostring(result), tostring(fake)
end