Add profile policy to set work challenge background color
Adding a policy for profile owners to set the background color of the
confirm credential screen for the managed profile.
Bug: 26638631
Change-Id: Iea36b94c5a42b6ae12cc36921ec5f840306e81a1
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 9e39a5f..e3959a0 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -5129,4 +5129,55 @@
return null;
}
}
+
+ /**
+ * Called by a profile owner of a managed profile to set the color used for customization.
+ * This color is used as background color of the confirm credentials screen for that user.
+ * The default color is {@link android.graphics.Color#GRAY}.
+ *
+ * <p>The confirm credentials screen can be created using
+ * {@link android.app.KeyguardManager#createConfirmDeviceCredentialIntent}.
+ *
+ * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
+ * @param color The 32bit representation of the color to be used.
+ */
+ public void setOrganizationColor(@NonNull ComponentName admin, int color) {
+ try {
+ mService.setOrganizationColor(admin, color);
+ } catch (RemoteException re) {
+ Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, re);
+ }
+ }
+
+ /**
+ * Called by a profile owner of a managed profile to retrieve the color used for customization.
+ * This color is used as background color of the confirm credentials screen for that user.
+ *
+ * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
+ * @return The 32bit representation of the color to be used.
+ */
+ public int getOrganizationColor(@NonNull ComponentName admin) {
+ try {
+ return mService.getOrganizationColor(admin);
+ } catch (RemoteException re) {
+ Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, re);
+ return 0;
+ }
+ }
+
+ /**
+ * @hide
+ * Retrieve the customization color for a given user.
+ *
+ * @param userHandle The user id of the user we're interested in.
+ * @return The 32bit representation of the color to be used.
+ */
+ public int getOrganizationColorForUser(int userHandle) {
+ try {
+ return mService.getOrganizationColorForUser(userHandle);
+ } catch (RemoteException re) {
+ Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, re);
+ return 0;
+ }
+ }
}
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index 08cab88..82115a2 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -263,4 +263,8 @@
String getLongSupportMessageForUser(in ComponentName admin, int userHandle);
boolean isSeparateProfileChallengeAllowed(int userHandle);
+
+ void setOrganizationColor(in ComponentName admin, in int color);
+ int getOrganizationColor(in ComponentName admin);
+ int getOrganizationColorForUser(int userHandle);
}