blackVR
blackVR

Reputation: 21

Device ownership on meta quest 2 and quest 3

I am able to take device ownership in other VR and Android devices via adb command

dpm set-device-owner --name "My Device Owner" packagename/adminReceiverClass

but when I am using same command in meta quest VR devices it is shows an error.

Error:

Not allowed to set the device owner because there are already some accounts on the device.

WHY

Because it have pre meta accounts (meta horizon profiles) and these accounts automatically available after factory reset.

What I Want

I want to remove that account before to take device-ownership via ADB and programmatically or any other way to remove that account.

Note

In market there are many companies provide MDM solution with VR devices and they are capable to remove that account but I don't know what am I missing to get device ownership in meta VR devices

Upvotes: 2

Views: 225

Answers (1)

koekblik
koekblik

Reputation: 11

Not sure if you still need an answer to this, but what I ended up doing to make this work is the following.

You can open the Android account settings menu by using the following adb command:

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

This menu shows all accounts currently on the device.

Then you can use the following command to simulate keyboard presses to navigate through the menu:

adb shell input keyevent <keycode>

Using the following keycodes you can navigate the entire menu and remove all Meta/Horizon accounts:

3  > KEYCODE_HOME (Used to wake up device)
19 > KEYCODE_DPAD_UP
20 > KEYCODE_DPAD_DOWN
22 > KEYCODE_DPAD_RIGHT
66 > KEYCODE_ENTER

I also added half a second wait time between each button press so the UI could update using the following command:

adb shell sleep 0.5

My full command ended up looking like this:

adb shell input keyevent 3 &&
adb shell sleep 3.0 &&
adb shell am start -n 'com.android.settings/.Settings$AccountDashboardActivity' &&
adb shell sleep 5.0 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 19 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 66 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 66 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 22 &&
adb shell sleep 0.5 &&
adb shell input keyevent 66 &&
adb shell sleep 0.5 &&
adb shell input keyevent 66 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 66 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 22 &&
adb shell sleep 0.5 &&
adb shell input keyevent 66 &&
adb shell sleep 0.5 &&
adb shell input keyevent 66 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 66 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 22 &&
adb shell sleep 0.5 &&
adb shell input keyevent 66 &&
adb shell sleep 0.5 &&
adb shell input keyevent 66 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 66 &&
adb shell sleep 0.5 &&
adb shell input keyevent 20 &&
adb shell sleep 0.5 &&
adb shell input keyevent 22 &&
adb shell sleep 0.5 &&
adb shell input keyevent 66 &&
adb shell sleep 0.5 &&
adb shell sleep 5.0

Upvotes: 1

Related Questions