OSDN Git Service

am 5edd0cbd: Fix build.
authorMarco Nelissen <marcone@google.com>
Sun, 13 Dec 2009 20:25:52 +0000 (12:25 -0800)
committerAndroid Git Automerger <android-git-automerger@android.com>
Sun, 13 Dec 2009 20:25:52 +0000 (12:25 -0800)
Merge commit '5edd0cbd1ae954dc8e97daef1a99375246bf985c' into eclair-mr2

* commit '5edd0cbd1ae954dc8e97daef1a99375246bf985c':
  Fix build.

1  2 
src/com/android/music/AlbumBrowserActivity.java
src/com/android/music/ArtistAlbumBrowserActivity.java

@@@ -157,12 -157,11 +157,12 @@@ public class AlbumBrowserActivity exten
          mLastListPosCourse = lv.getFirstVisiblePosition();
          mLastListPosFine = lv.getChildAt(0).getTop();
          MusicUtils.unbindFromService(this);
 -        if (!mAdapterSent) {
 -            Cursor c = mAdapter.getCursor();
 -            if (c != null) {
 -                c.close();
 -            }
 +        // If we have an adapter and didn't send it off to another activity yet, we should
 +        // close its cursor, which we do by assigning a null cursor to it. Doing this
 +        // instead of closing the cursor directly keeps the framework from accessing
 +        // the closed cursor later.
 +        if (!mAdapterSent && mAdapter != null) {
 +            mAdapter.changeCursor(null);
          }
          // Because we pass the adapter to the next activity, we need to make
          // sure it doesn't keep a reference to this activity. We can do this
          
          @Override
          public void changeCursor(Cursor cursor) {
 +            if (mActivity.isFinishing() && cursor != null) {
 +                cursor.close();
 +                cursor = null;
 +            }
              if (cursor != mActivity.mAlbumCursor) {
                  mActivity.mAlbumCursor = cursor;
                  getColumnIndices(cursor);
      private Cursor mAlbumCursor;
      private String mArtistId;
  
-     @Override
      public void onServiceConnected(ComponentName name, IBinder service) {
          MusicUtils.updateNowPlaying(this);
      }
  
-     @Override
      public void onServiceDisconnected(ComponentName name) {
          finish();
      }
@@@ -164,12 -164,11 +164,12 @@@ public class ArtistAlbumBrowserActivit
          mLastListPosFine = lv.getChildAt(0).getTop();
          
          MusicUtils.unbindFromService(this);
 -        if (!mAdapterSent) {
 -            Cursor c = mAdapter.getCursor();
 -            if (c != null) {
 -                c.close();
 -            }
 +        // If we have an adapter and didn't send it off to another activity yet, we should
 +        // close its cursor, which we do by assigning a null cursor to it. Doing this
 +        // instead of closing the cursor directly keeps the framework from accessing
 +        // the closed cursor later.
 +        if (!mAdapterSent && mAdapter != null) {
 +            mAdapter.changeCursor(null);
          }
          // Because we pass the adapter to the next activity, we need to make
          // sure it doesn't keep a reference to this activity. We can do this
  
          @Override
          public void changeCursor(Cursor cursor) {
 +            if (mActivity.isFinishing() && cursor != null) {
 +                cursor.close();
 +                cursor = null;
 +            }
              if (cursor != mActivity.mArtistCursor) {
                  mActivity.mArtistCursor = cursor;
                  getColumnIndices(cursor);
      
      private Cursor mArtistCursor;
  
-     @Override
      public void onServiceConnected(ComponentName name, IBinder service) {
          MusicUtils.updateNowPlaying(this);
      }
  
-     @Override
      public void onServiceDisconnected(ComponentName name) {
          finish();
      }