Skip to content

Commit 41676fa

Browse files
committed
Upload version 3.0.0
2 parents 9a31f46 + 6b1f6bf commit 41676fa

File tree

60 files changed

+4928
-668
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+4928
-668
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ bin/
1818
#Gradle-based build
1919
.gradle
2020
build/
21+
# Android Studio/IntelliJ IDEA related files.
22+
*.iml

README.md

Lines changed: 61 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,61 @@
1-
Test Device Policy Control (Test DPC) App
2-
=========================================
3-
4-
Test DPC is an app designed to help EMMs, ISVs and OEMs to test their applications and platforms in a Managed Profile effectively. It serves as both a sample Device Policy Client and a testing application to flex the APIs available for Android for Work. It supports devices running Android 5.0 Lollipop or later.
5-
6-
Pre-requisites
7-
--------------
8-
9-
- Android SDK v23
10-
- Android Build Tools v23.0.1
11-
- Android Support Repository
12-
13-
Getting Started
14-
---------------
15-
16-
This sample uses the Gradle build system. To build this project, use the
17-
"gradlew assemble” command or use "Import Project" in Android Studio.
18-
19-
Screenshots
20-
-----------
21-
22-
<img src="doc/setup.png" height="400" alt="Setup" title="Setup screen"/>
23-
<img src="doc/policy_management.png" height="400" alt="Policy Management" title="Home screen once the profile is setup" />
24-
<img src="doc/manage_app_restrictions.png" height="400" alt="Manage App Restrictions" title="Manage restrictions for apps in the work profile" />
25-
<img src="doc/work_profile_management.png" height="400" alt="Work Profile Management" title="Manage policies specific to the work profile" />
26-
<img src="doc/network_data_usage_stats.png" height="400" alt="Network Data Usage Stats" title="Analyze data usage for specific work apps or the entire profile" />
27-
28-
Known Issues
29-
------------
30-
31-
1. No support for mime type in cross-profile intent filter creation.
32-
2. No support for PackageInstaller APIs.
33-
3. Values are not saving correctly under Manage app permissions.
34-
35-
Support
36-
-------
37-
38-
If you've found an error in this sample, please file an issue:
39-
https://github.com/googlesamples/android-testdpc/issues
40-
41-
Patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub.
42-
43-
License
44-
-------
45-
46-
Licensed under the Apache 2.0 license. See the LICENSE file for details.
47-
48-
How to make contributions?
49-
--------------------------
50-
51-
Please read and follow the steps in the CONTRIB file.
1+
{\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf340
2+
{\fonttbl\f0\fmodern\fcharset0 Courier;}
3+
{\colortbl;\red255\green255\blue255;}
4+
\margl1440\margr1440\vieww23240\viewh19780\viewkind0
5+
\deftab720
6+
\pard\pardeftab720\sl280\partightenfactor0
7+
8+
\f0\fs24 \cf0 \expnd0\expndtw0\kerning0
9+
Test Device Policy Controller (Test DPC) App\
10+
=========================================\
11+
\
12+
Test DPC is an app designed to help EMMs, ISVs, and OEMs to test their applications and platforms in a Android for Work managed profile (i.e. work profile). It serves as both a sample Device Policy Controller and a testing application to flex the APIs available for Android for Work. It supports devices running Android 5.0 Lollipop or later. As of March 9, 2016, it also supports devices running the Android N Developer Preview.\
13+
\
14+
Pre-requisites\
15+
--------------\
16+
\
17+
- Android N Preview SDK\
18+
- Android Build Tools v23.0.2\
19+
- Android Support Repository\
20+
\
21+
Getting Started\
22+
---------------\
23+
\
24+
This sample uses the Gradle build system. To build this project, use the \'93gradlew assemble\'94 command or use "Import Project" in Android Studio.\
25+
\
26+
Please note that two apks will be generated when building this app: TestDPC-standard-*.apk is the apk targeting devices Android 6.0 and below while TestDPC-N-*.apk is targeting the Android N Developer Preview.\
27+
\
28+
Screenshots\
29+
-----------\
30+
\
31+
<img src="doc/setup.png" height="400" alt="Setup" title="Setup screen"/>\
32+
<img src="doc/policy_management.png" height="400" alt="Policy Management" title="Home screen once the profile is setup" />\
33+
<img src="doc/manage_app_restrictions.png" height="400" alt="Manage App Restrictions" title="Manage restrictions for apps in the work profile" />\
34+
<img src="doc/work_profile_management.png" height="400" alt="Work Profile Management" title="Manage policies specific to the work profile" />\
35+
<img src="doc/network_data_usage_stats.png" height="400" alt="Network Data Usage Stats" title="Analyze data usage for specific work apps or the entire profile" />\
36+
\
37+
Known Issues\
38+
------------\
39+
\
40+
1. No support for mime type in cross-profile intent filter creation.\
41+
2. No support for PackageInstaller APIs.\
42+
3. Values are not saving correctly under Manage app permissions.\
43+
\
44+
Support\
45+
-------\
46+
\
47+
If you've found an error in this sample, please file an issue:\
48+
https://github.com/googlesamples/android-testdpc/issues\
49+
\
50+
Patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub.\
51+
\
52+
License\
53+
-------\
54+
\
55+
Licensed under the Apache 2.0 license. See the LICENSE file for details.\
56+
\
57+
How to make contributions?\
58+
--------------------------\
59+
\
60+
Please read and follow the steps in the CONTRIB file.\
61+
}

