Closed fuger222 closed 1 year ago
It looks like that is some device-related bug, I am not sure if it can be fixed.
I haven't started experimenting with the code yet, but I'm curious, is there any reason why Termux:X11 doesn't use am
for exchanging Unix sockets for communication, just like Termux:GUI and :API?
Because it must pass Binder
to BroadcastReceiver
which is impossible while using am
command.
I see. Thank you!
I can try to invoke some private Android APIs to let it work without instantiating Context, but it may be a bit problematic.
Can you please post termux-info
output?
Try to replace /data/data/com.termux/files/usr/libexec/termux-x11/loader.apk
with the apk inside this zip archive.
Still crashes. The only thing that solved this weird Android bug for me was when I removed everything related to the package manager. The APK path is now hardcoded though... Maybe I could solve this by passing it via environment variables, but the problem still exists in CmdEntryPoint.
Is this log relevant to your version of loader or to the version I've sent you?
I'll post that too, give me a sec
This is for the version you sent:
Unfortunately I have no idea how to fix this. That is some firmware-related bug. And I do not have source codes of this to fix.
That's ok, you helped a lot already. I'll remove the package-manager-related code from CmdEntryPoint too, then it should be fine.
Wait a sec.
Ok. Try this one. shell-loader-debug.zip
This one should be better. shell-loader-debug.zip
The first one crashed here:
PackageManager pm = ctx == null ? null : ctx.getPackageManager();
08-16 18:41:14.127 1444 1444 E AndroidRuntime: java.lang.ExceptionInInitializerError
08-16 18:41:14.127 1444 1444 E AndroidRuntime: at com.lge.systemservice.core.LGContext.<clinit>(LGContext.java:434)
08-16 18:41:14.127 1444 1444 E AndroidRuntime: at android.app.ApplicationPackageManager.getLGPackageLabelService(ApplicationPackageManager.java:1775)
08-16 18:41:14.127 1444 1444 E AndroidRuntime: at android.app.ApplicationPackageManager.<init>(ApplicationPackageManager.java:1517)
08-16 18:41:14.127 1444 1444 E AndroidRuntime: at android.app.ContextImpl.getPackageManager(ContextImpl.java:235)
08-16 18:41:14.127 1444 1444 E AndroidRuntime: at com.termux.x11.Loader.main(Loader.java:62)
Yeah, I know. I moved it to try
block in the second apk to trigger reflection
way of doing so.
Here's the stack trace for the second:
08-16 18:51:39.213 1503 1503 E AndroidRuntime: java.lang.ExceptionInInitializerError
08-16 18:51:39.213 1503 1503 E AndroidRuntime: at com.lge.systemservice.core.LGContext.<clinit>(LGContext.java:434)
08-16 18:51:39.213 1503 1503 E AndroidRuntime: at android.app.ApplicationPackageManager.getLGPackageLabelService(ApplicationPackageManager.java:1775)
08-16 18:51:39.213 1503 1503 E AndroidRuntime: at android.app.ApplicationPackageManager.<init>(ApplicationPackageManager.java:1517)
08-16 18:51:39.213 1503 1503 E AndroidRuntime: at android.app.ContextImpl.getPackageManager(ContextImpl.java:235)
08-16 18:51:39.213 1503 1503 E AndroidRuntime: at com.termux.x11.Loader.main(Loader.java:69)
08-16 18:51:39.213 1503 1503 E AndroidRuntime: at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
08-16 18:51:39.213 1503 1503 E AndroidRuntime: at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:284)
Post the full log please.
Ok, wait. I've got this.
It worked! The loader at least.
08-16 18:58:08.680 1798 1798 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 10343 <<<<<<
08-16 18:58:08.747 3779 4044 V WifiServerServiceExt: checkPollTimer Cnt= 0 rssi =-49 threshold=-100
08-16 18:58:08.789 1798 1798 D AndroidRuntime: Calling main entry com.termux.x11.Loader
08-16 18:58:08.801 1798 1798 I Termux:X11 loader: started
08-16 18:58:08.806 1807 1807 E asset : setgid: Operation not permitted
08-16 18:58:08.840 1809 1809 E asset : setgid: Operation not permitted
08-16 18:58:08.860 1798 1798 E asset : AssetManager::addSystemOverlays delete oidmap
08-16 18:58:08.862 1798 1798 E asset : AssetManager::addSystemOverlays delete oidmap
08-16 18:58:08.878 1798 1798 W ResourceType: No package identifier when getting value for resource number 0x00060044
08-16 18:58:08.878 1798 1798 W /system/bin/app_process: Lcom/lge/systemservice/core/LGMiniClockManager; failed initialization
08-16 18:58:08.879 1798 1798 W /system/bin/app_process: Lcom/lge/systemservice/core/LGContext; failed initialization
08-16 18:58:08.879 1798 1798 E Loader : Failed to get package info traditional way, trying again using reflections.
08-16 18:58:08.879 1798 1798 E Loader : java.lang.ExceptionInInitializerError
08-16 18:58:08.879 1798 1798 E Loader : at com.lge.systemservice.core.LGContext.<clinit>(LGContext.java:434)
08-16 18:58:08.879 1798 1798 E Loader : at android.app.ApplicationPackageManager.getLGPackageLabelService(ApplicationPackageManager.java:1775)
08-16 18:58:08.879 1798 1798 E Loader : at android.app.ApplicationPackageManager.<init>(ApplicationPackageManager.java:1517)
08-16 18:58:08.879 1798 1798 E Loader : at android.app.ContextImpl.getPackageManager(ContextImpl.java:235)
08-16 18:58:08.879 1798 1798 E Loader : at com.termux.x11.Loader.main(Loader.java:69)
08-16 18:58:08.879 1798 1798 E Loader : at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
08-16 18:58:08.879 1798 1798 E Loader : at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:284)
08-16 18:58:08.879 1798 1798 E Loader : Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x60044
08-16 18:58:08.879 1798 1798 E Loader : at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:223)
08-16 18:58:08.879 1798 1798 E Loader : at android.content.res.Resources.getBoolean(Resources.java:1065)
08-16 18:58:08.879 1798 1798 E Loader : at com.lge.systemservice.core.LGMiniClockManager.<clinit>(LGMiniClockManager.java:23)
08-16 18:58:08.879 1798 1798 E Loader : ... 7 more
08-16 18:58:08.885 1798 1798 I PackageParser: com.termux.x11: compat added android.permission.WRITE_EXTERNAL_STORAGE android.permission.READ_PHONE_STATE
08-16 18:58:08.900 1798 1798 I Termux:X11 loader: loading /data/app/com.termux.x11-3mtYNdjdxYYUapFUYqjQGA==/base.apk of com.termux.x11 application
08-16 18:58:08.910 1798 1798 I Termux:X11 loader: starting com.termux.x11.CmdEntryPoint::main();
08-16 18:58:08.914 1798 1798 W ResourceType: No package identifier when getting value for resource number 0x000600a6
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: Problem during obtaining Context:
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: java.lang.RuntimeException: Unable to instantiate Application():android.content.res.Resources$NotFoundException: Resource ID #0x600a6
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at android.app.ActivityThread.attach(ActivityThread.java:6632)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at android.app.ActivityThread.systemMain(ActivityThread.java:6672)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at com.termux.x11.CmdEntryPoint.<init>(CmdEntryPoint.java:59)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at com.termux.x11.CmdEntryPoint.lambda$main$0(CmdEntryPoint.java:48)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at com.termux.x11.CmdEntryPoint.$r8$lambda$d1moglI7_fYfJOFrG6IE89MaB24(CmdEntryPoint.java:0)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at com.termux.x11.CmdEntryPoint$$ExternalSyntheticLambda0.run(R8$$SyntheticClass:0)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at android.os.Handler.handleCallback(Handler.java:789)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at android.os.Handler.dispatchMessage(Handler.java:98)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at android.os.Looper.loop(Looper.java:164)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at com.termux.x11.CmdEntryPoint.main(CmdEntryPoint.java:49)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at java.lang.reflect.Method.invoke(Native Method)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at com.termux.x11.Loader.main(Loader.java:122)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:284)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x600a6
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:223)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at android.content.res.Resources.getBoolean(Resources.java:1065)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at com.lge.systemservice.core.PerfTrackerManager.init(PerfTrackerManager.java:49)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at android.app.Application.onCreate(Application.java:103)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: at android.app.ActivityThread.attach(ActivityThread.java:6630)
08-16 18:58:08.914 1798 1798 E CmdEntryPoint: ... 13 more
08-16 18:58:08.915 1798 1798 V LorieNative: Using TMPDIR="/data/data/com.termux/files/usr/tmp"
08-16 18:58:08.917 1798 1812 E CmdEntryPoint: Listening port 7892
08-16 18:58:08.924 1798 1798 I /system/bin/app_process: System.exit called, status: 0
08-16 18:58:08.924 1798 1798 I AndroidRuntime: VM exiting with result code 0.
Aaand the main package: app-arm64-v8a-debug.zip
08-16 19:06:43.667 2463 2463 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 10343 <<<<<<
08-16 19:06:43.762 2463 2463 D AndroidRuntime: Calling main entry com.termux.x11.Loader
08-16 19:06:43.769 2463 2463 I Termux:X11 loader: started
08-16 19:06:43.773 2472 2472 E asset : setgid: Operation not permitted
08-16 19:06:43.806 2474 2474 E asset : setgid: Operation not permitted
08-16 19:06:43.845 2463 2463 E asset : AssetManager::addSystemOverlays delete oidmap
08-16 19:06:43.849 2463 2463 E asset : AssetManager::addSystemOverlays delete oidmap
08-16 19:06:43.865 2463 2463 W ResourceType: No package identifier when getting value for resource number 0x00060044
08-16 19:06:43.865 2463 2463 W /system/bin/app_process: Lcom/lge/systemservice/core/LGMiniClockManager; failed initialization
08-16 19:06:43.865 2463 2463 W /system/bin/app_process: Lcom/lge/systemservice/core/LGContext; failed initialization
08-16 19:06:43.865 2463 2463 E Loader : Failed to get package info traditional way, trying again using reflections.
08-16 19:06:43.865 2463 2463 E Loader : java.lang.ExceptionInInitializerError
08-16 19:06:43.865 2463 2463 E Loader : at com.lge.systemservice.core.LGContext.<clinit>(LGContext.java:434)
08-16 19:06:43.865 2463 2463 E Loader : at android.app.ApplicationPackageManager.getLGPackageLabelService(ApplicationPackageManager.java:1775)
08-16 19:06:43.865 2463 2463 E Loader : at android.app.ApplicationPackageManager.<init>(ApplicationPackageManager.java:1517)
08-16 19:06:43.865 2463 2463 E Loader : at android.app.ContextImpl.getPackageManager(ContextImpl.java:235)
08-16 19:06:43.865 2463 2463 E Loader : at com.termux.x11.Loader.main(Loader.java:69)
08-16 19:06:43.865 2463 2463 E Loader : at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
08-16 19:06:43.865 2463 2463 E Loader : at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:284)
08-16 19:06:43.865 2463 2463 E Loader : Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x60044
08-16 19:06:43.865 2463 2463 E Loader : at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:223)
08-16 19:06:43.865 2463 2463 E Loader : at android.content.res.Resources.getBoolean(Resources.java:1065)
08-16 19:06:43.865 2463 2463 E Loader : at com.lge.systemservice.core.LGMiniClockManager.<clinit>(LGMiniClockManager.java:23)
08-16 19:06:43.865 2463 2463 E Loader : ... 7 more
08-16 19:06:43.867 2463 2463 I PackageParser: com.termux.x11: compat added android.permission.WRITE_EXTERNAL_STORAGE android.permission.READ_PHONE_STATE
08-16 19:06:43.873 2463 2463 I Termux:X11 loader: loading /data/app/com.termux.x11-M_CBqm-gcBcu5ZTe32_klQ==/base.apk of com.termux.x11 application
08-16 19:06:43.879 2463 2463 I Termux:X11 loader: starting com.termux.x11.CmdEntryPoint::main();
08-16 19:06:43.879 2463 2463 V LorieNative: Using TMPDIR="/data/data/com.termux/files/usr/tmp"
08-16 19:06:43.889 3779 6191 E ActivityManager: isInstantApp with an application's uid, no record, and no package name
08-16 19:06:43.889 3779 6191 E ActivityManager: Activity Manager Crash. UID:1000 PID:3779 TRANS:8
08-16 19:06:43.889 3779 6191 E ActivityManager: java.lang.IllegalArgumentException: Calling application did not provide package name
08-16 19:06:43.889 3779 6191 E ActivityManager: at com.android.server.am.ActivityManagerService.isInstantApp(ActivityManagerService.java:19777)
08-16 19:06:43.889 3779 6191 E ActivityManager: at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:20204)
08-16 19:06:43.889 3779 6191 E ActivityManager: at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:21028)
08-16 19:06:43.889 3779 6191 E ActivityManager: at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:240)
08-16 19:06:43.889 3779 6191 E ActivityManager: at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3200)
08-16 19:06:43.889 3779 6191 E ActivityManager: at com.android.server.am.ActivityManagerServiceEx.onTransact(ActivityManagerServiceEx.java:568)
08-16 19:06:43.889 3779 6191 E ActivityManager: at android.os.Binder.execTransact(Binder.java:690)
08-16 19:06:43.890 2463 2463 I /system/bin/app_process: Rejecting re-init on previously-failed class java.lang.Class<com.lge.systemservice.core.LGContext>: java.lang.ExceptionInInitializerError:
08-16 19:06:43.890 2463 2463 I /system/bin/app_process: (Throwable with no stack trace)
08-16 19:06:43.890 2463 2463 I /system/bin/app_process:
08-16 19:06:43.907 2463 2476 E CmdEntryPoint: Listening port 7892
08-16 19:06:43.937 2463 2463 I /system/bin/app_process: System.exit called, status: 0
08-16 19:06:43.937 2463 2463 I AndroidRuntime: VM exiting with result code 0.
First I only had a black screen, but with -legacy-drawing
it works perfectly. Thanks so much!
Ok, I am merging it. The issue will be closed with a commit.
Can you please test latest loader? I changed it's code again.
Sure!
It still works for me.
Good. Thank you.
Seems to be related to issue #413 When I try to run
termux-x11 :1
, it dies from a SIGKILL without any error message. I'm using Android 8 / Oreo, and the latest Termux (Build #646: Commit 7c262b8) and Termux X11 (Build #482: Commit 8d98883) packages from Github.