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

Commit 6623f77e authored by Tiger Huang's avatar Tiger Huang Committed by Android (Google) Code Review
Browse files

Merge "Send public types while showing or aborting transient bars"

parents a9a2b261 cff14c06
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -781,19 +781,6 @@ public class InsetsState implements Parcelable {
        }
    }

    public static boolean containsType(@InternalInsetsType int[] types,
            @InternalInsetsType int type) {
        if (types == null) {
            return false;
        }
        for (int t : types) {
            if (t == type) {
                return true;
            }
        }
        return false;
    }

    public void dump(String prefix, PrintWriter pw) {
        final String newPrefix = prefix + "  ";
        pw.println(prefix + "InsetsState");
+4 −4
Original line number Diff line number Diff line
@@ -214,11 +214,11 @@ oneway interface IStatusBar
     * bar and navigation bar which are temporarily visible to the user.
     *
     * @param displayId the ID of the display to notify.
     * @param types the internal insets types of the bars are about to show transiently.
     * @param types the insets types of the bars are about to show transiently.
     * @param isGestureOnSystemBar whether the gesture to show the transient bar was a gesture on
     *        one of the bars itself.
     */
    void showTransient(int displayId, in int[] types, boolean isGestureOnSystemBar);
    void showTransient(int displayId, int types, boolean isGestureOnSystemBar);

    /**
     * Notifies System UI to abort the transient state of system bars, which prevents the bars being
@@ -226,9 +226,9 @@ oneway interface IStatusBar
     * bars again.
     *
     * @param displayId the ID of the display to notify.
     * @param types the internal insets types of the bars are about to abort the transient state.
     * @param types the insets types of the bars are about to abort the transient state.
     */
    void abortTransient(int displayId, in int[] types);
    void abortTransient(int displayId, int types);

    /**
     * Show a warning that the device is about to go to sleep due to user inactivity.
+4 −6
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.internal.statusbar;

import android.annotation.NonNull;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
@@ -41,15 +40,14 @@ public final class RegisterStatusBarResult implements Parcelable {
    public final int mBehavior;
    public final int mRequestedVisibleTypes;
    public final String mPackageName;
    public final int[] mTransientBarTypes;
    public final int mTransientBarTypes;
    public final LetterboxDetails[] mLetterboxDetails;

    public RegisterStatusBarResult(ArrayMap<String, StatusBarIcon> icons, int disabledFlags1,
            int appearance, AppearanceRegion[] appearanceRegions, int imeWindowVis,
            int imeBackDisposition, boolean showImeSwitcher, int disabledFlags2, IBinder imeToken,
            boolean navbarColorManagedByIme, int behavior, int requestedVisibleTypes,
            String packageName, @NonNull int[] transientBarTypes,
            LetterboxDetails[] letterboxDetails) {
            String packageName, int transientBarTypes, LetterboxDetails[] letterboxDetails) {
        mIcons = new ArrayMap<>(icons);
        mDisabledFlags1 = disabledFlags1;
        mAppearance = appearance;
@@ -87,7 +85,7 @@ public final class RegisterStatusBarResult implements Parcelable {
        dest.writeInt(mBehavior);
        dest.writeInt(mRequestedVisibleTypes);
        dest.writeString(mPackageName);
        dest.writeIntArray(mTransientBarTypes);
        dest.writeInt(mTransientBarTypes);
        dest.writeParcelableArray(mLetterboxDetails, flags);
    }

@@ -113,7 +111,7 @@ public final class RegisterStatusBarResult implements Parcelable {
                    final int behavior = source.readInt();
                    final int requestedVisibleTypes = source.readInt();
                    final String packageName = source.readString();
                    final int[] transientBarTypes = source.createIntArray();
                    final int transientBarTypes = source.readInt();
                    final LetterboxDetails[] letterboxDetails =
                            source.readParcelableArray(null, LetterboxDetails.class);
                    return new RegisterStatusBarResult(icons, disabledFlags1, appearance,
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ public class RegisterStatusBarResultTest {
                BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE,
                WindowInsets.Type.defaultVisible(),
                "test" /* packageName */,
                new int[0] /* transientBarTypes */,
                0 /* transientBarTypes */,
                new LetterboxDetails[] {letterboxDetails});

        final RegisterStatusBarResult copy = clone(original);
+5 −7
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import static android.view.InsetsState.ITYPE_BOTTOM_TAPPABLE_ELEMENT;
import static android.view.InsetsState.ITYPE_LEFT_GESTURES;
import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
import static android.view.InsetsState.ITYPE_RIGHT_GESTURES;
import static android.view.InsetsState.containsType;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
@@ -85,7 +84,6 @@ import android.view.DisplayCutout;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.InsetsFrameProvider;
import android.view.InsetsState.InternalInsetsType;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.Surface;
@@ -97,6 +95,7 @@ import android.view.ViewRootImpl.SurfaceChangedCallback;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.InternalInsetsInfo;
import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
import android.view.WindowInsets;
import android.view.WindowInsets.Type.InsetsType;
import android.view.WindowInsetsController.Appearance;
import android.view.WindowInsetsController.Behavior;
@@ -1150,12 +1149,11 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
    }

    @Override
    public void showTransient(int displayId, @InternalInsetsType int[] types,
            boolean isGestureOnSystemBar) {
    public void showTransient(int displayId, @InsetsType int types, boolean isGestureOnSystemBar) {
        if (displayId != mDisplayId) {
            return;
        }
        if (!containsType(types, ITYPE_NAVIGATION_BAR)) {
        if ((types & WindowInsets.Type.navigationBars()) == 0) {
            return;
        }
        if (!mTransientShown) {
@@ -1166,11 +1164,11 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
    }

    @Override
    public void abortTransient(int displayId, @InternalInsetsType int[] types) {
    public void abortTransient(int displayId, @InsetsType int types) {
        if (displayId != mDisplayId) {
            return;
        }
        if (!containsType(types, ITYPE_NAVIGATION_BAR)) {
        if ((types & WindowInsets.Type.navigationBars()) == 0) {
            return;
        }
        clearTransient();
Loading