File tree Expand file tree Collapse file tree 2 files changed +3
-19
lines changed
app/src/main/java/com/afwsamples/testdpc Expand file tree Collapse file tree 2 files changed +3
-19
lines changed Original file line number Diff line number Diff line change @@ -257,13 +257,7 @@ private int getCurrentAdmin() {
257
257
if (dpm .isDeviceOwnerApp (packageName )) {
258
258
return ADMIN_DEVICE_OWNER ;
259
259
}
260
- Boolean orgOwned ;
261
- try {
262
- orgOwned = (Boolean ) ReflectionUtil .invoke (dpm ,
263
- "isOrganizationOwnedDeviceWithManagedProfile" );
264
- } catch (ReflectionIsTemporaryException e ) {
265
- orgOwned = false ;
266
- }
260
+ Boolean orgOwned = dpm .isOrganizationOwnedDeviceWithManagedProfile ();
267
261
if (dpm .isProfileOwnerApp (packageName )) {
268
262
if (orgOwned ) {
269
263
return ADMIN_ORG_OWNED_PROFILE_OWNER ;
Original file line number Diff line number Diff line change @@ -2370,8 +2370,9 @@ private void loadAppFeedbackNotifications() {
2370
2370
2371
2371
private void loadAppStatus () {
2372
2372
final @ StringRes int appStatusStringId ;
2373
+ boolean isOrgOwned = mDevicePolicyManager .isOrganizationOwnedDeviceWithManagedProfile ();
2373
2374
if (mDevicePolicyManager .isProfileOwnerApp (mPackageName )) {
2374
- if (isOrganizationOwnedDeviceWithManagedProfile ()) {
2375
+ if (mDevicePolicyManager . isOrganizationOwnedDeviceWithManagedProfile ()) {
2375
2376
appStatusStringId = R .string .this_is_an_org_owned_profile_owner ;
2376
2377
} else {
2377
2378
appStatusStringId = R .string .this_is_a_profile_owner ;
@@ -4054,17 +4055,6 @@ private int validateDeviceOwnerBeforeQ() {
4054
4055
return NO_CUSTOM_CONSTRIANT ;
4055
4056
}
4056
4057
4057
- // TODO: nuke it when R sdk is available
4058
- private boolean isOrganizationOwnedDeviceWithManagedProfile () {
4059
- try {
4060
- return (Boolean ) ReflectionUtil .invoke (
4061
- mDevicePolicyManager , "isOrganizationOwnedDeviceWithManagedProfile" );
4062
- } catch (ReflectionIsTemporaryException e ) {
4063
- Log .e (TAG , "Error invoking isOrganizationOwnedDeviceWithManagedProfile" , e );
4064
- return false ;
4065
- }
4066
- }
4067
-
4068
4058
abstract static class ManageLockTaskListCallback {
4069
4059
public abstract void onPositiveButtonClicked (String [] lockTaskArray );
4070
4060
}
You can’t perform that action at this time.
0 commit comments