Add Context argument to getAction methods

Add a Context argument to methods for getting title and
icon for the action link, to support cases where we're
obtaining these from resources.

Bug: 77695473

Change-Id: I3e8b1d47afa46ab98d82f29ee0b19148362e249a
diff --git a/src/com/android/wallpaper/model/CurrentWallpaperInfoV16.java b/src/com/android/wallpaper/model/CurrentWallpaperInfoV16.java
index 41a7459..e5efee6 100755
--- a/src/com/android/wallpaper/model/CurrentWallpaperInfoV16.java
+++ b/src/com/android/wallpaper/model/CurrentWallpaperInfoV16.java
@@ -107,12 +107,12 @@
     }
 
     @Override
-    public int getActionIconRes() {
+    public int getActionIconRes(Context unused) {
         return mActionIconRes != 0 ? mActionIconRes : WallpaperInfo.getDefaultActionIcon();
     }
 
     @Override
-    public int getActionLabelRes() {
+    public int getActionLabelRes(Context unused) {
         return mActionLabelRes != 0 ? mActionLabelRes : WallpaperInfo.getDefaultActionLabel();
     }
 
diff --git a/src/com/android/wallpaper/model/CurrentWallpaperInfoVN.java b/src/com/android/wallpaper/model/CurrentWallpaperInfoVN.java
index 87ea124..8d1aa03 100755
--- a/src/com/android/wallpaper/model/CurrentWallpaperInfoVN.java
+++ b/src/com/android/wallpaper/model/CurrentWallpaperInfoVN.java
@@ -124,12 +124,12 @@
     }
 
     @Override
-    public int getActionIconRes() {
+    public int getActionIconRes(Context unused) {
         return mActionIconRes != 0 ? mActionIconRes : WallpaperInfo.getDefaultActionIcon();
     }
 
     @Override
-    public int getActionLabelRes() {
+    public int getActionLabelRes(Context unused) {
         return mActionLabelRes != 0 ? mActionLabelRes : WallpaperInfo.getDefaultActionLabel();
     }
 
diff --git a/src/com/android/wallpaper/model/WallpaperInfo.java b/src/com/android/wallpaper/model/WallpaperInfo.java
index 01ff774..04a97d0 100755
--- a/src/com/android/wallpaper/model/WallpaperInfo.java
+++ b/src/com/android/wallpaper/model/WallpaperInfo.java
@@ -80,7 +80,7 @@
      * {@link #getActionUrl(Context)}
      */
     @DrawableRes
-    public int getActionIconRes() {
+    public int getActionIconRes(Context context) {
         return getDefaultActionIcon();
     }
 
@@ -89,7 +89,7 @@
      * {@link #getActionUrl(Context)}
      */
     @StringRes
-    public int getActionLabelRes() {
+    public int getActionLabelRes(Context context) {
         return getDefaultActionLabel();
     }
 
diff --git a/src/com/android/wallpaper/module/DefaultWallpaperPersister.java b/src/com/android/wallpaper/module/DefaultWallpaperPersister.java
index 5d371a3..1c9c0ba 100755
--- a/src/com/android/wallpaper/module/DefaultWallpaperPersister.java
+++ b/src/com/android/wallpaper/module/DefaultWallpaperPersister.java
@@ -1001,8 +1001,10 @@
                     mWallpaper.getAttributions(mAppContext));
             mWallpaperPreferences.setHomeWallpaperBaseImageUrl(mWallpaper.getBaseImageUrl());
             mWallpaperPreferences.setHomeWallpaperActionUrl(mWallpaper.getActionUrl(mAppContext));
-            mWallpaperPreferences.setHomeWallpaperActionLabelRes(mWallpaper.getActionLabelRes());
-            mWallpaperPreferences.setHomeWallpaperActionIconRes(mWallpaper.getActionIconRes());
+            mWallpaperPreferences.setHomeWallpaperActionLabelRes(
+                    mWallpaper.getActionLabelRes(mAppContext));
+            mWallpaperPreferences.setHomeWallpaperActionIconRes(
+                    mWallpaper.getActionIconRes(mAppContext));
             mWallpaperPreferences.setHomeWallpaperCollectionId(
                     mWallpaper.getCollectionId(mAppContext));
             mWallpaperPreferences.setHomeWallpaperRemoteId(mWallpaper.getWallpaperId());
@@ -1013,8 +1015,10 @@
             mWallpaperPreferences.setLockWallpaperAttributions(
                     mWallpaper.getAttributions(mAppContext));
             mWallpaperPreferences.setLockWallpaperActionUrl(mWallpaper.getActionUrl(mAppContext));
-            mWallpaperPreferences.setHomeWallpaperActionLabelRes(mWallpaper.getActionLabelRes());
-            mWallpaperPreferences.setHomeWallpaperActionIconRes(mWallpaper.getActionIconRes());
+            mWallpaperPreferences.setHomeWallpaperActionLabelRes(
+                    mWallpaper.getActionLabelRes(mAppContext));
+            mWallpaperPreferences.setHomeWallpaperActionIconRes(
+                    mWallpaper.getActionIconRes(mAppContext));
             mWallpaperPreferences.setLockWallpaperCollectionId(
                     mWallpaper.getCollectionId(mAppContext));
 
diff --git a/src/com/android/wallpaper/picker/CategoryPickerFragment.java b/src/com/android/wallpaper/picker/CategoryPickerFragment.java
index 94914d4..eac2fb7 100755
--- a/src/com/android/wallpaper/picker/CategoryPickerFragment.java
+++ b/src/com/android/wallpaper/picker/CategoryPickerFragment.java
@@ -563,9 +563,9 @@
                     if (showSkipWallpaperButton) {
                         exploreButton = mWallpaperExploreButtonNoText;
                         mWallpaperExploreButtonNoText.setImageDrawable(getContext().getDrawable(
-                                mWallpaperInfo.getActionIconRes()));
+                                mWallpaperInfo.getActionIconRes(appContext)));
                         mWallpaperExploreButtonNoText.setContentDescription(
-                                getString(mWallpaperInfo.getActionLabelRes()));
+                                getString(mWallpaperInfo.getActionLabelRes(appContext)));
                         mWallpaperExploreButtonNoText.setColorFilter(
                                 getResources().getColor(R.color.currently_set_explore_button_color),
                                 Mode.SRC_IN);
@@ -574,14 +574,15 @@
                         exploreButton = mWallpaperExploreButton;
 
                         Drawable drawable = getContext().getDrawable(
-                                mWallpaperInfo.getActionIconRes()).getConstantState()
+                                mWallpaperInfo.getActionIconRes(appContext)).getConstantState()
                                 .newDrawable().mutate();
                         // Color the "compass" icon with the accent color.
                         drawable.setColorFilter(
                                 getResources().getColor(R.color.accent_color), Mode.SRC_IN);
                         ButtonDrawableSetterCompat.setDrawableToButtonStart(
                                 mWallpaperExploreButton, drawable);
-                        mWallpaperExploreButton.setText(mWallpaperInfo.getActionLabelRes());
+                        mWallpaperExploreButton.setText(
+                                mWallpaperInfo.getActionLabelRes(appContext));
                         mWallpaperExploreButtonNoText.setVisibility(View.GONE);
                     }
                     exploreButton.setVisibility(View.VISIBLE);
@@ -732,9 +733,9 @@
 
                             exploreButton.setVisibility(View.VISIBLE);
                             exploreButton.setImageDrawable(getContext().getDrawable(
-                                    homeWallpaper.getActionIconRes()));
+                                    homeWallpaper.getActionIconRes(appContext)));
                             exploreButton.setContentDescription(getString(homeWallpaper
-                                    .getActionLabelRes()));
+                                    .getActionLabelRes(appContext)));
                             exploreButton.setColorFilter(
                                     getResources().getColor(R.color.currently_set_explore_button_color), Mode.SRC_IN);
                             exploreButton.setOnClickListener(new OnClickListener() {
@@ -822,9 +823,9 @@
                                 return;
                             }
                             exploreButton.setImageDrawable(getContext().getDrawable(
-                                    lockWallpaper.getActionIconRes()));
+                                    lockWallpaper.getActionIconRes(appContext)));
                             exploreButton.setContentDescription(getString(
-                                    lockWallpaper.getActionLabelRes()));
+                                    lockWallpaper.getActionLabelRes(appContext)));
                             exploreButton.setVisibility(View.VISIBLE);
                             exploreButton.setColorFilter(
                                     getResources().getColor(
diff --git a/src/com/android/wallpaper/picker/PreviewFragment.java b/src/com/android/wallpaper/picker/PreviewFragment.java
index dfbd7cb..f0ba615 100755
--- a/src/com/android/wallpaper/picker/PreviewFragment.java
+++ b/src/com/android/wallpaper/picker/PreviewFragment.java
@@ -593,7 +593,7 @@
             if (mExploreIntent != null) {
                 if (Flags.skipDailyWallpaperButtonEnabled) {
                     Drawable exploreButtonDrawable = context.getDrawable(
-                            mWallpaper.getActionIconRes());
+                            mWallpaper.getActionIconRes(context));
 
                     // This Drawable's state is shared across the app, so make a copy of it before applying a
                     // color tint as not to affect other clients elsewhere in the app.
@@ -605,7 +605,7 @@
                     ButtonDrawableSetterCompat.setDrawableToButtonStart(
                             mAttributionExploreButton, exploreButtonDrawable);
                     mAttributionExploreButton.setText(context.getString(
-                            mWallpaper.getActionLabelRes()));
+                            mWallpaper.getActionLabelRes(context)));
                 }
 
                 mAttributionExploreSection.setVisibility(View.VISIBLE);
