am 06a441de: Merge "Pass along the user id to AttributeCache requests" into jb-mr2-dev

* commit '06a441de3b6756cf49879ff445ac26c66da54d02':
  Pass along the user id to AttributeCache requests
This commit is contained in:
Amith Yamasani
2013-07-12 11:19:24 -07:00
committed by Android Git Automerger
4 changed files with 15 additions and 6 deletions

View File

@@ -23,6 +23,7 @@ import android.content.pm.PackageManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.os.UserHandle;
import android.util.SparseArray; import android.util.SparseArray;
import java.util.HashMap; 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) { synchronized (this) {
Package pkg = mPackages.get(packageName); Package pkg = mPackages.get(packageName);
HashMap<int[], Entry> map = null; HashMap<int[], Entry> map = null;
@@ -110,7 +111,8 @@ public final class AttributeCache {
} else { } else {
Context context; Context context;
try { try {
context = mContext.createPackageContext(packageName, 0); context = mContext.createPackageContextAsUser(packageName, 0,
new UserHandle(userId));
if (context == null) { if (context == null) {
return null; return null;
} }

View File

@@ -418,7 +418,7 @@ final class ActivityRecord {
launchMode = aInfo.launchMode; launchMode = aInfo.launchMode;
AttributeCache.Entry ent = AttributeCache.instance().get(packageName, 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( fullscreen = ent != null && !ent.array.getBoolean(
com.android.internal.R.styleable.Window_windowIsFloating, false) com.android.internal.R.styleable.Window_windowIsFloating, false)
&& !ent.array.getBoolean( && !ent.array.getBoolean(

View File

@@ -147,6 +147,8 @@ public class AppTransition implements Dump {
private final Interpolator mDecelerateInterpolator; private final Interpolator mDecelerateInterpolator;
private final Interpolator mThumbnailFadeoutInterpolator; private final Interpolator mThumbnailFadeoutInterpolator;
private int mCurrentUserId = 0;
AppTransition(Context context, Handler h) { AppTransition(Context context, Handler h) {
mContext = context; mContext = context;
mH = h; mH = h;
@@ -259,7 +261,7 @@ public class AppTransition implements Dump {
if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package=" if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package="
+ packageName); + packageName);
return AttributeCache.instance().get(packageName, resId, return AttributeCache.instance().get(packageName, resId,
com.android.internal.R.styleable.WindowAnimation); com.android.internal.R.styleable.WindowAnimation, mCurrentUserId);
} }
return null; return null;
} }
@@ -274,7 +276,7 @@ public class AppTransition implements Dump {
if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package=" if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package="
+ packageName); + packageName);
return AttributeCache.instance().get(packageName, resId, return AttributeCache.instance().get(packageName, resId,
com.android.internal.R.styleable.WindowAnimation); com.android.internal.R.styleable.WindowAnimation, mCurrentUserId);
} }
return null; return null;
} }
@@ -758,4 +760,8 @@ public class AppTransition implements Dump {
pw.println(mNextAppTransitionCallback); pw.println(mNextAppTransitionCallback);
} }
} }
public void setCurrentUser(int newUserId) {
mCurrentUserId = newUserId;
}
} }

View File

@@ -3927,7 +3927,7 @@ public class WindowManagerService extends IWindowManager.Stub
+ Integer.toHexString(theme)); + Integer.toHexString(theme));
if (theme != 0) { if (theme != 0) {
AttributeCache.Entry ent = AttributeCache.instance().get(pkg, theme, AttributeCache.Entry ent = AttributeCache.instance().get(pkg, theme,
com.android.internal.R.styleable.Window); com.android.internal.R.styleable.Window, mCurrentUserId);
if (ent == null) { if (ent == null) {
// Whoops! App doesn't exist. Um. Okay. We'll just // Whoops! App doesn't exist. Um. Okay. We'll just
// pretend like we didn't see that. // pretend like we didn't see that.
@@ -4981,6 +4981,7 @@ public class WindowManagerService extends IWindowManager.Stub
public void setCurrentUser(final int newUserId) { public void setCurrentUser(final int newUserId) {
synchronized (mWindowMap) { synchronized (mWindowMap) {
mCurrentUserId = newUserId; mCurrentUserId = newUserId;
mAppTransition.setCurrentUser(newUserId);
mPolicy.setCurrentUserLw(newUserId); mPolicy.setCurrentUserLw(newUserId);
// Hide windows that should not be seen by the new user. // Hide windows that should not be seen by the new user.