|
|
@ -34,9 +34,17 @@ def start_offroad(): |
|
|
|
threading.Thread(target=f).start() |
|
|
|
threading.Thread(target=f).start() |
|
|
|
|
|
|
|
|
|
|
|
def set_package_permissions(): |
|
|
|
def set_package_permissions(): |
|
|
|
pm_grant("ai.comma.plus.offroad", "android.permission.ACCESS_FINE_LOCATION") |
|
|
|
try: |
|
|
|
pm_grant("ai.comma.plus.offroad", "android.permission.READ_PHONE_STATE") |
|
|
|
output = subprocess.check_output(['dumpsys', 'package', 'ai.comma.plus.offroad'], encoding="utf-8") |
|
|
|
pm_grant("ai.comma.plus.offroad", "android.permission.READ_EXTERNAL_STORAGE") |
|
|
|
given_permissions = output.split("runtime permissions")[1] |
|
|
|
|
|
|
|
except Exception: |
|
|
|
|
|
|
|
given_permissions = "" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wanted_permissions = ["ACCESS_FINE_LOCATION", "READ_PHONE_STATE", "READ_EXTERNAL_STORAGE"] |
|
|
|
|
|
|
|
for permission in wanted_permissions: |
|
|
|
|
|
|
|
if permission not in given_permissions: |
|
|
|
|
|
|
|
pm_grant("ai.comma.plus.offroad", "android.permission."+permission) |
|
|
|
|
|
|
|
|
|
|
|
appops_set("ai.comma.plus.offroad", "SU", "allow") |
|
|
|
appops_set("ai.comma.plus.offroad", "SU", "allow") |
|
|
|
appops_set("ai.comma.plus.offroad", "WIFI_SCAN", "allow") |
|
|
|
appops_set("ai.comma.plus.offroad", "WIFI_SCAN", "allow") |
|
|
|
|
|
|
|
|
|
|
|