Skip to content

Commit 470e712

Browse files
committed
No public description
PiperOrigin-RevId: 647333692
1 parent 8b7dc92 commit 470e712

File tree

4 files changed

+47
-36
lines changed

4 files changed

+47
-36
lines changed

README.md

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,63 @@ Test DPC is an app designed to help EMMs, ISVs, and OEMs to test their applicati
55

66
See the [documentation](https://developer.android.com/work/index.html) to learn more about Android in the enterprise.
77

8-
Getting Started
9-
---------------
8+
## Getting Started
109

1110
This sample uses the Bazel build system. To build this project, use the "bazel build testdpc" command.
1211

1312
This app can also be found [on the Play store](https://play.google.com/store/apps/details?id=com.afwsamples.testdpc).
1413

15-
Provisioning
16-
------------
14+
## Provisioning
1715

1816
You can find various kinds of provisioning methods [here](https://developers.google.com/android/work/prov-devices#Key_provisioning_differences_across_android_releases). Let's take a few of them as an example.
1917

20-
#### QR code provisioning (Device Owner N+ only) ####
18+
### AFW# code provisioning (Device Owner M+)
2119
1. Factory reset your device and tap the welcome screen in setup wizard 6 times.
22-
2. The setup wizard prompts the user to connect to the Internet so the setup wizard can download a QR code reader.
23-
3. Modify (if needed) and scan [this QR code] (http://down-box.appspot.com/qr/nQB0tw7b).
24-
4. Follow onscreen instructions
20+
2. When prompted to sign in, enter **afw#testdpc**
21+
3. Follow onscreen instructions
2522

26-
#### ADB command ####
27-
28-
**Device Owner**
23+
### QR code provisioning (Device Owner N+ only)
24+
1. Factory reset your device and tap the welcome screen in setup wizard 6 times.
25+
1. On Android O or older, the setup wizard prompts the user to connect to the Internet so the setup wizard can download a QR code reader.
26+
Android P and newer devices already have the QR code reader available.
27+
1. Generate a QR code with the content:
28+
```
29+
{
30+
"android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "com.afwsamples.testdpc/com.afwsamples.testdpc.DeviceAdminReceiver",
31+
"android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "gJD2YwtOiWJHkSMkkIfLRlj-quNqG1fb6v100QmzM9w=",
32+
"android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "https://testdpc-latest-apk.appspot.com"
33+
}
34+
```
35+
or use this pre-made QR code:
36+
![testdpc_provisioning](qrcode.png)
37+
1. Scan the QR code and follow onscreen instructions
38+
39+
### ADB command
40+
41+
#### Device Owner (DO)
2942

3043
* Run the `adb` command:
3144

3245
```console
3346
adb shell dpm set-device-owner com.afwsamples.testdpc/.DeviceAdminReceiver
3447
```
3548

36-
**Profile Owner**
49+
#### Profile Owner - Personal device (PO - BYOD)
3750

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)
51+
* Create a managed profile by launching the “Set up TestDPC” app
4052
* Skip adding an account at the end of the flow
4153

42-
**COPE Profile Owner**
54+
#### Profile Owner - Corporate-owned device (PO - COPE)
4355

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)
56+
* Create a managed profile by launching the “Set up TestDPC” app
4657
* Skip adding an account at the end of the flow
4758
* Run the `adb` command:
4859

4960
```console
5061
adb shell dpm mark-profile-owner-on-organization-owned-device --user 10 com.afwsamples.testdpc/.DeviceAdminReceiver`
5162
```
5263

53-
## TestDPC as DM role holder
64+
#### TestDPC as DM role holder
5465

5566
TestDPC v9.0.5+ can be setup as Device Management Role Holder.
5667

@@ -62,11 +73,9 @@ TestDPC v9.0.5+ can be setup as Device Management Role Holder.
6273
```
6374

6475
Note: unlike DO/PO, this change is not persisted so TestDPC needs to be
65-
marked as role holder again if the device reboots or if a work profile is
66-
added to the device.
76+
marked as role holder again if the device reboots.
6777

68-
Android Studio import
69-
---------------------
78+
## Android Studio import
7079

7180
To import this repository in Android Studio, you need to use the
7281
[Bazel for Android Studio](https://plugins.jetbrains.com/plugin/9185-bazel-for-android-studio)
@@ -84,29 +93,32 @@ Select "Bazel Command" as Configuration type and add `//:testdpc` as
8493

8594
You can now run the project from inside Android Studio.
8695

87-
88-
Building with Bazel
89-
-------------------
96+
## Building with Bazel
9097

9198
The repository includes a `build.sh` script to build the application. The required
9299
[setupdesign library](https://android.googlesource.com/platform/external/setupdesign/+/refs/heads/main)
93100
is now imported and patched dynamically using the command line utility `ed`. This needs to be
94101
available on the path to successfully build the project.
95102

96-
Support
97-
-------
103+
### `ANDROID_HOME` environment setup
104+
105+
Bazel requires that you set the `ANDROID_HOME` environment variable to the path of your Android SDK.
106+
As an example, you can add to your `.bashrc` on linux:
107+
```
108+
export ANDROID_HOME=<Path to the Android SDK>
109+
```
110+
111+
## Support
98112
99113
If you've found an error in this sample, please file an issue:
100114
https://github.com/googlesamples/android-testdpc/issues
101115
102116
Patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub.
103117
104-
License
105-
-------
118+
## License
106119
107120
Licensed under the Apache 2.0 license. See the LICENSE file for details.
108121
109-
How to make contributions?
110-
--------------------------
122+
## How to make contributions?
111123
112-
Please read and follow the steps in the CONTRIB file.
124+
Please read and follow the steps in the CONTRIB file.

qrcode.png

1.2 KB
Loading

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="9009"
23-
android:versionName="9.0.9">
22+
android:versionCode="9010"
23+
android:versionName="9.0.10">
2424
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34"/>
2525

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

src/main/res/values/attrs.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
<enum name="S_V2" value="32" />
3535
<enum name="T" value="33" />
3636
<enum name="U" value="34" />
37-
<!-- Change to V API level once released. -->
38-
<enum name="V" value="10000" />
37+
<enum name="V" value="35" />
3938
</attr>
4039

4140
<!-- Constrain a preference to DO or PO admins. -->

0 commit comments

Comments
 (0)