Skip to content

Commit

Permalink
My Update of XPrivacy-Lua
Browse files Browse the repository at this point in the history
My new start to XPrivacy-Lua base, my changes
  • Loading branch information
0bbedCode committed Dec 25, 2023
1 parent 85a1e49 commit 71a182a
Show file tree
Hide file tree
Showing 216 changed files with 13,039 additions and 1,759 deletions.
Binary file added XPrivacyLua_Pro_base.apk
Binary file not shown.
37 changes: 37 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,45 @@
android:value=".ActivityMain" />
</activity>

<activity
android:name=".ActivityProps"
android:configChanges="orientation|screenSize"
android:label="@string/menu_props"
android:launchMode="singleTop"
android:parentActivityName=".ActivityMain"
android:resizeableActivity="true">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ActivityMain" />
</activity>

<activity
android:name=".ActivityDatabase"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:parentActivityName=".ActivityMain"
android:resizeableActivity="true">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ActivityMain" />
</activity>

<activity
android:name=".ActivityCpu"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:parentActivityName=".ActivityMain"
android:resizeableActivity="true">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ActivityMain" />
</activity>

<provider
android:name=".VXP"
android:exported="true"
android:authorities="eu.faircode.xlua.vxp"
android:process=":vxp" />
</application>
Expand Down
136 changes: 136 additions & 0 deletions app/src/main/assets/BatteryHooks/hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
[
//https://android.googlesource.com/platform/frameworks/base/+/2164cf4f4043b4892db5688ed53624af758fcdaa/core/java/android/os/BatteryManager.java
//https://developer.android.com/reference/android/os/BatteryManager

{
"builtin": false,
"collection": "PrivacyEx",
"group": "Spoof.Battery",
"name": "PowerManager.isPowerSaveMode",
"author": "Fif, OBC",
"className": "android.os.PowerManager",
"methodName": "isPowerSaveMode",
"parameterTypes": [ ],
"returnType": "boolean",
"minSdk": 4,
"maxSdk": 999,
"version": 2,
"description": "Add Fifs Decription",
"enabled":true,
"optional":true,
"usage":true,
"notify":false,
"luaScript": "@spoof_powermanager_ispowersavemode",
"settings":[]
},

{
"builtin": false,
"collection": "PrivacyEx",
"group": "Spoof.Battery",
"name": "Intent.createFromParcel/battery",
"author": "Fif, OBC",
"className": "android.content.Intent",
"methodName": "CREATOR:createFromParcel",
"parameterTypes": [ "android.os.Parcel" ],
"returnType": "android.content.Intent",
"minSdk": 4,
"maxSdk": 999,
"version": 2,
"description": "Add Fifs Decription",
"enabled":true,
"optional":true,
"usage":true,
"notify":false,
"luaScript": "@spoof_battery_intent_createfromparcel",
"settings":[]
},

{
"builtin": false,
"collection": "PrivacyEx",
"group": "Spoof.Battery",
"name": "BatteryManager.computeChargeTimeRemaining",
"author": "OBC",
"className": "android.os.BatteryManager",
"methodName": "computeChargeTimeRemaining",
"parameterTypes": [ ],
"returnType": "long",
"minSdk": 4,
"maxSdk": 999,
"version": 1,
"description": "Compute an approximation for how much time (in milliseconds) remains until the battery is fully charged.",
"enabled":true,
"optional":true,
"usage":true,
"notify":false,
"luaScript": "@spoof_batterymanager_computechargetimeremaining",
"settings":[]
},

{
"builtin": false,
"collection": "PrivacyEx",
"group": "Spoof.Battery",
"name": "BatteryManager.isCharging",
"author": "OBC",
"className": "android.os.BatteryManager",
"methodName": "isCharging",
"parameterTypes": [ ],
"returnType": "boolean",
"minSdk": 4,
"maxSdk": 999,
"version": 1,
"description": "Return true if the battery is currently considered to be charging. ",
"enabled":true,
"optional":true,
"usage":true,
"notify":false,
"luaScript": "@spoof_batterymanager_ischarging",
"settings":[]
},

{
"builtin": false,
"collection": "PrivacyEx",
"group": "Spoof.Battery",
"name": "BatteryManager.getIntProperty",
"author": "OBC",
"className": "android.os.BatteryManager",
"methodName": "getIntProperty",
"parameterTypes": [ "int" ],
"returnType": "int",
"minSdk": 4,
"maxSdk": 999,
"version": 1,
"description": "Return the value of a battery property of integer type. ",
"enabled":true,
"optional":true,
"usage":true,
"notify":false,
"luaScript": "@spoof_batterymanager_get",
"settings":[]
},

{
"builtin": false,
"collection": "PrivacyEx",
"group": "Spoof.Battery",
"name": "BatteryManager.getIntProperty",
"author": "OBC",
"className": "android.os.BatteryManager",
"methodName": "getLongProperty",
"parameterTypes": [ "int" ],
"returnType": "long",
"minSdk": 4,
"maxSdk": 999,
"version": 1,
"description": "Return the value of a battery property of long type If the platform does not provide the property queried, this value will be Long.MIN_VALUE. ",
"enabled":true,
"optional":true,
"usage":true,
"notify":false,
"luaScript": "@spoof_batterymanager_get",
"settings":[]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
--Based off of M66B
--also check if this was ever updated
function after(hook, param)
local intent = param:getResult()
if intent == nil then
return false
end

local action = intent:getAction()
if action == nil then
return false
end

local old_intent = tostring(intent)
if action == "android.intent.action.BATTERY_CHANGED" then
local bmn = luajava.bindClass("android.os.BatteryManager")
local bundle = intent:getExtras()
local eLevel = bmn.EXTRA_LEVEL

local scale = bundle:getInt(bmn.EXTRA_SCALE, -1)
if bundle:getInt(eLevel, -1) then
bundle:putInt(eLevel, math.floor(.95*scale))
end

bundle:remove(bmn.EXTRA_BATTERY_LOW)
bundle:putInt(bmn.EXTRA_VOLTAGE, 4200)
bundle:putInt(bmn.EXTRA_TEMPERATURE, 250)
bundle:putInt(bmn.EXTRA_CHARGE_COUNTER, 0)
bundle:putInt(bmn.EXTRA_STATUS, bmn.STATUS_GOOD)
bundle:putInt(bmn.EXTRA_PLUGGED, 0)

intent:replaceExtras(bundle)

log("[BATTERY_CHANGED]")
return true, old_intent, tostring(intent)
elseif action == "android.intent.action.ACTION_POWER_CONNECTED" then
intent:setAction("android.intent.action.ACTION_POWER_DISCONNECTED")
log("[ACTION_POWER_CONNECTED] => [ACTION_POWER_DISCONNECTED]")
return true, old_intent, tostring(intent)
elseif action == "android.intent.action.BATTERY_LOW" then
intent:setAction("android.intent.action.BATTERY_OKAY")
log("[BATTERY_LOW] => [BATTERY_OKAY]")
return true, old_intent, tostring(intent)
end

return false
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
--computeChargeTimeRemaining

function after(hook, param)
log("computeChargeTimeRemaining=0")
param:setResult(0)
return true
end
32 changes: 32 additions & 0 deletions app/src/main/assets/BatteryHooks/spoof_batterymanager_get.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function after(hook, param)
local arg = param:getArgument(0)
local bmn = param:getThis()
local res = param:getResult()
local fake = nil

if arg == bmn.BATTERY_PROPERTY_CHARGE_COUNTER then
log("BATTERY_PROPERTY_CHARGE_COUNTER");
fake = 0
--Battery capacity in microampere-hours, as an integer.
elseif arg == bmn.BATTERY_PROPERTY_ENERGY_COUNTER then
log("BATTERY_PROPERTY_ENERGY_COUNTER");
fake = 150000
--Battery remaining energy in nanowatt-hours, as a long integer.
elseif arg == bmn.BATTERY_PROPERTY_STATUS then
log("BATTERY_PROPERTY_STATUS")
fake = bmn.BATTERY_STATUS_DISCHARGING
--elseif arg == bmn.BATTERY_PLUGGED_USB or arg == bmn.BATTERY_PLUGGED_WIRELESS or bmn.BATTERY_PLUGGED_DOCK or bmn.BATTERY_PLUGGED_AC then
-- fake = 0
--use these if your comparing return value as these indicate constant state value
elseif arg == bmn.BATTERY_PROPERTY_CAPACITY then
log("BATTERY_PROPERTY_CAPACITY=100")
fake = 100
end

if fake ~= nil then
param:setResult(fake)
return true
end

return false
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function after(hook, param)
log("isCharging=false")
param:setResult(false)
return true
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function after(hook, param)
local ret = param:getResult()
if ret == nil then
return false
end

log("isPowerSaveMode")

param:setResult(false)
return true
end
Loading

0 comments on commit 71a182a

Please sign in to comment.