diff options
| author | 2015-10-30 10:40:03 -0700 | |
|---|---|---|
| committer | 2015-10-30 10:40:03 -0700 | |
| commit | c0688301de5feea94c8456b3b9b42c41d0045f03 (patch) | |
| tree | 215beb4a826de6e16868ca5d3dd0e9c21e1fde2c | |
| parent | c8a5e4c16db7d4cd9e1ef6d52f249c5b89d17505 (diff) | |
Don't store a static instance of UserManager
Otherwise the context within it can't be GCed.
It's better to leave the caching to the ContextImpl.
Bug: 25308506
Change-Id: I9be3ba5b1bb6cdc88b77520b2fbd72d9b72ef30d
| -rw-r--r-- | core/java/android/os/UserManager.java | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 1c1575e06f7e..bc49b2306cc9 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -499,14 +499,9 @@ public class UserManager { /** @hide */ public static final int PIN_VERIFICATION_SUCCESS = -1; - private static UserManager sInstance = null; - /** @hide */ - public synchronized static UserManager get(Context context) { - if (sInstance == null) { - sInstance = (UserManager) context.getSystemService(Context.USER_SERVICE); - } - return sInstance; + public static UserManager get(Context context) { + return (UserManager) context.getSystemService(Context.USER_SERVICE); } /** @hide */ |