Skip to content

Commit 5e6f0e8

Browse files
committed
Merge /media/tonymak/SSD/testdpc-release/vendor/unbundled_google/packages/TestDPC
2 parents 7a7e2f3 + 141c24c commit 5e6f0e8

24 files changed

+261
-95
lines changed

app/build.gradle

Lines changed: 19 additions & 3 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 = 0
10+
versionBuild = 1
1111
}
1212

1313
android {
@@ -29,6 +29,14 @@ android {
2929
}
3030
}
3131

32+
lintOptions {
33+
check 'NewApi'
34+
abortOnError true
35+
xmlReport false
36+
textReport true
37+
textOutput "stdout"
38+
}
39+
3240
compileOptions {
3341
sourceCompatibility JavaVersion.VERSION_1_7
3442
targetCompatibility JavaVersion.VERSION_1_7
@@ -52,11 +60,11 @@ android {
5260
}
5361
}
5462

55-
/* TODO: remove once release version of N sdk is released */
63+
/* TODO: Remove once release version of N SDK is released. */
5664
applicationVariants.all { variant ->
5765
variant.outputs.each { output ->
5866
output.processManifest.doLast {
59-
// minSdkVersion and targetSdkVersion are overridden if we build against preview
67+
// minSdkVersion and targetSdkVersion are overrided if we build against preview
6068
// SDK, let us override them again here.
6169
minSdkVersion = variant.getMergedFlavor().minSdkVersion.getApiString();
6270
targetSdkVersion = variant.getMergedFlavor().targetSdkVersion.getApiString();
@@ -71,6 +79,14 @@ android {
7179
}
7280
}
7381
}
82+
83+
// Enable lint checking in all build variants.
84+
applicationVariants.all { variant ->
85+
variant.outputs.each { output ->
86+
def lintTask = tasks["lint${variant.name.capitalize()}"]
87+
output.assemble.dependsOn lintTask
88+
}
89+
}
7490
}
7591

7692
dependencies {

app/src/main/java/com/afwsamples/testdpc/common/ProfileOrParentFragment.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.afwsamples.testdpc.common;
1818

19+
import android.annotation.TargetApi;
1920
import android.app.Fragment;
2021
import android.app.admin.DevicePolicyManager;
2122
import android.content.ComponentName;
@@ -42,7 +43,10 @@
4243
*
4344
* If there is no parent user (for example, if the managed user is controlled by a Device Owner),
4445
* the fragment will be shown directly.
46+
*
47+
* Please notice that all subclasses of this fragment only support N or above.
4548
*/
49+
@TargetApi(VERSION_CODES.N)
4650
public abstract class ProfileOrParentFragment extends PreferenceFragment {
4751
private static final String LOG_TAG = "ProfileOrParentFragment";
4852

@@ -141,11 +145,6 @@ protected final boolean isManagedProfileInstance() {
141145
return mProfileOwner && !isParentProfileInstance();
142146
}
143147

144-
@Override
145-
public Context getContext() {
146-
return (Context) getActivity();
147-
}
148-
149148
@Override
150149
public void onCreate(Bundle savedInstanceState) {
151150
super.onCreate(savedInstanceState);

app/src/main/java/com/afwsamples/testdpc/common/ProvisioningStateUtil.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.afwsamples.testdpc.common;
1818

19+
import android.annotation.TargetApi;
1920
import android.app.admin.DevicePolicyManager;
2021
import android.content.ComponentName;
2122
import android.content.ContentResolver;
@@ -90,6 +91,7 @@ public static boolean isManaged(Context context) {
9091
* @param context Calling activity's context
9192
* @return true, if provisioning is allowed for corresponding action
9293
*/
94+
@TargetApi(Build.VERSION_CODES.N)
9395
public static boolean isProvisioningAllowed(Context context, String action) {
9496
/* TODO: Remove CODENAME check once SDK_INT on device is bumped for N */
9597
if (!versionIsAtLeastN()) {

0 commit comments

Comments
 (0)