Loading services/core/java/com/android/server/wm/AppTaskImpl.java +61 −43 Original line number Diff line number Diff line Loading @@ -185,13 +185,16 @@ class AppTaskImpl extends IAppTask.Stub { @Override public void moveTaskTo(int displayId, Rect bounds, IRemoteCallback callback) { checkCallerOrSystemOrRoot(); if (mService.checkPermission( REPOSITION_SELF_WINDOWS, Binder.getCallingPid(), Binder.getCallingUid()) final int origCallingPid = Binder.getCallingPid(); final int origCallingUid = Binder.getCallingUid(); final long origId = Binder.clearCallingIdentity(); if (mService.checkPermission(REPOSITION_SELF_WINDOWS, origCallingPid, origCallingUid) != PERMISSION_GRANTED) { reportTaskMoveRequestResult( RESULT_FAILED_NO_PERMISSIONS, INVALID_DISPLAY, null /* bounds */, callback); return; } try { synchronized (mService.mGlobalLock) { final Task task = mService.mRootWindowContainer.anyTaskForId(mTaskId); if (task == null) { Loading @@ -205,9 +208,11 @@ class AppTaskImpl extends IAppTask.Stub { } adjustTaskMoveRequestBounds(displayId, bounds); final int result = validateTaskMoveRequest(displayId, bounds, task); final int result = validateTaskMoveRequest(displayId, bounds, task, origCallingPid, origCallingUid); if (result != RESULT_APPROVED) { reportTaskMoveRequestResult(result, INVALID_DISPLAY, null /* bounds */, callback); reportTaskMoveRequestResult( result, INVALID_DISPLAY, null /* bounds */, callback); return; } Loading @@ -224,10 +229,15 @@ class AppTaskImpl extends IAppTask.Stub { int lateResult = validateTaskMoveRequest( transition.getRequestedLocation().getDisplayId(), transition.getRequestedLocation().getBounds(), task); task, origCallingPid, origCallingUid); if (lateResult != RESULT_APPROVED) { reportTaskMoveRequestResult( lateResult, INVALID_DISPLAY, null /* bounds */, callback); lateResult, INVALID_DISPLAY, null /* bounds */, callback); transition.abort(); return; } Loading @@ -236,6 +246,9 @@ class AppTaskImpl extends IAppTask.Stub { transition.setReady(task, true); }); } } finally { Binder.restoreCallingIdentity(origId); } } /** Loading Loading @@ -266,7 +279,12 @@ class AppTaskImpl extends IAppTask.Stub { } @TaskMoveRequestHandler.RequestResult private int validateTaskMoveRequest(int displayId, Rect bounds, @NonNull Task task) { private int validateTaskMoveRequest( int displayId, Rect bounds, @NonNull Task task, int origCallingPid, int origCallingUid) { final DisplayContent targetDisplay = mService.mRootWindowContainer.getDisplayContent(displayId); if (targetDisplay == null) { Loading @@ -274,7 +292,7 @@ class AppTaskImpl extends IAppTask.Stub { } if (!mService.mTaskSupervisor.canPlaceEntityOnDisplay( displayId, Binder.getCallingPid(), Binder.getCallingUid(), task)) { displayId, origCallingPid, origCallingUid, task)) { return RESULT_FAILED_UNABLE_TO_PLACE_TASK; } Loading Loading
services/core/java/com/android/server/wm/AppTaskImpl.java +61 −43 Original line number Diff line number Diff line Loading @@ -185,13 +185,16 @@ class AppTaskImpl extends IAppTask.Stub { @Override public void moveTaskTo(int displayId, Rect bounds, IRemoteCallback callback) { checkCallerOrSystemOrRoot(); if (mService.checkPermission( REPOSITION_SELF_WINDOWS, Binder.getCallingPid(), Binder.getCallingUid()) final int origCallingPid = Binder.getCallingPid(); final int origCallingUid = Binder.getCallingUid(); final long origId = Binder.clearCallingIdentity(); if (mService.checkPermission(REPOSITION_SELF_WINDOWS, origCallingPid, origCallingUid) != PERMISSION_GRANTED) { reportTaskMoveRequestResult( RESULT_FAILED_NO_PERMISSIONS, INVALID_DISPLAY, null /* bounds */, callback); return; } try { synchronized (mService.mGlobalLock) { final Task task = mService.mRootWindowContainer.anyTaskForId(mTaskId); if (task == null) { Loading @@ -205,9 +208,11 @@ class AppTaskImpl extends IAppTask.Stub { } adjustTaskMoveRequestBounds(displayId, bounds); final int result = validateTaskMoveRequest(displayId, bounds, task); final int result = validateTaskMoveRequest(displayId, bounds, task, origCallingPid, origCallingUid); if (result != RESULT_APPROVED) { reportTaskMoveRequestResult(result, INVALID_DISPLAY, null /* bounds */, callback); reportTaskMoveRequestResult( result, INVALID_DISPLAY, null /* bounds */, callback); return; } Loading @@ -224,10 +229,15 @@ class AppTaskImpl extends IAppTask.Stub { int lateResult = validateTaskMoveRequest( transition.getRequestedLocation().getDisplayId(), transition.getRequestedLocation().getBounds(), task); task, origCallingPid, origCallingUid); if (lateResult != RESULT_APPROVED) { reportTaskMoveRequestResult( lateResult, INVALID_DISPLAY, null /* bounds */, callback); lateResult, INVALID_DISPLAY, null /* bounds */, callback); transition.abort(); return; } Loading @@ -236,6 +246,9 @@ class AppTaskImpl extends IAppTask.Stub { transition.setReady(task, true); }); } } finally { Binder.restoreCallingIdentity(origId); } } /** Loading Loading @@ -266,7 +279,12 @@ class AppTaskImpl extends IAppTask.Stub { } @TaskMoveRequestHandler.RequestResult private int validateTaskMoveRequest(int displayId, Rect bounds, @NonNull Task task) { private int validateTaskMoveRequest( int displayId, Rect bounds, @NonNull Task task, int origCallingPid, int origCallingUid) { final DisplayContent targetDisplay = mService.mRootWindowContainer.getDisplayContent(displayId); if (targetDisplay == null) { Loading @@ -274,7 +292,7 @@ class AppTaskImpl extends IAppTask.Stub { } if (!mService.mTaskSupervisor.canPlaceEntityOnDisplay( displayId, Binder.getCallingPid(), Binder.getCallingUid(), task)) { displayId, origCallingPid, origCallingUid, task)) { return RESULT_FAILED_UNABLE_TO_PLACE_TASK; } Loading