Skip to content

Commit c6a9df9

Browse files
committed
Fix bug which crashes prior to R.
This was caused by a faulty version check. Fixes: 159761407 Change-Id: Id7f235b67a9d325e867a7575ef6c3e5b13c4fc63
1 parent e83e6d0 commit c6a9df9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

app/src/main/java/com/afwsamples/testdpc/policy/PolicyManagementFragment.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2527,8 +2527,11 @@ private void reloadSetAutoTimeRequiredUi() {
25272527

25282528
@TargetApi(Util.R_VERSION_CODE)
25292529
private void reloadSetAutoTimeUi() {
2530-
boolean isOrgOwned = Util.SDK_INT >= VERSION_CODES.R &&
2531-
mDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile();
2530+
if (Util.SDK_INT < VERSION_CODES.R) {
2531+
return;
2532+
}
2533+
boolean isOrgOwned =
2534+
mDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile();
25322535

25332536
if (mDevicePolicyManager.isDeviceOwnerApp(mPackageName)
25342537
|| (mDevicePolicyManager.isProfileOwnerApp(mPackageName)
@@ -2540,8 +2543,11 @@ private void reloadSetAutoTimeUi() {
25402543

25412544
@TargetApi(Util.R_VERSION_CODE)
25422545
private void reloadSetAutoTimeZoneUi() {
2543-
boolean isOrgOwned = Util.SDK_INT >= VERSION_CODES.R &&
2544-
mDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile();
2546+
if (Util.SDK_INT < VERSION_CODES.R) {
2547+
return;
2548+
}
2549+
boolean isOrgOwned =
2550+
mDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile();
25452551

25462552
if (mDevicePolicyManager.isDeviceOwnerApp(mPackageName)
25472553
|| (mDevicePolicyManager.isProfileOwnerApp(mPackageName)

0 commit comments

Comments
 (0)