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

Commit 4ffc8977 authored by Adrian Roos's avatar Adrian Roos
Browse files

Gestures: Assemble per-window exclusion zones

Adds a facility to listen for per-window exclusion zones and
assembles them into a per-display exclusion zone ready for
consumption by interested parties.

Bug: 126360272
Test: atest DisplayContentTests
Change-Id: Ic186f86ca551af98a5f77beb254d257c281a4160
parent c00ee569
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -383,6 +383,7 @@ java_defaults {
        "core/java/android/view/IRecentsAnimationRunner.aidl",
        "core/java/android/view/IRemoteAnimationFinishedCallback.aidl",
        "core/java/android/view/IRotationWatcher.aidl",
        "core/java/android/view/ISystemGestureExclusionListener.aidl",
        "core/java/android/view/IWallpaperVisibilityListener.aidl",
        "core/java/android/view/IWindow.aidl",
        "core/java/android/view/IWindowFocusObserver.aidl",
+34 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2019, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.view;

import android.graphics.Region;

/**
 * Listener for changes to the system gesture exclusion region
 *
 * {@hide}
 */
oneway interface ISystemGestureExclusionListener {
    /**
     * Called when the system gesture exclusion for the given display changed.
     * @param displayId the display whose system gesture exclusion changed
     * @param systemGestureExclusion a {@code Region} where the app would like priority over the
     *                               system gestures, in display coordinates.
     */
    void onSystemGestureExclusionChanged(int displayId, in Region systemGestureExclusion);
}
 No newline at end of file
+13 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.view.IOnKeyguardExitResult;
import android.view.IPinnedStackListener;
import android.view.RemoteAnimationAdapter;
import android.view.IRotationWatcher;
import android.view.ISystemGestureExclusionListener;
import android.view.IWallpaperVisibilityListener;
import android.view.IWindowSession;
import android.view.IWindowSessionCallback;
@@ -280,6 +281,18 @@ interface IWindowManager
    void unregisterWallpaperVisibilityListener(IWallpaperVisibilityListener listener,
        int displayId);

    /**
     * Registers a system gesture exclusion listener for a given display.
     */
    void registerSystemGestureExclusionListener(ISystemGestureExclusionListener listener,
        int displayId);

    /**
     * Unregisters a system gesture exclusion listener for a given display.
     */
    void unregisterSystemGestureExclusionListener(ISystemGestureExclusionListener listener,
        int displayId);

    /**
     * Used only for assist -- request a screenshot of the current application.
     */
+8 −0
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ import android.view.InsetsState;
import android.view.Surface;
import android.view.SurfaceControl;

import java.util.List;

/**
 * System private per-application interface to the window manager.
 *
@@ -265,4 +267,10 @@ interface IWindowSession {
     * that new state.
     */
    void insetsModified(IWindow window, in InsetsState state);


    /**
     * Called when the system gesture exclusion has changed.
     */
    void reportSystemGestureExclusionChanged(IWindow window, in List<Rect> exclusionRects);
}
+5 −1
Original line number Diff line number Diff line
@@ -3990,7 +3990,11 @@ public final class ViewRootImpl implements ViewParent,
    void systemGestureExclusionChanged() {
        final List<Rect> rectsForWindowManager = mGestureExclusionTracker.computeChangedRects();
        if (rectsForWindowManager != null) {
            // TODO Send to WM
            try {
                mWindowSession.reportSystemGestureExclusionChanged(mWindow, rectsForWindowManager);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
            mAttachInfo.mTreeObserver
                    .dispatchOnSystemGestureExclusionRectsChanged(rectsForWindowManager);
        }
Loading