HACK: granting full permission for apps data

This commit is contained in:
Rikka 2023-01-23 23:12:24 +08:00 committed by Rikka
parent 72e34c4a38
commit fa9e89e868
No known key found for this signature in database
GPG key ID: CD36B07FA9F7D2AA
6 changed files with 56 additions and 8 deletions

View file

@ -90,6 +90,36 @@ Open terminal and switch to directory where "main.py" is located then run:
sudo python3 main.py install smartdock
## Granting full permission for apps data (HACK)
This is a temporary hack to combat against the apps permission issue on Android 11. Whenever an app is open it will always enable a property (persist.sys.nodataperm) to make it execute a script to grant the data full permissions (777). The **correct** way is to use `sdcardfs` or `esdfs`, both need to recompile the kernel or WayDroid image.
Arknights, PUNISHING: GRAY RAVEN and other games won't freeze on the black screen.
![](assets/6.png)
Open terminal and switch to directory where "main.py" is located then run:
```
sudo python3 main.py install nodataperm
```
**WARNING**: Only tested on `lineage-18.1-20230121-VANILLA-waydroid_x86_64`. This script will replace `/system/framework/service.jar`, which may prevent WayDroid from booting.
Or you can run the following commands directly in `sudo waydroid shell`. In this way, every time a new game is installed, you need to run it again, but it's much less risky.
```
chmod 777 -R /sdcard/Android
chmod 777 -R /data/media/0/Android
chmod 777 -R /sdcard/Android/data
chmod 777 -R /data/media/0/Android/obb
chmod 777 -R /mnt/*/*/*/*/Android/data
chmod 777 -R /mnt/*/*/*/*/Android/obb
```
- https://github.com/supremegamers/device_generic_common/commit/2d47891376c96011b2ee3c1ccef61cb48e15aed6
- https://github.com/supremegamers/android_frameworks_base/commit/24a08bf800b2e461356a9d67d04572bb10b0e819
## Get Android ID for device registration

BIN
assets/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 MiB

View file

@ -7,6 +7,7 @@ from stuffs.gapps import Gapps
from stuffs.houdini import Houdini
from stuffs.magisk import Magisk
from stuffs.ndk import Ndk
from stuffs.nodataperm import Nodataperm
from stuffs.smartdock import Smartdock
from stuffs.widevine import Widevine
import tools.helper as helper
@ -29,8 +30,10 @@ def install(*args):
Magisk().install()
if "widevine" in args:
Widevine().install()
if "smartdock" in args :
if "smartdock" in args:
Smartdock().install()
if "nodataperm" in args:
Nodataperm().install()
def uninstall(*args):
pass
@ -57,7 +60,7 @@ def main():
"dest": "app",
"type": str,
"nargs": '+',
"choices": ["gapps", "libndk","libhoudini","magisk", "smartdock","widevine"],
"choices": ["gapps", "libndk","libhoudini","magisk", "smartdock","widevine", "nodataperm"],
}
install_parser = subparsers.add_parser("install", help='install something')

View file

@ -103,12 +103,6 @@ class General:
def extra2(self):
pass
# def install(self):
# if DBusContainerService().GetSession():
# print("running")
# else:
# print("stopped")
# run("waydroid session start".split())
def install(self):
if container.use_overlayfs():
self.download()

View file

@ -5,6 +5,7 @@ import re
from stuffs.general import General
from tools.helper import download_file, host, run
from tools.logger import Logger
from tools import container
class Magisk(General):
partition = "system"

20
stuffs/nodataperm.py Normal file
View file

@ -0,0 +1,20 @@
import os
import shutil
from stuffs.general import General
from tools.helper import run
from tools.logger import Logger
class Nodataperm(General):
dl_link = "https://github.com/ayasa520/hack_full_data_permission/archive/refs/heads/main.zip"
dl_file_name = "nodataperm.zip"
extract_to = "/tmp/nodataperm"
act_md5 = "eafd7b0986f3edaebaf1dd89f19d49bf"
partition = "system"
def copy(self):
extract_path = os.path.join(self.extract_to, "hack_full_data_permission-main")
os.chmod(os.path.join(extract_path, "framework", "services.jar"), 0o644)
os.chmod(os.path.join(extract_path, "etc", "nodataperm.sh"), 0o755)
os.chmod(os.path.join(extract_path, "etc", "init", "nodataperm.rc"), 0o755)
Logger.info("Copying widevine library files ...")
shutil.copytree(extract_path, os.path.join(self.copy_dir, self.partition), dirs_exist_ok=True)