Skip to content
Permalink
Browse files

Deprecate MuzeiArtSource and related fields

Clarify that com.google.android.apps.muzei.api.Artwork should only be used with MuzeiContract and Artwork.fromCursor().
  • Loading branch information...
ianhanniballake committed Aug 3, 2019
1 parent 0d647b0 commit 3b004f14ee03df53bdf439bd7c25aa334a2ba477
Showing with 227 additions and 57 deletions.
  1. +3 −3 android-client-common/src/main/java/com/google/android/apps/muzei/provider/MuzeiProvider.kt
  2. +1 −0 legacy-common/src/main/java/com/google/android/apps/muzei/legacy/LegacySourceServiceProtocol.kt
  3. +2 −0 legacy-standalone/src/main/java/com/google/android/apps/muzei/legacy/LegacySourceService.kt
  4. +2 −0 legacy-standalone/src/main/java/com/google/android/apps/muzei/legacy/NetworkChangeObserver.kt
  5. +2 −0 legacy-standalone/src/main/java/com/google/android/apps/muzei/legacy/SourceArtProvider.kt
  6. +2 −0 legacy-standalone/src/main/java/com/google/android/apps/muzei/legacy/SourceSettingsActivity.kt
  7. +2 −0 legacy-standalone/src/main/java/com/google/android/apps/muzei/legacy/SourceSetupActivity.kt
  8. +2 −0 legacy-standalone/src/main/java/com/google/android/apps/muzei/sources/SourceSubscriberService.kt
  9. +4 −4 main/src/main/java/com/google/android/apps/muzei/ArtDetailFragment.kt
  10. +2 −0 main/src/main/java/com/google/android/apps/muzei/legacy/LegacySourcePackageListener.kt
  11. +74 −33 muzei-api/src/main/java/com/google/android/apps/muzei/api/Artwork.java
  12. +67 −1 muzei-api/src/main/java/com/google/android/apps/muzei/api/MuzeiArtSource.java
  13. +15 −1 muzei-api/src/main/java/com/google/android/apps/muzei/api/MuzeiContract.java
  14. +15 −0 muzei-api/src/main/java/com/google/android/apps/muzei/api/RemoteMuzeiArtSource.java
  15. +5 −6 muzei-api/src/main/java/com/google/android/apps/muzei/api/UserCommand.java
  16. +10 −0 muzei-api/src/main/java/com/google/android/apps/muzei/api/internal/ProtocolConstants.java
  17. +19 −9 muzei-api/src/main/java/com/google/android/apps/muzei/api/internal/SourceState.java
