@Override public void onSongUpdate(ProviderIdentifier provider,final Song s) throws RemoteException {
  if (s == null) {
    Log.w(TAG,"Provider " + provider.mName + " sent in a null songUpdate");
    return;
  }
  try {
    Song cached=mCache.getSong(s.getRef());
    boolean wasLoaded=false;
    boolean changed=false;
    if (cached == null) {
      mCache.putSong(provider,s);
      changed=true;
      cached=s;
    }
 else {
      wasLoaded=cached.isLoaded();
      if (s.isLoaded() && !cached.isIdentical(s)) {
        cached.setAlbum(s.getAlbum());
        cached.setArtist(s.getArtist());
        cached.setSourceLogo(s.getLogo());
        cached.setDuration(s.getDuration());
        cached.setTitle(s.getTitle());
        cached.setYear(s.getYear());
        cached.setOfflineStatus(s.getOfflineStatus());
        cached.setAvailable(s.isAvailable());
        cached.setIsLoaded(s.isLoaded());
        changed=true;
      }
    }
    if (!wasLoaded && cached.isLoaded()) {
      Artist artist=mCache.getArtist(s.getArtist());
      if (artist == null && s.getArtist() != null) {
        artist=retrieveArtist(s.getArtist(),provider);
      }
      if (artist != null) {
        Album album=mCache.getAlbum(s.getAlbum());
        if (album == null && s.getAlbum() != null) {
          album=retrieveAlbum(s.getAlbum(),provider);
        }
        if (album != null) {
          artist.addAlbum(album.getRef());
        }
      }
    }
    if (changed) {
      postSongForUpdate(cached);
    }
  }
 catch (  Exception e) {
    Log.e(TAG,"Exception while updating song data",e);
  }
}

@ Override public void onSongUpdate ( ProviderIdentifier provider , final Song s ) throws RemoteException { if ( s == null ) { Log . w ( TAG , "Provider " + provider . mName + " sent in a null songUpdate" ) ; return ; } try { Song cached = mCache . getSong ( s . getRef ( ) ) ; boolean wasLoaded = false ; boolean changed = false ; if ( cached == null ) { mCache . putSong ( provider , s ) ; changed = true ; cached = s ; } else { wasLoaded = cached . isLoaded ( ) ; if ( s . isLoaded ( ) && ! cached . isIdentical ( s ) ) { cached . setAlbum ( s . getAlbum ( ) ) ; cached . setArtist ( s . getArtist ( ) ) ; cached . setSourceLogo ( s . getLogo ( ) ) ; cached . setDuration ( s . getDuration ( ) ) ; cached . setTitle ( s . getTitle ( ) ) ; cached . setYear ( s . getYear ( ) ) ; cached . setOfflineStatus ( s . getOfflineStatus ( ) ) ; cached . setAvailable ( s . isAvailable ( ) ) ; cached . setIsLoaded ( s . isLoaded ( ) ) ; changed = true ; } } if ( ! wasLoaded && cached . isLoaded ( ) ) { Artist artist = mCache . getArtist ( s . getArtist ( ) ) ; if ( artist == null && s . getArtist ( ) != null ) { artist = retrieveArtist ( s . getArtist ( ) , provider ) ; } if ( artist != null ) { Album album = mCache . getAlbum ( s . getAlbum ( ) ) ; if ( album == null && s . getAlbum ( ) != null ) { album = retrieveAlbum ( s . getAlbum ( ) , provider ) ; } if ( album != null ) { artist . addAlbum ( album . getRef ( ) ) ; } } } if ( changed ) { postSongForUpdate ( cached ) ; } } catch ( Exception e ) { Log . e ( TAG , "Exception while updating song data" , e ) ; } }
called by the providers when the details of a song have been updated .
