Skip to content

Commit ea22f1b

Browse files
elevenfivejscott1989
authored andcommitted
Update build.sh & gitignore & fix crash
- Fix build failure when using latest Bazel 6.2.1 - Error: Cannot fit requested classes in a single dex file - Removing --noincremental_dexing fixes the issue - Update readme to reflect the build.sh fix - Add build artifact & IDE files to a new .gitignore - Fix crash on Android 12 when TestDPC is device owner
1 parent 4f15200 commit ea22f1b

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
bazel-android-testdpc
2+
bazel-bin
3+
bazel-out
4+
bazel-testlogs
5+
**/*.iml
6+
.idea

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ See the [documentation](https://developer.android.com/work/index.html) to learn
88
Getting Started
99
---------------
1010

11-
This sample uses the Bazel build system. To build this project, use the "bazel build --noincremental_dexing" command.
11+
This sample uses the Bazel build system. To build this project, use the "bazel build testdpc" command.
1212

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

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Fail on any error.
44
set -e
55

6-
bazel build --noincremental_dexing testdpc
6+
bazel build testdpc

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.afwsamples.testdpc;
1818

19+
import static com.afwsamples.testdpc.common.Util.isAtLeastT;
20+
1921
import android.app.admin.DevicePolicyManager;
2022
import android.app.admin.NetworkEvent;
2123
import android.app.admin.SecurityLog.SecurityEvent;
@@ -636,7 +638,11 @@ public void setPreferentialNetworkServiceEnabled(
636638
public boolean isPreferentialNetworkServiceEnabled() {
637639
Util.requireAndroidS();
638640

639-
return mDevicePolicyManager.isPreferentialNetworkServiceEnabled();
641+
if (isAtLeastT()) {
642+
return mDevicePolicyManager.isPreferentialNetworkServiceEnabled();
643+
}
644+
645+
return false;
640646
}
641647

642648
@Override

0 commit comments

Comments
 (0)