Fix issue #4499996: LiveWallpaperPreview activity intent filter

Change-Id: I5fc71503d2c59c907da954dbda3587394e6405bf
diff --git a/api/current.txt b/api/current.txt
index 20c0b55..43d6a95 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -4069,10 +4069,12 @@
     method public void setWallpaperOffsetSteps(float, float);
     method public void setWallpaperOffsets(android.os.IBinder, float, float);
     method public void suggestDesiredDimensions(int, int);
+    field public static final java.lang.String ACTION_CHANGE_LIVE_WALLPAPER = "android.service.wallpaper.CHANGE_LIVE_WALLPAPER";
     field public static final java.lang.String ACTION_LIVE_WALLPAPER_CHOOSER = "android.service.wallpaper.LIVE_WALLPAPER_CHOOSER";
     field public static final java.lang.String COMMAND_DROP = "android.home.drop";
     field public static final java.lang.String COMMAND_SECONDARY_TAP = "android.wallpaper.secondaryTap";
     field public static final java.lang.String COMMAND_TAP = "android.wallpaper.tap";
+    field public static final java.lang.String EXTRA_LIVE_WALLPAPER_COMPONENT = "android.service.wallpaper.extra.LIVE_WALLPAPER_COMPONENT";
     field public static final java.lang.String WALLPAPER_PREVIEW_META_DATA = "android.wallpaper.preview";
   }
 
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 53a0186..8cd8900 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -194,6 +194,12 @@
                 String key = nextArgRequired();
                 String value = nextArgRequired();
                 intent.putExtra(key, Uri.parse(value));
+            } else if (opt.equals("--ecn")) {
+                String key = nextArgRequired();
+                String value = nextArgRequired();
+                ComponentName cn = ComponentName.unflattenFromString(value);
+                if (cn == null) throw new IllegalArgumentException("Bad component name: " + value);
+                intent.putExtra(key, cn);
             } else if (opt.equals("--eia")) {
                 String key = nextArgRequired();
                 String value = nextArgRequired();
@@ -1366,6 +1372,7 @@
                 "    [--el <EXTRA_KEY> <EXTRA_LONG_VALUE> ...]\n" +
                 "    [--ef <EXTRA_KEY> <EXTRA_FLOAT_VALUE> ...]\n" +
                 "    [--eu <EXTRA_KEY> <EXTRA_URI_VALUE> ...]\n" +
+                "    [--ecn <EXTRA_KEY> <EXTRA_COMPONENT_NAME_VALUE>]\n" +
                 "    [--eia <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]\n" +
                 "    [--ela <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]\n" +
                 "    [--efa <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]\n" +
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index c057d66..6f19934 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -67,6 +67,23 @@
             = "android.service.wallpaper.LIVE_WALLPAPER_CHOOSER";
 
     /**
+     * Directly launch live wallpaper preview, allowing the user to immediately
+     * confirm to switch to a specific live wallpaper.  You must specify
+     * {@link #EXTRA_LIVE_WALLPAPER_COMPONENT} with the ComponentName of
+     * a live wallpaper component that is to be shown.
+     */
+    public static final String ACTION_CHANGE_LIVE_WALLPAPER
+            = "android.service.wallpaper.CHANGE_LIVE_WALLPAPER";
+
+    /**
+     * Extra in {@link #ACTION_CHANGE_LIVE_WALLPAPER} that specifies the
+     * ComponentName of a live wallpaper that should be shown as a preview,
+     * for the user to confirm.
+     */
+    public static final String EXTRA_LIVE_WALLPAPER_COMPONENT
+            = "android.service.wallpaper.extra.LIVE_WALLPAPER_COMPONENT";
+
+    /**
      * Manifest entry for activities that respond to {@link Intent#ACTION_SET_WALLPAPER}
      * which allows them to provide a custom large icon associated with this action.
      */