Skip to content

Commit 7e877fa

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Fix to allow SYSTEM_UID to display windows." into jb-mr1-dev
2 parents de1d96c + a2d7b11 commit 7e877fa

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

services/java/com/android/server/wm/WindowState.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import android.graphics.RectF;
3737
import android.graphics.Region;
3838
import android.os.IBinder;
39+
import android.os.Process;
3940
import android.os.RemoteException;
4041
import android.os.UserHandle;
4142
import android.util.Slog;
@@ -261,8 +262,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
261262

262263
DisplayContent mDisplayContent;
263264

264-
// UserId of the owner. Don't display windows of non-current user.
265-
final int mOwnerUserId;
265+
// UserId and appId of the owner. Don't display windows of non-current user.
266+
final int mOwnerUid;
266267

267268
WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
268269
WindowState attachedWindow, int seq, WindowManager.LayoutParams a,
@@ -271,7 +272,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
271272
mSession = s;
272273
mClient = c;
273274
mToken = token;
274-
mOwnerUserId = UserHandle.getUserId(s.mUid);
275+
mOwnerUid = s.mUid;
275276
mAttrs.copyFrom(a);
276277
mViewVisibility = viewVisibility;
277278
mDisplayContent = displayContent;
@@ -904,7 +905,7 @@ public boolean showLw(boolean doAnimation) {
904905
boolean showLw(boolean doAnimation, boolean requestAnim) {
905906
if (isOtherUsersAppWindow()) {
906907
Slog.w(TAG, "Current user " + mService.mCurrentUserId + " trying to display "
907-
+ this + ", type " + mAttrs.type + ", belonging to " + mOwnerUserId);
908+
+ this + ", type " + mAttrs.type + ", belonging to " + mOwnerUid);
908909
return false;
909910
}
910911
if (mPolicyVisibility && mPolicyVisibilityAfterAnim) {
@@ -985,9 +986,10 @@ public boolean isAlive() {
985986

986987
boolean isOtherUsersAppWindow() {
987988
final int type = mAttrs.type;
988-
if ((mOwnerUserId != mService.mCurrentUserId)
989+
if ((UserHandle.getUserId(mOwnerUid) != mService.mCurrentUserId)
990+
&& (mOwnerUid != Process.SYSTEM_UID)
989991
&& (type >= TYPE_BASE_APPLICATION) && (type <= LAST_APPLICATION_WINDOW)
990-
&& (type != TYPE_APPLICATION_STARTING)) {
992+
&& (type != TYPE_APPLICATION_STARTING)) {
991993
return true;
992994
}
993995
return false;

services/java/com/android/server/wm/WindowStateAnimator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ void setWallpaperOffset(int left, int top) {
12921292
boolean performShowLocked() {
12931293
if (mWin.isOtherUsersAppWindow()) {
12941294
Slog.w(TAG, "Current user " + mService.mCurrentUserId + " trying to display "
1295-
+ this + ", type " + mWin.mAttrs.type + ", belonging to " + mWin.mOwnerUserId);
1295+
+ this + ", type " + mWin.mAttrs.type + ", belonging to " + mWin.mOwnerUid);
12961296
return false;
12971297
}
12981298
if (DEBUG_VISIBILITY || (DEBUG_STARTING_WINDOW &&

0 commit comments

Comments
 (0)