Allow privileged apps to set the organization color.
BUG:26923835
Change-Id: I97b0cbbc0d4fb9e9ca0e3d335a9d15eb5a1f9602
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 1b2322f..876f625 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -16,12 +16,14 @@
package android.app.admin;
+import android.annotation.ColorInt;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
+import android.annotation.UserIdInt;
import android.app.Activity;
import android.auditing.SecurityLog;
import android.auditing.SecurityLog.SecurityEvent;
@@ -5598,6 +5600,25 @@
}
/**
+ * @hide
+ *
+ * Sets the color used for customization.
+ *
+ * @param color The 32bit representation of the color to be used.
+ * @param userId which user to set the color to.
+ * @RequiresPermission(allOf = {
+ * Manifest.permission.MANAGE_USERS,
+ * Manifest.permission.INTERACT_ACROSS_USERS_FULL})
+ */
+ public void setOrganizationColorForUser(@ColorInt int color, @UserIdInt int userId) {
+ try {
+ mService.setOrganizationColorForUser(color, userId);
+ } 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.
*
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index bd68182..685ec3e 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -277,6 +277,7 @@
boolean isSeparateProfileChallengeAllowed(int userHandle);
void setOrganizationColor(in ComponentName admin, in int color);
+ void setOrganizationColorForUser(in int color, in int userId);
int getOrganizationColor(in ComponentName admin);
int getOrganizationColorForUser(int userHandle);