Loading core/java/android/app/Service.java +16 −14 Original line number Diff line number Diff line Loading @@ -671,21 +671,21 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac } /** * Make this service run in the foreground, supplying the ongoing * If your service is started (running through {@link Context#startService(Intent)}), then * also make this service run in the foreground, supplying the ongoing * notification to be shown to the user while in this state. * By default services are background, meaning that if the system needs to * kill them to reclaim more memory (such as to display a large page in a * web browser), they can be killed without too much harm. You can set this * flag if killing your service would be disruptive to the user, such as * By default started services are background, meaning that their process won't be given * foreground CPU scheduling (unless something else in that process is foreground) and, * if the system needs to kill them to reclaim more memory (such as to display a large page in a * web browser), they can be killed without too much harm. You use * {@link #startForeground} if killing your service would be disruptive to the user, such as * if your service is performing background music playback, so the user * would notice if their music stopped playing. * * <p>If you need your application to run on platform versions prior to API * level 5, you can use the following model to call the the older setForeground() * or this modern method as appropriate: * * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java * foreground_compatibility} * <p>Note that calling this method does <em>not</em> put the service in the started state * itself, even though the name sounds like it. You must always call * {@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> * * @param id The identifier for this notification as per * {@link NotificationManager#notify(int, Notification) Loading Loading @@ -716,7 +716,9 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac /** * Remove this service from foreground state, allowing it to be killed if * more memory is needed. * more memory is needed. This does not stop the service from running (for that * you use {@link #stopSelf()} or related methods), just takes it out of the * foreground state. * * @param flags additional behavior options. * @see #startForeground(int, Notification) Loading core/res/res/values/strings.xml +8 −3 Original line number Diff line number Diff line Loading @@ -644,8 +644,10 @@ <!-- Text shown when viewing channel settings for notifications related to a usb connection --> <string name="notification_channel_usb">USB connection</string> <!-- Text shown when viewing channel settings for notifications related to running foreground services [CHAR LIMIT=NONE] --> <!-- This is the label for the notification channel settings that controls the behavior of the notification about applications that are running in the background (that is, perhaps confusingly, running foreground services but not the foreground UI on the screen). [CHAR LIMIT=NONE] --> <string name="notification_channel_foreground_service">Apps running in background</string> <!-- Label for foreground service notification when one app is running. [CHAR LIMIT=NONE] --> Loading @@ -663,7 +665,10 @@ data usage</string> <!-- Separator for foreground service notification content listing all apps when there are multiple apps running [CHAR LIMIT=NONE] --> are multiple apps running. The left and right side may both already be compound (constructed using this separator). Should be kept as short as possible, this is for summary text in the notification where there is not a lot of space. [CHAR LIMIT=NONE] --> <string name="foreground_service_multiple_separator"><xliff:g id="left_side">%1$s</xliff:g>, <xliff:g id="right_side">%2$s</xliff:g></string> Loading packages/SystemUI/res/values/strings.xml +3 −1 Original line number Diff line number Diff line Loading @@ -2036,7 +2036,9 @@ <!-- Title of the "running foreground services" dialog. [CHAR LIMIT=NONE] --> <string name="running_foreground_services_title">Apps running in background</string> <!-- Title of the "running foreground services" dialog. [CHAR LIMIT=NONE] --> <!-- Descriptive text of an item in the "running foreground services" dialog, telling the user what will happen when they tap on that item (which is an application that has been identified for them as running). [CHAR LIMIT=NONE] --> <string name="running_foreground_services_msg">Tap for details on battery and data usage</string> </resources> packages/SystemUI/src/com/android/systemui/ForegroundServicesDialog.java +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public final class ForegroundServicesDialog extends AlertActivity implements private DialogInterface.OnClickListener mAppClickListener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String pkg = mPackages[which]; String pkg = mAdapter.getItem(which).packageName; Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.fromParts("package", pkg, null)); startActivity(intent); Loading Loading
core/java/android/app/Service.java +16 −14 Original line number Diff line number Diff line Loading @@ -671,21 +671,21 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac } /** * Make this service run in the foreground, supplying the ongoing * If your service is started (running through {@link Context#startService(Intent)}), then * also make this service run in the foreground, supplying the ongoing * notification to be shown to the user while in this state. * By default services are background, meaning that if the system needs to * kill them to reclaim more memory (such as to display a large page in a * web browser), they can be killed without too much harm. You can set this * flag if killing your service would be disruptive to the user, such as * By default started services are background, meaning that their process won't be given * foreground CPU scheduling (unless something else in that process is foreground) and, * if the system needs to kill them to reclaim more memory (such as to display a large page in a * web browser), they can be killed without too much harm. You use * {@link #startForeground} if killing your service would be disruptive to the user, such as * if your service is performing background music playback, so the user * would notice if their music stopped playing. * * <p>If you need your application to run on platform versions prior to API * level 5, you can use the following model to call the the older setForeground() * or this modern method as appropriate: * * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java * foreground_compatibility} * <p>Note that calling this method does <em>not</em> put the service in the started state * itself, even though the name sounds like it. You must always call * {@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> * * @param id The identifier for this notification as per * {@link NotificationManager#notify(int, Notification) Loading Loading @@ -716,7 +716,9 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac /** * Remove this service from foreground state, allowing it to be killed if * more memory is needed. * more memory is needed. This does not stop the service from running (for that * you use {@link #stopSelf()} or related methods), just takes it out of the * foreground state. * * @param flags additional behavior options. * @see #startForeground(int, Notification) Loading
core/res/res/values/strings.xml +8 −3 Original line number Diff line number Diff line Loading @@ -644,8 +644,10 @@ <!-- Text shown when viewing channel settings for notifications related to a usb connection --> <string name="notification_channel_usb">USB connection</string> <!-- Text shown when viewing channel settings for notifications related to running foreground services [CHAR LIMIT=NONE] --> <!-- This is the label for the notification channel settings that controls the behavior of the notification about applications that are running in the background (that is, perhaps confusingly, running foreground services but not the foreground UI on the screen). [CHAR LIMIT=NONE] --> <string name="notification_channel_foreground_service">Apps running in background</string> <!-- Label for foreground service notification when one app is running. [CHAR LIMIT=NONE] --> Loading @@ -663,7 +665,10 @@ data usage</string> <!-- Separator for foreground service notification content listing all apps when there are multiple apps running [CHAR LIMIT=NONE] --> are multiple apps running. The left and right side may both already be compound (constructed using this separator). Should be kept as short as possible, this is for summary text in the notification where there is not a lot of space. [CHAR LIMIT=NONE] --> <string name="foreground_service_multiple_separator"><xliff:g id="left_side">%1$s</xliff:g>, <xliff:g id="right_side">%2$s</xliff:g></string> Loading
packages/SystemUI/res/values/strings.xml +3 −1 Original line number Diff line number Diff line Loading @@ -2036,7 +2036,9 @@ <!-- Title of the "running foreground services" dialog. [CHAR LIMIT=NONE] --> <string name="running_foreground_services_title">Apps running in background</string> <!-- Title of the "running foreground services" dialog. [CHAR LIMIT=NONE] --> <!-- Descriptive text of an item in the "running foreground services" dialog, telling the user what will happen when they tap on that item (which is an application that has been identified for them as running). [CHAR LIMIT=NONE] --> <string name="running_foreground_services_msg">Tap for details on battery and data usage</string> </resources>
packages/SystemUI/src/com/android/systemui/ForegroundServicesDialog.java +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public final class ForegroundServicesDialog extends AlertActivity implements private DialogInterface.OnClickListener mAppClickListener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String pkg = mPackages[which]; String pkg = mAdapter.getItem(which).packageName; Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.fromParts("package", pkg, null)); startActivity(intent); Loading