forked from M66B/XPrivacyLua
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
My new start to XPrivacy-Lua base, my changes
- Loading branch information
Showing
216 changed files
with
13,039 additions
and
1,759 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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":[] | ||
} | ||
] |
47 changes: 47 additions & 0 deletions
47
app/src/main/assets/BatteryHooks/spoof_battery_intent_createfromparcel.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
7 changes: 7 additions & 0 deletions
7
app/src/main/assets/BatteryHooks/spoof_batterymanager_computechargetimeremaining.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
32
app/src/main/assets/BatteryHooks/spoof_batterymanager_get.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
5 changes: 5 additions & 0 deletions
5
app/src/main/assets/BatteryHooks/spoof_batterymanager_ischarging.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
11 changes: 11 additions & 0 deletions
11
app/src/main/assets/BatteryHooks/spoof_powermanager_ispowersavemode.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.