summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-02-12 19:47:35 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-02-12 19:47:35 +0000
commit8dddeb98f5ce685eab6f8c876c77578e0955dd77 (patch)
tree7ea91fc87542eb731066f9cbeead6af3290b6ba0 /core/java
parente848e106b6373d7ca73cfcdac26757c0ea763cd8 (diff)
parent0b4add68db8e5e2ed4f43a651a55574917fcf551 (diff)
Merge "Revert "Fix issue #72116995: Add permission guarding Service#startForeground""
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/Service.java12
-rw-r--r--core/java/android/os/Build.java8
2 files changed, 8 insertions, 12 deletions
diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java
index ea0fd75bec90..256c47934dc5 100644
--- a/core/java/android/app/Service.java
+++ b/core/java/android/app/Service.java
@@ -471,6 +471,14 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac
* {@link #onStart} and returns either {@link #START_STICKY}
* or {@link #START_STICKY_COMPATIBILITY}.
*
+ * <p>If you need your application to run on platform versions prior to API
+ * level 5, you can use the following model to handle the older {@link #onStart}
+ * callback in that case. The <code>handleCommand</code> method is implemented by
+ * you as appropriate:
+ *
+ * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
+ * start_compatibility}
+ *
* <p class="caution">Note that the system calls this on your
* service's main thread. A service's main thread is the same
* thread where UI operations take place for Activities running in the
@@ -679,10 +687,6 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac
* {@link #startService(Intent)} first to tell the system it should keep the service running,
* and then use this method to tell it to keep it running harder.</p>
*
- * <p>Apps targeting API {@link android.os.Build.VERSION_CODES#P} or later must request
- * the permission {@link android.Manifest.permission#FOREGROUND_SERVICE} in order to use
- * this API.</p>
- *
* @param id The identifier for this notification as per
* {@link NotificationManager#notify(int, Notification)
* NotificationManager.notify(int, Notification)}; must not be 0.
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index fc7886191898..48f56847e88d 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -894,14 +894,6 @@ public class Build {
/**
* P.
- *
- * <p>Applications targeting this or a later release will get these
- * new changes in behavior:</p>
- * <ul>
- * <li>{@link android.app.Service#startForeground Service.startForeground} requires
- * that apps hold the permission
- * {@link android.Manifest.permission#FOREGROUND_SERVICE}.</li>
- * </ul>
*/
public static final int P = CUR_DEVELOPMENT; // STOPSHIP Replace with the real version.
}