diff options
author | Jorim Jaggi <jjaggi@google.com> | 2016-05-24 00:29:19 -0700 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2016-06-03 15:50:31 -0700 |
commit | 526505da256a9af8542e592c566bd87334d075e6 (patch) | |
tree | 4755f922fac314e643c7b6deeafceea74e6af5ad | |
parent | f5b0bf356350b53d02d6dfea96defd087f8c2f2a (diff) |
Add new attributes for wallpaper info
Adjust test wallpaper to use these attributes.
Also fix some issues where wallpaper got laid out differently in the preview
mode.
Bug: 28770685
Change-Id: I259f3884f5f2c0b723a6a5ce012d45170f64c4c7
-rw-r--r-- | api/current.txt | 24 | ||||
-rw-r--r-- | api/system-current.txt | 24 | ||||
-rw-r--r-- | api/test-current.txt | 24 | ||||
-rw-r--r-- | core/java/android/app/WallpaperInfo.java | 78 | ||||
-rw-r--r-- | core/java/android/service/wallpaper/WallpaperService.java | 5 | ||||
-rw-r--r-- | core/res/res/values/attrs.xml | 14 | ||||
-rw-r--r-- | core/res/res/values/public.xml | 5 | ||||
-rw-r--r-- | services/core/java/com/android/server/policy/PhoneWindowManager.java | 27 | ||||
-rw-r--r-- | tests/WallpaperTest/res/values/strings.xml | 3 | ||||
-rw-r--r-- | tests/WallpaperTest/res/xml/test_wallpaper.xml | 5 | ||||
-rw-r--r-- | tests/WallpaperTest/src/com/example/wallpapertest/TestWallpaper.java | 8 |
11 files changed, 172 insertions, 45 deletions
diff --git a/api/current.txt b/api/current.txt index d3b4edfdbf42..64eff6b5daf5 100644 --- a/api/current.txt +++ b/api/current.txt @@ -420,7 +420,9 @@ package android { field public static final int contentInsetStart = 16843859; // 0x1010453 field public static final int contentInsetStartWithNavigation = 16844066; // 0x1010522 field public static final int contextClickable = 16844007; // 0x10104e7 + field public static final int contextDescription = 16844082; // 0x1010532 field public static final int contextPopupMenuStyle = 16844033; // 0x1010501 + field public static final int contextUri = 16844081; // 0x1010531 field public static final int controlX1 = 16843772; // 0x10103fc field public static final int controlX2 = 16843774; // 0x10103fe field public static final int controlY1 = 16843773; // 0x10103fd @@ -1039,7 +1041,7 @@ package android { field public static final int rotation = 16843558; // 0x1010326 field public static final int rotationX = 16843559; // 0x1010327 field public static final int rotationY = 16843560; // 0x1010328 - field public static final int roundIcon = 16844083; // 0x1010533 + field public static final int roundIcon = 16844080; // 0x1010530 field public static final int rowCount = 16843637; // 0x1010375 field public static final int rowDelay = 16843216; // 0x10101d0 field public static final int rowEdgeFlags = 16843329; // 0x1010241 @@ -1107,19 +1109,20 @@ package android { field public static final int shareInterpolator = 16843195; // 0x10101bb field public static final int sharedUserId = 16842763; // 0x101000b field public static final int sharedUserLabel = 16843361; // 0x1010261 - field public static final int shortcutCategories = 16844080; // 0x1010530 - field public static final int shortcutDisabledMessage = 16844079; // 0x101052f - field public static final int shortcutIcon = 16844076; // 0x101052c - field public static final int shortcutId = 16844075; // 0x101052b - field public static final int shortcutIntentAction = 16844081; // 0x1010531 - field public static final int shortcutIntentData = 16844082; // 0x1010532 - field public static final int shortcutLongLabel = 16844078; // 0x101052e - field public static final int shortcutShortLabel = 16844077; // 0x101052d + field public static final int shortcutCategories = 16844077; // 0x101052d + field public static final int shortcutDisabledMessage = 16844076; // 0x101052c + field public static final int shortcutIcon = 16844073; // 0x1010529 + field public static final int shortcutId = 16844072; // 0x1010528 + field public static final int shortcutIntentAction = 16844078; // 0x101052e + field public static final int shortcutIntentData = 16844079; // 0x101052f + field public static final int shortcutLongLabel = 16844075; // 0x101052b + field public static final int shortcutShortLabel = 16844074; // 0x101052a field public static final int shouldDisableView = 16843246; // 0x10101ee field public static final int showAsAction = 16843481; // 0x10102d9 field public static final int showDefault = 16843258; // 0x10101fa field public static final int showDividers = 16843561; // 0x1010329 field public static final int showForAllUsers = 16844015; // 0x10104ef + field public static final int showMetadataInPreview = 16844083; // 0x1010533 field public static final deprecated int showOnLockScreen = 16843721; // 0x10103c9 field public static final int showSilent = 16843259; // 0x10101fb field public static final int showText = 16843949; // 0x10104ad @@ -5765,7 +5768,10 @@ package android.app { method public android.content.pm.ServiceInfo getServiceInfo(); method public java.lang.String getServiceName(); method public java.lang.String getSettingsActivity(); + 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; + method public android.net.Uri loadContextUri(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException; method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException; method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager); method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); diff --git a/api/system-current.txt b/api/system-current.txt index 4af507c434ba..bdf8299ba54e 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -526,7 +526,9 @@ package android { field public static final int contentInsetStart = 16843859; // 0x1010453 field public static final int contentInsetStartWithNavigation = 16844066; // 0x1010522 field public static final int contextClickable = 16844007; // 0x10104e7 + field public static final int contextDescription = 16844082; // 0x1010532 field public static final int contextPopupMenuStyle = 16844033; // 0x1010501 + field public static final int contextUri = 16844081; // 0x1010531 field public static final int controlX1 = 16843772; // 0x10103fc field public static final int controlX2 = 16843774; // 0x10103fe field public static final int controlY1 = 16843773; // 0x10103fd @@ -1145,7 +1147,7 @@ package android { field public static final int rotation = 16843558; // 0x1010326 field public static final int rotationX = 16843559; // 0x1010327 field public static final int rotationY = 16843560; // 0x1010328 - field public static final int roundIcon = 16844083; // 0x1010533 + field public static final int roundIcon = 16844080; // 0x1010530 field public static final int rowCount = 16843637; // 0x1010375 field public static final int rowDelay = 16843216; // 0x10101d0 field public static final int rowEdgeFlags = 16843329; // 0x1010241 @@ -1217,19 +1219,20 @@ package android { field public static final int shareInterpolator = 16843195; // 0x10101bb field public static final int sharedUserId = 16842763; // 0x101000b field public static final int sharedUserLabel = 16843361; // 0x1010261 - field public static final int shortcutCategories = 16844080; // 0x1010530 - field public static final int shortcutDisabledMessage = 16844079; // 0x101052f - field public static final int shortcutIcon = 16844076; // 0x101052c - field public static final int shortcutId = 16844075; // 0x101052b - field public static final int shortcutIntentAction = 16844081; // 0x1010531 - field public static final int shortcutIntentData = 16844082; // 0x1010532 - field public static final int shortcutLongLabel = 16844078; // 0x101052e - field public static final int shortcutShortLabel = 16844077; // 0x101052d + field public static final int shortcutCategories = 16844077; // 0x101052d + field public static final int shortcutDisabledMessage = 16844076; // 0x101052c + field public static final int shortcutIcon = 16844073; // 0x1010529 + field public static final int shortcutId = 16844072; // 0x1010528 + field public static final int shortcutIntentAction = 16844078; // 0x101052e + field public static final int shortcutIntentData = 16844079; // 0x101052f + field public static final int shortcutLongLabel = 16844075; // 0x101052b + field public static final int shortcutShortLabel = 16844074; // 0x101052a field public static final int shouldDisableView = 16843246; // 0x10101ee field public static final int showAsAction = 16843481; // 0x10102d9 field public static final int showDefault = 16843258; // 0x10101fa field public static final int showDividers = 16843561; // 0x1010329 field public static final int showForAllUsers = 16844015; // 0x10104ef + field public static final int showMetadataInPreview = 16844083; // 0x1010533 field public static final deprecated int showOnLockScreen = 16843721; // 0x10103c9 field public static final int showSilent = 16843259; // 0x10101fb field public static final int showText = 16843949; // 0x10104ad @@ -5912,7 +5915,10 @@ package android.app { method public android.content.pm.ServiceInfo getServiceInfo(); method public java.lang.String getServiceName(); method public java.lang.String getSettingsActivity(); + 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; + method public android.net.Uri loadContextUri(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException; method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException; method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager); method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); diff --git a/api/test-current.txt b/api/test-current.txt index 3298c4845985..93b73686ef64 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -420,7 +420,9 @@ package android { field public static final int contentInsetStart = 16843859; // 0x1010453 field public static final int contentInsetStartWithNavigation = 16844066; // 0x1010522 field public static final int contextClickable = 16844007; // 0x10104e7 + field public static final int contextDescription = 16844082; // 0x1010532 field public static final int contextPopupMenuStyle = 16844033; // 0x1010501 + field public static final int contextUri = 16844081; // 0x1010531 field public static final int controlX1 = 16843772; // 0x10103fc field public static final int controlX2 = 16843774; // 0x10103fe field public static final int controlY1 = 16843773; // 0x10103fd @@ -1039,7 +1041,7 @@ package android { field public static final int rotation = 16843558; // 0x1010326 field public static final int rotationX = 16843559; // 0x1010327 field public static final int rotationY = 16843560; // 0x1010328 - field public static final int roundIcon = 16844083; // 0x1010533 + field public static final int roundIcon = 16844080; // 0x1010530 field public static final int rowCount = 16843637; // 0x1010375 field public static final int rowDelay = 16843216; // 0x10101d0 field public static final int rowEdgeFlags = 16843329; // 0x1010241 @@ -1107,19 +1109,20 @@ package android { field public static final int shareInterpolator = 16843195; // 0x10101bb field public static final int sharedUserId = 16842763; // 0x101000b field public static final int sharedUserLabel = 16843361; // 0x1010261 - field public static final int shortcutCategories = 16844080; // 0x1010530 - field public static final int shortcutDisabledMessage = 16844079; // 0x101052f - field public static final int shortcutIcon = 16844076; // 0x101052c - field public static final int shortcutId = 16844075; // 0x101052b - field public static final int shortcutIntentAction = 16844081; // 0x1010531 - field public static final int shortcutIntentData = 16844082; // 0x1010532 - field public static final int shortcutLongLabel = 16844078; // 0x101052e - field public static final int shortcutShortLabel = 16844077; // 0x101052d + field public static final int shortcutCategories = 16844077; // 0x101052d + field public static final int shortcutDisabledMessage = 16844076; // 0x101052c + field public static final int shortcutIcon = 16844073; // 0x1010529 + field public static final int shortcutId = 16844072; // 0x1010528 + field public static final int shortcutIntentAction = 16844078; // 0x101052e + field public static final int shortcutIntentData = 16844079; // 0x101052f + field public static final int shortcutLongLabel = 16844075; // 0x101052b + field public static final int shortcutShortLabel = 16844074; // 0x101052a field public static final int shouldDisableView = 16843246; // 0x10101ee field public static final int showAsAction = 16843481; // 0x10102d9 field public static final int showDefault = 16843258; // 0x10101fa field public static final int showDividers = 16843561; // 0x1010329 field public static final int showForAllUsers = 16844015; // 0x10104ef + field public static final int showMetadataInPreview = 16844083; // 0x1010533 field public static final deprecated int showOnLockScreen = 16843721; // 0x10103c9 field public static final int showSilent = 16843259; // 0x10101fb field public static final int showText = 16843949; // 0x10104ad @@ -5771,7 +5774,10 @@ package android.app { method public android.content.pm.ServiceInfo getServiceInfo(); method public java.lang.String getServiceName(); method public java.lang.String getSettingsActivity(); + 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; + method public android.net.Uri loadContextUri(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException; method public java.lang.CharSequence loadDescription(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException; method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager); method public java.lang.CharSequence loadLabel(android.content.pm.PackageManager); diff --git a/core/java/android/app/WallpaperInfo.java b/core/java/android/app/WallpaperInfo.java index 7db9fa8fed65..84a16cf3e96a 100644 --- a/core/java/android/app/WallpaperInfo.java +++ b/core/java/android/app/WallpaperInfo.java @@ -31,6 +31,7 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.graphics.drawable.Drawable; +import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; import android.service.wallpaper.WallpaperService; @@ -72,6 +73,10 @@ public final class WallpaperInfo implements Parcelable { */ final int mDescriptionResource; + final int mContextUriResource; + final int mContextDescriptionResource; + final boolean mShowMetadataInPreview; + /** * Constructor. * @@ -89,7 +94,10 @@ public final class WallpaperInfo implements Parcelable { int thumbnailRes = -1; int authorRes = -1; int descriptionRes = -1; - + int contextUriRes = -1; + int contextDescriptionRes = -1; + boolean showMetadataInPreview = false; + XmlResourceParser parser = null; try { parser = si.loadXmlMetaData(pm, WallpaperService.SERVICE_META_DATA); @@ -127,6 +135,15 @@ public final class WallpaperInfo implements Parcelable { descriptionRes = sa.getResourceId( com.android.internal.R.styleable.Wallpaper_description, -1); + contextUriRes = sa.getResourceId( + com.android.internal.R.styleable.Wallpaper_contextUri, + -1); + contextDescriptionRes = sa.getResourceId( + com.android.internal.R.styleable.Wallpaper_contextDescription, + -1); + showMetadataInPreview = sa.getBoolean( + com.android.internal.R.styleable.Wallpaper_showMetadataInPreview, + false); sa.recycle(); } catch (NameNotFoundException e) { @@ -140,6 +157,9 @@ public final class WallpaperInfo implements Parcelable { mThumbnailResource = thumbnailRes; mAuthorResource = authorRes; mDescriptionResource = descriptionRes; + mContextUriResource = contextUriRes; + mContextDescriptionResource = contextDescriptionRes; + mShowMetadataInPreview = showMetadataInPreview; } WallpaperInfo(Parcel source) { @@ -147,6 +167,9 @@ public final class WallpaperInfo implements Parcelable { mThumbnailResource = source.readInt(); mAuthorResource = source.readInt(); mDescriptionResource = source.readInt(); + mContextUriResource = source.readInt(); + mContextDescriptionResource = source.readInt(); + mShowMetadataInPreview = source.readInt() != 0; mService = ResolveInfo.CREATOR.createFromParcel(source); } @@ -248,7 +271,55 @@ public final class WallpaperInfo implements Parcelable { return pm.getText(packageName, mDescriptionResource, mService.serviceInfo.applicationInfo); } - + + /** + * Returns an URI that specifies a link for further context about this wallpaper. + * + * @param pm An instance of {@link PackageManager} to retrieve the URI. + * @return The URI. + */ + public Uri loadContextUri(PackageManager pm) throws NotFoundException { + if (mContextUriResource <= 0) throw new NotFoundException(); + String packageName = mService.resolvePackageName; + ApplicationInfo applicationInfo = null; + if (packageName == null) { + packageName = mService.serviceInfo.packageName; + applicationInfo = mService.serviceInfo.applicationInfo; + } + String contextUriString = pm.getText( + packageName, mContextUriResource, applicationInfo).toString(); + if (contextUriString == null) { + return null; + } + return Uri.parse(contextUriString); + } + + /** + * Retrieves a title of the URI that specifies a link for further context about this wallpaper. + * + * @param pm An instance of {@link PackageManager} to retrieve the title. + * @return The title. + */ + public CharSequence loadContextDescription(PackageManager pm) throws NotFoundException { + if (mContextDescriptionResource <= 0) throw new NotFoundException(); + String packageName = mService.resolvePackageName; + ApplicationInfo applicationInfo = null; + if (packageName == null) { + packageName = mService.serviceInfo.packageName; + applicationInfo = mService.serviceInfo.applicationInfo; + } + return pm.getText(packageName, mContextDescriptionResource, applicationInfo).toString(); + } + + /** + * Queries whether any metadata should be shown when previewing the wallpaper. + * + * @return Whether any metadata should be shown when previewing the wallpaper. + */ + public boolean getShowMetadataInPreview() { + return mShowMetadataInPreview; + } + /** * Return the class name of an activity that provides a settings UI for * the wallpaper. You can launch this activity be starting it with @@ -287,6 +358,9 @@ public final class WallpaperInfo implements Parcelable { dest.writeInt(mThumbnailResource); dest.writeInt(mAuthorResource); dest.writeInt(mDescriptionResource); + dest.writeInt(mContextUriResource); + dest.writeInt(mContextDescriptionResource); + dest.writeInt(mShowMetadataInPreview ? 1 : 0); mService.writeToParcel(dest, flags); } diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index de8133b33aa6..06d87f84699d 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -55,6 +55,7 @@ import android.view.SurfaceHolder; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; +import android.view.WindowManager.LayoutParams; import android.view.WindowManagerGlobal; import java.io.FileDescriptor; @@ -628,9 +629,9 @@ public abstract class WallpaperService extends Service { mCurWindowFlags = mWindowFlags; mLayout.flags = mWindowFlags | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS + | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN - | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE - ; + | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; mCurWindowPrivateFlags = mWindowPrivateFlags; mLayout.privateFlags = mWindowPrivateFlags; diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 1af991104a84..d0c6a8ef012e 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -7335,14 +7335,24 @@ i <declare-styleable name="Wallpaper"> <attr name="settingsActivity" /> - <!-- Reference to a the wallpaper's thumbnail bitmap. --> + <!-- Reference to the wallpaper's thumbnail bitmap. --> <attr name="thumbnail" format="reference" /> - <!-- Name of the author of this component, e.g. Google. --> + <!-- Name of the author and/or source/collection of this component, e.g. Art Collection, Picasso. --> <attr name="author" format="reference" /> <!-- Short description of the component's purpose or behavior. --> <attr name="description" /> + + <!-- Uri that specifies a link for further context of this wallpaper, e.g. http://www.picasso.org. --> + <attr name="contextUri" format="reference" /> + + <!-- Title of the uri that specifies a link for further context of this wallpaper, e.g. Explore collection. --> + <attr name="contextDescription" format="reference" /> + + <!-- Whether to show any metadata when previewing the wallpaper. --> + <attr name="showMetadataInPreview" format="boolean" /> + </declare-styleable> <!-- Use <code>dream</code> as the root tag of the XML resource that diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index eb28edf2b2a9..da31767b7972 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2741,4 +2741,9 @@ <public type="attr" name="shortcutIntentAction" /> <public type="attr" name="shortcutIntentData" /> <public type="attr" name="roundIcon" /> + + <public type="attr" name="contextUri" /> + <public type="attr" name="contextDescription" /> + <public type="attr" name="showMetadataInPreview" /> + </resources> diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 14ed1907b9a0..c1040c9636a7 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -4392,6 +4392,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { } else { vf.set(cf); } + } else if (attrs.type == TYPE_WALLPAPER) { + layoutWallpaper(win, pf, df, of, cf); } else if (win == mStatusBar) { pf.left = df.left = of.left = mUnrestrictedScreenLeft; pf.top = df.top = of.top = mUnrestrictedScreenTop; @@ -4615,17 +4617,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { + mOverscanScreenWidth; pf.bottom = df.bottom = of.bottom = cf.bottom = mOverscanScreenTop + mOverscanScreenHeight; - } else if (attrs.type == TYPE_WALLPAPER) { - // The wallpaper also has Real Ultimate Power, but we want to tell - // it about the overscan area. - pf.left = df.left = mOverscanScreenLeft; - pf.top = df.top = mOverscanScreenTop; - pf.right = df.right = mOverscanScreenLeft + mOverscanScreenWidth; - pf.bottom = df.bottom = mOverscanScreenTop + mOverscanScreenHeight; - of.left = cf.left = mUnrestrictedScreenLeft; - of.top = cf.top = mUnrestrictedScreenTop; - of.right = cf.right = mUnrestrictedScreenLeft + mUnrestrictedScreenWidth; - of.bottom = cf.bottom = mUnrestrictedScreenTop + mUnrestrictedScreenHeight; } else if ((fl & FLAG_LAYOUT_IN_OVERSCAN) != 0 && attrs.type >= WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW && attrs.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) { @@ -4818,6 +4809,20 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } + private void layoutWallpaper(WindowState win, Rect pf, Rect df, Rect of, Rect cf) { + + // The wallpaper also has Real Ultimate Power, but we want to tell + // it about the overscan area. + pf.left = df.left = mOverscanScreenLeft; + pf.top = df.top = mOverscanScreenTop; + pf.right = df.right = mOverscanScreenLeft + mOverscanScreenWidth; + pf.bottom = df.bottom = mOverscanScreenTop + mOverscanScreenHeight; + of.left = cf.left = mUnrestrictedScreenLeft; + of.top = cf.top = mUnrestrictedScreenTop; + of.right = cf.right = mUnrestrictedScreenLeft + mUnrestrictedScreenWidth; + of.bottom = cf.bottom = mUnrestrictedScreenTop + mUnrestrictedScreenHeight; + } + private void offsetInputMethodWindowLw(WindowState win) { int top = Math.max(win.getDisplayFrameLw().top, win.getContentFrameLw().top); top += win.getGivenContentInsetsLw().top; diff --git a/tests/WallpaperTest/res/values/strings.xml b/tests/WallpaperTest/res/values/strings.xml index fd212596f644..80a3d494e5bb 100644 --- a/tests/WallpaperTest/res/values/strings.xml +++ b/tests/WallpaperTest/res/values/strings.xml @@ -24,6 +24,9 @@ limitations under the License. Test wallpaper for use with the wallpaper test app. </string> + <string name="test_wallpaper_context_uri">https://www.google.com/maps/@37.8092876,-122.408986,1391m/data=!3m1!1e3</string> + <string name="test_wallpaper_context_description">Explore</string> + <string name="dimens">Dimens: </string> <string name="width">Width: </string> <string name="height">Height: </string> diff --git a/tests/WallpaperTest/res/xml/test_wallpaper.xml b/tests/WallpaperTest/res/xml/test_wallpaper.xml index 9f7d714b75cd..ba2247855165 100644 --- a/tests/WallpaperTest/res/xml/test_wallpaper.xml +++ b/tests/WallpaperTest/res/xml/test_wallpaper.xml @@ -23,4 +23,7 @@ <wallpaper xmlns:android="http://schemas.android.com/apk/res/android" android:author="@string/test_wallpaper_author" android:description="@string/test_wallpaper_desc" - android:thumbnail="@drawable/test_wallpaper_thumb" /> + android:thumbnail="@drawable/test_wallpaper_thumb" + android:showMetadataInPreview="true" + android:contextUri="@string/test_wallpaper_context_uri" + android:contextDescription="@string/test_wallpaper_context_description"/> diff --git a/tests/WallpaperTest/src/com/example/wallpapertest/TestWallpaper.java b/tests/WallpaperTest/src/com/example/wallpapertest/TestWallpaper.java index 95db6d100b79..ab36c222113a 100644 --- a/tests/WallpaperTest/src/com/example/wallpapertest/TestWallpaper.java +++ b/tests/WallpaperTest/src/com/example/wallpapertest/TestWallpaper.java @@ -144,6 +144,14 @@ public class TestWallpaper extends WallpaperService { @Override public void onSurfaceCreated(SurfaceHolder holder) { super.onSurfaceCreated(holder); + + // Simulate some slowness, so we can test the loading process in the live wallpaper + // picker. + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } } @Override |