Skip to content

Commit 1589a02

Browse files
committed
Release final R version.
2 parents 0151c77 + e28642f commit 1589a02

27 files changed

+2991
-215
lines changed

app/build.gradle

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ext {
77
// exactly 1 digit
88
versionMinor = 0
99
// exactly 2 digits
10-
versionBuild = 02
10+
versionBuild = 03
1111
}
1212

1313
android {
@@ -121,15 +121,19 @@ private void stripTestOnlyForBuild(flavor, buildType) {
121121
def manifestPath =
122122
"${buildDir}/intermediates/manifests/full/${flavor}/${buildType}/AndroidManifest.xml"
123123
if (file(manifestPath).exists()) {
124-
def xml = new XmlParser().parse(manifestPath)
125-
def attributeNames = xml.application[0].attributes().collect { it.key }
126-
attributeNames.each {
127-
if (it.getLocalPart() == 'testOnly') {
128-
xml.application[0].attributes().remove(it)
129-
println "Removed testOnly attribute successfully!"
124+
if (System.getenv('TESTDPC_ALLOW_TEST_ONLY') == 'true') {
125+
println "NOT stripping testOnly from manifest because of TESTDPC_ALLOW_TEST_ONLY"
126+
} else {
127+
def xml = new XmlParser().parse(manifestPath)
128+
def attributeNames = xml.application[0].attributes().collect { it.key }
129+
attributeNames.each {
130+
if (it.getLocalPart() == 'testOnly') {
131+
xml.application[0].attributes().remove(it)
132+
println "Removed testOnly attribute successfully!"
133+
}
130134
}
135+
new XmlNodePrinter(new PrintWriter(new FileWriter(manifestPath))).print(xml)
131136
}
132-
new XmlNodePrinter(new PrintWriter(new FileWriter(manifestPath))).print(xml)
133137
}
134138
}
135139

app/src/main/AndroidManifest.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
3434
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
3535

36+
<!-- NOTE: android:testOnly will be stripped by build.fradle (stripTestOnlyForBuild()) -->
3637
<application
38+
android:testOnly="true"
3739
android:allowBackup="true"
3840
android:icon="@drawable/ic_launcher"
3941
android:banner="@drawable/ic_launcher"
@@ -184,6 +186,13 @@
184186
android:resource="@xml/filepaths" />
185187
</provider>
186188

189+
<provider
190+
android:authorities="com.afwsamples.testdpc.usericoncontentprovider"
191+
android:name="com.afwsamples.testdpc.UserIconContentProvider"
192+
android:grantUriPermissions="true"
193+
android:exported="true">
194+
</provider>
195+
187196
<service android:name=".profilepolicy.apprestrictions.AppRestrictionsProxy">
188197
<intent-filter>
189198
<action android:name="com.android.vending.dpc.APPLICATION_RESTRICTIONS_PROXY" />

app/src/main/java/com/afwsamples/testdpc/DeviceAdminService.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
1+
/*
2+
* Copyright (C) 2017 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package com.afwsamples.testdpc;
217

18+
import java.io.FileDescriptor;
19+
import java.io.PrintWriter;
20+
321
import android.content.BroadcastReceiver;
422
import android.content.Intent;
523
import android.content.IntentFilter;
@@ -43,4 +61,9 @@ private void unregisterPackageChangesReceiver() {
4361
mPackageChangedReceiver = null;
4462
}
4563
}
64+
65+
@Override
66+
protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
67+
new ShellCommand(getApplicationContext(), writer, args).run();
68+
}
4669
}

0 commit comments

Comments
 (0)