Related work on issue #2170897.
The wallpaper preview now delivers touch events to the wallpaper.
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
index cbc783d..f63d5a0 100644
--- a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
+++ b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
@@ -32,6 +32,7 @@
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.Bundle;
+import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.ViewGroup;
@@ -182,6 +183,25 @@
mWallpaperConnection = null;
}
+ @Override
+ public boolean dispatchTouchEvent(MotionEvent ev) {
+ if (mWallpaperConnection != null && mWallpaperConnection.mEngine != null) {
+ MotionEvent dup = MotionEvent.obtainNoHistory(ev);
+ try {
+ mWallpaperConnection.mEngine.dispatchPointer(dup);
+ } catch (RemoteException e) {
+ }
+ }
+
+ if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ onUserInteraction();
+ }
+ if (getWindow().superDispatchTouchEvent(ev)) {
+ return true;
+ }
+ return onTouchEvent(ev);
+ }
+
class WallpaperConnection extends IWallpaperConnection.Stub implements ServiceConnection {
final Intent mIntent;
IWallpaperService mService;