summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorwilsonshih <wilsonshih@google.com>2018-11-20 20:16:58 +0800
committerWei Sheng Shih <wilsonshih@google.com>2018-11-27 04:47:46 +0000
commit968b30ee74d3ddba7370e576b2c8a65b9a823086 (patch)
tree07a7b2fb8754684cd8a2beaadb1168f9528e2ffa /core/java
parentda77cc6ea3f3eff5e99e001730516897c6dcc6c5 (diff)
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
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/WallpaperInfo.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/app/WallpaperInfo.java b/core/java/android/app/WallpaperInfo.java
index e33d1fed4b4c..3ea3da25e2fc 100644
--- a/core/java/android/app/WallpaperInfo.java
+++ b/core/java/android/app/WallpaperInfo.java
@@ -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);
}