Skip to content

Commit af909d5

Browse files
committed
No public description
PiperOrigin-RevId: 615816344
1 parent 9435b8a commit af909d5

File tree

3 files changed

+76
-8
lines changed

3 files changed

+76
-8
lines changed

README.md

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,65 @@ You can find various kinds of provisioning methods [here](https://developers.goo
2323
3. Modify (if needed) and scan [this QR code] (http://down-box.appspot.com/qr/nQB0tw7b).
2424
4. Follow onscreen instructions
2525

26-
#### ADB command (Device Owner) ####
26+
#### ADB command ####
2727

28-
```shell
29-
adb shell dpm set-device-owner com.afwsamples.testdpc/.DeviceAdminReceiver
30-
```
28+
**Device Owner**
3129

32-
#### Work profile ####
33-
The easiest way is to launch the "Set Up TestDPC" app in launcher and follow the onscreen instructions.
30+
* Run the `adb` command:
31+
32+
```console
33+
adb shell dpm set-device-owner com.afwsamples.testdpc/.DeviceAdminReceiver
34+
```
35+
36+
**Profile Owner**
37+
38+
* Create a managed profile by launching the “Set up TestDPC” app (if this app
39+
seems broken and you are in dark mode, switch to light mode)
40+
* Skip adding an account at the end of the flow
41+
42+
**COPE Profile Owner**
43+
44+
* Create a managed profile by launching the “Set up TestDPC” app (if this app
45+
seems broken and you are in dark mode, switch to light mode)
46+
* Skip adding an account at the end of the flow
47+
* Run the `adb` command:
48+
49+
```console
50+
adb shell dpm mark-profile-owner-on-organization-owned-device --user 10 com.afwsamples.testdpc/.DeviceAdminReceiver`
51+
```
52+
53+
## TestDPC as DM role holder
54+
55+
TestDPC v9.0.5+ can be setup as Device Management Role Holder.
56+
57+
* Running the following `adb` commands:
58+
59+
```console
60+
adb shell cmd role set-bypassing-role-qualification true
61+
adb shell cmd role add-role-holder android.app.role.DEVICE_POLICY_MANAGEMENT com.afwsamples.testdpc
62+
```
63+
64+
Note: unlike DO/PO, this change is not persisted so TestDPC needs to be
65+
marked as role holder again if the device reboots.
66+
67+
Android Studio import
68+
---------------------
69+
70+
To import this repository in Android Studio, you need to use the
71+
[Bazel for IntelliJ](https://plugins.jetbrains.com/plugin/8609-bazel-for-intellij)
72+
Plugin.
73+
74+
When importing the project you have to select the folder containing the Bazel's
75+
`BUILD` file. When prompted to select a "project view", you can choose the
76+
option "Copy external" and choose the `scripts/ij.bazelproject` available in
77+
this repository.
78+
79+
Once Bazel has complete the import operation and the first sync of the
80+
project, you can create a "Run Configuration".
81+
Select "Bazel Command" as Configuration type and add `//:testdpc` as
82+
"target expression".
83+
84+
You can now run the project from inside Android Studio.
3485

3586
Support
3687
-------

scripts/ij.bazelproject

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
directories:
2+
.
3+
4+
# Automatically includes all relevant targets under the 'directories' above
5+
derive_targets_from_directories: false
6+
7+
targets:
8+
testdpc
9+
10+
additional_languages:
11+
# kotlin
12+
13+
test_sources:
14+
# Sources that are categorized as test code by the IDE
15+
src/tests/*
16+
17+
android_sdk_platform: android-34

src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
xmlns:tools="http://schemas.android.com/tools"
2020
package="com.afwsamples.testdpc"
2121
tools:ignore="MissingClass"
22-
android:versionCode="9005"
23-
android:versionName="9.0.5">
22+
android:versionCode="9006"
23+
android:versionName="9.0.6">
2424
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34"/>
2525

2626
<uses-permission android:name="android.permission.GET_ACCOUNTS" />

0 commit comments

Comments
 (0)