diff --git a/src/com/android/wallpaper/picker/TopLevelPickerActivity.java b/src/com/android/wallpaper/picker/TopLevelPickerActivity.java
index e0b2dec..fa46373 100755
--- a/src/com/android/wallpaper/picker/TopLevelPickerActivity.java
+++ b/src/com/android/wallpaper/picker/TopLevelPickerActivity.java
@@ -581,7 +581,7 @@
                         if (exploreIntent != null && !isDestroyed()) {
                             // Set the icon for the button
                             Drawable exploreButtonDrawable = getResources().getDrawable(
-                                    homeWallpaper.getActionIconRes());
+                                    homeWallpaper.getActionIconRes(appContext));
 
                             // This Drawable's state is shared across the app, so make a copy of it
                             // before applying a color tint as not to affect other clients elsewhere
@@ -595,7 +595,7 @@
                             ButtonDrawableSetterCompat.setDrawableToButtonStart(
                                     mCurrentWallpaperExploreButton, exploreButtonDrawable);
                             mCurrentWallpaperExploreButton.setText(getString(
-                                    homeWallpaper.getActionLabelRes()));
+                                    homeWallpaper.getActionLabelRes(appContext)));
                             mCurrentWallpaperExploreButton.setVisibility(View.VISIBLE);
                             mCurrentWallpaperExploreButton.setOnClickListener(new OnClickListener() {
                                 @Override