bk138 / droidVNC-NG

VNC server app for Android that does not require root privileges.
GNU General Public License v2.0
1.22k stars 177 forks source link

Crash running on devices without com.android.systemui #168

Closed zaventh closed 10 months ago

zaventh commented 10 months ago

Description

Certain Android-based devices have modified ROMs that have removed the com.android.systemui and thus the com.android.systemui.media.MediaProjectionPermissionActivity. In these cases, the application will crash immediately upon attempting to start the server.

I am curious if there are any thoughts on a remedy or a workaround. Perhaps these devices don't even need to request this permission?

To Reproduce

  1. Create a build of AOSP without com.android.systemui (not trivial) or acquire a device running without it (see below).
  2. Attempt to run droidVNC-NG

Expected Behavior

Theoretically, it runs the VNC server successfully.

Logs/Backtraces

09-01 23:18:42.289  4614  4614 E AndroidRuntime: Process: net.christianbeier.droidvnc_ng, PID: 4614
09-01 23:18:42.289  4614  4614 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{net.christianbeier.droidvnc_ng/net.christianbeier.droidvnc_ng.MediaProjectionRequestActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.systemui/com.android.systemui.media.MediaProjectionPermissionActivity}; have you declared this activity in your AndroidManifest.xml?
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2666)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.app.ActivityThread.-wrap12(ActivityThread.java)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:154)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6121)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
09-01 23:18:42.289  4614  4614 E AndroidRuntime: Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.systemui/com.android.systemui.media.MediaProjectionPermissionActivity}; have you declared this activity in your AndroidManifest.xml?
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1813)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1526)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.app.Activity.startActivityForResult(Activity.java:4280)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:728)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.app.Activity.startActivityForResult(Activity.java:4238)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:709)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at net.christianbeier.droidvnc_ng.MediaProjectionRequestActivity.onCreate(MediaProjectionRequestActivity.java:48)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.app.Activity.performCreate(Activity.java:6741)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
09-01 23:18:42.289  4614  4614 E AndroidRuntime:    ... 9 more
09-01 23:18:42.292  1718  2271 W ActivityManager:   Force finishing activity net.christianbeier.droidvnc_ng/.MediaProjectionRequestActivity
09-01 23:18:42.300  1718  2271 V ActivityManager: Finish needs to pause: ActivityRecord{2d1086c u0 net.christianbeier.droidvnc_ng/.MediaProjectionRequestActivity t32 f}
09-01 23:18:42.300  1718  2271 V ActivityManager: Start pausing: ActivityRecord{2d1086c u0 net.christianbeier.droidvnc_ng/.MediaProjectionRequestActivity t32 f}
09-01 23:18:42.300  1718  2271 D ActivityTrigger: ActivityTrigger activityPauseTrigger 
09-01 23:18:42.300  1718  2271 V ActivityManager: Enqueueing pending pause: ActivityRecord{2d1086c u0 net.christianbeier.droidvnc_ng/.MediaProjectionRequestActivity t32 f}
09-01 23:18:42.300  1718  2271 V ActivityManager: Waiting for pause to complete...

Your environment (please complete the following information):

Additional context

The device in question is a Nebula Apollo Pocket Projector seen here https://www.amazon.com/dp/B07W4PJHF3. It is running a modified version of Android 7 with an ARM quad-core processor.

There is adb access but not root. F-Droid and thus droidVNC-NG can be installed. However, it has an entirely custom interface. Yet, many of the other permission screens are present such as allowing accessibility mode, granted access to files, etc.

$ uname -a                                                                                                                                                                                                        
Linux localhost 3.10.49 #1 SMP PREEMPT Fri May 19 12:51:30 CST 2023 armv7l

Capsule:/ $ cat /proc/cpuinfo                                                                                                                                                                                                   
processor   : 0
model name  : ARMv7 Processor rev 5 (v7l)
BogoMIPS    : 38.40
Features    : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xc07
CPU revision    : 5

processor   : 1
model name  : ARMv7 Processor rev 5 (v7l)
BogoMIPS    : 38.40
Features    : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xc07
CPU revision    : 5

processor   : 2
model name  : ARMv7 Processor rev 5 (v7l)
BogoMIPS    : 38.40
Features    : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xc07
CPU revision    : 5

processor   : 3
model name  : ARMv7 Processor rev 5 (v7l)
BogoMIPS    : 38.40
Features    : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xc07
CPU revision    : 5

Hardware    : Qualcomm Technologies, Inc MSM8909
Revision    : 0000
Serial      : 0000000000000000
Processor   : ARMv7 Processor rev 5 (v7l)
bk138 commented 10 months ago

What do you think would be a workaround?

bk138 commented 10 months ago

Tentatively closing, please post new info here once available, we can re-open this then.

zaventh commented 9 months ago

After researching this a bit more, there doesn't seem to be a way around this without modifying the underlying ROM, so yes feel free to keep this closed. For completion-ism, it might be nice to detect this edge case and handle it gracefully, but I'm not entirely sure that's possible either in this case.

bk138 commented 9 months ago

I would merge a PR in case someone comes up with a solution for this edge case.