Fix possible NPE in DPMS.
If there's no ActiveAdmin for the given user then the ternary expression would return null, which immediately will throw an NPE as it gets auto-unboxed into from Boolean to boolean. Bug: 217923092 Test: errorprone build Change-Id: I4043f0061e5a23e4d5aa408917f6d51b8bbf22ec
This commit is contained in:
@@ -17,6 +17,7 @@ java_defaults {
|
||||
"-Xep:AndroidFrameworkCompatChange:ERROR",
|
||||
// "-Xep:AndroidFrameworkUid:ERROR",
|
||||
"-Xep:SelfEquals:ERROR",
|
||||
"-Xep:NullTernary:ERROR",
|
||||
// NOTE: only enable to generate local patchfiles
|
||||
// "-XepPatchChecks:refaster:frameworks/base/errorprone/refaster/EfficientXml.java.refaster",
|
||||
// "-XepPatchLocation:/tmp/refaster/",
|
||||
|
||||
@@ -6847,7 +6847,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
String.format(NOT_SYSTEM_CALLER_MSG, "call isAlwaysOnVpnLockdownEnabledForUser"));
|
||||
synchronized (getLockObject()) {
|
||||
ActiveAdmin admin = getDeviceOrProfileOwnerAdminLocked(userHandle);
|
||||
return admin != null ? admin.mAlwaysOnVpnLockdown : null;
|
||||
return admin != null && admin.mAlwaysOnVpnLockdown;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user