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

Commit 53d06f24 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9428515 from d287d1d6 to tm-qpr2-release

Change-Id: If9ba15f5f63266ce58f32edc1e1bedeffd6865ca
parents c98a09ff d287d1d6
Loading
Loading
Loading
Loading
+53 −0
Original line number Diff line number Diff line
@@ -583,6 +583,15 @@ status_t BootAnimation::readyToRun() {
    mFlingerSurface = s;
    mTargetInset = -1;

    // Rotate the boot animation according to the value specified in the sysprop
    // ro.bootanim.set_orientation_<display_id>. Four values are supported: ORIENTATION_0,
    // ORIENTATION_90, ORIENTATION_180 and ORIENTATION_270.
    // If the value isn't specified or is ORIENTATION_0, nothing will be changed.
    // This is needed to support having boot animation in orientations different from the natural
    // device orientation. For example, on tablets that may want to keep natural orientation
    // portrait for applications compatibility and to have the boot animation in landscape.
    rotateAwayFromNaturalOrientationIfNeeded();

    projectSceneToWindow();

    // Register a display event receiver
@@ -596,6 +605,50 @@ status_t BootAnimation::readyToRun() {
    return NO_ERROR;
}

void BootAnimation::rotateAwayFromNaturalOrientationIfNeeded() {
    const auto orientation = parseOrientationProperty();

    if (orientation == ui::ROTATION_0) {
        // Do nothing if the sysprop isn't set or is set to ROTATION_0.
        return;
    }

    if (orientation == ui::ROTATION_90 || orientation == ui::ROTATION_270) {
        std::swap(mWidth, mHeight);
        std::swap(mInitWidth, mInitHeight);
        mFlingerSurfaceControl->updateDefaultBufferSize(mWidth, mHeight);
    }

    Rect displayRect(0, 0, mWidth, mHeight);
    Rect layerStackRect(0, 0, mWidth, mHeight);

    SurfaceComposerClient::Transaction t;
    t.setDisplayProjection(mDisplayToken, orientation, layerStackRect, displayRect);
    t.apply();
}

ui::Rotation BootAnimation::parseOrientationProperty() {
    const auto displayIds = SurfaceComposerClient::getPhysicalDisplayIds();
    if (displayIds.size() == 0) {
        return ui::ROTATION_0;
    }
    const auto displayId = displayIds[0];
    const auto syspropName = [displayId] {
        std::stringstream ss;
        ss << "ro.bootanim.set_orientation_" << displayId.value;
        return ss.str();
    }();
    const auto syspropValue = android::base::GetProperty(syspropName, "ORIENTATION_0");
    if (syspropValue == "ORIENTATION_90") {
        return ui::ROTATION_90;
    } else if (syspropValue == "ORIENTATION_180") {
        return ui::ROTATION_180;
    } else if (syspropValue == "ORIENTATION_270") {
        return ui::ROTATION_270;
    }
    return ui::ROTATION_0;
}

void BootAnimation::projectSceneToWindow() {
    glViewport(0, 0, mWidth, mHeight);
    glScissor(0, 0, mWidth, mHeight);
+4 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@
#include <utils/Thread.h>
#include <binder/IBinder.h>

#include <ui/Rotation.h>

#include <EGL/egl.h>
#include <GLES2/gl2.h>

@@ -200,6 +202,8 @@ private:
    ui::Size limitSurfaceSize(int width, int height) const;
    void resizeSurface(int newWidth, int newHeight);
    void projectSceneToWindow();
    void rotateAwayFromNaturalOrientationIfNeeded();
    ui::Rotation parseOrientationProperty();

    bool shouldStopPlayingPart(const Animation::Part& part, int fadedFramesCount,
                               int lastDisplayedProgress);
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ public final class CameraManager {
     */
    @ChangeId
    @Overridable
    @EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.TIRAMISU)
    @EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.BASE)
    @TestApi
    public static final long OVERRIDE_FRONT_CAMERA_APP_COMPAT = 250678880L;

+30 −3
Original line number Diff line number Diff line
@@ -608,7 +608,10 @@ public final class PowerManager {
            WAKE_REASON_DISPLAY_GROUP_ADDED,
            WAKE_REASON_DISPLAY_GROUP_TURNED_ON,
            WAKE_REASON_UNFOLD_DEVICE,
            WAKE_REASON_DREAM_FINISHED
            WAKE_REASON_DREAM_FINISHED,
            WAKE_REASON_TAP,
            WAKE_REASON_LIFT,
            WAKE_REASON_BIOMETRIC,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface WakeReason{}
@@ -660,8 +663,9 @@ public final class PowerManager {
    public static final int WAKE_REASON_PLUGGED_IN = 3;

    /**
     * Wake up reason code: Waking up due to a user performed gesture (e.g. double tapping on the
     * screen).
     * Wake up reason code: Waking up due to a user performed gesture. This includes user
     * interactions with UI on the screen such as the notification shade. This does not include
     * {@link WAKE_REASON_TAP} or {@link WAKE_REASON_LIFT}.
     * @hide
     */
    public static final int WAKE_REASON_GESTURE = 4;
@@ -722,6 +726,26 @@ public final class PowerManager {
     */
    public static final int WAKE_REASON_DREAM_FINISHED = 13;

    /**
     * Wake up reason code: Waking up due to the user single or double tapping on the screen. This
     * wake reason is used when the user is not tapping on a specific UI element; rather, the device
     * wakes up due to a generic tap on the screen.
     * @hide
     */
    public static final int WAKE_REASON_TAP = 15;

    /**
     * Wake up reason code: Waking up due to a user performed lift gesture.
     * @hide
     */
    public static final int WAKE_REASON_LIFT = 16;

    /**
     * Wake up reason code: Waking up due to a user interacting with a biometric.
     * @hide
     */
    public static final int WAKE_REASON_BIOMETRIC = 17;

    /**
     * Convert the wake reason to a string for debugging purposes.
     * @hide
@@ -742,6 +766,9 @@ public final class PowerManager {
            case WAKE_REASON_DISPLAY_GROUP_TURNED_ON: return "WAKE_REASON_DISPLAY_GROUP_TURNED_ON";
            case WAKE_REASON_UNFOLD_DEVICE: return "WAKE_REASON_UNFOLD_DEVICE";
            case WAKE_REASON_DREAM_FINISHED: return "WAKE_REASON_DREAM_FINISHED";
            case WAKE_REASON_TAP: return "WAKE_REASON_TAP";
            case WAKE_REASON_LIFT: return "WAKE_REASON_LIFT";
            case WAKE_REASON_BIOMETRIC: return "WAKE_REASON_BIOMETRIC";
            default: return Integer.toString(wakeReason);
        }
    }
+9 −4
Original line number Diff line number Diff line
@@ -58,19 +58,24 @@ public abstract class ControlsProviderService extends Service {
     * Manifest metadata to show a custom embedded activity as part of device controls.
     *
     * The value of this metadata must be the {@link ComponentName} as a string of an activity in
     * the same package that will be launched as part of a TaskView.
     * the same package that will be launched embedded in the device controls space.
     *
     * The activity must be exported, enabled and protected by
     * {@link Manifest.permission.BIND_CONTROLS}.
     *
     * It is recommended that the activity is declared {@code android:resizeableActivity="true"}.
     *
     * @hide
     */
    public static final String META_DATA_PANEL_ACTIVITY =
            "android.service.controls.META_DATA_PANEL_ACTIVITY";

    /**
     * Boolean extra containing the value of
     * {@link android.provider.Settings.Secure#LOCKSCREEN_ALLOW_TRIVIAL_CONTROLS}.
     * Boolean extra containing the value of the setting allowing actions on a locked device.
     *
     * This corresponds to the setting that indicates whether the user has
     * consented to allow actions on devices that declare {@link Control#isAuthRequired()} as
     * {@code false} when the device is locked.
     *
     * This is passed with the intent when the panel specified by {@link #META_DATA_PANEL_ACTIVITY}
     * is launched.
@@ -78,7 +83,7 @@ public abstract class ControlsProviderService extends Service {
     * @hide
     */
    public static final String EXTRA_LOCKSCREEN_ALLOW_TRIVIAL_CONTROLS =
            "android.service.controls.extra.EXTRA_LOCKSCREEN_ALLOW_TRIVIAL_CONTROLS";
            "android.service.controls.extra.LOCKSCREEN_ALLOW_TRIVIAL_CONTROLS";

    /**
     * @hide
Loading