PowerManager.newWakeLock

These hooks have nothing to do with privacy. They prevent apps from blanking the screen when the proximity sensor detects a close object like your cheek. If your proximity sensor is busted, you can use the hooks to make calls and keep the screen on if you apply them to the system dialer, hangouts, skype, etc. Instructions: 1. Download both hooks: - PowerManager.newWakelock - PowerManager.Wakelock.release 2. Make sure that the Fif collection is enabled in XPL Pro. 3.a. In XPL, activate the "Use proximity wakelock" category for the apps that make use of the proximity wakelock. 3.b. Or, alternately, enable both PowerManager.newWakelock and PowerManager.Wakelock.release hooks in XPL Pro. Changelog: v1 - 2018-10-02 First public release.

CollectionFif
GroupUse proximity wakelock
NamePowerManager.newWakeLock
AuthorFif_
Version1
Updated (UTC)2018-10-02 17:28:35
Created (UTC)2018-10-02 17:28:35
Downloads783
Class nameandroid.os.PowerManager
Method namenewWakeLock
Parameter typesint, java.lang.String
Return typeandroid.os.PowerManager$WakeLock
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, 32) ~= 0 then
     -- Replace PROXIMITY_SCREEN_OFF_WAKELOCK (32) with PARTIAL_WAKELOCK (1)
    local fake = bit32.bor(bit32.band(flags, bit32.bnot(32)), 1)
    log('flags ' .. tostring(flags) .. ' → ' .. tostring(fake))
    param:setArgument(0, fake)
    return true, 'flags=' .. tostring(flags), 'flags=' .. tostring(fake)
  else
    return false
  end
end