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

Commit 4710c04e authored by Weien Wang's avatar Weien Wang
Browse files

Add new WallpaperInfo attr settingsSliceUri.

Add settingsSliceUri attribute for supporting live wallpaper inline-
control, public for AOSP live wallpaper to use.

Bug: 117200693
Test: atest tests/Internal/src/android/app/WallpaperInfoTest.java

Change-Id: Iffe9fbd9f49daf8a63d5745f91532de13b7288e3
parent 60786f88
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1199,6 +1199,7 @@ package android {
    field public static final deprecated int selectedWeekBackgroundColor = 16843586; // 0x1010342
    field public static final int sessionService = 16843837; // 0x101043d
    field public static final int settingsActivity = 16843301; // 0x1010225
    field public static final int settingsSliceUri = 16844179; // 0x1010593
    field public static final int setupActivity = 16843766; // 0x10103f6
    field public static final int shadowColor = 16843105; // 0x1010161
    field public static final int shadowDx = 16843106; // 0x1010162
@@ -6320,6 +6321,7 @@ package android.app {
    method public android.content.pm.ServiceInfo getServiceInfo();
    method public java.lang.String getServiceName();
    method public java.lang.String getSettingsActivity();
    method public android.net.Uri getSettingsSliceUri();
    method public boolean getShowMetadataInPreview();
    method public java.lang.CharSequence loadAuthor(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException;
    method public java.lang.CharSequence loadContextDescription(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException;
+22 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.app;

import android.app.slice.Slice;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ApplicationInfo;
@@ -77,6 +78,7 @@ public final class WallpaperInfo implements Parcelable {
    final int mContextDescriptionResource;
    final boolean mShowMetadataInPreview;
    final boolean mSupportsAmbientMode;
    final String mSettingsSliceUri;

    /**
     * Constructor.
@@ -118,7 +120,6 @@ public final class WallpaperInfo implements Parcelable {
                    com.android.internal.R.styleable.Wallpaper);
            mSettingsActivityName = sa.getString(
                    com.android.internal.R.styleable.Wallpaper_settingsActivity);

            mThumbnailResource = sa.getResourceId(
                    com.android.internal.R.styleable.Wallpaper_thumbnail,
                    -1);
@@ -140,6 +141,8 @@ public final class WallpaperInfo implements Parcelable {
            mSupportsAmbientMode = sa.getBoolean(
                    com.android.internal.R.styleable.Wallpaper_supportsAmbientMode,
                    false);
            mSettingsSliceUri = sa.getString(
                    com.android.internal.R.styleable.Wallpaper_settingsSliceUri);

            sa.recycle();
        } catch (NameNotFoundException e) {
@@ -159,6 +162,7 @@ public final class WallpaperInfo implements Parcelable {
        mContextDescriptionResource = source.readInt();
        mShowMetadataInPreview = source.readInt() != 0;
        mSupportsAmbientMode = source.readInt() != 0;
        mSettingsSliceUri = source.readString();
        mService = ResolveInfo.CREATOR.createFromParcel(source);
    }
    
@@ -332,13 +336,28 @@ public final class WallpaperInfo implements Parcelable {
     * explicit {@link android.content.ComponentName}
     * composed of {@link #getPackageName} and the class name returned here.
     * 
     * <p>A null will be returned if there is no settings activity associated
     * <p>{@code null} will be returned if there is no settings activity associated
     * with the wallpaper.
     */
    public String getSettingsActivity() {
        return mSettingsActivityName;
    }
    
    /**
     * Returns an URI that provides a settings {@link Slice} for this wallpaper.
     *
     * <p>{@code null} will be returned if there is no settings Slice URI associated
     * with the wallpaper.
     *
     * @return The URI.
     */
    public Uri getSettingsSliceUri() {
        if (mSettingsSliceUri == null) {
            return null;
        }
        return Uri.parse(mSettingsSliceUri);
    }

    public void dump(Printer pw, String prefix) {
        pw.println(prefix + "Service:");
        mService.dump(pw, prefix + "  ");
@@ -367,6 +386,7 @@ public final class WallpaperInfo implements Parcelable {
        dest.writeInt(mContextDescriptionResource);
        dest.writeInt(mShowMetadataInPreview ? 1 : 0);
        dest.writeInt(mSupportsAmbientMode ? 1 : 0);
        dest.writeString(mSettingsSliceUri);
        mService.writeToParcel(dest, flags);
    }

+3 −0
Original line number Diff line number Diff line
@@ -7894,6 +7894,9 @@
        <!-- Wallpapers optimized and capable of drawing in ambient mode will return true. -->
        <attr name="supportsAmbientMode" format="boolean" />

        <!-- Uri that specifies a settings Slice for this wallpaper. -->
        <attr name="settingsSliceUri" />

    </declare-styleable>

    <!-- Use <code>dream</code> as the root tag of the XML resource that
+1 −0
Original line number Diff line number Diff line
@@ -2916,6 +2916,7 @@
        <public name="isLightTheme" />
        <public name="isSplitRequired" />
        <public name="textLocale" />
        <public name="settingsSliceUri" />
    </public-group>

    <public-group type="drawable" first-id="0x010800b4">
+2 −1
Original line number Diff line number Diff line
@@ -16,4 +16,5 @@
  -->
<wallpaper
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:settingsSliceUri="content://com.android.internal.tests/slice"
    android:supportsAmbientMode="true"/>
Loading