app/build.gradle

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ apply plugin: 'com.android.application'
33
ext {
44
/* Version code for *next* release, bump *after* a release is created. */
55
// 1 or more digits
6-
versionMajor = 2
6+
versionMajor = 3
77
// exactly 1 digit
88
versionMinor = 0
99
// exactly 2 digits
10-
versionBuild = 6
10+
versionBuild = 0
1111
}
1212

1313
android {
14-
compileSdkVersion 'android-23'
15-
buildToolsVersion '23.0.1'
14+
compileSdkVersion 'android-N'
15+
buildToolsVersion '23.0.2'
1616

1717
defaultConfig {
1818
applicationId "com.afwsamples.testdpc"
@@ -39,9 +39,42 @@ android {
3939
dirs 'libs'
4040
}
4141
}
42+
43+
productFlavors {
44+
standard {
45+
minSdkVersion 21
46+
targetSdkVersion 23
47+
}
48+
49+
N {
50+
minSdkVersion 'N'
51+
targetSdkVersion 'N'
52+
}
53+
}
54+
55+
/* TODO: remove once release version of N sdk is released */
56+
applicationVariants.all { variant ->
57+
variant.outputs.each { output ->
58+
output.processManifest.doLast {
59+
// minSdkVersion and targetSdkVersion are overridden if we build against preview
60+
// SDK, let us override them again here.
61+
minSdkVersion = variant.getMergedFlavor().minSdkVersion.getApiString();
62+
targetSdkVersion = variant.getMergedFlavor().targetSdkVersion.getApiString();
63+
64+
def manifestOutFile = output.processManifest.manifestOutputFile
65+
def newFileContents = manifestOutFile.getText('UTF-8').
66+
replace('android:minSdkVersion="N"',
67+
'android:minSdkVersion="' + minSdkVersion + '"')
68+
newFileContents = newFileContents.replace('android:targetSdkVersion="N"',
69+
'android:targetSdkVersion="' + targetSdkVersion + '"')
70+
manifestOutFile.write(newFileContents, 'UTF-8')
71+
}
72+
}
73+
}
4274
}
4375

4476
dependencies {
4577
compile "com.android.support:support-v4:22.0.0"
78+
compile "com.android.support:support-v13:22.0.0"
4679
compile(name:'setup-wizard-lib-platform-release', ext:'aar')
4780
}

app/src/main/AndroidManifest.xml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
2525
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
2626
<uses-permission android:name="android.permission.INTERNET" />
27+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
2728

2829
<application
2930
android:allowBackup="true"
@@ -64,21 +65,6 @@
6465
android:label="@string/app_name"
6566
android:theme="@style/SetupTheme"/>
6667

67-
<activity
68-
android:name=".syncauth.SetupSyncAuthManagement"
69-
android:label="@string/app_name"
70-
android:theme="@style/SetupTheme"/>
71-
72-
<activity
73-
android:name=".syncauth.FinishSyncAuthDeviceOwnerActivity"
74-
android:label="@string/app_name"
75-
android:theme="@style/SetupTheme"/>
76-
77-
<activity
78-
android:name=".syncauth.FinishSyncAuthProfileOwnerActivity"
79-
android:label="@string/app_name"
80-
android:theme="@style/SetupTheme"/>
81-
8268
<activity
8369
android:name=".policy.locktask.KioskModeActivity"
8470
android:label="@string/kiosk_mode"
@@ -102,6 +88,7 @@
10288
<intent-filter>
10389
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED"/>
10490
<action android:name="android.app.action.PROFILE_PROVISIONING_COMPLETE"/>
91+
<action android:name="android.intent.action.BOOT_COMPLETED"/>
10592
</intent-filter>
10693
</receiver>
10794

@@ -115,6 +102,12 @@
115102
android:resource="@xml/filepaths" />
116103
</provider>
117104

105+
<service android:name=".profilepolicy.apprestrictions.AppRestrictionsProxy">
106+
<intent-filter>
107+
<action android:name="com.android.vending.dpc.APPLICATION_RESTRICTIONS_PROXY" />
108+
</intent-filter>
109+
</service>
110+
118111
</application>
119112

120113
</manifest>

0 commit comments

Comments
 (0)