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

Commit 2c39e86c authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 10776546 from c7bce336 to udc-qpr1-release

Change-Id: Ie1624f8bc1d419afa19431cf9e8f7e3c12937328
parents 1fc78d42 c7bce336
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -247,7 +247,6 @@ public class FeatureFlagUtils {
        DEFAULT_FLAGS.put(SETTINGS_ENABLE_LOCKSCREEN_TRANSFER_API, "true");
        DEFAULT_FLAGS.put(SETTINGS_REMOTE_DEVICE_CREDENTIAL_VALIDATION, "true");
        DEFAULT_FLAGS.put(SETTINGS_BIOMETRICS2_FINGERPRINT_SETTINGS, "false");
        DEFAULT_FLAGS.put("settings_press_hold_nav_handle_to_search", "false");
    }

    private static final Set<String> PERSISTENT_FLAGS;
+2 −2
Original line number Diff line number Diff line
@@ -5618,13 +5618,13 @@

    <!-- Blur radius for the Option 3 in R.integer.config_letterboxBackgroundType. Values < 0 are
        ignored and 0 is used. -->
    <dimen name="config_letterboxBackgroundWallpaperBlurRadius">24dp</dimen>
    <dimen name="config_letterboxBackgroundWallpaperBlurRadius">38dp</dimen>

    <!-- Alpha of a black translucent scrim showed over wallpaper letterbox background when
        the Option 3 is selected for R.integer.config_letterboxBackgroundType.
        Values < 0 or >= 1 are ignored and 0.0 (transparent) is used instead. -->
    <item name="config_letterboxBackgroundWallaperDarkScrimAlpha" format="float" type="dimen">
        0.75
        0.54
    </item>

    <!-- Corners appearance of the letterbox background.