@@ -83,7 +83,7 @@ class MuzeiProvider : ContentProvider() {
private val allArtworkColumnProjectionMap = mapOf(
BaseColumns._ID to "artwork._id",
"${MuzeiContract.Artwork.TABLE_NAME}.${BaseColumns._ID}" to "artwork._id",
MuzeiContract.Artwork.COLUMN_NAME_SOURCE_COMPONENT_NAME to
MuzeiContract.Artwork.COLUMN_NAME_PROVIDER_AUTHORITY to
"providerAuthority AS sourceComponentName",
MuzeiContract.Artwork.COLUMN_NAME_IMAGE_URI to "imageUri",
MuzeiContract.Artwork.COLUMN_NAME_TITLE to "title",
@@ -95,7 +95,7 @@ class MuzeiProvider : ContentProvider() {
MuzeiContract.Artwork.COLUMN_NAME_DATE_ADDED to "date_added",
"${MuzeiContract.Sources.TABLE_NAME}.${BaseColumns._ID}" to
"0 AS \"sources._id\"",
MuzeiContract.Sources.COLUMN_NAME_COMPONENT_NAME to
MuzeiContract.Sources.COLUMN_NAME_AUTHORITY to
"providerAuthority AS component_name",
MuzeiContract.Sources.COLUMN_NAME_IS_SELECTED to "1 AS selected",
MuzeiContract.Sources.COLUMN_NAME_DESCRIPTION to "\"\" AS description",
@@ -205,7 +205,7 @@ class MuzeiProvider : ContentProvider() {
currentProvider?.let { provider ->
c.newRow().apply {
add(BaseColumns._ID, 0L)
add(MuzeiContract.Sources.COLUMN_NAME_COMPONENT_NAME, provider.authority)
add(MuzeiContract.Sources.COLUMN_NAME_AUTHORITY, provider.authority)
add(MuzeiContract.Sources.COLUMN_NAME_IS_SELECTED, true)
add(MuzeiContract.Sources.COLUMN_NAME_DESCRIPTION, runBlocking {
ProviderManager.getDescription(context, provider.authority)
@@ -20,6 +20,7 @@ package com.google.android.apps.muzei.legacy
* Constants used as the protocol to communicate with the LegacySourceService.
*/
object LegacySourceServiceProtocol {
const val LEGACY_COMMAND_ID_NEXT_ARTWORK = 1001
const val LEGACY_SOURCE_ACTION = "com.google.android.apps.muzei.legacy"

const val WHAT_REGISTER_REPLY_TO = 0
@@ -14,6 +14,8 @@
* limitations under the License.
*/

@file:Suppress("DEPRECATION")

package com.google.android.apps.muzei.legacy

import android.app.Service
@@ -14,6 +14,8 @@
* limitations under the License.
*/

@file:Suppress("DEPRECATION")

package com.google.android.apps.muzei.legacy

import android.content.BroadcastReceiver
@@ -14,6 +14,8 @@
* limitations under the License.
*/

@file:Suppress("DEPRECATION")

package com.google.android.apps.muzei.legacy

import android.annotation.SuppressLint
@@ -14,6 +14,8 @@
* limitations under the License.
*/

@file:Suppress("DEPRECATION")

package com.google.android.apps.muzei.legacy

import android.app.Activity
@@ -14,6 +14,8 @@
* limitations under the License.
*/

@file:Suppress("DEPRECATION")

package com.google.android.apps.muzei.legacy

import android.app.Activity
@@ -14,6 +14,8 @@
* limitations under the License.
*/

@file:Suppress("DEPRECATION")

package com.google.android.apps.muzei.sources

import android.app.IntentService
@@ -48,9 +48,9 @@ import androidx.navigation.fragment.findNavController
import com.davemorrissey.labs.subscaleview.ImageSource
import com.davemorrissey.labs.subscaleview.ImageViewState
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
import com.google.android.apps.muzei.api.MuzeiArtSource
import com.google.android.apps.muzei.api.MuzeiContract
import com.google.android.apps.muzei.api.UserCommand
import com.google.android.apps.muzei.legacy.LegacySourceServiceProtocol
import com.google.android.apps.muzei.notifications.NewWallpaperNotificationReceiver
import com.google.android.apps.muzei.render.ArtworkSizeLiveData
import com.google.android.apps.muzei.render.ContentUriImageLoader
@@ -153,7 +153,7 @@ class ArtDetailFragment : Fragment(), (Boolean) -> Unit {
currentArtwork?.getCommands(this) ?: run {
if (currentProviderLiveData.value?.authority == LEGACY_AUTHORITY) {
listOf(UserCommand(
MuzeiArtSource.BUILTIN_COMMAND_ID_NEXT_ARTWORK,
LegacySourceServiceProtocol.LEGACY_COMMAND_ID_NEXT_ARTWORK,
getString(R.string.action_next_artwork)))
} else {
listOf()
@@ -171,7 +171,7 @@ class ArtDetailFragment : Fragment(), (Boolean) -> Unit {
overflowSourceActionMap.put(SOURCE_ACTION_IDS[i], action.id)
val menuItem = overflowMenu.menu.add(0, SOURCE_ACTION_IDS[i],
0, action.title)
if (action.id == MuzeiArtSource.BUILTIN_COMMAND_ID_NEXT_ARTWORK &&
if (action.id == LegacySourceServiceProtocol.LEGACY_COMMAND_ID_NEXT_ARTWORK &&
currentProviderLiveData.value?.authority == LEGACY_AUTHORITY) {
menuItem.setIcon(R.drawable.ic_skip)
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS)
@@ -272,7 +272,7 @@ class ArtDetailFragment : Fragment(), (Boolean) -> Unit {
if (id > 0) {
currentArtworkLiveData.value?.run {
GlobalScope.launch {
if (id == MuzeiArtSource.BUILTIN_COMMAND_ID_NEXT_ARTWORK) {
if (id == LegacySourceServiceProtocol.LEGACY_COMMAND_ID_NEXT_ARTWORK) {
FirebaseAnalytics.getInstance(context).logEvent("next_artwork", bundleOf(
FirebaseAnalytics.Param.CONTENT_TYPE to "art_detail"))
} else {
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION")

package com.google.android.apps.muzei.legacy

import android.app.NotificationChannel

0 comments on commit 3b004f1

Please sign in to comment.
You can’t perform that action at this time.