3636import android .graphics .RectF ;
3737import android .graphics .Region ;
3838import android .os .IBinder ;
39+ import android .os .Process ;
3940import android .os .RemoteException ;
4041import android .os .UserHandle ;
4142import 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 ;
0 commit comments