diff options
author | Kenny Guy <kennyguy@google.com> | 2014-09-10 11:14:57 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-09-10 11:14:59 +0000 |
commit | c8824b18c1fe1ea917d4cc8b72796522c25605f0 (patch) | |
tree | b91d7070287d3e049a70f761b59325548adec29a /core/java | |
parent | c8e1d78af967579a5a3227f3234420baca49042f (diff) | |
parent | 8942bcd6ea7de228d1145599739bd43a881dfe1d (diff) | |
download | frameworks_base-c8824b18c1fe1ea917d4cc8b72796522c25605f0.zip frameworks_base-c8824b18c1fe1ea917d4cc8b72796522c25605f0.tar.gz frameworks_base-c8824b18c1fe1ea917d4cc8b72796522c25605f0.tar.bz2 |
Merge "Remember userId when stripping / rebuilding notification." into lmp-dev
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/app/Notification.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index b93d17c..f9e4895 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -842,6 +842,13 @@ public class Notification implements Parcelable public static final String EXTRA_COMPACT_ACTIONS = "android.compactActions"; /** + * {@link #extras} key: the user that built the notification. + * + * @hide + */ + public static final String EXTRA_ORIGINATING_USERID = "android.originatingUserId"; + + /** * Value for {@link #EXTRA_AS_HEADS_UP} that indicates this notification should not be * displayed in the heads up space. * @@ -1880,6 +1887,11 @@ public class Notification implements Parcelable private int mColor = COLOR_DEFAULT; /** + * The user that built the notification originally. + */ + private int mOriginatingUserId; + + /** * Contains extras related to rebuilding during the build phase. */ private Bundle mRebuildBundle = new Bundle(); @@ -2599,7 +2611,7 @@ public class Notification implements Parcelable // Note: This assumes that the current user can read the profile badge of the // originating user. return mContext.getPackageManager().getUserBadgeForDensity( - new UserHandle(mContext.getUserId()), 0); + new UserHandle(mOriginatingUserId), 0); } private Bitmap getProfileBadge() { @@ -3070,6 +3082,7 @@ public class Notification implements Parcelable */ public void populateExtras(Bundle extras) { // Store original information used in the construction of this object + extras.putInt(EXTRA_ORIGINATING_USERID, mOriginatingUserId); extras.putParcelable(EXTRA_REBUILD_CONTEXT_APPLICATION_INFO, mContext.getApplicationInfo()); extras.putCharSequence(EXTRA_TITLE, mContentTitle); @@ -3301,6 +3314,7 @@ public class Notification implements Parcelable // Extras. Bundle extras = n.extras; + mOriginatingUserId = extras.getInt(EXTRA_ORIGINATING_USERID); mContentTitle = extras.getCharSequence(EXTRA_TITLE); mContentText = extras.getCharSequence(EXTRA_TEXT); mSubText = extras.getCharSequence(EXTRA_SUB_TEXT); @@ -3333,6 +3347,7 @@ public class Notification implements Parcelable * object. */ public Notification build() { + mOriginatingUserId = mContext.getUserId(); mHasThreeLines = hasThreeLines(); Notification n = buildUnstyled(); |