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

Commit 5a5678d2 authored by Ioannis Ilkos's avatar Ioannis Ilkos Committed by Android (Google) Code Review
Browse files

Merge "Revert "Window Manager Flag Migration (4/n)""

parents 6e40b40f 8cca1410
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -305,11 +305,6 @@ interface IWindowManager
     */
    oneway void statusBarVisibilityChanged(int displayId, int visibility);

    /**
     * Called by System UI to notify Window Manager to hide transient bars.
     */
    oneway void hideTransientBars(int displayId);

    /**
    * When set to {@code true} the system bars will always be shown. This is true even if an app
    * requests to be fullscreen by setting the system ui visibility flags. The
+17 −17
Original line number Diff line number Diff line
@@ -146,11 +146,20 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
        }
        final Insets offset = Insets.subtract(mShownInsets, mPendingInsets);
        ArrayList<SurfaceParams> params = new ArrayList<>();
        if (offset.left != 0) {
            updateLeashesForSide(INSET_SIDE_LEFT, offset.left, mPendingInsets.left, params, state);
        }
        if (offset.top != 0) {
            updateLeashesForSide(INSET_SIDE_TOP, offset.top, mPendingInsets.top, params, state);
        updateLeashesForSide(INSET_SIDE_RIGHT, offset.right, mPendingInsets.right, params, state);
        }
        if (offset.right != 0) {
            updateLeashesForSide(INSET_SIDE_RIGHT, offset.right, mPendingInsets.right, params,
                    state);
        }
        if (offset.bottom != 0) {
            updateLeashesForSide(INSET_SIDE_BOTTOM, offset.bottom, mPendingInsets.bottom, params,
                    state);
        }
        SyncRtSurfaceTransactionApplier applier = mTransactionApplierSupplier.get();
        applier.scheduleApply(params.toArray(new SurfaceParams[params.size()]));
        mCurrentInsets = mPendingInsets;
@@ -215,9 +224,6 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
    private void updateLeashesForSide(@InsetSide int side, int offset, int inset,
            ArrayList<SurfaceParams> surfaceParams, InsetsState state) {
        ArraySet<InsetsSourceConsumer> items = mSideSourceMap.get(side);
        if (items == null) {
            return;
        }
        // TODO: Implement behavior when inset spans over multiple types
        for (int i = items.size() - 1; i >= 0; i--) {
            final InsetsSourceConsumer consumer = items.valueAt(i);
@@ -268,15 +274,9 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
            SparseSetArray<InsetsSourceConsumer> sideSourcesMap,
            SparseArray<InsetsSourceConsumer> consumers) {
        for (int i = typeSideMap.size() - 1; i >= 0; i--) {
            final int type = typeSideMap.keyAt(i);
            final int side = typeSideMap.valueAt(i);
            final InsetsSourceConsumer consumer = consumers.get(type);
            if (consumer == null) {
                // If the types that we are controlling are less than the types that the system has,
                // there can be some null consumers.
                continue;
            }
            sideSourcesMap.add(side, consumer);
            int type = typeSideMap.keyAt(i);
            int side = typeSideMap.valueAt(i);
            sideSourcesMap.add(side, consumers.get(type));
        }
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -67,9 +67,9 @@ public class InsetsController implements WindowInsetsController {
     * Translation animation evaluator.
     */
    private static TypeEvaluator<Insets> sEvaluator = (fraction, startValue, endValue) -> Insets.of(
            (int) (startValue.left + fraction * (endValue.left - startValue.left)),
            0,
            (int) (startValue.top + fraction * (endValue.top - startValue.top)),
            (int) (startValue.right + fraction * (endValue.right - startValue.right)),
            0,
            (int) (startValue.bottom + fraction * (endValue.bottom - startValue.bottom)));

    /**
+4 −56
Original line number Diff line number Diff line
@@ -16,18 +16,10 @@

package android.view;

import static android.view.View.NAVIGATION_BAR_TRANSLUCENT;
import static android.view.View.NAVIGATION_BAR_TRANSPARENT;
import static android.view.View.STATUS_BAR_TRANSLUCENT;
import static android.view.View.STATUS_BAR_TRANSPARENT;
import static android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
import static android.view.View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
import static android.view.View.SYSTEM_UI_FLAG_LOW_PROFILE;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_SIDE_BARS;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_TOP_BAR;
import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS;
import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_SIDE_BARS;
import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_TOP_BAR;
import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_BARS;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_SWIPE;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;

@@ -43,13 +35,9 @@ public class InsetsFlags {

    @ViewDebug.ExportedProperty(flagMapping = {
            @ViewDebug.FlagToString(
                    mask = APPEARANCE_OPAQUE_TOP_BAR,
                    equals = APPEARANCE_OPAQUE_TOP_BAR,
                    name = "OPAQUE_TOP_BAR"),
            @ViewDebug.FlagToString(
                    mask = APPEARANCE_OPAQUE_SIDE_BARS,
                    equals = APPEARANCE_OPAQUE_SIDE_BARS,
                    name = "OPAQUE_SIDE_BARS"),
                    mask = APPEARANCE_OPAQUE_BARS,
                    equals = APPEARANCE_OPAQUE_BARS,
                    name = "OPAQUE_BARS"),
            @ViewDebug.FlagToString(
                    mask = APPEARANCE_LOW_PROFILE_BARS,
                    equals = APPEARANCE_LOW_PROFILE_BARS,
@@ -76,44 +64,4 @@ public class InsetsFlags {
                    name = "SHOW_TRANSIENT_BARS_BY_SWIPE")
    })
    public @Behavior int behavior;

    /**
     * Converts system UI visibility to appearance.
     *
     * @param systemUiVisibility the system UI visibility to be converted.
     * @return the outcome {@link Appearance}
     */
    public static @Appearance int getAppearance(int systemUiVisibility) {
        int appearance = 0;
        appearance |= convertFlag(systemUiVisibility, SYSTEM_UI_FLAG_LOW_PROFILE,
                APPEARANCE_LOW_PROFILE_BARS);
        appearance |= convertFlag(systemUiVisibility, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR,
                APPEARANCE_LIGHT_TOP_BAR);
        appearance |= convertFlag(systemUiVisibility, SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR,
                APPEARANCE_LIGHT_SIDE_BARS);
        appearance |= convertNoFlag(systemUiVisibility,
                STATUS_BAR_TRANSLUCENT | STATUS_BAR_TRANSPARENT, APPEARANCE_OPAQUE_TOP_BAR);
        appearance |= convertNoFlag(systemUiVisibility,
                NAVIGATION_BAR_TRANSLUCENT | NAVIGATION_BAR_TRANSPARENT,
                APPEARANCE_OPAQUE_SIDE_BARS);
        return appearance;
    }

    /**
     * Converts the system UI visibility into an appearance flag if the given visibility contains
     * the given system UI flag.
     */
    private static @Appearance int convertFlag(int systemUiVisibility, int systemUiFlag,
            @Appearance int appearance) {
        return (systemUiVisibility & systemUiFlag) != 0 ? appearance : 0;
    }

    /**
     * Converts the system UI visibility into an appearance flag if the given visibility doesn't
     * contains the given system UI flag.
     */
    private static @Appearance int convertNoFlag(int systemUiVisibility, int systemUiFlag,
            @Appearance int appearance) {
        return (systemUiVisibility & systemUiFlag) == 0 ? appearance : 0;
    }
}
+2 −28
Original line number Diff line number Diff line
@@ -270,23 +270,10 @@ public class InsetsState implements Parcelable {
     *
     * @param type The {@link InternalInsetType} of the source to remove
     */
    public void removeSource(@InternalInsetType int type) {
    public void removeSource(int type) {
        mSources.remove(type);
    }

    /**
     * A shortcut for setting the visibility of the source.
     *
     * @param type The {@link InternalInsetType} of the source to set the visibility
     * @param visible {@code true} for visible
     */
    public void setSourceVisible(@InternalInsetType int type, boolean visible) {
        InsetsSource source = mSources.get(type);
        if (source != null) {
            source.setVisible(visible);
        }
    }

    public void set(InsetsState other) {
        set(other, false /* copySources */);
    }
@@ -370,19 +357,6 @@ public class InsetsState implements Parcelable {
        }
    }

    public static boolean containsType(@InternalInsetType int[] types,
            @InternalInsetType 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) {
        pw.println(prefix + "InsetsState");
        for (int i = mSources.size() - 1; i >= 0; i--) {
@@ -390,7 +364,7 @@ public class InsetsState implements Parcelable {
        }
    }

    public static String typeToString(@InternalInsetType int type) {
    public static String typeToString(int type) {
        switch (type) {
            case TYPE_TOP_BAR:
                return "TYPE_TOP_BAR";
Loading