+5 −1
Original line number Diff line number Diff line
@@ -327,13 +327,17 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent {
            return features;
        }

        // We will transform the feature bounds to the Activity window, so using the rotation
        // from the same source (WindowConfiguration) to make sure they are synchronized.
        final int rotation = windowConfiguration.getDisplayRotation();

        for (CommonFoldingFeature baseFeature : storedFeatures) {
            Integer state = convertToExtensionState(baseFeature.getState());
            if (state == null) {
                continue;
            }
            Rect featureRect = baseFeature.getRect();
            rotateRectToDisplayRotation(displayId, featureRect);
            rotateRectToDisplayRotation(displayId, rotation, featureRect);
            transformToWindowSpaceRect(windowConfiguration, featureRect);

            if (isZero(featureRect)) {
+3 −1
Original line number Diff line number Diff line
@@ -120,10 +120,12 @@ class SampleSidecarImpl extends StubSidecar {
        }

        List<SidecarDisplayFeature> features = new ArrayList<>();
        final int rotation = activity.getResources().getConfiguration().windowConfiguration
                .getDisplayRotation();
        for (CommonFoldingFeature baseFeature : mStoredFeatures) {
            SidecarDisplayFeature feature = new SidecarDisplayFeature();
            Rect featureRect = baseFeature.getRect();
            rotateRectToDisplayRotation(displayId, featureRect);
            rotateRectToDisplayRotation(displayId, rotation, featureRect);
            transformToWindowSpaceRect(activity, featureRect);
            feature.setRect(featureRect);
            feature.setType(baseFeature.getType());
+32 −38
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package androidx.window.util;

import static android.view.Surface.ROTATION_0;
import static android.view.Surface.ROTATION_180;
import static android.view.Surface.ROTATION_270;
import static android.view.Surface.ROTATION_90;

@@ -25,12 +23,14 @@ import android.app.WindowConfiguration;
import android.content.Context;
import android.graphics.Rect;
import android.hardware.display.DisplayManagerGlobal;
import android.util.RotationUtils;
import android.view.DisplayInfo;
import android.view.Surface;
import android.view.WindowManager;

import androidx.annotation.NonNull;
import androidx.annotation.UiContext;
import androidx.annotation.VisibleForTesting;

/**
 * Util class for both Sidecar and Extensions.
@@ -44,47 +44,41 @@ public final class ExtensionHelper {
    /**
     * Rotates the input rectangle specified in default display orientation to the current display
     * rotation.
     *
     * @param displayId the display id.
     * @param rotation the target rotation relative to the default display orientation.
     * @param inOutRect the input/output Rect as specified in the default display orientation.
     */
    public static void rotateRectToDisplayRotation(int displayId, Rect inOutRect) {
        DisplayManagerGlobal dmGlobal = DisplayManagerGlobal.getInstance();
        DisplayInfo displayInfo = dmGlobal.getDisplayInfo(displayId);
        int rotation = displayInfo.rotation;

        boolean isSideRotation = rotation == ROTATION_90 || rotation == ROTATION_270;
        int displayWidth = isSideRotation ? displayInfo.logicalHeight : displayInfo.logicalWidth;
        int displayHeight = isSideRotation ? displayInfo.logicalWidth : displayInfo.logicalHeight;

        inOutRect.intersect(0, 0, displayWidth, displayHeight);
    public static void rotateRectToDisplayRotation(
            int displayId, @Surface.Rotation int rotation, @NonNull Rect inOutRect) {
        final DisplayManagerGlobal dmGlobal = DisplayManagerGlobal.getInstance();
        final DisplayInfo displayInfo = dmGlobal.getDisplayInfo(displayId);

        rotateBounds(inOutRect, displayWidth, displayHeight, rotation);
        rotateRectToDisplayRotation(displayInfo, rotation, inOutRect);
    }

    /**
     * Rotates the input rectangle within parent bounds for a given delta.
     */
    private static void rotateBounds(Rect inOutRect, int parentWidth, int parentHeight,
            @Surface.Rotation int delta) {
        int origLeft = inOutRect.left;
        switch (delta) {
            case ROTATION_0:
                return;
            case ROTATION_90:
                inOutRect.left = inOutRect.top;
                inOutRect.top = parentWidth - inOutRect.right;
                inOutRect.right = inOutRect.bottom;
                inOutRect.bottom = parentWidth - origLeft;
                return;
            case ROTATION_180:
                inOutRect.left = parentWidth - inOutRect.right;
                inOutRect.right = parentWidth - origLeft;
                return;
            case ROTATION_270:
                inOutRect.left = parentHeight - inOutRect.bottom;
                inOutRect.bottom = inOutRect.right;
                inOutRect.right = parentHeight - inOutRect.top;
                inOutRect.top = origLeft;
                return;
    @VisibleForTesting
    static void rotateRectToDisplayRotation(@NonNull DisplayInfo displayInfo,
            @Surface.Rotation int rotation, @NonNull Rect inOutRect) {
        // The inOutRect is specified in the default display orientation, so here we need to get
        // the display width and height in the default orientation to perform the intersection and
        // rotation.
        final boolean isSideRotation =
                displayInfo.rotation == ROTATION_90 || displayInfo.rotation == ROTATION_270;
        final int baseDisplayWidth =
                isSideRotation ? displayInfo.logicalHeight : displayInfo.logicalWidth;
        final int baseDisplayHeight =
                isSideRotation ? displayInfo.logicalWidth : displayInfo.logicalHeight;

        final boolean success = inOutRect.intersect(0, 0, baseDisplayWidth, baseDisplayHeight);
        if (!success) {
            throw new IllegalArgumentException("inOutRect must intersect with the display."
                    + " inOutRect: " + inOutRect
                    + ", baseDisplayWidth: " + baseDisplayWidth
                    + ", baseDisplayHeight: " + baseDisplayHeight);
        }

        RotationUtils.rotateBounds(inOutRect, baseDisplayWidth, baseDisplayHeight, rotation);
    }

    /** Transforms rectangle from absolute coordinate space to the window coordinate space. */
Loading