ThemePicker: Fix hardcoded launcher package name
Change-Id: I2950245901634e2e0d69436bb67ab53fc5c8747d
diff --git a/src/com/android/customization/model/grid/DefaultShapeGridManager.kt b/src/com/android/customization/model/grid/DefaultShapeGridManager.kt
index 421333b..97011ea 100644
--- a/src/com/android/customization/model/grid/DefaultShapeGridManager.kt
+++ b/src/com/android/customization/model/grid/DefaultShapeGridManager.kt
@@ -159,10 +159,13 @@
}
override fun getGridOptionDrawable(iconId: Int): Drawable? {
+ val pkgName = context.getString(
+ com.android.themepicker.R.string.launcher_overlayable_package
+ )
try {
val drawable =
ResourcesCompat.getDrawable(
- context.packageManager.getResourcesForApplication(APP_RESOURCES_PACKAGE_NAME),
+ context.packageManager.getResourcesForApplication(pkgName),
iconId,
/* theme = */ null,
)
@@ -170,7 +173,7 @@
} catch (exception: Resources.NotFoundException) {
Log.w(
TAG,
- "Unable to find drawable resource from package $APP_RESOURCES_PACKAGE_NAME with resource ID $iconId",
+ "Unable to find drawable resource from package $pkgName with resource ID $iconId",
)
return null
}
@@ -192,7 +195,5 @@
const val COL_IS_DEFAULT: String = "is_default"
const val COL_PATH: String = "path"
const val KEY_GRID_ICON_ID: String = "grid_icon_id"
- private const val APP_RESOURCES_PACKAGE_NAME: String =
- "com.google.android.apps.nexuslauncher"
}
}