Skip to content

Commit 352dc55

Browse files
committed
No public description
PiperOrigin-RevId: 619500419
1 parent 5760fe5 commit 352dc55

File tree

6 files changed

+34
-52
lines changed

6 files changed

+34
-52
lines changed

README.md

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,41 @@ 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
8+
Getting Started
9+
---------------
910

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

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

14-
## Provisioning
15+
Provisioning
16+
------------
1517

1618
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.
1719

18-
### AFW# code provisioning (Device Owner M+)
20+
#### QR code provisioning (Device Owner N+ only) ####
1921
1. Factory reset your device and tap the welcome screen in setup wizard 6 times.
20-
2. When prompted to sign in, enter **afw#testdpc**
21-
3. Follow onscreen instructions
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
2225

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](https://github.com/googlesamples/android-testdpc/assets/188886/a54b809f-cf58-433b-8cbe-f14cf3f00612)
37-
1. Scan the QR code and follow onscreen instructions
38-
39-
### ADB command
40-
41-
#### Device Owner (DO)
26+
#### ADB command ####
27+
28+
**Device Owner**
4229

4330
* Run the `adb` command:
4431

4532
```console
4633
adb shell dpm set-device-owner com.afwsamples.testdpc/.DeviceAdminReceiver
4734
```
4835

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

5138
* Create a managed profile by launching the “Set up TestDPC” app (if this app
5239
seems broken and you are in dark mode, switch to light mode)
5340
* Skip adding an account at the end of the flow
5441

55-
#### Profile Owner - Corporate-owned device (PO - COPE)
42+
**COPE Profile Owner**
5643

5744
* Create a managed profile by launching the “Set up TestDPC” app (if this app
5845
seems broken and you are in dark mode, switch to light mode)
@@ -63,7 +50,7 @@ You can find various kinds of provisioning methods [here](https://developers.goo
6350
adb shell dpm mark-profile-owner-on-organization-owned-device --user 10 com.afwsamples.testdpc/.DeviceAdminReceiver`
6451
```
6552

66-
#### TestDPC as DM role holder
53+
## TestDPC as DM role holder
6754

6855
TestDPC v9.0.5+ can be setup as Device Management Role Holder.
6956

@@ -75,9 +62,11 @@ TestDPC v9.0.5+ can be setup as Device Management Role Holder.
7562
```
7663

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

80-
## Android Studio import
68+
Android Studio import
69+
---------------------
8170

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

9685
You can now run the project from inside Android Studio.
9786

98-
## Building with Bazel
87+
88+
Building with Bazel
89+
-------------------
9990

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

105-
### `ANDROID_HOME` environment setup
106-
107-
Bazel requires that you set the `ANDROID_HOME` environment variable to the path of your Android SDK.
108-
As an example, you can add to your `.bashrc` on linux:
109-
```
110-
export ANDROID_HOME=<Path to the Android SDK>
111-
```
112-
113-
## Support
96+
Support
97+
-------
11498

11599
If you've found an error in this sample, please file an issue:
116100
https://github.com/googlesamples/android-testdpc/issues
117101

118102
Patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub.
119103

120-
## License
104+
License
105+
-------
121106

122107
Licensed under the Apache 2.0 license. See the LICENSE file for details.
123108

124-
## How to make contributions?
109+
How to make contributions?
110+
--------------------------
125111

126112
Please read and follow the steps in the CONTRIB file.

src/main/AndroidManifest.xml

Lines changed: 3 additions & 4 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="9006"
23-
android:versionName="9.0.6">
22+
android:versionCode="9007"
23+
android:versionName="9.0.7">
2424
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34"/>
2525

2626
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
@@ -74,8 +74,7 @@
7474
android:icon="@drawable/ic_launcher"
7575
android:banner="@drawable/ic_launcher"
7676
android:theme="@style/AppTheme"
77-
android:label="@string/app_name"
78-
tools:remove="android:appComponentFactory" >
77+
android:label="@string/app_name">
7978

8079
<activity
8180
android:name=".PolicyManagementActivity"

src/main/java/com/afwsamples/testdpc/ShellCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
/**
6666
* Provides a CLI (command-line interface) to TestDPC through {@code dumpsys}.
6767
*
68-
* <p>Usage: {@code adb shell dumpsys activity --user USER_ID service com.afwsamples.testdpc CMD}.
68+
* <p>Usage: {@code adb shell dumpsys activity service --user USER_ID com.afwsamples.testdpc CMD}.
6969
*/
7070
final class ShellCommand {
7171
private static final String TAG = "TestDPCShellCommand";

src/main/res/layout/activity_add_account.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
android:layout_width="match_parent"
2121
android:layout_height="match_parent"
2222
android:icon="@drawable/ic_enterprise_blue"
23-
app:sucHeaderText="@string/add_account"
24-
app:sucUsePartnerResource="true">
23+
app:sucHeaderText="@string/add_account">
2524

2625
<LinearLayout
2726
style="@style/SudItemContainer"

src/main/res/layout/finalize_activity.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
android:layout_width="match_parent"
2222
android:layout_height="match_parent"
2323
android:icon="@drawable/ic_enterprise_blue"
24-
app:sucHeaderText="@string/finish_setup"
25-
app:sucUsePartnerResource="true">
24+
app:sucHeaderText="@string/finish_setup">
2625

2726
<LinearLayout
2827
style="@style/SudContentFrame"

src/main/res/layout/setup_management_fragment.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
android:layout_width="match_parent"
2222
android:layout_height="match_parent"
2323
android:icon="@drawable/ic_enterprise_blue"
24-
app:sucHeaderText="@string/set_up_management_header"
25-
app:sucUsePartnerResource="true">
24+
app:sucHeaderText="@string/set_up_management_header">
2625

2726
<LinearLayout
2827
style="@style/SudContentFrame"

0 commit comments

Comments
 (0)