Created
April 9, 2024 13:33
-
-
Save eam/3d76d506de87b2891c1f58e5db430907 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
diff --git a/mod/project.py b/mod/project.py | |
index 8aa359f..8682ffa 100644 | |
--- a/mod/project.py | |
+++ b/mod/project.py | |
@@ -3,6 +3,7 @@ | |
import os | |
import shutil | |
import subprocess | |
+from pprint import pprint | |
from mod import log, util, config, dep, template, settings, android, emsdk, wasisdk | |
from mod.tools import git, cmake, xcrun, ccmake, cmake_gui, vscode, clion, httpserver, wasmtime | |
@@ -298,6 +299,16 @@ def run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd) : | |
subprocess.call(cmd, shell=True, cwd=deploy_dir) | |
cmd = '{} install {}.apk'.format(adb_path, target_name) | |
subprocess.call(cmd, shell=True, cwd=deploy_dir) | |
+ # ...grant perms, since we can't ask | |
+ print("configs\n") | |
+ pprint(configs) | |
+ # TODO - generalize this to just grant a list of permissions automatically | |
+ # we also need a production way to run it and grant it | |
+ # maybe tie into java/requestPermissions() | |
+ for expr in cfg['adb-prerun-cmds']: | |
+ print("Adding user generated command: " + expr) | |
+ cmd = eval(expr) | |
+ subprocess.call(cmd, shell=True) | |
# ...then start the apk | |
cmd = '{} shell am start -n {}/android.app.NativeActivity'.format(adb_path, pkg_name) | |
subprocess.call(cmd, shell=True) | |
diff --git a/tools/android-create-apk.py b/tools/android-create-apk.py | |
index 9944295..af6a331 100644 | |
--- a/tools/android-create-apk.py | |
+++ b/tools/android-create-apk.py | |
@@ -111,6 +111,7 @@ with open(apk_dir + 'AndroidManifest.xml', 'w') as f: | |
f.write(' android:versionName="1.0">\n') | |
f.write(' <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="{}"/>\n'.format(args.version)) | |
f.write(' <uses-permission android:name="android.permission.INTERNET"></uses-permission>\n') | |
+ f.write(' <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>\n') | |
f.write(' <uses-feature android:glEsVersion="0x00030000"></uses-feature>\n') | |
f.write(' <application android:label="{}" android:debuggable="true" android:hasCode="false">\n'.format(args.name)) | |
f.write(' <activity android:name="android.app.NativeActivity"\n'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment