Skip to content

Commit a2d7b11

Browse files
author
Craig Mautner
committed
Fix to allow SYSTEM_UID to display windows.
Was not previously checking to make sure that the appId was not SYSTEM_UID (1000). This caused certain system windows to fail to appear. Change-Id: I939dc2f8a256acb84b7c413c7e00003a89aff6d4
1 parent 9dc52bc commit a2d7b11

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
@@ -1302,7 +1302,7 @@ void setWallpaperOffset(int left, int top) {
13021302
boolean performShowLocked() {
13031303
if (mWin.isOtherUsersAppWindow()) {
13041304
Slog.w(TAG, "Current user " + mService.mCurrentUserId + " trying to display "
1305-
+ this + ", type " + mWin.mAttrs.type + ", belonging to " + mWin.mOwnerUserId);
1305+
+ this + ", type " + mWin.mAttrs.type + ", belonging to " + mWin.mOwnerUid);
13061306
return false;
13071307
}
13081308
if (DEBUG_VISIBILITY || (DEBUG_STARTING_WINDOW &&

0 commit comments

Comments
 (0)