Modifying both loader and main application to print base commit to logcat

This commit is contained in:
twaik 2023-09-14 09:16:13 +03:00
parent 94bf3d12b2
commit 5e0f484f9d
5 changed files with 6 additions and 2 deletions

View File

@ -110,7 +110,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
name: 'Desktop/Android APP Nightly Release $$'
name: 'Nightly Release $$'
draft: false
prerelease: true
body: |

View File

@ -9,6 +9,7 @@ android {
targetSdkVersion 33
versionCode 14
versionName "1.03.00"
buildConfigField "String", "COMMIT", "\"" + "git rev-parse HEAD\n".execute().getText().trim() + "\""
}
signingConfigs.debug {
@ -31,6 +32,7 @@ android {
externalNativeBuild.cmake.path "src/main/cpp/CMakeLists.txt"
packagingOptions.jniLibs.useLegacyPackaging false
buildFeatures.aidl true
buildFeatures.buildConfig true
buildTypes.debug {
signingConfig signingConfigs.debug
postprocessing {

View File

@ -44,6 +44,7 @@ public class CmdEntryPoint extends ICmdEntryInterface.Stub {
* @param args The command-line arguments
*/
public static void main(String[] args) {
android.util.Log.i("CmdEntryPoint", "commit " + BuildConfig.COMMIT);
handler.post(() -> new CmdEntryPoint(args));
Looper.loop();
}

View File

@ -24,3 +24,4 @@ android.defaultConfig.buildConfigField "String", "packageNotInstalledErrorText",
\"After this you should download \\"termux-x11-ARCH-debug\\" or \\"termux-x11-universal-debug\\" artifact and install apk contained in this zip file.\""""
android.defaultConfig.buildConfigField "String", "packageSignatureMismatchErrorText",
"\"Signature verification of target application " + android.namespace + " failed.\\nPlease, reinstall both termux-x11 package and Termux:X11 application from the same source\""
android.defaultConfig.buildConfigField "String", "COMMIT", "\"" + "git rev-parse HEAD\n".execute().getText().trim() + "\""

View File

@ -20,7 +20,7 @@ public class Loader {
assert targetInfo != null : BuildConfig.packageNotInstalledErrorText.replace("ARCH", android.os.Build.SUPPORTED_ABIS[0]);
assert targetInfo.signatures.length == 1 && BuildConfig.SIGNATURE == targetInfo.signatures[0].hashCode() : BuildConfig.packageSignatureMismatchErrorText;
android.util.Log.i(BuildConfig.logTag, "loading " + targetInfo.applicationInfo.sourceDir + "::" + BuildConfig.CLASS_ID + "::main of " + BuildConfig.APPLICATION_ID + " application");
android.util.Log.i(BuildConfig.logTag, "loading " + targetInfo.applicationInfo.sourceDir + "::" + BuildConfig.CLASS_ID + "::main of " + BuildConfig.APPLICATION_ID + " application (commit " + BuildConfig.COMMIT + ")");
Class<?> targetClass = Class.forName(BuildConfig.CLASS_ID, true,
new dalvik.system.PathClassLoader(targetInfo.applicationInfo.sourceDir, null, ClassLoader.getSystemClassLoader()));
targetClass.getMethod("main", String[].class).invoke(null, (Object) args);