How to set Device Owner via ADB on Meta Quest without losing Developer Mode?

Hi friends,

I am trying to provision a Meta Quest headset with a custom MDM (SecureGuard) by setting it as the Device Owner via ADB.

The Goal: Run the command: adb shell dpm set-device-owner com.secureguard.mdm/.SecureGuardDeviceAdminReceiver

The Problem: The command fails with java.lang.IllegalStateException: Not allowed to set the device owner because there are already some accounts on the device.

The Paradox:

  1. To set a Device Owner, I must remove all accounts (Meta/Oculus/Horizon).

  2. To have ADB access to run the command, Developer Mode must be enabled.

  3. On Meta Quest, Developer Mode requires a Meta account to be logged in.

What I have tried:

  1. pm clear or pm disable-user on com.oculus.horizon → Failed (SecurityException: Protected Package).

  2. Trying to open native Android Settings via am start to remove accounts manually → Failed (Permission Denial).

  3. Using Activity Launcher to access Settings$AccountsActivity → The specific activities crash or refuse to open.

My Question: Is there a known workaround or a “race condition” script that allows removing the primary Meta account while keeping the ADB session alive long enough to set the Device Owner? Or is there a specific intent/activity I can launch to remove accounts without killing the ADB session immediately?

Any help would be appreciated!

סליחה אם זה לא מספיק ברור כי זה מתורגם

5 Likes

oof… did not know that is a cause. try pm disable-user -- user 0

2 Likes

If I understood correctly, you wrote that I would try the command adb shell pm disable-user --user 0 com.oculus.horizon or adb shell pm disable-user --user 0
Both of them don’t work

Interesting dilemma.

Can you run termux on this device?

Edit - never mind, termux would probably not have enough permissions

Check this out

This app removes accounts from within the app. I think it’s for your device? If it works you can just disregard the rest of their instructions.

2 Likes

Try this, it’s what oculess uses:

com.android.settings.Settings$AccountDashboardActivity

1 Like

First of all, thank you very much
I reset the device now trying to install Oculus and trying to progress

1 Like
C:\\Users\\user\\Downloads\\platform-tools-latest-windows\\platform-tools>adb shell am start -n com.android.settings/com.android.settings.Settings$AccountDashboardActivity
Starting: Intent { cmp=com.android.settings/.Settings }

Exception occurred while executing ‘start’:
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.android.settings/.Settings } from null (pid=30610, uid=2000) not exported from uid 1000
at com.android.server.wm.ActivityTaskSupervisor.checkStartAnyActivityPermission(ActivityTaskSupervisor.java:1197)
at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:1113)
at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:768)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1295)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1246)
at com.android.server.am.ActivityManagerService.startActivityAsUserWithFeature(ActivityManagerService.java:3321)
at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:728)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:235)
at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
at android.os.ShellCommand.exec(ShellCommand.java:40)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:10160)
at android.os.Binder.shellCommand(Binder.java:1093)
at android.os.Binder.onTransact(Binder.java:913)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5436)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2793)
at android.os.Binder.execTransactInternal(Binder.java:1369)
at android.os.Binder.execTransact(Binder.java:1300)

C:\\Users\\user\\Downloads\\platform-tools-latest-windows\\platform-tools>adb shell am start -n “com.android.settings/com.android.settings.Settings$AccountDashboardActivity”
Starting: Intent { cmp=com.android.settings/.Settings }

Exception occurred while executing ‘start’:
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.android.settings/.Settings } from null (pid=30777, uid=2000) not exported from uid 1000
at com.android.server.wm.ActivityTaskSupervisor.checkStartAnyActivityPermission(ActivityTaskSupervisor.java:1197)
at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:1113)
at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:768)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1295)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1246)
at com.android.server.am.ActivityManagerService.startActivityAsUserWithFeature(ActivityManagerService.java:3321)
at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:728)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:235)
at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
at android.os.ShellCommand.exec(ShellCommand.java:40)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:10160)
at android.os.Binder.shellCommand(Binder.java:1093)
at android.os.Binder.onTransact(Binder.java:913)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5436)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2793)
at android.os.Binder.execTransactInternal(Binder.java:1369)
at android.os.Binder.execTransact(Binder.java:1300)

Try this

adb shell am start -n com.android.settings/com.android.settings.Settings\$AccountDashboardActivity

And this

adb shell "am start -n 'com.android.settings/com.android.settings.Settings\$AccountDashboardActivity'"
C:\Users\user\Downloads\platform-tools-latest-windows\platform-tools>adb shell am start -n com.android.settings/com.android.settings.Settings$AccountDashboardActivity
Starting: Intent { cmp=com.android.settings/.Settings$AccountDashboardActivity }

C:\Users\user\Downloads\platform-tools-latest-windows\platform-tools>adb shell “am start -n ‘com.android.settings/com.android.settings.Settings$AccountDashboardActivity’”
Starting: Intent { cmp=com.android.settings/.Settings$AccountDashboardActivity }
Error type 3
Error: Activity class {com.android.settings/com.android.settings.Settings$AccountDashboardActivity} does not exist.

C:\Users\user\Downloads\platform-tools-latest-windows\platform-tools>

The first one opened the screen for me like in the attached picture and the second one did nothing.

@TripleU By the way, notice which app is open below.:musical_notes: :face_with_raised_eyebrow:

2 Likes

I’m sorry I don’t know

Anyway, thanks for the help.

1 Like

Oculus did nothing?

Oculus also opened that screen

1 Like

Sorry

Is there a way to maybe flash the firmware?
Then configure it
If it goes into download mode is it possible to flash?
How can I try to flash without taking a risk on the device

Can you pull the settings APK with adb?

מה הפקודה אני ינסה

adb shell pm path com.android.settings

# copy the path

adb pull /path/to/settings.apk

Then upload somewhere and send me a link

No guarantees but I’ll try

1 Like