basti564 / Oculess

Removes account requirements and telemetry from Oculus Quest devices
The Unlicense
1.81k stars 76 forks source link

feat: remove admin over adb #21

Closed M3skar closed 2 years ago

M3skar commented 2 years ago

export main activity for adb access and add method in MainActivity ( required command added to readme) ps: used method is deprecated but still works, needs testing! command : adb shell am start -n com.bos.oculess/.MainActivity --ez DISABLE_ADMIN true

basti564 commented 2 years ago

Your pull request doesn't work for me

19:24:24.917   879   879 E adbd          : failed to connect to socket 'tcp:17012': Connection refused
19:24:25.802   725   754 W libperfmgr    : Failed to write to node: /sys/class/devfreq/soc:qcom,cpu-cpu-llcc-bw/min_freq with value: 15258, fd: 11
19:24:25.802   725   754 W libperfmgr    : Failed to write to node: /sys/class/devfreq/soc:qcom,cpu-llcc-ddr-bw/min_freq with value: 7980, fd: 9
19:24:25.803  1063  4661 W InputReader   : Device has associated, but no associated display id.
19:24:25.818   695   695 D Zygote        : Forked child process 28597
19:24:25.820  1063  1091 I ActivityManager: Start proc 28597:com.bos.oculess/u0a93 for activity {com.bos.oculess/com.bos.oculess.MainActivity}
19:24:25.825  1063  1090 W ProcessStats  : Tracking association SourceState{7377f18 com.oculus.shellenv/10013 Top #17029} whose proc state 1 is better than process ProcessState{918d2ec com.oculus.horizon/10031 pkg=com.oculus.horizon} proc state 2 (4 skipped)
19:24:25.828 28597 28597 E com.bos.ocules: Not starting debugger since process cannot load the jdwp agent.
19:24:25.828  2376  2376 D UnifiedTelemetryLogger: Already initialized.
19:24:25.831   695 28598 W zygote64      : Reducing the number of considered missed Gc histogram windows from 178 to 100
19:24:25.836  1063  4661 W InputReader   : Device has associated, but no associated display id.
19:24:25.841   852   852 I chatty        : uid=0(root) /system/bin/vrfocusserver identical 2 lines
19:24:25.845  1907  1907 D VrRuntimeService: onForegroundActivitiesChanged: pid=28597, uid=10093, hasForegroundActivities=true
19:24:25.846  1907  1907 D VrRuntimeService: Package com.bos.oculess has ossplash false
19:24:25.930 28597 28597 D MainActivity  : Disabling device admin
19:24:25.930 28597 28597 D MainActivity  : disableDeviceOwner: clearDeviceOwnerApp
19:24:25.943  1063  4661 E ActivityThread: Failed to find provider info for telephony
19:24:25.944 28597 28597 D AndroidRuntime: Shutting down VM
19:24:25.945 28597 28597 E AndroidRuntime: FATAL EXCEPTION: main
19:24:25.945 28597 28597 E AndroidRuntime: Process: com.bos.oculess, PID: 28597
19:24:25.945 28597 28597 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bos.oculess/com.bos.oculess.MainActivity}: java.lang.IllegalArgumentException: Unknown URI content://telephony/carriers/enforce_managed
19:24:25.945 28597 28597 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3279)
19:24:25.945 28597 28597 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3418)
19:24:25.945 28597 28597 E AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
19:24:25.945 28597 28597 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
19:24:25.945 28597 28597 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
19:24:25.945 28597 28597 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2025)
19:24:25.945 28597 28597 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:107)
19:24:25.945 28597 28597 E AndroidRuntime: at android.os.Looper.loop(Looper.java:214)
19:24:25.945 28597 28597 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7389)
19:24:25.945 28597 28597 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
19:24:25.945 28597 28597 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
19:24:25.945 28597 28597 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
19:24:25.945 28597 28597 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: Unknown URI content://telephony/carriers/enforce_managed
19:24:25.945 28597 28597 E AndroidRuntime: at android.os.Parcel.createException(Parcel.java:2042)
19:24:25.945 28597 28597 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:2006)
19:24:25.945 28597 28597 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1954)
19:24:25.945 28597 28597 E AndroidRuntime: at android.app.admin.IDevicePolicyManager$Stub$Proxy.clearDeviceOwner(IDevicePolicyManager.java:8479)
19:24:25.945 28597 28597 E AndroidRuntime: at android.app.admin.DevicePolicyManager.clearDeviceOwnerApp(DevicePolicyManager.java:6023)
19:24:25.945 28597 28597 E AndroidRuntime: at com.bos.oculess.MainActivity.disableDeviceOwner(MainActivity.kt:229)
19:24:25.945 28597 28597 E AndroidRuntime: at com.bos.oculess.MainActivity.onCreate(MainActivity.kt:38)
19:24:25.945 28597 28597 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7825)
19:24:25.945 28597 28597 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7814)
19:24:25.945 28597 28597 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
19:24:25.945 28597 28597 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3254)
19:24:25.945 28597 28597 E AndroidRuntime: ... 11 more
19:24:25.945 28597 28597 E AndroidRuntime: Caused by: android.os.RemoteException: Remote stack trace:
19:24:25.945 28597 28597 E AndroidRuntime: at android.content.ContentResolver.update(ContentResolver.java:1989)
19:24:25.945 28597 28597 E AndroidRuntime: at com.android.server.devicepolicy.DevicePolicyManagerService.setOverrideApnsEnabledUnchecked(DevicePolicyManagerService.java:14047)
19:24:25.945 28597 28597 E AndroidRuntime: at com.android.server.devicepolicy.DevicePolicyManagerService.clearOverrideApnUnchecked(DevicePolicyManagerService.java:8036)
19:24:25.945 28597 28597 E AndroidRuntime: at com.android.server.devicepolicy.DevicePolicyManagerService.clearDeviceOwnerLocked(DevicePolicyManagerService.java:8063)
19:24:25.945 28597 28597 E AndroidRuntime: at com.android.server.devicepolicy.DevicePolicyManagerService.clearDeviceOwner(DevicePolicyManagerService.java:8023)
19:24:25.945 28597 28597 E AndroidRuntime: 
19:24:25.947  1063 28620 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
19:24:25.947  1063  4661 W ActivityTaskManager: Force finishing activity com.bos.oculess/.MainActivity
19:24:25.950 28597 28597 I Process       : Sending signal. PID: 28597 SIG: 9
19:24:25.951  1907  1907 I ClientMgr     : FocusedWindowChanged: falling back to client with same uid: 10013, and pid: 12960
19:24:25.951  1907  1907 I ClientMgr     : ClientMgr::SetFocusedClient: 12960:com.oculus.shellenv type 0
19:24:25.951  1907  1907 I ClientMgr     : SetFocusedPackageName - packageName com.oculus.shellenv processName com.oculus.shellenv clientId 2824858569 clientPid 12960
19:24:25.971  3110  3110 W com.oculus.processhelper.ProcessHelper: Current process name is: com.oculus.socialplatform
19:24:25.971  2010  2010 E OVRMediaServiceManager: LivestreamingManager Not initialized
19:24:25.973  3110  3110 E PartyStateManager: onAppStart nativeGetSystemVoipData didn't contain state
19:24:25.974  1063  5011 I ActivityManager: Process com.bos.oculess (pid 28597) has died: vis TPSL
19:24:25.974  1063  1092 I libprocessgroup: Successfully killed process cgroup uid 10093 pid 28597 in 0ms
19:24:25.975   695   695 I Zygote        : Process 28597 exited due to signal 9 (Killed)
19:24:25.975  1063  5011 W InputReader   : Device has associated, but no associated display id.
19:24:25.977  3110  3110 W VRLifecycleManager: onHeadsetUnmounted
19:24:26.044  3110  3110 W PartyNativeModuleManager: Calling nativeTearDown but native code wasn't initialized. Noop.
19:24:26.340  1063  1084 W ActivityTaskManager: Activity top resumed state loss timeout for ActivityRecord{e03d6f0 u0 com.bos.oculess/.MainActivity t-1 f}
basti564 commented 2 years ago

I already tried it without adb on my own, but nothing I've tried worked on the Quest

M3skar commented 2 years ago

Have forgotten about this ( at the time of pull request, i didn't have much time ). I don't have my headset anymore (gifted cause of not using it a lot), but regarding this issue, and AndroidApi <=28, this ( or a similar approach) should work, i have done it in production. The activity OR app (or another mock activity) should be open when the command is issued ( it varies with different devices and OEMs), but should be hackable somehow, since you have the admin policy.