PowerManager.WakeLock.release

Please refer to the PowerManager.newWakelock hook documentation.

CollectionFif
GroupUse proximity wakelock
NamePowerManager.WakeLock.release
AuthorFif_
Version1
Updated (UTC)2018-10-02 17:28:32
Created (UTC)2018-10-02 17:28:32
Downloads769
Class nameandroid.os.PowerManager$WakeLock
Method namerelease
Parameter typesint
Return typevoid
Min SDK21
Max SDK999
Min APK0
Max APK2147483647
Excluded packages-
EnabledYes
OptionalNo
UsageYes
NotifyNo
Settings-
-- Fif.PowerManager is a set of Lua hook definitions
-- designed to work with XPrivacyLua.

-- Fif.PowerManager 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.

-- Fif.PowerManager 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.

-- You should have received a copy of the GNU General Public License
-- along with XPrivacyLua.  If not, see <http://www.gnu.org/licenses/>.

-- Copyright (C) 2018 Philippe Troin (Fif_ on XDA)

function before(hook, param)
  local flags = param:getArgument(0)
  if bit32.band(flags,1) ~= 0 then
     -- Drop RELEASE_FLAG_FOR_NO_PROXIMITY (1)
    local fake = bit32.band(flags, bit32.bnot(1))
    log('flags ' .. tostring(flags) .. ' → ' .. tostring(fake))
    param:setArgument(0, fake)
    return true, 'flags=' .. tostring(flags), 'flags=' .. tostring(fake)
  else
    return false
  end
end