summaryrefslogtreecommitdiff
path: root/core/java/android/os
diff options
context:
space:
mode:
authorBeverly <beverlyt@google.com>2020-04-27 16:15:15 -0400
committerBeverly <beverlyt@google.com>2020-05-07 09:20:19 -0400
commit2b4306a8ecd64f6e03498104f314600f9cc7507c (patch)
tree1f373f5e61922b931b7ad7c7185b1c3edda99fbd /core/java/android/os
parent27f4c791a24e449c0478c1f67804ada048a2b621 (diff)
Add badge colors for dark theme
Test: manual Test: atest UserManagerTest#testProfileTypeInformation Fixes: 149669756 Change-Id: Ib3fd377a4902bbe936d574dc52bac4eae6e25dd4
Diffstat (limited to 'core/java/android/os')
-rw-r--r--core/java/android/os/IUserManager.aidl1
-rw-r--r--core/java/android/os/UserManager.java24
2 files changed, 24 insertions, 1 deletions
diff --git a/core/java/android/os/IUserManager.aidl b/core/java/android/os/IUserManager.aidl
index b10abe7557d5..07363edd3e75 100644
--- a/core/java/android/os/IUserManager.aidl
+++ b/core/java/android/os/IUserManager.aidl
@@ -108,6 +108,7 @@ interface IUserManager {
int getUserBadgeNoBackgroundResId(int userId);
int getUserBadgeLabelResId(int userId);
int getUserBadgeColorResId(int userId);
+ int getUserBadgeDarkColorResId(int userId);
boolean hasBadge(int userId);
boolean isUserUnlocked(int userId);
boolean isUserRunning(int userId);
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 187274a837a0..0023b92ac04b 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -3662,7 +3662,8 @@ public class UserManager {
}
/**
- * Returns the badge color for the given user (generally to color a profile's icon's badge).
+ * Returns the light theme badge color for the given user (generally to color a profile's
+ * icon's badge).
*
* <p>To check whether a badge color is expected for the user, first call {@link #hasBadge}.
*
@@ -3682,6 +3683,27 @@ public class UserManager {
}
/**
+ * Returns the dark theme badge color for the given user (generally to color a profile's icon's
+ * badge).
+ *
+ * <p>To check whether a badge color is expected for the user, first call {@link #hasBadge}.
+ *
+ * @return the color (not the resource ID) to be used for the user's badge
+ * @throws Resources.NotFoundException if no valid badge color exists for this user
+ *
+ * @see #getBadgedIconForUser more information about badging in general
+ * @hide
+ */
+ public @ColorInt int getUserBadgeDarkColor(@UserIdInt int userId) {
+ try {
+ final int resourceId = mService.getUserBadgeDarkColorResId(userId);
+ return Resources.getSystem().getColor(resourceId, null);
+ } catch (RemoteException re) {
+ throw re.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Returns the Resource ID of the user's icon badge.
*
* @return the Resource ID of the user's icon badge if it has one; otherwise