diff options
| author | 2019-11-06 11:59:07 +0000 | |
|---|---|---|
| committer | 2019-11-06 17:03:38 +0000 | |
| commit | b7eb15dfa896ed7a95bd84954d4c88faa38c8c8d (patch) | |
| tree | c0036839af1f5988f67da66ad191370e708c27e7 | |
| parent | 4f27cd6f468dabaff1ab2da555b47624fd54ea9e (diff) | |
Add an override for getUser in ContextWrapper
This is to fix an issue when calling getUser for a context that
is different than the context of the current foreground user.
getUser for a ContextWrapper would call the base
class Context#getUser which returns the user of the current foreground
process rather than returning the user of the calling context.
Currently, this is a bug that does not meet the ContextWrapper class Javadoc.
It looks like the ContextWrapper call was missed in Ib772ec4438e57a2ad4950821b9432f9842998451.
Fix: 144024489
Test: called the API from a test App with a different context than the
current application context.
Change-Id: I2d24f5141e8cbc2546c8dc5894a1aeab376b7632
| -rw-r--r-- | core/java/android/content/ContextWrapper.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java index d5d0dcea9438..251100413246 100644 --- a/core/java/android/content/ContextWrapper.java +++ b/core/java/android/content/ContextWrapper.java @@ -917,6 +917,12 @@ public class ContextWrapper extends Context { return mBase.getUserId(); } + /** @hide */ + @Override + public UserHandle getUser() { + return mBase.getUser(); + } + @Override public Context createConfigurationContext(Configuration overrideConfiguration) { return mBase.createConfigurationContext(overrideConfiguration); |