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

Commit 8f09a505 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Expose Ambient Wallpaper API

In P we introduced a private concept of AOD wallpapers, in Q
we're making it a public surface.

Bug: 111395593
Test: make
Change-Id: I4c406386f0ee15dc8734a24b040482b6cb807126
parent 9016f921
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1295,6 +1295,7 @@ package android {
    field public static final int summaryColumn = 16843426; // 0x10102a2
    field public static final int summaryOff = 16843248; // 0x10101f0
    field public static final int summaryOn = 16843247; // 0x10101ef
    field public static final int supportsAmbientMode = 16844172; // 0x101058c
    field public static final int supportsAssist = 16844016; // 0x10104f0
    field public static final int supportsLaunchVoiceAssistFromKeyguard = 16844017; // 0x10104f1
    field public static final int supportsLocalInteraction = 16844047; // 0x101050f
@@ -6281,6 +6282,7 @@ package android.app {
    method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
    method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager);
    method public android.graphics.drawable.Drawable loadThumbnail(android.content.pm.PackageManager);
    method public boolean supportsAmbientMode();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.WallpaperInfo> CREATOR;
  }
@@ -39851,9 +39853,11 @@ package android.service.wallpaper {
    method public int getDesiredMinimumHeight();
    method public int getDesiredMinimumWidth();
    method public android.view.SurfaceHolder getSurfaceHolder();
    method public boolean isInAmbientMode();
    method public boolean isPreview();
    method public boolean isVisible();
    method public void notifyColorsChanged();
    method public void onAmbientModeChanged(boolean, boolean);
    method public void onApplyWindowInsets(android.view.WindowInsets);
    method public android.os.Bundle onCommand(java.lang.String, int, int, int, android.os.Bundle, boolean);
    method public android.app.WallpaperColors onComputeColors();
+5 −4
Original line number Diff line number Diff line
@@ -315,12 +315,13 @@ public final class WallpaperInfo implements Parcelable {
    }

    /**
     * Returns whether a wallpaper was optimized or not for ambient mode.
     * Returns whether a wallpaper was optimized or not for ambient mode and can be drawn in there.
     *
     * @return {@code true} if wallpaper can draw in ambient mode.
     * @hide
     * @see WallpaperService.Engine#onAmbientModeChanged(boolean, boolean)
     * @see WallpaperService.Engine#isInAmbientMode()
     * @return {@code true} if wallpaper can draw when in ambient mode.
     */
    public boolean getSupportsAmbientMode() {
    public boolean supportsAmbientMode() {
        return mSupportsAmbientMode;
    }

+8 −6
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.app.Service;
import android.app.WallpaperColors;
import android.app.WallpaperInfo;
import android.app.WallpaperManager;
import android.content.Context;
import android.content.Intent;
@@ -436,8 +437,7 @@ public abstract class WallpaperService extends Service {

        /**
         * Returns true if this engine is running in ambient mode -- that is,
         * it is being shown in low power mode, in always on display.
         * @hide
         * it is being shown in low power mode, on always on display.
         */
        public boolean isInAmbientMode() {
            return mIsInAmbientMode;
@@ -563,10 +563,12 @@ public abstract class WallpaperService extends Service {
         * Called when the device enters or exits ambient mode.
         *
         * @param inAmbientMode {@code true} if in ambient mode.
         * @param animated {@code true} if you'll have te opportunity of animating your transition
         *                 {@code false} when the screen will blank and the wallpaper should be
         *                 set to ambient mode immediately.
         * @hide
         * @param animated {@code true} if you'll have the opportunity of animating your transition
         *                 {@code false} when the wallpaper should present its ambient version
         *                 immediately.
         *
         * @see #isInAmbientMode()
         * @see WallpaperInfo#supportsAmbientMode()
         */
        public void onAmbientModeChanged(boolean inAmbientMode, boolean animated) {
        }
+1 −2
Original line number Diff line number Diff line
@@ -7866,8 +7866,7 @@
             wallpaper. -->
        <attr name="showMetadataInPreview" format="boolean" />

        <!-- Wallpapers optimized and capable of drawing in ambient mode will return true.
            @hide -->
        <!-- Wallpapers optimized and capable of drawing in ambient mode will return true. -->
        <attr name="supportsAmbientMode" format="boolean" />

    </declare-styleable>
+1 −0
Original line number Diff line number Diff line
@@ -2908,6 +2908,7 @@
        <public name="opticalInsetRight" />
        <public name="opticalInsetBottom" />
        <public name="allowForceDark" />
        <public name="supportsAmbientMode" />
    </public-group>

    <public-group type="style" first-id="0x010302e2">
Loading