content: package androidx.loader.content;
  
  import android.content.Context;
  import android.database.Cursor;
  import android.net.Uri;
  import androidx.core.content.ContentResolverCompat;
  import androidx.core.os.CancellationSignal;
  import androidx.core.os.OperationCanceledException;
  import androidx.loader.content.Loader;
  import java.io.FileDescriptor;
  import java.io.PrintWriter;
  import java.util.Arrays;
  import mt.Log1F380D;
  
  /* compiled from: 0086 */
  public class CursorLoader extends AsyncTaskLoader<Cursor> {
      CancellationSignal mCancellationSignal;
      Cursor mCursor;
      final Loader<Cursor>.ForceLoadContentObserver mObserver = new Loader.ForceLoadContentObserver();
      String[] mProjection;
      String mSelection;
      String[] mSelectionArgs;
      String mSortOrder;
      Uri mUri;
  
      public CursorLoader(Context context) {
          super(context);
      }
  
      public CursorLoader(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
          super(context);
          this.mUri = uri;
          this.mProjection = projection;
          this.mSelection = selection;
          this.mSelectionArgs = selectionArgs;
          this.mSortOrder = sortOrder;
      }
  
      public void cancelLoadInBackground() {
          super.cancelLoadInBackground();
          synchronized (this) {
              CancellationSignal cancellationSignal = this.mCancellationSignal;
              if (cancellationSignal != null) {
                  cancellationSignal.cancel();
              }
          }
      }
  
      public void deliverResult(Cursor cursor) {
          if (!isReset()) {
              Cursor cursor2 = this.mCursor;
              this.mCursor = cursor;
              if (isStarted()) {
                  super.deliverResult(cursor);
              }
              if (cursor2 != null && cursor2 != cursor && !cursor2.isClosed()) {
                  cursor2.close();
              }
          } else if (cursor != null) {
              cursor.close();
          }
      }
  
      @Deprecated
      public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
          super.dump(prefix, fd, writer, args);
          writer.print(prefix);
          writer.print("mUri=");
          writer.println(this.mUri);
          writer.print(prefix);
          writer.print("mProjection=");
          String arrays = Arrays.toString(this.mProjection);
          Log1F380D.a((Object) arrays);
          writer.println(arrays);
          writer.print(prefix);
          writer.print("mSelection=");
          writer.println(this.mSelection);
          writer.print(prefix);
          writer.print("mSelectionArgs=");
          String arrays2 = Arrays.toString(this.mSelectionArgs);
          Log1F380D.a((Object) arrays2);
          writer.println(arrays2);
          writer.print(prefix);
          writer.print("mSortOrder=");
          writer.println(this.mSortOrder);
          writer.print(prefix);
          writer.print("mCursor=");
          writer.println(this.mCursor);
          writer.print(prefix);
          writer.print("mContentChanged=");
          writer.println(this.mContentChanged);
      }
  
      public String[] getProjection() {
          return this.mProjection;
      }
  
      public String getSelection() {
          return this.mSelection;
      }
  
      public String[] getSelectionArgs() {
          return this.mSelectionArgs;
      }
  
      public String getSortOrder() {
          return this.mSortOrder;
      }
  
      public Uri getUri() {
          return this.mUri;
      }
  
      public Cursor loadInBackground() {
          Cursor query;
          synchronized (this) {
              if (!isLoadInBackgroundCanceled()) {
                  this.mCancellationSignal = new CancellationSignal();
              } else {
                  throw new OperationCanceledException();
              }
          }
          try {
              query = ContentResolverCompat.query(getContext().getContentResolver(), this.mUri, this.mProjection, this.mSelection, this.mSelectionArgs, this.mSortOrder, this.mCancellationSignal);
              if (query != null) {
                  query.getCount();
                  query.registerContentObserver(this.mObserver);
              }
              synchronized (this) {
                  this.mCancellationSignal = null;
              }
              return query;
          } catch (RuntimeException e) {
              query.close();
              throw e;
          } catch (Throwable th) {
              synchronized (this) {
                  this.mCancellationSignal = null;
                  throw th;
              }
          }
      }
  
      public void onCanceled(Cursor cursor) {
          if (cursor != null && !cursor.isClosed()) {
              cursor.close();
          }
      }
  
      /* access modifiers changed from: protected */
      public void onReset() {
          super.onReset();
          onStopLoading();
          Cursor cursor = this.mCursor;
          if (cursor != null && !cursor.isClosed()) {
              this.mCursor.close();
          }
          this.mCursor = null;
      }
  
      /* access modifiers changed from: protected */
      public void onStartLoading() {
          Cursor cursor = this.mCursor;
          if (cursor != null) {
              deliverResult(cursor);
          }
          if (takeContentChanged() || this.mCursor == null) {
              forceLoad();
          }
      }
  
      /* access modifiers changed from: protected */
      public void onStopLoading() {
          cancelLoad();
      }
  
      public void setProjection(String[] projection) {
          this.mProjection = projection;
      }
  
      public void setSelection(String selection) {
          this.mSelection = selection;
      }
  
      public void setSelectionArgs(String[] selectionArgs) {
          this.mSelectionArgs = selectionArgs;
      }
  
      public void setSortOrder(String sortOrder) {
          this.mSortOrder = sortOrder;
      }
  
      public void setUri(Uri uri) {
          this.mUri = uri;
      }
  }
  