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

Commit 968b30ee authored by wilsonshih's avatar wilsonshih Committed by Wei Sheng Shih
Browse files

Support wallpaper on secondary displays.(4/N)

Provides a flag to let the system server and wallpaper picker know
if this wallpaper service supports multiple displays.

Bug: 115486823
Test: Manually test with modified wallpaper sample app.
Change-Id: I0c8b2c5d00bfd97d069511dda9965c557b5733c6
parent da77cc6e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1319,6 +1319,7 @@ package android {
    field public static final int supportsAssist = 16844016; // 0x10104f0
    field public static final int supportsLaunchVoiceAssistFromKeyguard = 16844017; // 0x10104f1
    field public static final int supportsLocalInteraction = 16844047; // 0x101050f
    field public static final int supportsMultipleDisplays = 16844183; // 0x1010597
    field public static final int supportsPictureInPicture = 16844023; // 0x10104f7
    field public static final int supportsRtl = 16843695; // 0x10103af
    field public static final int supportsSwitchingToNextInputMethod = 16843755; // 0x10103eb
@@ -6354,6 +6355,7 @@ package android.app {
    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 boolean supportsMultipleDisplays();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.WallpaperInfo> CREATOR;
  }
+20 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.service.wallpaper.WallpaperService;
import android.util.AttributeSet;
import android.util.Printer;
import android.util.Xml;
import android.view.SurfaceHolder;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -79,6 +80,7 @@ public final class WallpaperInfo implements Parcelable {
    final boolean mShowMetadataInPreview;
    final boolean mSupportsAmbientMode;
    final String mSettingsSliceUri;
    final boolean mSupportMultipleDisplays;

    /**
     * Constructor.
@@ -143,6 +145,9 @@ public final class WallpaperInfo implements Parcelable {
                    false);
            mSettingsSliceUri = sa.getString(
                    com.android.internal.R.styleable.Wallpaper_settingsSliceUri);
            mSupportMultipleDisplays = sa.getBoolean(
                    com.android.internal.R.styleable.Wallpaper_supportsMultipleDisplays,
                    false);

            sa.recycle();
        } catch (NameNotFoundException e) {
@@ -163,6 +168,7 @@ public final class WallpaperInfo implements Parcelable {
        mShowMetadataInPreview = source.readInt() != 0;
        mSupportsAmbientMode = source.readInt() != 0;
        mSettingsSliceUri = source.readString();
        mSupportMultipleDisplays = source.readInt() != 0;
        mService = ResolveInfo.CREATOR.createFromParcel(source);
    }
    
@@ -358,6 +364,19 @@ public final class WallpaperInfo implements Parcelable {
        return Uri.parse(mSettingsSliceUri);
    }

    /**
     * Returns whether this wallpaper service can support multiple engines to render on each surface
     * independently. An example use case is a multi-display set-up where the wallpaper service can
     * render surfaces to each of the connected displays.
     *
     * @see WallpaperService#onCreateEngine()
     * @see WallpaperService.Engine#onCreate(SurfaceHolder)
     * @return {@code true} if multiple engines can render independently on each surface.
     */
    public boolean supportsMultipleDisplays() {
        return mSupportMultipleDisplays;
    }

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

+5 −0
Original line number Diff line number Diff line
@@ -7941,6 +7941,11 @@
        <!-- Uri that specifies a settings Slice for this wallpaper. -->
        <attr name="settingsSliceUri" />

        <!-- Indicates that this wallpaper service can support multiple engines to render on each
             surface independently. An example use case is a multi-display set-up where the
             wallpaper service can render surfaces to each of the connected displays. -->
        <attr name="supportsMultipleDisplays" format="boolean" />

    </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
@@ -2920,6 +2920,7 @@
        <public name="shell" />
        <public name="interactiveUiTimeout" />
        <public name="importantForContentCapture" />
        <public name="supportsMultipleDisplays" />
    </public-group>

    <public-group type="drawable" first-id="0x010800b4">