* @param alwaysFocusable True if the app windows are always focusable regardless of the stack
* they are in.
* @param homeTask True if this is the task.
+ * @param targetSdkVersion The application's target SDK version
*/
void addAppToken(int addPos, IApplicationToken token, int taskId, int stackId,
int requestedOrientation, boolean fullscreen, boolean showWhenLocked, int userId,
int configChanges, boolean voiceInteraction, boolean launchTaskBehind,
in Rect taskBounds, in Configuration configuration, int taskResizeMode,
- boolean alwaysFocusable, boolean homeTask);
+ boolean alwaysFocusable, boolean homeTask, int targetSdkVersion);
/**
*
* @param token The token we are adding to the input task Id.
r.task.taskId, mStackId, r.info.screenOrientation, r.fullscreen,
(r.info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0, r.userId, r.info.configChanges,
task.voiceSession != null, r.mLaunchTaskBehind, bounds, task.mOverrideConfig,
- task.mResizeMode, r.isAlwaysFocusable(), task.isHomeTask());
+ task.mResizeMode, r.isAlwaysFocusable(), task.isHomeTask(),
+ r.appInfo.targetSdkVersion);
r.taskConfigOverride = task.mOverrideConfig;
}
int requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
boolean layoutConfigChanges;
boolean showForAllUsers;
+ int targetSdk;
// The input dispatching timeout for this application token in nanoseconds.
long inputDispatchingTimeoutNanos;
import android.graphics.Matrix;
import android.graphics.Point;
import android.hardware.input.InputManager;
+import android.os.Build;
import android.os.IBinder;
import android.os.Message;
import android.os.Process;
if (!targetWin.isPotentialDragTarget()) {
return false;
}
- if ((mFlags & View.DRAG_FLAG_GLOBAL) == 0) {
+ if ((mFlags & View.DRAG_FLAG_GLOBAL) == 0 || !targetWindowSupportsGlobalDrag(targetWin)) {
// Drag is limited to the current window.
if (mLocalWin != targetWin.mClient.asBinder()) {
return false;
mSourceUserId == UserHandle.getUserId(targetWin.getOwningUid());
}
+ private boolean targetWindowSupportsGlobalDrag(WindowState targetWin) {
+ // Global drags are limited to system windows, and windows for apps that are targeting N and
+ // above.
+ return targetWin.mAppToken == null
+ || targetWin.mAppToken.targetSdk >= Build.VERSION_CODES.N;
+ }
+
/* helper - send a ACTION_DRAG_STARTED event only if the window has not
* previously been notified, i.e. it became visible after the drag operation
* was begun. This is a rare case.
int requestedOrientation, boolean fullscreen, boolean showForAllUsers, int userId,
int configChanges, boolean voiceInteraction, boolean launchTaskBehind,
Rect taskBounds, Configuration config, int taskResizeMode, boolean alwaysFocusable,
- boolean homeTask) {
+ boolean homeTask, int targetSdkVersion) {
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
"addAppToken()")) {
throw new SecurityException("Requires MANAGE_APP_TOKENS permission");
atoken.inputDispatchingTimeoutNanos = inputDispatchingTimeoutNanos;
atoken.appFullscreen = fullscreen;
atoken.showForAllUsers = showForAllUsers;
+ atoken.targetSdk = targetSdkVersion;
atoken.requestedOrientation = requestedOrientation;
atoken.layoutConfigChanges = (configChanges &
(ActivityInfo.CONFIG_SCREEN_SIZE | ActivityInfo.CONFIG_ORIENTATION)) != 0;
try {
mWm.addAppToken(0, null, 0, 0, 0, false, false, 0, 0, false, false, null,
- Configuration.EMPTY, 0, false, false);
+ Configuration.EMPTY, 0, false, false, 0);
fail("IWindowManager.addAppToken did not throw SecurityException as"
+ " expected");
} catch (SecurityException e) {
@Override
public void addAppToken(int arg0, IApplicationToken arg1, int arg2, int arg3, int arg4,
boolean arg5, boolean arg6, int arg7, int arg8, boolean arg9, boolean arg10,
- Rect arg11, Configuration arg12, int arg13, boolean arg14, boolean arg15)
+ Rect arg11, Configuration arg12, int arg13, boolean arg14, boolean arg15, int arg16)
throws RemoteException {
// TODO Auto-generated method stub
}