Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java

Issue 1266023002: [MediaSession,Android] Use a badged notification icon for the Work profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No canvas drawing into bitmap Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/media/ui/NotificationMediaPlaybackControls.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
diff --git a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
index b3eff94e81d69888712ea5aa535e66d4f734a446..c2d596e381171221391cd2491fc42715dd773ac0 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;
+ }
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/media/ui/NotificationMediaPlaybackControls.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698