Skip to content

Instantly share code, notes, and snippets.

@devnoname120
Last active April 28, 2024 22:09
Show Gist options
  • Save devnoname120/324e9fe2105fbac37bfe2aa65495332f to your computer and use it in GitHub Desktop.
Save devnoname120/324e9fe2105fbac37bfe2aa65495332f to your computer and use it in GitHub Desktop.
XPrivacyLua hooks — Fake.DateTime
{
"script": [
{
"name": "Privacy.Calendar.getInstance",
"code": "function after(hook, param)\n local cal = param:getResult()\n cal:set(2024, 4, 27)\n param:setResult(cal)\n return true\nend\n"
}
],
"definition": [
{
"builtin": false,
"collection": "Privacy",
"group": "Fake.DateTime",
"name": "Calendar.getInstance",
"author": "devnoname120",
"version": 0,
"description": "",
"className": "java.util.Calendar",
"methodName": "getInstance",
"parameterTypes": [],
"returnType": "java.util.Calendar",
"minSdk": 1,
"maxSdk": 999,
"minApk": 0,
"maxApk": 2147483647,
"enabled": true,
"optional": false,
"usage": true,
"notify": false,
"luaScript": "@Privacy.Calendar.getInstance"
}
]
}
{
"script": [
{
"name": "Privacy.Clock.systemDefaultZone",
"code": "function after(hook, param)\n local c = luajava.bindClass('java.time.Clock')\n local e = luajava.bindClass('java.time.Instant')\n\n -- 2014-04-27 at 1pm\n local epochMilli = e:ofEpochMilli(1711918800000)\n\n local zid = luajava.bindClass('java.time.ZoneId')\n\n local zoneIdDefault = zid:systemDefault()\n\n local fixedClock = c:fixed(epochMilli, zoneIdDefault)\n param:setResult(fixedClock)\n return true\nend\n"
}
],
"definition": [
{
"builtin": false,
"collection": "Privacy",
"group": "Fake.DateTime",
"name": "Clock.systemDefaultZone",
"author": "devnoname120",
"version": 0,
"description": "",
"className": "java.time.Clock",
"methodName": "systemDefaultZone",
"parameterTypes": [],
"returnType": "java.time.Clock",
"minSdk": 26,
"maxSdk": 999,
"minApk": 0,
"maxApk": 2147483647,
"enabled": true,
"optional": false,
"usage": true,
"notify": false,
"luaScript": "@Privacy.Clock.systemDefaultZone"
}
]
}
{
"script": [
{
"name": "Privacy.LocalDateTime.now",
"code": "function after(hook, param)\n local ldt = luajava.bindClass('java.time.LocalDateTime')\n local fake = ldt:of(2024, 4, 27, 13, 0)\n param:setResult(ldt)\n return true\nend\n"
}
],
"definition": [
{
"builtin": false,
"collection": "Privacy",
"group": "Fake.DateTime",
"name": "LocalDateTime.now",
"author": "devnoname120",
"version": 0,
"description": "",
"className": "java.time.LocalDateTime",
"methodName": "now",
"parameterTypes": [],
"returnType": "java.time.LocalDateTime",
"minSdk": 26,
"maxSdk": 999,
"minApk": 0,
"maxApk": 2147483647,
"enabled": true,
"optional": false,
"usage": true,
"notify": false,
"luaScript": "@Privacy.LocalDateTime.now"
}
]
}
{
"script": [
{
"name": "Privacy.System.currentTimeMillis",
"code": "function after(hook, param)\n -- 2014-04-27 at 1pm\n local fixedTimeInMillis = \"1711918800000\"\n param:setResult(fixedTimeInMillis)\n return true\nend\n"
}
],
"definition": [
{
"builtin": false,
"collection": "Privacy",
"group": "Fake.DateTime",
"name": "System.currentTimeMillis",
"author": "devnoname120",
"version": 0,
"description": "",
"className": "java.lang.System",
"methodName": "currentTimeMillis",
"parameterTypes": [],
"returnType": "long",
"minSdk": 1,
"maxSdk": 999,
"minApk": 0,
"maxApk": 2147483647,
"enabled": true,
"optional": false,
"usage": true,
"notify": false,
"luaScript": "@Privacy.System.currentTimeMillis"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment