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

Commit eb04bd24 authored by Alex Stetson's avatar Alex Stetson Committed by Android (Google) Code Review
Browse files

Merge "Update topFocusedWindowChanged API" into tm-qpr-dev

parents 22f40b1e 02cb8c6f
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view;

import android.content.ComponentName;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
import android.view.InsetsVisibilities;
@@ -30,10 +31,11 @@ oneway interface IDisplayWindowInsetsController {
    /**
     * Called when top focused window changes to determine whether or not to take over insets
     * control. Won't be called if config_remoteInsetsControllerControlsSystemBars is false.
     * @param packageName: Passes the top package name
     * @param component: Passes the top application component in the focused window.
     * @param requestedVisibilities The insets visibilities requested by the focussed window.
     */
    void topFocusedWindowChanged(String packageName, in InsetsVisibilities insetsVisibilities);
    void topFocusedWindowChanged(in ComponentName component,
            in InsetsVisibilities insetsVisibilities);

    /**
     * @see IWindow#insetsChanged
+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.annotation.IntDef;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Point;
@@ -324,7 +325,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
        }

        @Override
        public void topFocusedWindowChanged(String packageName,
        public void topFocusedWindowChanged(ComponentName component,
                InsetsVisibilities requestedVisibilities) {
            // Do nothing
        }
+7 −6
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.wm.shell.common;

import android.content.ComponentName;
import android.os.RemoteException;
import android.util.Slog;
import android.util.SparseArray;
@@ -171,14 +172,14 @@ public class DisplayInsetsController implements DisplayController.OnDisplaysChan
            }
        }

        private void topFocusedWindowChanged(String packageName,
        private void topFocusedWindowChanged(ComponentName component,
                InsetsVisibilities requestedVisibilities) {
            CopyOnWriteArrayList<OnInsetsChangedListener> listeners = mListeners.get(mDisplayId);
            if (listeners == null) {
                return;
            }
            for (OnInsetsChangedListener listener : listeners) {
                listener.topFocusedWindowChanged(packageName, requestedVisibilities);
                listener.topFocusedWindowChanged(component, requestedVisibilities);
            }
        }

@@ -186,10 +187,10 @@ public class DisplayInsetsController implements DisplayController.OnDisplaysChan
        private class DisplayWindowInsetsControllerImpl
                extends IDisplayWindowInsetsController.Stub {
            @Override
            public void topFocusedWindowChanged(String packageName,
            public void topFocusedWindowChanged(ComponentName component,
                    InsetsVisibilities requestedVisibilities) throws RemoteException {
                mMainExecutor.execute(() -> {
                    PerDisplay.this.topFocusedWindowChanged(packageName, requestedVisibilities);
                    PerDisplay.this.topFocusedWindowChanged(component, requestedVisibilities);
                });
            }

@@ -234,10 +235,10 @@ public class DisplayInsetsController implements DisplayController.OnDisplaysChan
        /**
         * Called when top focused window changes to determine whether or not to take over insets
         * control. Won't be called if config_remoteInsetsControllerControlsSystemBars is false.
         * @param packageName The name of the package that is open in the top focussed window.
         * @param component The application component that is open in the top focussed window.
         * @param requestedVisibilities The insets visibilities requested by the focussed window.
         */
        default void topFocusedWindowChanged(String packageName,
        default void topFocusedWindowChanged(ComponentName component,
                InsetsVisibilities requestedVisibilities) {}

        /**
+2 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static org.mockito.ArgumentMatchers.notNull;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import android.content.ComponentName;
import android.os.RemoteException;
import android.util.SparseArray;
import android.view.IDisplayWindowInsetsController;
@@ -165,7 +166,7 @@ public class DisplayInsetsControllerTest extends ShellTestCase {
        int hideInsetsCount = 0;

        @Override
        public void topFocusedWindowChanged(String packageName,
        public void topFocusedWindowChanged(ComponentName component,
                InsetsVisibilities requestedVisibilities) {
            topFocusedWindowChangedCount++;
        }
+5 −3
Original line number Diff line number Diff line
@@ -161,6 +161,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.ActivityInfo.ScreenOrientation;
@@ -6520,12 +6521,13 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        /**
         * Notifies the remote insets controller that the top focused window has changed.
         *
         * @param packageName The name of the package that is open in the top focused window.
         * @param component The application component that is open in the top focussed window.
         * @param requestedVisibilities The insets visibilities requested by the focussed window.
         */
        void topFocusedWindowChanged(String packageName, InsetsVisibilities requestedVisibilities) {
        void topFocusedWindowChanged(ComponentName component,
                InsetsVisibilities requestedVisibilities) {
            try {
                mRemoteInsetsController.topFocusedWindowChanged(packageName, requestedVisibilities);
                mRemoteInsetsController.topFocusedWindowChanged(component, requestedVisibilities);
            } catch (RemoteException e) {
                Slog.w(TAG, "Failed to deliver package in top focused window change", e);
            }
Loading