Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f33af228 authored by Yorke Lee's avatar Yorke Lee Committed by Android (Google) Code Review
Browse files

Merge "Limit global drags to apps targeting SDK 24 and above" into nyc-dev

parents d06520a4 0e852471
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -106,12 +106,13 @@ interface IWindowManager
     * @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.
+2 −1
Original line number Diff line number Diff line
@@ -5177,7 +5177,8 @@ final class ActivityStack {
                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;
    }

+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ class AppWindowToken extends WindowToken {
    int requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    boolean layoutConfigChanges;
    boolean showForAllUsers;
    int targetSdk;

    // The input dispatching timeout for this application token in nanoseconds.
    long inputDispatchingTimeoutNanos;
+9 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.content.Context;
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;
@@ -289,7 +290,7 @@ class DragState {
        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;
@@ -300,6 +301,13 @@ class DragState {
                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.
+2 −1
Original line number Diff line number Diff line
@@ -3420,7 +3420,7 @@ public class WindowManagerService extends IWindowManager.Stub
            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");
@@ -3450,6 +3450,7 @@ public class WindowManagerService extends IWindowManager.Stub
            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;
Loading