Loading core/java/android/content/AsyncTaskLoader.java +17 −17 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,7 @@ import android.os.AsyncTask; import android.os.Handler; import android.os.Handler; import android.os.OperationCanceledException; import android.os.OperationCanceledException; import android.os.SystemClock; import android.os.SystemClock; import android.util.Slog; import android.util.Log; import android.util.TimeUtils; import android.util.TimeUtils; import java.io.FileDescriptor; import java.io.FileDescriptor; Loading Loading @@ -64,10 +64,10 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { /* Runs on a worker thread */ /* Runs on a worker thread */ @Override @Override protected D doInBackground(Void... params) { protected D doInBackground(Void... params) { if (DEBUG) Slog.v(TAG, this + " >>> doInBackground"); if (DEBUG) Log.v(TAG, this + " >>> doInBackground"); try { try { D data = AsyncTaskLoader.this.onLoadInBackground(); D data = AsyncTaskLoader.this.onLoadInBackground(); if (DEBUG) Slog.v(TAG, this + " <<< doInBackground"); if (DEBUG) Log.v(TAG, this + " <<< doInBackground"); return data; return data; } catch (OperationCanceledException ex) { } catch (OperationCanceledException ex) { if (!isCancelled()) { if (!isCancelled()) { Loading @@ -79,7 +79,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { // So we treat this case as an unhandled exception. // So we treat this case as an unhandled exception. throw ex; throw ex; } } if (DEBUG) Slog.v(TAG, this + " <<< doInBackground (was canceled)", ex); if (DEBUG) Log.v(TAG, this + " <<< doInBackground (was canceled)", ex); return null; return null; } } } } Loading @@ -87,7 +87,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { /* Runs on the UI thread */ /* Runs on the UI thread */ @Override @Override protected void onPostExecute(D data) { protected void onPostExecute(D data) { if (DEBUG) Slog.v(TAG, this + " onPostExecute"); if (DEBUG) Log.v(TAG, this + " onPostExecute"); try { try { AsyncTaskLoader.this.dispatchOnLoadComplete(this, data); AsyncTaskLoader.this.dispatchOnLoadComplete(this, data); } finally { } finally { Loading @@ -98,7 +98,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { /* Runs on the UI thread */ /* Runs on the UI thread */ @Override @Override protected void onCancelled(D data) { protected void onCancelled(D data) { if (DEBUG) Slog.v(TAG, this + " onCancelled"); if (DEBUG) Log.v(TAG, this + " onCancelled"); try { try { AsyncTaskLoader.this.dispatchOnCancelled(this, data); AsyncTaskLoader.this.dispatchOnCancelled(this, data); } finally { } finally { Loading Loading @@ -162,18 +162,18 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { super.onForceLoad(); super.onForceLoad(); cancelLoad(); cancelLoad(); mTask = new LoadTask(); mTask = new LoadTask(); if (DEBUG) Slog.v(TAG, "Preparing load: mTask=" + mTask); if (DEBUG) Log.v(TAG, "Preparing load: mTask=" + mTask); executePendingTask(); executePendingTask(); } } @Override @Override protected boolean onCancelLoad() { protected boolean onCancelLoad() { if (DEBUG) Slog.v(TAG, "onCancelLoad: mTask=" + mTask); if (DEBUG) Log.v(TAG, "onCancelLoad: mTask=" + mTask); if (mTask != null) { if (mTask != null) { if (mCancellingTask != null) { if (mCancellingTask != null) { // There was a pending task already waiting for a previous // There was a pending task already waiting for a previous // one being canceled; just drop it. // one being canceled; just drop it. if (DEBUG) Slog.v(TAG, if (DEBUG) Log.v(TAG, "cancelLoad: still waiting for cancelled task; dropping next"); "cancelLoad: still waiting for cancelled task; dropping next"); if (mTask.waiting) { if (mTask.waiting) { mTask.waiting = false; mTask.waiting = false; Loading @@ -184,14 +184,14 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { } else if (mTask.waiting) { } else if (mTask.waiting) { // There is a task, but it is waiting for the time it should // There is a task, but it is waiting for the time it should // execute. We can just toss it. // execute. We can just toss it. if (DEBUG) Slog.v(TAG, "cancelLoad: task is waiting, dropping it"); if (DEBUG) Log.v(TAG, "cancelLoad: task is waiting, dropping it"); mTask.waiting = false; mTask.waiting = false; mHandler.removeCallbacks(mTask); mHandler.removeCallbacks(mTask); mTask = null; mTask = null; return false; return false; } else { } else { boolean cancelled = mTask.cancel(false); boolean cancelled = mTask.cancel(false); if (DEBUG) Slog.v(TAG, "cancelLoad: cancelled=" + cancelled); if (DEBUG) Log.v(TAG, "cancelLoad: cancelled=" + cancelled); if (cancelled) { if (cancelled) { mCancellingTask = mTask; mCancellingTask = mTask; cancelLoadInBackground(); cancelLoadInBackground(); Loading Loading @@ -223,7 +223,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { long now = SystemClock.uptimeMillis(); long now = SystemClock.uptimeMillis(); if (now < (mLastLoadCompleteTime+mUpdateThrottle)) { if (now < (mLastLoadCompleteTime+mUpdateThrottle)) { // Not yet time to do another load. // Not yet time to do another load. if (DEBUG) Slog.v(TAG, "Waiting until " if (DEBUG) Log.v(TAG, "Waiting until " + (mLastLoadCompleteTime+mUpdateThrottle) + (mLastLoadCompleteTime+mUpdateThrottle) + " to execute: " + mTask); + " to execute: " + mTask); mTask.waiting = true; mTask.waiting = true; Loading @@ -231,7 +231,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { return; return; } } } } if (DEBUG) Slog.v(TAG, "Executing: " + mTask); if (DEBUG) Log.v(TAG, "Executing: " + mTask); mTask.executeOnExecutor(mExecutor, (Void[]) null); mTask.executeOnExecutor(mExecutor, (Void[]) null); } } } } Loading @@ -239,11 +239,11 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { void dispatchOnCancelled(LoadTask task, D data) { void dispatchOnCancelled(LoadTask task, D data) { onCanceled(data); onCanceled(data); if (mCancellingTask == task) { if (mCancellingTask == task) { if (DEBUG) Slog.v(TAG, "Cancelled task is now canceled!"); if (DEBUG) Log.v(TAG, "Cancelled task is now canceled!"); rollbackContentChanged(); rollbackContentChanged(); mLastLoadCompleteTime = SystemClock.uptimeMillis(); mLastLoadCompleteTime = SystemClock.uptimeMillis(); mCancellingTask = null; mCancellingTask = null; if (DEBUG) Slog.v(TAG, "Delivering cancellation"); if (DEBUG) Log.v(TAG, "Delivering cancellation"); deliverCancellation(); deliverCancellation(); executePendingTask(); executePendingTask(); } } Loading @@ -251,7 +251,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { void dispatchOnLoadComplete(LoadTask task, D data) { void dispatchOnLoadComplete(LoadTask task, D data) { if (mTask != task) { if (mTask != task) { if (DEBUG) Slog.v(TAG, "Load complete of old task, trying to cancel"); if (DEBUG) Log.v(TAG, "Load complete of old task, trying to cancel"); dispatchOnCancelled(task, data); dispatchOnCancelled(task, data); } else { } else { if (isAbandoned()) { if (isAbandoned()) { Loading @@ -261,7 +261,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { commitContentChanged(); commitContentChanged(); mLastLoadCompleteTime = SystemClock.uptimeMillis(); mLastLoadCompleteTime = SystemClock.uptimeMillis(); mTask = null; mTask = null; if (DEBUG) Slog.v(TAG, "Delivering result"); if (DEBUG) Log.v(TAG, "Delivering result"); deliverResult(data); deliverResult(data); } } } } Loading core/java/android/content/ContentResolver.java +2 −5 Original line number Original line Diff line number Diff line Loading @@ -368,9 +368,7 @@ public abstract class ContentResolver { } } /** /** * <p> * Query the given URI, returning a {@link Cursor} over the result set. * Query the given URI, returning a {@link Cursor} over the result set. * </p> * <p> * <p> * For best performance, the caller should follow these guidelines: * For best performance, the caller should follow these guidelines: * <ul> * <ul> Loading Loading @@ -405,9 +403,8 @@ public abstract class ContentResolver { } } /** /** * <p> * Query the given URI, returning a {@link Cursor} over the result set * Query the given URI, returning a {@link Cursor} over the result set. * with optional support for cancellation. * </p> * <p> * <p> * For best performance, the caller should follow these guidelines: * For best performance, the caller should follow these guidelines: * <ul> * <ul> Loading core/java/android/content/Loader.java +1 −1 File changed.Contains only whitespace changes. Show changes Loading
core/java/android/content/AsyncTaskLoader.java +17 −17 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,7 @@ import android.os.AsyncTask; import android.os.Handler; import android.os.Handler; import android.os.OperationCanceledException; import android.os.OperationCanceledException; import android.os.SystemClock; import android.os.SystemClock; import android.util.Slog; import android.util.Log; import android.util.TimeUtils; import android.util.TimeUtils; import java.io.FileDescriptor; import java.io.FileDescriptor; Loading Loading @@ -64,10 +64,10 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { /* Runs on a worker thread */ /* Runs on a worker thread */ @Override @Override protected D doInBackground(Void... params) { protected D doInBackground(Void... params) { if (DEBUG) Slog.v(TAG, this + " >>> doInBackground"); if (DEBUG) Log.v(TAG, this + " >>> doInBackground"); try { try { D data = AsyncTaskLoader.this.onLoadInBackground(); D data = AsyncTaskLoader.this.onLoadInBackground(); if (DEBUG) Slog.v(TAG, this + " <<< doInBackground"); if (DEBUG) Log.v(TAG, this + " <<< doInBackground"); return data; return data; } catch (OperationCanceledException ex) { } catch (OperationCanceledException ex) { if (!isCancelled()) { if (!isCancelled()) { Loading @@ -79,7 +79,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { // So we treat this case as an unhandled exception. // So we treat this case as an unhandled exception. throw ex; throw ex; } } if (DEBUG) Slog.v(TAG, this + " <<< doInBackground (was canceled)", ex); if (DEBUG) Log.v(TAG, this + " <<< doInBackground (was canceled)", ex); return null; return null; } } } } Loading @@ -87,7 +87,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { /* Runs on the UI thread */ /* Runs on the UI thread */ @Override @Override protected void onPostExecute(D data) { protected void onPostExecute(D data) { if (DEBUG) Slog.v(TAG, this + " onPostExecute"); if (DEBUG) Log.v(TAG, this + " onPostExecute"); try { try { AsyncTaskLoader.this.dispatchOnLoadComplete(this, data); AsyncTaskLoader.this.dispatchOnLoadComplete(this, data); } finally { } finally { Loading @@ -98,7 +98,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { /* Runs on the UI thread */ /* Runs on the UI thread */ @Override @Override protected void onCancelled(D data) { protected void onCancelled(D data) { if (DEBUG) Slog.v(TAG, this + " onCancelled"); if (DEBUG) Log.v(TAG, this + " onCancelled"); try { try { AsyncTaskLoader.this.dispatchOnCancelled(this, data); AsyncTaskLoader.this.dispatchOnCancelled(this, data); } finally { } finally { Loading Loading @@ -162,18 +162,18 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { super.onForceLoad(); super.onForceLoad(); cancelLoad(); cancelLoad(); mTask = new LoadTask(); mTask = new LoadTask(); if (DEBUG) Slog.v(TAG, "Preparing load: mTask=" + mTask); if (DEBUG) Log.v(TAG, "Preparing load: mTask=" + mTask); executePendingTask(); executePendingTask(); } } @Override @Override protected boolean onCancelLoad() { protected boolean onCancelLoad() { if (DEBUG) Slog.v(TAG, "onCancelLoad: mTask=" + mTask); if (DEBUG) Log.v(TAG, "onCancelLoad: mTask=" + mTask); if (mTask != null) { if (mTask != null) { if (mCancellingTask != null) { if (mCancellingTask != null) { // There was a pending task already waiting for a previous // There was a pending task already waiting for a previous // one being canceled; just drop it. // one being canceled; just drop it. if (DEBUG) Slog.v(TAG, if (DEBUG) Log.v(TAG, "cancelLoad: still waiting for cancelled task; dropping next"); "cancelLoad: still waiting for cancelled task; dropping next"); if (mTask.waiting) { if (mTask.waiting) { mTask.waiting = false; mTask.waiting = false; Loading @@ -184,14 +184,14 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { } else if (mTask.waiting) { } else if (mTask.waiting) { // There is a task, but it is waiting for the time it should // There is a task, but it is waiting for the time it should // execute. We can just toss it. // execute. We can just toss it. if (DEBUG) Slog.v(TAG, "cancelLoad: task is waiting, dropping it"); if (DEBUG) Log.v(TAG, "cancelLoad: task is waiting, dropping it"); mTask.waiting = false; mTask.waiting = false; mHandler.removeCallbacks(mTask); mHandler.removeCallbacks(mTask); mTask = null; mTask = null; return false; return false; } else { } else { boolean cancelled = mTask.cancel(false); boolean cancelled = mTask.cancel(false); if (DEBUG) Slog.v(TAG, "cancelLoad: cancelled=" + cancelled); if (DEBUG) Log.v(TAG, "cancelLoad: cancelled=" + cancelled); if (cancelled) { if (cancelled) { mCancellingTask = mTask; mCancellingTask = mTask; cancelLoadInBackground(); cancelLoadInBackground(); Loading Loading @@ -223,7 +223,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { long now = SystemClock.uptimeMillis(); long now = SystemClock.uptimeMillis(); if (now < (mLastLoadCompleteTime+mUpdateThrottle)) { if (now < (mLastLoadCompleteTime+mUpdateThrottle)) { // Not yet time to do another load. // Not yet time to do another load. if (DEBUG) Slog.v(TAG, "Waiting until " if (DEBUG) Log.v(TAG, "Waiting until " + (mLastLoadCompleteTime+mUpdateThrottle) + (mLastLoadCompleteTime+mUpdateThrottle) + " to execute: " + mTask); + " to execute: " + mTask); mTask.waiting = true; mTask.waiting = true; Loading @@ -231,7 +231,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { return; return; } } } } if (DEBUG) Slog.v(TAG, "Executing: " + mTask); if (DEBUG) Log.v(TAG, "Executing: " + mTask); mTask.executeOnExecutor(mExecutor, (Void[]) null); mTask.executeOnExecutor(mExecutor, (Void[]) null); } } } } Loading @@ -239,11 +239,11 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { void dispatchOnCancelled(LoadTask task, D data) { void dispatchOnCancelled(LoadTask task, D data) { onCanceled(data); onCanceled(data); if (mCancellingTask == task) { if (mCancellingTask == task) { if (DEBUG) Slog.v(TAG, "Cancelled task is now canceled!"); if (DEBUG) Log.v(TAG, "Cancelled task is now canceled!"); rollbackContentChanged(); rollbackContentChanged(); mLastLoadCompleteTime = SystemClock.uptimeMillis(); mLastLoadCompleteTime = SystemClock.uptimeMillis(); mCancellingTask = null; mCancellingTask = null; if (DEBUG) Slog.v(TAG, "Delivering cancellation"); if (DEBUG) Log.v(TAG, "Delivering cancellation"); deliverCancellation(); deliverCancellation(); executePendingTask(); executePendingTask(); } } Loading @@ -251,7 +251,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { void dispatchOnLoadComplete(LoadTask task, D data) { void dispatchOnLoadComplete(LoadTask task, D data) { if (mTask != task) { if (mTask != task) { if (DEBUG) Slog.v(TAG, "Load complete of old task, trying to cancel"); if (DEBUG) Log.v(TAG, "Load complete of old task, trying to cancel"); dispatchOnCancelled(task, data); dispatchOnCancelled(task, data); } else { } else { if (isAbandoned()) { if (isAbandoned()) { Loading @@ -261,7 +261,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { commitContentChanged(); commitContentChanged(); mLastLoadCompleteTime = SystemClock.uptimeMillis(); mLastLoadCompleteTime = SystemClock.uptimeMillis(); mTask = null; mTask = null; if (DEBUG) Slog.v(TAG, "Delivering result"); if (DEBUG) Log.v(TAG, "Delivering result"); deliverResult(data); deliverResult(data); } } } } Loading
core/java/android/content/ContentResolver.java +2 −5 Original line number Original line Diff line number Diff line Loading @@ -368,9 +368,7 @@ public abstract class ContentResolver { } } /** /** * <p> * Query the given URI, returning a {@link Cursor} over the result set. * Query the given URI, returning a {@link Cursor} over the result set. * </p> * <p> * <p> * For best performance, the caller should follow these guidelines: * For best performance, the caller should follow these guidelines: * <ul> * <ul> Loading Loading @@ -405,9 +403,8 @@ public abstract class ContentResolver { } } /** /** * <p> * Query the given URI, returning a {@link Cursor} over the result set * Query the given URI, returning a {@link Cursor} over the result set. * with optional support for cancellation. * </p> * <p> * <p> * For best performance, the caller should follow these guidelines: * For best performance, the caller should follow these guidelines: * <ul> * <ul> Loading
core/java/android/content/Loader.java +1 −1 File changed.Contains only whitespace changes. Show changes