Snap for 11526283 from f2b29609226e3441cd3c96d661a421cf2fd15650 to 24Q2-release
Change-Id: I19be473b406b0258c6bb858a0522764c3b516c53
diff --git a/res/values-eu/strings.xml b/res/values-eu/strings.xml
index 51f902b..f3720bf 100644
--- a/res/values-eu/strings.xml
+++ b/res/values-eu/strings.xml
@@ -31,11 +31,11 @@
<string name="wallpaper_destination_both" msgid="1124197176741944063">"Hasieran eta pantaila blokeatuan"</string>
<string name="choose_a_wallpaper_section_title" msgid="1009823506890453891">"Hautatu horma-paper bat"</string>
<string name="creative_wallpaper_title" msgid="3581650238648981372">"Sortu horma-papera"</string>
- <string name="home_screen_message" msgid="106444102822522813">"Hasierako pantaila"</string>
+ <string name="home_screen_message" msgid="106444102822522813">"Orri nagusia"</string>
<string name="lock_screen_message" msgid="1534506081955058013">"Pantaila blokeatua"</string>
<string name="home_and_lock_short_label" msgid="2937922943541927983">"Hasieran + pantaila blokeatuan"</string>
<string name="set_wallpaper_dialog_message" msgid="2110475703996853076">"Ezarri horma-papera"</string>
- <string name="set_wallpaper_home_screen_destination" msgid="7315594722013109354">"Hasierako pantaila"</string>
+ <string name="set_wallpaper_home_screen_destination" msgid="7315594722013109354">"Orri nagusia"</string>
<string name="set_wallpaper_lock_screen_destination" msgid="6224685559375417945">"Pantaila blokeatua"</string>
<string name="set_wallpaper_both_destination" msgid="2536004558738350775">"Hasierako pantaila eta pantaila blokeatua"</string>
<string name="no_backup_image_wallpaper_label" msgid="6316627676107284851">"Txandakako irudidun horma-papera"</string>
@@ -58,13 +58,13 @@
<string name="wallpaper_disabled_by_administrator_message" msgid="1551430406714747884">"Gailuaren administratzaileak desgaituta dauka horma-papera ezartzeko aukera"</string>
<string name="wallpaper_set_successfully_message" msgid="2958998799111688578">"Ezarri da horma-papera"</string>
<string name="wallpapers_unavailable_offline_message" msgid="8136405438621689532">"Internetera konektatu behar duzu horma-paperak ikusteko. Konekta zaitez eta saiatu berriro."</string>
- <string name="currently_set_home_wallpaper_thumbnail" msgid="4022381436821898917">"Hasierako pantailan ezarrita dagoen horma-paperaren irudi txikia"</string>
+ <string name="currently_set_home_wallpaper_thumbnail" msgid="4022381436821898917">"Orri nagusian ezarrita dagoen horma-paperaren irudi txikia"</string>
<string name="currently_set_lock_wallpaper_thumbnail" msgid="2094209303934569997">"Pantaila blokeatuan ezarrita dagoen horma-paperaren irudi txikia"</string>
<string name="currently_set_wallpaper_thumbnail" msgid="8651887838745545107">"Ezarrita dagoen horma-paperaren irudi txikia"</string>
<string name="wallpaper_thumbnail" msgid="569931475923605974">"Horma-paperaren irudi txikia"</string>
- <string name="explore_home_screen" msgid="8756346794535765482">"Arakatu hasierako pantailaren horma-papera"</string>
+ <string name="explore_home_screen" msgid="8756346794535765482">"Arakatu orri nagusiaren horma-papera"</string>
<string name="explore_lock_screen" msgid="268938342103703665">"Arakatu pantaila blokeatuaren horma-papera"</string>
- <string name="refresh_daily_wallpaper_home_content_description" msgid="2770445044556164259">"Freskatu hasierako pantailaren eguneko horma-papera"</string>
+ <string name="refresh_daily_wallpaper_home_content_description" msgid="2770445044556164259">"Freskatu orri nagusiaren eguneko horma-papera"</string>
<string name="refresh_daily_wallpaper_content_description" msgid="4362142658237147583">"Freskatu eguneko horma-papera"</string>
<string name="preview_screen_description" msgid="3386387053327775919">"Horma-paperaren aurrebistaren pantaila"</string>
<string name="refreshing_daily_wallpaper_dialog_message" msgid="1975910873362855761">"Eguneko horma-papera freskatzen…"</string>
@@ -101,7 +101,7 @@
<string name="wallpaper_title" msgid="6754214682228331092">"Horma-papera"</string>
<string name="wallpaper_preview_card_content_description" msgid="6049261033541034584">"Horma-paperaren aurrebista"</string>
<string name="lock_wallpaper_preview_card_content_description" msgid="5236839857695985498">"Pantaila blokeatuko horma-paperaren aurrebista"</string>
- <string name="home_wallpaper_preview_card_content_description" msgid="4059418716070821630">"Hasierako pantailako horma-paperaren aurrebista"</string>
+ <string name="home_wallpaper_preview_card_content_description" msgid="4059418716070821630">"Orri nagusiko horma-paperaren aurrebista"</string>
<string name="collection_not_exist_msg" msgid="3504852962885064842">"Ez dago bildumarik"</string>
<string name="wallpaper_exit_split_screen" msgid="1928870664619591636">"Irten pantaila zatituaren modutik eta saiatu berriro"</string>
<string name="set_wallpaper_dialog_set_button" msgid="5760149969510325088">"Ezarri"</string>
@@ -126,7 +126,7 @@
<string name="settings_snackbar_enable" msgid="5992112808061426068">"Gaitu"</string>
<string name="open_my_photos" msgid="4107196465713868381">"Ireki nire argazkiak"</string>
<string name="lock_screen_tab" msgid="6672930765010407652">"Pantaila blokeatua"</string>
- <string name="home_screen_tab" msgid="1080445697837877526">"Hasierako pantaila"</string>
+ <string name="home_screen_tab" msgid="1080445697837877526">"Orri nagusia"</string>
<string name="reset" msgid="4945445169532850631">"Berrezarri"</string>
<string name="reset_confirmation_dialog_title" msgid="3391905685838213712">"Aldaketak berrezarri?"</string>
<string name="reset_confirmation_dialog_message" msgid="888669268626289603">"Ez dira gordeko aldaketak"</string>
diff --git a/src/com/android/wallpaper/module/DefaultWallpaperPersister.java b/src/com/android/wallpaper/module/DefaultWallpaperPersister.java
index 6a43253..9683857 100755
--- a/src/com/android/wallpaper/module/DefaultWallpaperPersister.java
+++ b/src/com/android/wallpaper/module/DefaultWallpaperPersister.java
@@ -59,6 +59,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
+import java.util.Map;
/**
* Concrete implementation of WallpaperPersister which actually sets wallpapers to the system via
@@ -395,7 +396,7 @@
}
@Override
- public int setStreamToWallpaperManager(InputStream inputStream, Rect cropHint,
+ public int setStreamToWallpaperManager(InputStream inputStream, @Nullable Rect cropHint,
boolean allowBackup, int whichWallpaper) {
try {
return mWallpaperManager.setStream(inputStream, cropHint, allowBackup,
@@ -406,6 +407,17 @@
}
@Override
+ public int setStreamWithCropsToWallpaperManager(InputStream inputStream,
+ @NonNull Map<Point, Rect> cropHints, boolean allowBackup, int whichWallpaper) {
+ try {
+ return mWallpaperManager.setStreamWithCrops(inputStream, cropHints, allowBackup,
+ whichWallpaper);
+ } catch (IOException e) {
+ return 0;
+ }
+ }
+
+ @Override
public void setWallpaperInfoInPreview(WallpaperInfo wallpaper) {
mWallpaperInfoInPreview = wallpaper;
}
diff --git a/src/com/android/wallpaper/module/DefaultWallpaperPreferences.kt b/src/com/android/wallpaper/module/DefaultWallpaperPreferences.kt
index f6c55f9..a59b0a3 100755
--- a/src/com/android/wallpaper/module/DefaultWallpaperPreferences.kt
+++ b/src/com/android/wallpaper/module/DefaultWallpaperPreferences.kt
@@ -897,7 +897,7 @@
destination: WallpaperDestination,
wallpaperModel: StaticWallpaperModel,
bitmap: Bitmap,
- cropHints: Map<Point, Rect?>,
+ cropHints: Map<Point, Rect>?,
) {}
override suspend fun addLiveWallpaperToRecentWallpapers(
diff --git a/src/com/android/wallpaper/module/WallpaperPersister.java b/src/com/android/wallpaper/module/WallpaperPersister.java
index 0940d81..585aa13 100755
--- a/src/com/android/wallpaper/module/WallpaperPersister.java
+++ b/src/com/android/wallpaper/module/WallpaperPersister.java
@@ -20,9 +20,11 @@
import static android.app.WallpaperManager.SetWallpaperFlags;
import android.graphics.Bitmap;
+import android.graphics.Point;
import android.graphics.Rect;
import androidx.annotation.IntDef;
+import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.wallpaper.asset.Asset;
@@ -31,6 +33,7 @@
import java.io.InputStream;
import java.util.List;
+import java.util.Map;
/**
* Interface for classes which persist wallpapers to the system.
@@ -159,7 +162,18 @@
* Android, otherwise on pre-N versions of Android will return a positive integer when the
* operation was successful and zero if the operation encountered an error.
*/
- int setStreamToWallpaperManager(InputStream inputStream, Rect cropHint,
+ int setStreamToWallpaperManager(InputStream inputStream, @Nullable Rect cropHint,
+ boolean allowBackup, int whichWallpaper);
+
+ /**
+ * Sets a wallpaper stream to the {@link android.app.WallpaperManager}.
+ *
+ * @return an integer wallpaper ID. This is an actual wallpaper ID on N and later versions of
+ * Android, otherwise on pre-N versions of Android will return a positive integer when the
+ * operation was successful and zero if the operation encountered an error.
+ */
+ int setStreamWithCropsToWallpaperManager(InputStream inputStream,
+ @NonNull Map<Point, Rect> cropModel,
boolean allowBackup, int whichWallpaper);
/**
diff --git a/src/com/android/wallpaper/module/WallpaperPreferences.kt b/src/com/android/wallpaper/module/WallpaperPreferences.kt
index e45cbf3..6fbb34a 100755
--- a/src/com/android/wallpaper/module/WallpaperPreferences.kt
+++ b/src/com/android/wallpaper/module/WallpaperPreferences.kt
@@ -392,7 +392,7 @@
destination: WallpaperDestination,
wallpaperModel: StaticWallpaperModel,
bitmap: Bitmap,
- cropHints: Map<Point, Rect?>,
+ cropHints: Map<Point, Rect>?,
)
/**
diff --git a/src/com/android/wallpaper/picker/customization/data/content/WallpaperClientImpl.kt b/src/com/android/wallpaper/picker/customization/data/content/WallpaperClientImpl.kt
index e9f97b0..7edc234 100644
--- a/src/com/android/wallpaper/picker/customization/data/content/WallpaperClientImpl.kt
+++ b/src/com/android/wallpaper/picker/customization/data/content/WallpaperClientImpl.kt
@@ -167,8 +167,7 @@
destination,
wallpaperModel,
bitmap,
- // TODO (b/309139122): Introduce crop hints to recent wallpapers
- emptyMap(),
+ cropHintsWithParallax,
)
}
diff --git a/tests/common/src/com/android/wallpaper/testing/TestWallpaperPersister.java b/tests/common/src/com/android/wallpaper/testing/TestWallpaperPersister.java
index e1be186..7d36852 100644
--- a/tests/common/src/com/android/wallpaper/testing/TestWallpaperPersister.java
+++ b/tests/common/src/com/android/wallpaper/testing/TestWallpaperPersister.java
@@ -17,8 +17,10 @@
import android.content.Context;
import android.graphics.Bitmap;
+import android.graphics.Point;
import android.graphics.Rect;
+import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.wallpaper.asset.Asset;
@@ -31,6 +33,7 @@
import java.io.InputStream;
import java.util.List;
+import java.util.Map;
/**
* Test double for {@link WallpaperPersister}.
@@ -43,6 +46,7 @@
private Bitmap mCurrentHomeWallpaper;
private Bitmap mCurrentLockWallpaper;
private Bitmap mPendingHomeWallpaper;
+
private Bitmap mPendingLockWallpaper;
private List<String> mHomeAttributions;
private String mHomeActionUrl;
@@ -239,4 +243,10 @@
boolean allowBackup, int whichWallpaper) {
return 1;
}
+
+ @Override
+ public int setStreamWithCropsToWallpaperManager(InputStream inputStream,
+ @NonNull Map<Point, Rect> cropHints, boolean allowBackup, int whichWallpaper) {
+ return 1;
+ }
}
diff --git a/tests/common/src/com/android/wallpaper/testing/TestWallpaperPreferences.kt b/tests/common/src/com/android/wallpaper/testing/TestWallpaperPreferences.kt
index 8d4f91b..e7480cf 100644
--- a/tests/common/src/com/android/wallpaper/testing/TestWallpaperPreferences.kt
+++ b/tests/common/src/com/android/wallpaper/testing/TestWallpaperPreferences.kt
@@ -477,7 +477,7 @@
destination: WallpaperDestination,
wallpaperModel: WallpaperModel.StaticWallpaperModel,
bitmap: Bitmap,
- cropHints: Map<Point, Rect?>
+ cropHints: Map<Point, Rect>?,
) {}
override suspend fun addLiveWallpaperToRecentWallpapers(
diff --git a/tests/common/src/com/android/wallpaper/testing/WallpaperModelUtils.kt b/tests/common/src/com/android/wallpaper/testing/WallpaperModelUtils.kt
index 68fdc12..4ec057f 100644
--- a/tests/common/src/com/android/wallpaper/testing/WallpaperModelUtils.kt
+++ b/tests/common/src/com/android/wallpaper/testing/WallpaperModelUtils.kt
@@ -17,6 +17,7 @@
package com.android.wallpaper.testing
import android.app.WallpaperColors
+import android.app.WallpaperInfo
import android.content.ComponentName
import android.graphics.Color
import android.net.Uri
@@ -25,6 +26,7 @@
import com.android.wallpaper.picker.data.CommonWallpaperData
import com.android.wallpaper.picker.data.Destination
import com.android.wallpaper.picker.data.ImageWallpaperData
+import com.android.wallpaper.picker.data.LiveWallpaperData
import com.android.wallpaper.picker.data.StaticWallpaperData
import com.android.wallpaper.picker.data.WallpaperId
import com.android.wallpaper.picker.data.WallpaperModel
@@ -41,13 +43,14 @@
Color.valueOf(Color.BLUE)
)
val DEFAULT_ASSET = TestAsset(TestStaticWallpaperInfo.COLOR_DEFAULT, false)
+ const val DEFAULT_GROUP_NAME = "group name"
fun getStaticWallpaperModel(
wallpaperId: String,
collectionId: String,
placeholderColor: Int = DEFAULT_PLACEHOLDER_COLOR,
- attribution: List<String> = emptyList(),
- actionUrl: String = DEFAULT_ACTION_URL,
+ attribution: List<String>? = emptyList(),
+ actionUrl: String? = DEFAULT_ACTION_URL,
colors: WallpaperColors = DEFAULT_COLORS,
asset: Asset = DEFAULT_ASSET,
): WallpaperModel.StaticWallpaperModel {
@@ -84,5 +87,52 @@
downloadableWallpaperData = null,
)
}
+
+ fun getLiveWallpaperModel(
+ wallpaperId: String,
+ collectionId: String,
+ placeholderColor: Int = DEFAULT_PLACEHOLDER_COLOR,
+ attribution: List<String>? = emptyList(),
+ actionUrl: String? = DEFAULT_ACTION_URL,
+ colors: WallpaperColors = DEFAULT_COLORS,
+ asset: Asset = DEFAULT_ASSET,
+ groupName: String = DEFAULT_GROUP_NAME,
+ systemWallpaperInfo: WallpaperInfo,
+ isTitleVisible: Boolean = true,
+ isApplied: Boolean = true,
+ effectNames: String? = null,
+ ): WallpaperModel.LiveWallpaperModel {
+ return WallpaperModel.LiveWallpaperModel(
+ commonWallpaperData =
+ CommonWallpaperData(
+ id =
+ WallpaperId(
+ systemWallpaperInfo.component,
+ wallpaperId,
+ collectionId,
+ ),
+ title = null,
+ attributions = attribution,
+ exploreActionUrl = actionUrl,
+ thumbAsset = asset,
+ placeholderColorInfo =
+ ColorInfo(
+ colors,
+ placeholderColor,
+ ),
+ destination = Destination.NOT_APPLIED,
+ ),
+ liveWallpaperData =
+ LiveWallpaperData(
+ groupName,
+ systemWallpaperInfo,
+ isTitleVisible,
+ isApplied,
+ effectNames
+ ),
+ creativeWallpaperData = null,
+ internalLiveWallpaperData = null,
+ )
+ }
}
}