diff options
| author | 2016-01-22 10:32:57 +0000 | |
|---|---|---|
| committer | 2016-01-22 10:32:57 +0000 | |
| commit | e15b4f6db8ab5ad910836aa7b06480862fbad4fc (patch) | |
| tree | 7900799e782295d42c877bf10fbddb466ba86fd9 | |
| parent | 094e64b7cf943a5f489d299e7ed3fa7104db929a (diff) | |
| parent | ce8d4f51b9405003e664736d81e2374dfc117db9 (diff) | |
Merge "Improve documentation for IntentService"
| -rw-r--r-- | core/java/android/app/IntentService.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/core/java/android/app/IntentService.java b/core/java/android/app/IntentService.java index 3cda9736e91c..f33af396070e 100644 --- a/core/java/android/app/IntentService.java +++ b/core/java/android/app/IntentService.java @@ -17,6 +17,7 @@ package android.app; import android.annotation.WorkerThread; +import android.annotation.Nullable; import android.content.Intent; import android.os.Handler; import android.os.HandlerThread; @@ -113,7 +114,7 @@ public abstract class IntentService extends Service { } @Override - public void onStart(Intent intent, int startId) { + public void onStart(@Nullable Intent intent, int startId) { Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = intent; @@ -127,7 +128,7 @@ public abstract class IntentService extends Service { * @see android.app.Service#onStartCommand */ @Override - public int onStartCommand(Intent intent, int flags, int startId) { + public int onStartCommand(@Nullable Intent intent, int flags, int startId) { onStart(intent, startId); return mRedelivery ? START_REDELIVER_INTENT : START_NOT_STICKY; } @@ -139,10 +140,11 @@ public abstract class IntentService extends Service { /** * Unless you provide binding for your service, you don't need to implement this - * method, because the default implementation returns null. + * method, because the default implementation returns null. * @see android.app.Service#onBind */ @Override + @Nullable public IBinder onBind(Intent intent) { return null; } @@ -158,7 +160,11 @@ public abstract class IntentService extends Service { * * @param intent The value passed to {@link * android.content.Context#startService(Intent)}. + * This may be null if the service is being restarted after + * its process has gone away; see + * {@link android.app.Service#onStartCommand} + * for details. */ @WorkerThread - protected abstract void onHandleIntent(Intent intent); + protected abstract void onHandleIntent(@Nullable Intent intent); } |