Merge "Fix to allow SYSTEM_UID to display windows." into jb-mr1-dev

This commit is contained in:
Craig Mautner
2012-08-21 15:30:41 -07:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 7 deletions

View File

@@ -36,6 +36,7 @@ import android.graphics.Rect;
import android.graphics.RectF; import android.graphics.RectF;
import android.graphics.Region; import android.graphics.Region;
import android.os.IBinder; import android.os.IBinder;
import android.os.Process;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.UserHandle; import android.os.UserHandle;
import android.util.Slog; import android.util.Slog;
@@ -261,8 +262,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
DisplayContent mDisplayContent; DisplayContent mDisplayContent;
// UserId of the owner. Don't display windows of non-current user. // UserId and appId of the owner. Don't display windows of non-current user.
final int mOwnerUserId; final int mOwnerUid;
WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token, WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
WindowState attachedWindow, int seq, WindowManager.LayoutParams a, WindowState attachedWindow, int seq, WindowManager.LayoutParams a,
@@ -271,7 +272,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
mSession = s; mSession = s;
mClient = c; mClient = c;
mToken = token; mToken = token;
mOwnerUserId = UserHandle.getUserId(s.mUid); mOwnerUid = s.mUid;
mAttrs.copyFrom(a); mAttrs.copyFrom(a);
mViewVisibility = viewVisibility; mViewVisibility = viewVisibility;
mDisplayContent = displayContent; mDisplayContent = displayContent;
@@ -904,7 +905,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
boolean showLw(boolean doAnimation, boolean requestAnim) { boolean showLw(boolean doAnimation, boolean requestAnim) {
if (isOtherUsersAppWindow()) { if (isOtherUsersAppWindow()) {
Slog.w(TAG, "Current user " + mService.mCurrentUserId + " trying to display " Slog.w(TAG, "Current user " + mService.mCurrentUserId + " trying to display "
+ this + ", type " + mAttrs.type + ", belonging to " + mOwnerUserId); + this + ", type " + mAttrs.type + ", belonging to " + mOwnerUid);
return false; return false;
} }
if (mPolicyVisibility && mPolicyVisibilityAfterAnim) { if (mPolicyVisibility && mPolicyVisibilityAfterAnim) {
@@ -985,9 +986,10 @@ final class WindowState implements WindowManagerPolicy.WindowState {
boolean isOtherUsersAppWindow() { boolean isOtherUsersAppWindow() {
final int type = mAttrs.type; final int type = mAttrs.type;
if ((mOwnerUserId != mService.mCurrentUserId) if ((UserHandle.getUserId(mOwnerUid) != mService.mCurrentUserId)
&& (mOwnerUid != Process.SYSTEM_UID)
&& (type >= TYPE_BASE_APPLICATION) && (type <= LAST_APPLICATION_WINDOW) && (type >= TYPE_BASE_APPLICATION) && (type <= LAST_APPLICATION_WINDOW)
&& (type != TYPE_APPLICATION_STARTING)) { && (type != TYPE_APPLICATION_STARTING)) {
return true; return true;
} }
return false; return false;

View File

@@ -1292,7 +1292,7 @@ class WindowStateAnimator {
boolean performShowLocked() { boolean performShowLocked() {
if (mWin.isOtherUsersAppWindow()) { if (mWin.isOtherUsersAppWindow()) {
Slog.w(TAG, "Current user " + mService.mCurrentUserId + " trying to display " Slog.w(TAG, "Current user " + mService.mCurrentUserId + " trying to display "
+ this + ", type " + mWin.mAttrs.type + ", belonging to " + mWin.mOwnerUserId); + this + ", type " + mWin.mAttrs.type + ", belonging to " + mWin.mOwnerUid);
return false; return false;
} }
if (DEBUG_VISIBILITY || (DEBUG_STARTING_WINDOW && if (DEBUG_VISIBILITY || (DEBUG_STARTING_WINDOW &&