Compare commits

..
4 changed files with 99 additions and 56 deletions
-10
View File
@@ -1,13 +1,3 @@
# What's the difference from this fork ?
I added some small code lines to enable this script for beeing used with "MULTIPLE ANDROID USERS IN WAYDROID"
--> It won't work with only a single user created (maybe fixing that in the future..)
--> You need to create at least "two users" in Waydroid to be able to get the IDs for Android verifications
# Waydroid Extras Script # Waydroid Extras Script
Script to add GApps and other stuff to Waydroid! Script to add GApps and other stuff to Waydroid!
+8 -3
View File
@@ -18,6 +18,7 @@ from stuff.nodataperm import Nodataperm
from stuff.smartdock import Smartdock from stuff.smartdock import Smartdock
from stuff.widevine import Widevine from stuff.widevine import Widevine
from stuff.fdroidpriv import FDroidPriv from stuff.fdroidpriv import FDroidPriv
from stuff.tflitefix import TfliteFix
import tools.helper as helper import tools.helper as helper
from tools import container from tools import container
from tools import images from tools import images
@@ -144,6 +145,8 @@ def remove_app(args):
remove_list.append(Nodataperm(args.android_version)) remove_list.append(Nodataperm(args.android_version))
if "hidestatusbar" in app: if "hidestatusbar" in app:
remove_list.append(HideStatusBar()) remove_list.append(HideStatusBar())
if "tflitefix" in app:
remove_list.append(TfliteFix())
if not container.use_overlayfs(): if not container.use_overlayfs():
copy_dir = "/tmp/waydroid" copy_dir = "/tmp/waydroid"
@@ -169,6 +172,8 @@ def hack_option(args):
hack_list.append(Nodataperm()) hack_list.append(Nodataperm())
if "hidestatusbar" in options: if "hidestatusbar" in options:
hack_list.append(HideStatusBar()) hack_list.append(HideStatusBar())
if "tflitefix" in options:
hack_list.append(TfliteFix())
if not container.use_overlayfs(): if not container.use_overlayfs():
copy_dir = "/tmp/waydroid" copy_dir = "/tmp/waydroid"
@@ -204,7 +209,7 @@ def interact():
args = argparse.Namespace() args = argparse.Namespace()
android_version = inquirer.select( android_version = inquirer.select(
message="Select Android version", message="Select Android version",
instruction="(\u2191\u2193 Select Item)", instruction="(↑↓ Select Item)",
choices=[ choices=[
Choice(name="Android 11", value="11"), Choice(name="Android 11", value="11"),
Choice(name="Android 13", value="13"), Choice(name="Android 13", value="13"),
@@ -230,7 +235,7 @@ def interact():
exit() exit()
install_choices = ["gapps", "microg", "libndk", "libhoudini", "magisk", "smartdock", "fdroidpriv", "widevine",] install_choices = ["gapps", "microg", "libndk", "libhoudini", "magisk", "smartdock", "fdroidpriv", "widevine",]
hack_choices = [] hack_choices = ["tflitefix"]
if android_version=="11": if android_version=="11":
hack_choices.extend(["nodataperm", "hidestatusbar"]) hack_choices.extend(["nodataperm", "hidestatusbar"])
@@ -297,7 +302,7 @@ def main():
install_choices = ["gapps", "microg", "libndk", "libhoudini", install_choices = ["gapps", "microg", "libndk", "libhoudini",
"magisk", "mitm", "smartdock", "widevine"] "magisk", "mitm", "smartdock", "widevine"]
hack_choices = ["nodataperm", "hidestatusbar"] hack_choices = ["nodataperm", "hidestatusbar", "tflitefix"]
micrg_variants = ["Standard", "NoGoolag", "UNLP", "Minimal", "MinimalIAP"] micrg_variants = ["Standard", "NoGoolag", "UNLP", "Minimal", "MinimalIAP"]
remove_choices = install_choices remove_choices = install_choices
+13 -43
View File
@@ -1,51 +1,21 @@
from tools import container from tools import container
from tools.helper import shell from tools.helper import shell
from tools.logger import Logger from tools.logger import Logger
import re
class AndroidId: class AndroidId:
def get_id(self): def get_id(self):
if not container.is_running(): if container.is_running():
try:
queryout = shell(
arg="sqlite3 /data/data/com.google.android.gsf/databases/gservices.db \"select * from main where name = 'android_id';\"",
env="ANDROID_RUNTIME_ROOT=/apex/com.android.runtime ANDROID_DATA=/data ANDROID_TZDATA_ROOT=/apex/com.android.tzdata ANDROID_I18N_ROOT=/apex/com.android.i18n"
)
except:
return
else:
Logger.error("Please make sure Waydroid is running and Gapps has been installed!") Logger.error("Please make sure Waydroid is running and Gapps has been installed!")
return return
print(queryout.replace("android_id|", "").strip())
try:
# Get list of user IDs and their names using 'pm list users'
users_raw = shell(
arg="pm list users",
env="ANDROID_RUNTIME_ROOT=/apex/com.android.runtime ANDROID_DATA=/data ANDROID_TZDATA_ROOT=/apex/com.android.tzdata ANDROID_I18N_ROOT=/apex/com.android.i18n"
)
user_map = {}
for line in users_raw.strip().splitlines():
match = re.search(r'UserInfo\{(\d+):([^:}]+)', line)
if match:
user_id, username = match.groups()
user_map[user_id] = username
except Exception as e:
Logger.error(f"Failed to parse user list: {e}")
return
print("------------------------------------------------------------------------")
print(f"{'Username':<20} | {'User ID':^10} | {'GSF Android ID'}")
print("------------------------------------------------------------------------")
for user_id, username in user_map.items():
try:
db_path = f"/data/user/{user_id}/com.google.android.gsf/databases/gservices.db"
query = f"sqlite3 {db_path} \"select value from main where name = 'android_id';\""
gsf_id = shell(
arg=query,
env="ANDROID_RUNTIME_ROOT=/apex/com.android.runtime ANDROID_DATA=/data ANDROID_TZDATA_ROOT=/apex/com.android.tzdata ANDROID_I18N_ROOT=/apex/com.android.i18n"
).strip()
if gsf_id:
print(f"{username:<20} | {user_id:^10} | {gsf_id}")
else:
print(f"{username:<20} | {user_id:^10} | (not found)")
except:
print(f"{username:<20} | {user_id:^10} | (query error)")
print("------------------------------------------------------------------------")
print(" ^----- Open https://google.com/android/uncertified/?pli=1") print(" ^----- Open https://google.com/android/uncertified/?pli=1")
print(" Login with your Google ID, then submit the form with the ID(s) shown above.") print(" Login with your google id then submit the form with id shown above")
+78
View File
@@ -0,0 +1,78 @@
import glob
import os
import shutil
from stuff.general import General
from tools.logger import Logger
class TfliteFix(General):
id = "tflitefix"
partition = "system"
TARGET_OFFSET = 0x2E9204
PATCH_BYTES = b"\xc0\x03\x5f\xd6" # ret in AArch64 little-endian
def __init__(self, android_version="13") -> None:
super().__init__()
def download(self):
pass
@property
def skip_extract(self):
return True
def copy(self):
pass
def extra1(self):
"""Applies binary patch to libtensorflowlite.so in installed apps"""
search_paths = [
os.path.expanduser("~/.local/share/waydroid/data/app/~~*==/*/lib/arm64/libtensorflowlite.so"),
"/var/lib/waydroid/data/app/~~*==/*/lib/arm64/libtensorflowlite.so",
]
found = []
for p in search_paths:
found.extend(glob.glob(p))
if not found:
Logger.warning("No installed apps with libtensorflowlite.so found in Waydroid data.")
return
for lib_path in found:
try:
with open(lib_path, "rb") as f:
data = bytearray(f.read())
if len(data) > self.TARGET_OFFSET + 4:
if bytes(data[self.TARGET_OFFSET:self.TARGET_OFFSET+4]) == self.PATCH_BYTES:
Logger.info(f"Patch already applied to {lib_path}")
continue
backup = lib_path + ".orig"
if not os.path.exists(backup):
shutil.copy2(lib_path, backup)
data[self.TARGET_OFFSET:self.TARGET_OFFSET+4] = self.PATCH_BYTES
with open(lib_path, "wb") as f:
f.write(data)
os.chmod(lib_path, 0o755)
Logger.info(f"Successfully patched {lib_path}")
except Exception as e:
Logger.error(f"Failed to patch {lib_path}: {e}")
def extra2(self):
"""Restores original libtensorflowlite.so from backup"""
search_paths = [
os.path.expanduser("~/.local/share/waydroid/data/app/~~*==/*/lib/arm64/libtensorflowlite.so.orig"),
"/var/lib/waydroid/data/app/~~*==/*/lib/arm64/libtensorflowlite.so.orig",
]
for p in search_paths:
for orig in glob.glob(p):
target = orig[:-5]
try:
shutil.copy2(orig, target)
os.remove(orig)
os.chmod(target, 0o755)
Logger.info(f"Restored {target}")
except Exception as e:
Logger.error(f"Failed to restore {target}: {e}")