summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authoravayvod <avayvod@chromium.org>2015-07-30 15:46:09 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-30 22:46:48 +0000
commit0b69a3fb58aea4a762c326f4b4ba227eead44b28 (patch)
tree50b40a1f88bcddbe23ac967397e417cba1c5c78b /base
parent19c81c689ac484b960dcbfb8633e1723245e5810 (diff)
downloadchromium_src-0b69a3fb58aea4a762c326f4b4ba227eead44b28.zip
chromium_src-0b69a3fb58aea4a762c326f4b4ba227eead44b28.tar.gz
chromium_src-0b69a3fb58aea4a762c326f4b4ba227eead44b28.tar.bz2
[MediaSession,Android] Use a badged notification icon for the Work profile
BUG=515066 Review URL: https://codereview.chromium.org/1266023002 Cr-Commit-Position: refs/heads/master@{#341214}
Diffstat (limited to 'base')
-rw-r--r--base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
index b3eff94..c2d596e 100644
--- a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
+++ b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
@@ -11,6 +11,7 @@ import android.app.PendingIntent;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
@@ -19,6 +20,7 @@ import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.PowerManager;
+import android.os.Process;
import android.provider.Settings;
import android.view.View;
import android.view.ViewGroup.MarginLayoutParams;
@@ -415,4 +417,16 @@ public class ApiCompatibilityUtils {
activity.finish();
}
}
+
+ /**
+ * @see android.content.pm.PackageManager#getUserBadgedIcon(Drawable, android.os.UserHandle).
+ */
+ public static Drawable getUserBadgedIcon(Context context, int id) {
+ Drawable drawable = getDrawable(context.getResources(), id);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ PackageManager packageManager = context.getPackageManager();
+ drawable = packageManager.getUserBadgedIcon(drawable, Process.myUserHandle());
+ }
+ return drawable;
+ }
}