I am trying to get the value of a system setting in a XPrivacyLua custom hook.
Settings.Secure | Android Developers #getInt()
function after(hook, param)
local result = param:getResult()
if result == null or result:getItemCount() == 0 then
return false
end
--
local context = param:getApplicationContext()
local cls = luajava.bindClass('android.provider.Settings$Secure')
local isColorInverted = cls:getInt(context, cls:ACCESSIBILITY_DISPLAY_INVERSION_ENABLED)
if isColorInverted == 1 then
return true
end
--
local fake = result:newPlainText('XPrivacyLua', 'Private')
param:setResult(fake)
return true
end
Attempt 1: cls:
ACCESSIBILITY_DISPLAY_INVERSION_ENABLED
local isColorInverted = cls:getInt(context, cls:ACCESSIBILITY_DISPLAY_INVERSION_ENABLED)
-- [string "script"]:9: function arguments expected
Attempt 2: cls.
ACCESSIBILITY_DISPLAY_INVERSION_ENABLED
local isColorInverted = cls:getInt(context, cls.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED)
-- Exception:
-- org.luaj.vm2.LuaError: script:9 no coercible public method at org.luaj.vm2.LuaValue.error(SourceFile:1041)
-- ...
-- <full stack trace>
Attempt 3: ACCESSIBILITY_DISPLAY_INVERSION_ENABLED
local isColorInverted = cls:getInt(context, ACCESSIBILITY_DISPLAY_INVERSION_ENABLED)
-- Same as attempt 2
What is the correct syntax in luajava to get the value of ACCESSIBILITY_DISPLAY_INVERSION_ENABLED
?