Merge "Update Device Admin Info Settings text for a financed device" into sc-dev am: d2ca004392

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/13879788

Change-Id: I033950c94e9f0e1e2e11c3b6e773c6aa2b2a23c9
This commit is contained in:
Rajeev Kumar
2021-03-16 17:18:00 +00:00
committed by Automerger Merge Worker
2 changed files with 15 additions and 1 deletions

View File

@@ -10522,6 +10522,9 @@
<string name="admin_device_owner_message">Your admin can monitor and manage apps and data <string name="admin_device_owner_message">Your admin can monitor and manage apps and data
associated with this device, including settings, permissions, corporate access, associated with this device, including settings, permissions, corporate access,
network activity, and the device\'s location information.</string> network activity, and the device\'s location information.</string>
<!-- Shown in admin details page to warn user about policies the admin can set on a financed device. [CHAR LIMIT=NONE] -->
<string name="admin_financed_message">Your device admin may be able to access data associated
with this device and change this device\s settings.</string>
<!-- Turn off a conditional state of the device (e.g. airplane mode, or hotspot) [CHAR LIMIT=30] --> <!-- Turn off a conditional state of the device (e.g. airplane mode, or hotspot) [CHAR LIMIT=30] -->
<string name="condition_turn_off">Turn off</string> <string name="condition_turn_off">Turn off</string>

View File

@@ -16,6 +16,8 @@
package com.android.settings.applications.specialaccess.deviceadmin; package com.android.settings.applications.specialaccess.deviceadmin;
import static android.app.admin.DevicePolicyManager.DEVICE_OWNER_TYPE_FINANCED;
import android.app.Activity; import android.app.Activity;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.AppOpsManager; import android.app.AppOpsManager;
@@ -661,8 +663,12 @@ public class DeviceAdminAdd extends Activity {
mAdminWarning.setText(R.string.admin_profile_owner_user_message); mAdminWarning.setText(R.string.admin_profile_owner_user_message);
} else { } else {
// Show device owner description. // Show device owner description.
if (isFinancedDevice()) {
mAdminWarning.setText(R.string.admin_financed_message);
} else {
mAdminWarning.setText(R.string.admin_device_owner_message); mAdminWarning.setText(R.string.admin_device_owner_message);
} }
}
mActionButton.setText(R.string.remove_device_admin); mActionButton.setText(R.string.remove_device_admin);
mActionButton.setEnabled(false); mActionButton.setEnabled(false);
} else { } else {
@@ -759,6 +765,11 @@ public class DeviceAdminAdd extends Activity {
return info != null ? info.isManagedProfile() : false; 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, * @return an {@link Optional} containing the admin with a given package name, if it exists,
* or {@link Optional#empty()} otherwise. * or {@link Optional#empty()} otherwise.