private void updatePlaybackStatus() {
    int state = PlaybackProxy.getState();

    switch (state) {
      case PlaybackService.STATE_STOPPED:
      case PlaybackService.STATE_PAUSED:
        mPlayDrawable.setShape(PlayPauseDrawable.SHAPE_PLAY);
        mPlayDrawable.setBuffering(false);
        break;

      case PlaybackService.STATE_BUFFERING:
        mPlayDrawable.setShape(PlayPauseDrawable.SHAPE_PAUSE);
        mPlayDrawable.setBuffering(true);
        break;

      case PlaybackService.STATE_PAUSING:
        mPlayDrawable.setShape(PlayPauseDrawable.SHAPE_PAUSE);
        mPlayDrawable.setBuffering(true);
        break;

      case PlaybackService.STATE_PLAYING:
        mPlayDrawable.setShape(PlayPauseDrawable.SHAPE_PAUSE);
        mPlayDrawable.setBuffering(false);
        break;
    }

    Song currentTrack = PlaybackProxy.getCurrentTrack();

    if (currentTrack != null && currentTrack.isLoaded()) {
      final ProviderAggregator aggregator = ProviderAggregator.getDefault();

      mTvTitle.setText(currentTrack.getTitle());

      if (currentTrack.getArtist() != null) {
        Artist artist =
            aggregator.retrieveArtist(currentTrack.getArtist(), currentTrack.getProvider());

        if (artist != null && artist.getName() != null && !artist.getName().isEmpty()) {
          mTvArtist.setText(artist.getName());
        } else if (artist != null && !artist.isLoaded()) {
          mTvArtist.setText(R.string.loading);
        } else {
          mTvArtist.setText(null);
        }
      } else {
        mTvArtist.setText(null);
      }

      if (currentTrack.getAlbum() != null) {
        Album album = aggregator.retrieveAlbum(currentTrack.getAlbum(), currentTrack.getProvider());

        if (album != null && album.getName() != null && !album.getName().isEmpty()) {
          mTvAlbum.setText(album.getName());
        } else if (album != null && !album.isLoaded()) {
          mTvAlbum.setText(R.string.loading);
        } else {
          mTvAlbum.setText(null);
        }
      } else {
        mTvAlbum.setText(null);
      }

      mIvAlbumArt.loadArtForSong(currentTrack);
      mSeek.setMax(currentTrack.getDuration());
    } else if (currentTrack != null) {
      mTvTitle.setText(R.string.loading);
      mTvArtist.setText(null);
      mIvAlbumArt.setDefaultArt();
    } else {
      // TODO: No song playing
    }
  }
  /** Called by the providers when the details of an album have been updated. */
  @Override
  public void onAlbumUpdate(ProviderIdentifier provider, final Album a) throws RemoteException {
    if (a == null) {
      Log.w(TAG, "Provider returned a null album");
      return;
    }

    Album cached = mCache.getAlbum(a.getRef());
    boolean modified = false;

    // See IProviderCallback.aidl in providerlib for more info about the logic of updating
    // the Album objects
    if (cached == null) {
      mCache.putAlbum(provider, a);
      cached = a;
      modified = true;
    } else if (!cached.isLoaded() || !cached.isIdentical(a)) {
      cached.setName(a.getName());
      cached.setYear(a.getYear());
      cached.setIsLoaded(a.isLoaded());
      cached.setProvider(a.getProvider());

      if (cached.getSongsCount() != a.getSongsCount()) {
        Iterator<String> songsIt = a.songs();
        while (songsIt.hasNext()) {
          String songRef = songsIt.next();
          cached.addSong(songRef);
        }
      }

      modified = true;
    }

    if (cached.getProvider() == null) {
      Log.e(TAG, "Provider for " + cached.getRef() + " is null!");
    }

    if (modified) {
      // Add the album to each artist of the song (once)
      Iterator<String> songs = a.songs();

      while (songs.hasNext()) {
        String songRef = songs.next();
        Song song = retrieveSong(songRef, a.getProvider());

        if (song != null && song.isLoaded()) {
          String artistRef = song.getArtist();
          if (artistRef != null) {
            Artist artist = retrieveArtist(artistRef, song.getProvider());

            if (artist != null) {
              artist.addAlbum(a.getRef());
            } else {
              if (DEBUG) Log.e(TAG, "Artist is null!");
            }
          }
        } else {
          if (DEBUG) Log.e(TAG, "Song is null!");
        }
      }

      postAlbumForUpdate(cached);
    }
  }