Merge "Improve documentation for IntentService"
diff --git a/core/java/android/app/IntentService.java b/core/java/android/app/IntentService.java
index 3cda973..f33af39 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 @@
}
@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 @@
* @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 @@
/**
* 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 @@
*
* @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);
}