diff options
author | Amith Yamasani <yamasani@google.com> | 2013-07-10 16:18:01 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2013-07-10 16:18:01 -0700 |
commit | 4befbecfcc286652209126b9a64883b35544157d (patch) | |
tree | 5a722fdbcdaea59f9832521d93de4ac3b9586184 | |
parent | 2f50097a5d5a1fb60574c89c7202cc43ecb51c54 (diff) | |
download | base-4befbecfcc286652209126b9a64883b35544157d.tar.gz |
Pass along the user id to AttributeCache requests
Bug: 9759331
Change-Id: Ib96ba6a89c58edc207021aa43a2b67b4f6c50117
4 files changed, 15 insertions, 6 deletions
diff --git a/services/java/com/android/server/AttributeCache.java b/services/java/com/android/server/AttributeCache.java index 81378dcdc51a..427dbc091ced 100644 --- a/services/java/com/android/server/AttributeCache.java +++ b/services/java/com/android/server/AttributeCache.java @@ -23,6 +23,7 @@ import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; +import android.os.UserHandle; import android.util.SparseArray; import java.util.HashMap; @@ -94,7 +95,7 @@ public final class AttributeCache { } } - public Entry get(String packageName, int resId, int[] styleable) { + public Entry get(String packageName, int resId, int[] styleable, int userId) { synchronized (this) { Package pkg = mPackages.get(packageName); HashMap<int[], Entry> map = null; @@ -110,7 +111,8 @@ public final class AttributeCache { } else { Context context; try { - context = mContext.createPackageContext(packageName, 0); + context = mContext.createPackageContextAsUser(packageName, 0, + new UserHandle(userId)); if (context == null) { return null; } diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java index 054d213f3f28..aa82be3cc74f 100644 --- a/services/java/com/android/server/am/ActivityRecord.java +++ b/services/java/com/android/server/am/ActivityRecord.java @@ -418,7 +418,7 @@ final class ActivityRecord { launchMode = aInfo.launchMode; AttributeCache.Entry ent = AttributeCache.instance().get(packageName, - realTheme, com.android.internal.R.styleable.Window); + realTheme, com.android.internal.R.styleable.Window, userId); fullscreen = ent != null && !ent.array.getBoolean( com.android.internal.R.styleable.Window_windowIsFloating, false) && !ent.array.getBoolean( diff --git a/services/java/com/android/server/wm/AppTransition.java b/services/java/com/android/server/wm/AppTransition.java index 30019e77dc75..cd3daaa9f271 100644 --- a/services/java/com/android/server/wm/AppTransition.java +++ b/services/java/com/android/server/wm/AppTransition.java @@ -147,6 +147,8 @@ public class AppTransition implements Dump { private final Interpolator mDecelerateInterpolator; private final Interpolator mThumbnailFadeoutInterpolator; + private int mCurrentUserId = 0; + AppTransition(Context context, Handler h) { mContext = context; mH = h; @@ -259,7 +261,7 @@ public class AppTransition implements Dump { if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package=" + packageName); return AttributeCache.instance().get(packageName, resId, - com.android.internal.R.styleable.WindowAnimation); + com.android.internal.R.styleable.WindowAnimation, mCurrentUserId); } return null; } @@ -274,7 +276,7 @@ public class AppTransition implements Dump { if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package=" + packageName); return AttributeCache.instance().get(packageName, resId, - com.android.internal.R.styleable.WindowAnimation); + com.android.internal.R.styleable.WindowAnimation, mCurrentUserId); } return null; } @@ -758,4 +760,8 @@ public class AppTransition implements Dump { pw.println(mNextAppTransitionCallback); } } + + public void setCurrentUser(int newUserId) { + mCurrentUserId = newUserId; + } } diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index bc442cef2e40..f2c1bbd3fb88 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -3927,7 +3927,7 @@ public class WindowManagerService extends IWindowManager.Stub + Integer.toHexString(theme)); if (theme != 0) { AttributeCache.Entry ent = AttributeCache.instance().get(pkg, theme, - com.android.internal.R.styleable.Window); + com.android.internal.R.styleable.Window, mCurrentUserId); if (ent == null) { // Whoops! App doesn't exist. Um. Okay. We'll just // pretend like we didn't see that. @@ -4981,6 +4981,7 @@ public class WindowManagerService extends IWindowManager.Stub public void setCurrentUser(final int newUserId) { synchronized (mWindowMap) { mCurrentUserId = newUserId; + mAppTransition.setCurrentUser(newUserId); mPolicy.setCurrentUserLw(newUserId); // Hide windows that should not be seen by the new user. |