From 2ce6dc82b3adc4657eaa994e4046e0d2a9985f22 Mon Sep 17 00:00:00 2001 From: Salud Lemus Date: Mon, 15 Mar 2021 20:54:30 +0000 Subject: [PATCH] Update Device Admin Info Settings text for a financed device Bug: 182804474 Test: Used a test device that is registered via ZT Change-Id: Ia48e1767038f8dc3d8965ee30bc7aa9efaec59ef --- res/values/strings.xml | 3 +++ .../specialaccess/deviceadmin/DeviceAdminAdd.java | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 7a8c5c31ec7..c85624d4a2b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -10503,6 +10503,9 @@ Your admin can monitor and manage apps and data associated with this device, including settings, permissions, corporate access, network activity, and the device\'s location information. + + Your device admin may be able to access data associated + with this device and change this device\’s settings. Turn off diff --git a/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java b/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java index 7c8b96f4ff5..1fe3f177b69 100644 --- a/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java +++ b/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java @@ -16,6 +16,8 @@ package com.android.settings.applications.specialaccess.deviceadmin; +import static android.app.admin.DevicePolicyManager.DEVICE_OWNER_TYPE_FINANCED; + import android.app.Activity; import android.app.ActivityManager; import android.app.AppOpsManager; @@ -661,7 +663,11 @@ public class DeviceAdminAdd extends Activity { mAdminWarning.setText(R.string.admin_profile_owner_user_message); } else { // Show device owner description. - mAdminWarning.setText(R.string.admin_device_owner_message); + if (isFinancedDevice()) { + mAdminWarning.setText(R.string.admin_financed_message); + } else { + mAdminWarning.setText(R.string.admin_device_owner_message); + } } mActionButton.setText(R.string.remove_device_admin); mActionButton.setEnabled(false); @@ -759,6 +765,11 @@ public class DeviceAdminAdd extends Activity { return info != null ? info.isManagedProfile() : false; } + private boolean isFinancedDevice() { + return mDPM.isDeviceManaged() && mDPM.getDeviceOwnerType( + mDPM.getDeviceOwnerComponentOnAnyUser()) == DEVICE_OWNER_TYPE_FINANCED; + } + /** * @return an {@link Optional} containing the admin with a given package name, if it exists, * or {@link Optional#empty()} otherwise.