Fixed
Status Update
Comments
sy...@google.com <sy...@google.com> #3
Hi,
Thanks for reporting the issue. We are working on this issue and will provide updates as they are available.
Thanks..
Thanks for reporting the issue. We are working on this issue and will provide updates as they are available.
Thanks..
ke...@gmail.com <ke...@gmail.com> #4
This is a very important trick to *illegally* increase priority of a certain service by a lot of developers, so that the service would be less likely to be killed, and users are not aware that someone is abusing their battery.
mm...@commonsware.com <mm...@commonsware.com> #5
Note that this problem still exists on NPD906 (N Developer Preview 5), as tested on a Nexus 9.
sy...@google.com <sy...@google.com> #6
This issue is fixed internal builds and fix will be available in future releases.
ke...@gmail.com <ke...@gmail.com> #7
Note that this problem still exists on the first generally available Android 7.0(NRD90M) released yesterday, as tested on a Nexus 6p:
Does it mean "Status: FutureRelease " suggusts the fix is included in the (possibly) coming nougat MR1 release in October?
dumpsys shows
angler:/ $ dumpsys activity services grep AlipayService
ACTIVITY MANAGER SERVICES (dumpsys activity services)
User 0 active services:
* ServiceRecord{1bd1e1f u0 com.weixinfu.circles/.service.AlipayService}
intent={cmp=com.weixinfu.circles/.service.AlipayService}
packageName=com.weixinfu.circles
processName=com.weixinfu.circles
baseDir=/data/app/com.weixinfu.circles-1/base.apk
dataDir=/data/user/0/com.weixinfu.circles
app=ProcessRecord{53d6aff 12966:com.weixinfu.circles/u0a282}
isForeground=true foregroundId=1017 foregroundNoti=Notification(pri=0 contentView=com.weixinfu.circles/0x7f040017 vibrate=null sound=null defaults=0x0 flags=0x62 color=0x00000000 vis=PRIVATE)
createTime=-24s321ms startingBgTimeout=--
lastActivity=-24s322ms restartTime=-24s322ms createdFromFg=true
startRequested=true delayedStop=false stopIfKilled=false callStart=true lastStartId=1
The system did show a notification, for about 0.5 second, and after that, the foreground service was kept running.
The sample app here is made by someone else:
https://github.com/jezhee/sneaky_foreground_service
Does it mean "Status: FutureRelease " suggusts the fix is included in the (possibly) coming nougat MR1 release in October?
dumpsys shows
angler:/ $ dumpsys activity services grep AlipayService
ACTIVITY MANAGER SERVICES (dumpsys activity services)
User 0 active services:
* ServiceRecord{1bd1e1f u0 com.weixinfu.circles/.service.AlipayService}
intent={cmp=com.weixinfu.circles/.service.AlipayService}
packageName=com.weixinfu.circles
processName=com.weixinfu.circles
baseDir=/data/app/com.weixinfu.circles-1/base.apk
dataDir=/data/user/0/com.weixinfu.circles
app=ProcessRecord{53d6aff 12966:com.weixinfu.circles/u0a282}
isForeground=true foregroundId=1017 foregroundNoti=Notification(pri=0 contentView=com.weixinfu.circles/0x7f040017 vibrate=null sound=null defaults=0x0 flags=0x62 color=0x00000000 vis=PRIVATE)
createTime=-24s321ms startingBgTimeout=--
lastActivity=-24s322ms restartTime=-24s322ms createdFromFg=true
startRequested=true delayedStop=false stopIfKilled=false callStart=true lastStartId=1
The system did show a notification, for about 0.5 second, and after that, the foreground service was kept running.
The sample app here is made by someone else:
mm...@commonsware.com <mm...@commonsware.com> #8
Also note that the issue can be reproduced using the sample app from the original issue report, on a Nexus 9 running NDR90M.
ke...@gmail.com <ke...@gmail.com> #9
@7
Based on the changelog between DP5(NPC91K) and GA(NDR90M), It seems NDR90M only includes commits before a certain day in somewhat the middle of July.
Based on the changelog between DP5(NPC91K) and GA(NDR90M), It seems NDR90M only includes commits before a certain day in somewhat the middle of July.
ke...@gmail.com <ke...@gmail.com> #10
can anyone confirm whether this issue has been fixed in 7.1 or not?
mm...@commonsware.com <mm...@commonsware.com> #11
This is somewhat fixed in Android 7.1, as tested on a Nexus 5X running NPF10C. The hidden-foreground-service scenario behaves the same as the regular foreground-service scenario: no status bar icon, but the notification appears in the shade.
Description
example, NPC91K). See Settings > About phone > Build number
NPD56N
* What device are you using? (for example, Nexus 6P)
Nexus 9
* What are the steps to reproduce the problem? (Please provide the
minimal reproducible test case.)
Step #1: UnZIP, build, and install the attached app.
Step #2: From the command line, run adb shell dumpsys activity p | fgrep commonsware. This should show no results.
Step #2: Run the app.
Step #3: With the app's UI in the foreground, run adb shell dumpsys activity p | fgrep commonsware. This should show, among other lines:
Proc # 0: fore T/A/T trm: 0 30057:com.commonsware.android.rotation.bundle/u0a98 (top-activity)
The "fore" and "top-activity" indicates that our app has foreground importance, as expected.
Step #4: Press HOME, to bring up the HOME screen.
Step #5: Run adb shell dumpsys activity p | fgrep commonsware. This should show, among other lines:
Proc # 3: prev B/ /LA trm: 0 30057:com.commonsware.android.rotation.bundle/u0a98 (previous)
The "prev" and "previous" means that our app has "previous"-level importance.
Step #6: Using the RECENTS button, return to the running activity. There, press the "Foreground Service" button. Then press HOME.
Step #7: Run adb shell dumpsys activity p | fgrep commonsware. This should show, among other lines:
Proc # 2: prcp F/S/SF trm: 0 30057:com.commonsware.android.rotation.bundle/u0a98 (fg-service)
This indicates that the process as foreground service importance.
Step #8: Look at your status bar and notice that there is no icon associated with this app.
Step #9: Slide open the notification shade, and notice that there is a notification there for us, even though there is no icon.
Step #10: Press the RECENTS button and return to our activity. Click the "Stop Service" button to stop that running service. Press HOME.
Step #11: Run adb shell dumpsys activity p | fgrep commonsware. This should show, among other lines:
Proc # 3: prev B/ /LA trm: 0 30057:com.commonsware.android.rotation.bundle/u0a98 (previous)
The "prev" and "previous" means that our app has "previous"-level importance. In other words, we are back to where we were after Step #5.
Step #12: Using the RECENTS button, return to the running activity. There, press the "Hidden Service" button. Then press HOME.
Step #13: Run adb shell dumpsys activity p | fgrep commonsware. This should show, among other lines:
Proc # 2: prcp F/S/SF trm: 0 30057:com.commonsware.android.rotation.bundle/u0a98 (fg-service)
This indicates that the process as foreground service importance.
Step #14: Look at your status bar and notice that there is no icon associated with this app.
Step #15: Slide open the notification shade, and notice that there is no notification for our app, even though we have foreground service importance
* What was the expected result?
Either:
- We should not have foreground service importance, or
- We should have both a notification tile in the shade and a notification icon in the status bar
* What was the actual result?
We have foreground service importance, with no status bar icon, and in the latter case, no notification at all.
-----------------
This was recognized as a problem years ago. See this G+ post from Dianne Hackborn, for example:
When the user taps the "Foreground Service" button, I just call startForeground() with a largely empty Notification:
startForeground(NOTIFICATION_ID, new Notification.Builder(this).build());
This should cause an icon to appear in the status bar, derived from my app's icon, but it does not. The icon appears in the tile in the notification shade, though.
When the user taps the "Hidden Service" button, I employ a trick that was reported as an issue over a year ago (see
Based on the available evidence, my guess is that while Android tracks process importance based upon any running service that has called startForeground(), the code to manage the notification is simply honoring the stopForeground() call and removing the notification. Those two bits of code need to coordinate: you need to show the notification (with the icon) so long as *any* service has called startForeground() without a corresponding stopForeground().
Thanks!