Store recently applied wallpapers
Bug: 188248576
Test: manual
Change-Id: I19984c8919cd8b0b24856cd43284f0029d3e2950
diff --git a/src/com/android/wallpaper/module/DefaultWallpaperPersister.java b/src/com/android/wallpaper/module/DefaultWallpaperPersister.java
index bf86585..3b1fd91 100755
--- a/src/com/android/wallpaper/module/DefaultWallpaperPersister.java
+++ b/src/com/android/wallpaper/module/DefaultWallpaperPersister.java
@@ -17,6 +17,7 @@
import android.annotation.SuppressLint;
import android.app.Activity;
+import android.app.WallpaperColors;
import android.app.WallpaperManager;
import android.content.Context;
import android.content.res.Resources;
@@ -29,6 +30,7 @@
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.os.ParcelFileDescriptor;
+import android.text.TextUtils;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
@@ -797,6 +799,7 @@
mWallpaperManager.forgetLoadedWallpaper();
mBitmap = ((BitmapDrawable) mWallpaperManagerCompat.getDrawable()).getBitmap();
long bitmapHash = BitmapUtils.generateHashCode(mBitmap);
+ WallpaperColors colors = WallpaperColors.fromBitmap(mBitmap);
mWallpaperPreferences.setHomeWallpaperHashCode(bitmapHash);
@@ -811,6 +814,10 @@
mWallpaperPreferences.setHomeWallpaperCollectionId(
mWallpaper.getCollectionId(mAppContext));
mWallpaperPreferences.setHomeWallpaperRemoteId(mWallpaper.getWallpaperId());
+ mWallpaperPreferences.storeLatestHomeWallpaper(
+ TextUtils.isEmpty(mWallpaper.getWallpaperId()) ? String.valueOf(bitmapHash)
+ : mWallpaper.getWallpaperId(),
+ mWallpaper, mBitmap, colors);
}
private void setImageWallpaperLockMetadata(int lockWallpaperId) {