ayufan-pine64 / android-6.0

Main repository with Android 6.0 releases
27 stars 8 forks source link

BackgroundManagerService prevents many Apps from working #12

Closed burningthumb closed 7 years ago

burningthumb commented 7 years ago

It seems something called the BackroundManagerService is preventing many Apps from running in the background. I thought this had something to do with battery optimization, and maybe it does, but there is no battery system setting so its not possible to easily check. I did launch the battery settings intent from my App and excluded it from doze (so put it on the whitelist) but still its not being allowed to start a service... Its causing many, many Apps (Autosync Dropbox, Wifi ADB, etc.) that try to startup in the background to fail and really makes this build ,unfortunately, unusable in its current state.

ayufan commented 7 years ago

Do you have any relevant logs?

burningthumb commented 7 years ago

Sure. You can, quite easily, re-create the problem by installing Autosync Dropbox and then reboot the device.

I was actually looking at an AppWidget, which uses a service, to receive update broadcasts. On Android v5 it works fine. On v6 the service is not starting. The relevant messages for my AppWidget are:

05-07 14:06:11.200 2666 4013 I BackgroundManagerService: package not in whitelist: com.burningthumb.videokioskrsswidget 05-07 14:06:11.201 2666 4013 I BackgroundManagerService: not whitelist service Intent { cmp=com.burningthumb.videokioskrsswidget/.UpdateService }

I thought it had to do with Doze so I implemented this code:

// Android 6 battery optimizations prevent the service from running. We need to get permission to ignore // battery optimization PowerManager l_pm = (PowerManager) getSystemService(Context.POWER_SERVICE);

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { Intent l_ibpo_intent = new Intent(); Boolean l_isOnWhitelist = l_pm.isIgnoringBatteryOptimizations (PACKAGE_NAME);

if (l_isOnWhitelist)
{
    //l_ibpo_intent.setAction(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS);
}
else
{
    l_ibpo_intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
    l_ibpo_intent.setData(Uri.parse("package:" + PACKAGE_NAME));
    l_ibpo_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    WidgetConfigure.this.startActivity(l_ibpo_intent);
}

And I do get the dialog and am able to turn off battery optimizations, but that does not solve the problem. Even with battery optimizations turned off its still not working.

I’m downloading the full Android source from the repo now so maybe I can get more specific after looking at the source.

But in the meantime, here , filtered for BackgroundManagerService, are a bunch of messages - notice all the ones that say “package not in whitelist” — but really all of these massages are breaking something:

Guests-Computer:Logs robert$ adb logcat | grep BackgroundManagerService 05-07 14:05:49.444 2666 2666 D BackgroundManagerService: reload inputmethod list: [com.google.android.inputmethod.pinyin, com.android.inputmethod.latin, jp.co.omronsoft.openwnn] 05-07 14:05:49.472 2666 2666 D BackgroundManagerService: reload account app list: [com.android.email, com.android.email, com.google.android.gms] 05-07 14:05:51.646 2666 4048 I BackgroundManagerService: package not in whitelist: com.burningthumb.premiervideokiosk 05-07 14:05:56.666 2666 3360 D BackgroundManagerService: readMemInfo: freeMem=1600204800,threshold=226492416 05-07 14:05:56.666 2666 3360 D BackgroundManagerService: NOTIFY_CHECK_BACKGROUND_TASK_MSG spends 8ms 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.softwinner.loggerservice 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.android.systemui 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: eu.chainfire.supersu 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.android.phone 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.android.calendar 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.android.providers.calendar 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.android.providers.downloads 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.android.managedprovisioning 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.android.calendar 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.android.camera2 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.android.deskclock 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.android.email 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.android.gallery3d 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.android.inputmethod.latin 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.softwinner.update 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.softwinner.update 05-07 14:06:00.237 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.android.vending 05-07 14:06:00.238 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.ttxapps.wifiadb 05-07 14:06:00.238 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.ttxapps.dropsync 05-07 14:06:00.238 2666 2864 I BackgroundManagerService: prevent from boot complete broadcast: com.burningthumb.premiervideokiosk 05-07 14:06:00.473 2666 2666 D BackgroundManagerService: reload bgmusic list: [com.burningthumb.premiervideokiosk] 05-07 14:06:05.546 2666 2756 I BackgroundManagerService: package not in whitelist: com.estrongs.android.pop 05-07 14:06:05.546 2666 2756 I BackgroundManagerService: not whitelist service Intent { cmp=com.estrongs.android.pop/com.estrongs.android.ui.notification.ESTaskService } 05-07 14:06:05.547 2666 2756 I BackgroundManagerService: skipService Intent { cmp=com.estrongs.android.pop/com.estrongs.android.ui.notification.ESTaskService } because of activity not started! 05-07 14:06:07.814 2666 4265 I BackgroundManagerService: package not in whitelist: com.estrongs.android.pop 05-07 14:06:07.814 2666 4265 I BackgroundManagerService: not whitelist service Intent { cmp=com.estrongs.android.pop/com.duapps.ad.services.KeepAliveService } 05-07 14:06:07.814 2666 4265 I BackgroundManagerService: skipService Intent { cmp=com.estrongs.android.pop/com.duapps.ad.services.KeepAliveService } because of activity not started! 05-07 14:06:08.359 2666 4261 I BackgroundManagerService: package not in whitelist: com.estrongs.android.pop 05-07 14:06:08.359 2666 4261 I BackgroundManagerService: not whitelist service Intent { cmp=com.estrongs.android.pop/com.dianxinos.dxservice.core.DXCoreService } 05-07 14:06:08.359 2666 4261 I BackgroundManagerService: skipService Intent { cmp=com.estrongs.android.pop/com.dianxinos.dxservice.core.DXCoreService } because of activity not started! 05-07 14:06:08.451 2666 2756 I BackgroundManagerService: package not in whitelist: com.estrongs.android.pop 05-07 14:06:08.451 2666 2756 I BackgroundManagerService: not whitelist service Intent { cmp=com.estrongs.android.pop/com.estrongs.android.scanner.service.FileScannerService } 05-07 14:06:08.451 2666 2756 I BackgroundManagerService: skipService Intent { cmp=com.estrongs.android.pop/com.estrongs.android.scanner.service.FileScannerService } because of activity not started! 05-07 14:06:10.550 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:06:10.612 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:06:10.721 2666 2666 D BackgroundManagerService: reload bgmusic list: [com.burningthumb.premiervideokiosk] 05-07 14:06:11.200 2666 4013 I BackgroundManagerService: package not in whitelist: com.burningthumb.videokioskrsswidget 05-07 14:06:11.201 2666 4013 I BackgroundManagerService: not whitelist service Intent { cmp=com.burningthumb.videokioskrsswidget/.UpdateService } 05-07 14:06:11.201 2666 4013 I BackgroundManagerService: skipService Intent { cmp=com.burningthumb.videokioskrsswidget/.UpdateService } because of activity not started! 05-07 14:06:13.343 2666 4280 I BackgroundManagerService: package not in whitelist: com.estrongs.android.pop 05-07 14:06:13.344 2666 4280 I BackgroundManagerService: not whitelist service Intent { cmp=com.estrongs.android.pop/com.duapps.ad.services.HeartBitService } 05-07 14:06:13.344 2666 4280 I BackgroundManagerService: skipService Intent { cmp=com.estrongs.android.pop/com.duapps.ad.services.HeartBitService } because of activity not started! 05-07 14:06:15.316 2666 2666 D BackgroundManagerService: reload bgmusic list: [com.burningthumb.premiervideokiosk] 05-07 14:06:19.628 2666 4265 I BackgroundManagerService: package not in whitelist: com.ttxapps.dropsync 05-07 14:06:19.628 2666 4265 I BackgroundManagerService: not whitelist service Intent { cmp=com.ttxapps.dropsync/com.ttxapps.sync.LocalFsMonitor } 05-07 14:06:19.628 2666 4265 I BackgroundManagerService: skipService Intent { cmp=com.ttxapps.dropsync/com.ttxapps.sync.LocalFsMonitor } because of activity not started! 05-07 14:06:19.657 2666 4265 I BackgroundManagerService: package not in whitelist: com.ttxapps.dropsync 05-07 14:06:19.657 2666 4265 I BackgroundManagerService: not whitelist service Intent { cmp=com.ttxapps.dropsync/com.ttxapps.sync.LocalFsMonitor } 05-07 14:06:19.657 2666 4265 I BackgroundManagerService: skipService Intent { cmp=com.ttxapps.dropsync/com.ttxapps.sync.LocalFsMonitor } because of activity not started! 05-07 14:06:19.691 2666 2707 I BackgroundManagerService: package not in whitelist: com.ttxapps.dropsync 05-07 14:06:19.691 2666 2707 I BackgroundManagerService: not whitelist service Intent { cmp=com.ttxapps.dropsync/com.ttxapps.sync.PowerSourceMonitor } 05-07 14:06:19.691 2666 2707 I BackgroundManagerService: skipService Intent { cmp=com.ttxapps.dropsync/com.ttxapps.sync.PowerSourceMonitor } because of activity not started! 05-07 14:06:19.691 2666 4283 I BackgroundManagerService: package not in whitelist: com.ttxapps.dropsync 05-07 14:06:19.691 2666 4283 I BackgroundManagerService: not whitelist service Intent { cmp=com.ttxapps.dropsync/com.ttxapps.sync.PowerSourceMonitor } 05-07 14:06:19.691 2666 4283 I BackgroundManagerService: skipService Intent { cmp=com.ttxapps.dropsync/com.ttxapps.sync.PowerSourceMonitor } because of activity not started! 05-07 14:06:23.351 2666 4261 I BackgroundManagerService: package not in whitelist: com.estrongs.android.pop 05-07 14:06:23.351 2666 4261 I BackgroundManagerService: not whitelist service Intent { cmp=com.estrongs.android.pop/com.estrongs.android.ui.notification.ESTaskService } 05-07 14:06:23.352 2666 4261 I BackgroundManagerService: skipService Intent { cmp=com.estrongs.android.pop/com.estrongs.android.ui.notification.ESTaskService } because of activity not started! 05-07 14:06:23.540 2666 4266 I BackgroundManagerService: package not in whitelist: com.estrongs.android.pop 05-07 14:06:23.540 2666 4266 I BackgroundManagerService: not whitelist service Intent { cmp=com.estrongs.android.pop/com.duapps.ad.services.KeepAliveService } 05-07 14:06:23.541 2666 4266 I BackgroundManagerService: skipService Intent { cmp=com.estrongs.android.pop/com.duapps.ad.services.KeepAliveService } because of activity not started! 05-07 14:06:23.922 2666 4265 I BackgroundManagerService: package not in whitelist: com.estrongs.android.pop 05-07 14:06:23.922 2666 4265 I BackgroundManagerService: not whitelist service Intent { cmp=com.estrongs.android.pop/com.dianxinos.dxservice.core.DXCoreService } 05-07 14:06:23.922 2666 4265 I BackgroundManagerService: skipService Intent { cmp=com.estrongs.android.pop/com.dianxinos.dxservice.core.DXCoreService } because of activity not started! 05-07 14:06:24.084 2666 7061 I BackgroundManagerService: package not in whitelist: com.estrongs.android.pop 05-07 14:06:24.085 2666 7061 I BackgroundManagerService: not whitelist service Intent { cmp=com.estrongs.android.pop/com.estrongs.android.scanner.service.FileScannerService } 05-07 14:06:24.085 2666 7061 I BackgroundManagerService: skipService Intent { cmp=com.estrongs.android.pop/com.estrongs.android.scanner.service.FileScannerService } because of activity not started! 05-07 14:06:24.589 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:06:24.640 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:06:24.724 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:06:24.753 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:06:24.859 2666 2666 D BackgroundManagerService: reload bgmusic list: [com.burningthumb.premiervideokiosk] 05-07 14:06:26.931 2666 2666 D BackgroundManagerService: reload inputmethod list: [com.google.android.inputmethod.pinyin, com.android.inputmethod.latin, jp.co.omronsoft.openwnn] 05-07 14:06:26.931 2666 2666 D BackgroundManagerService: reload account app list: [com.android.email, com.android.email, com.google.android.gms] 05-07 14:06:27.281 2666 4283 I BackgroundManagerService: package not in whitelist: com.estrongs.android.pop 05-07 14:06:27.281 2666 4283 I BackgroundManagerService: not whitelist service Intent { cmp=com.estrongs.android.pop/com.duapps.ad.services.HeartBitService } 05-07 14:06:27.282 2666 4283 I BackgroundManagerService: skipService Intent { cmp=com.estrongs.android.pop/com.duapps.ad.services.HeartBitService } because of activity not started! 05-07 14:06:34.352 2666 2666 D BackgroundManagerService: reload bgmusic list: [com.burningthumb.premiervideokiosk] 05-07 14:06:38.091 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:06:38.129 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:06:38.168 2666 7063 I BackgroundManagerService: package not in whitelist: com.burningthumb.premiervideokiosk 05-07 14:06:38.235 2666 2709 I BackgroundManagerService: package not in whitelist: com.burningthumb.premiervideokiosk 05-07 14:06:43.251 2666 3360 D BackgroundManagerService: readMemInfo: freeMem=1311281152,threshold=226492416 05-07 14:06:43.251 2666 3360 D BackgroundManagerService: NOTIFY_CHECK_BACKGROUND_TASK_MSG spends 12ms 05-07 14:06:47.696 2666 4283 I BackgroundManagerService: package not in whitelist: com.burningthumb.premiervideokiosk 05-07 14:06:47.760 2666 7060 I BackgroundManagerService: package not in whitelist: com.burningthumb.premiervideokiosk 05-07 14:06:52.288 2666 4265 I BackgroundManagerService: package not in whitelist: com.burningthumb.premiervideokiosk 05-07 14:06:52.450 2666 7064 I BackgroundManagerService: package not in whitelist: com.ttxapps.wifiadb 05-07 14:06:57.460 2666 3360 D BackgroundManagerService: readMemInfo: freeMem=1287233536,threshold=226492416 05-07 14:06:57.460 2666 3360 D BackgroundManagerService: NOTIFY_CHECK_BACKGROUND_TASK_MSG spends 5ms 05-07 14:07:01.445 2666 3459 I BackgroundManagerService: package not in whitelist: com.ttxapps.wifiadb 05-07 14:07:01.472 2666 4283 I BackgroundManagerService: package not in whitelist: com.burningthumb.premiervideokiosk 05-07 14:07:01.789 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:07:01.804 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:07:01.855 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:07:01.884 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:07:02.118 2666 2666 D BackgroundManagerService: reload bgmusic list: [com.burningthumb.premiervideokiosk] 05-07 14:07:02.483 2666 2666 D BackgroundManagerService: reload bgmusic list: [com.burningthumb.premiervideokiosk] 05-07 14:07:02.484 2666 2666 D BackgroundManagerService: reload bgmusic list: [com.burningthumb.premiervideokiosk] 05-07 14:07:06.507 2666 3360 D BackgroundManagerService: readMemInfo: freeMem=1282338816,threshold=226492416 05-07 14:07:06.507 2666 3360 D BackgroundManagerService: NOTIFY_CHECK_BACKGROUND_TASK_MSG spends 30ms 05-07 14:07:16.523 2666 2666 D BackgroundManagerService: reload bgmusic list: [com.burningthumb.premiervideokiosk] 05-07 14:07:24.265 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:07:24.351 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:07:24.383 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:07:24.454 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:07:24.498 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:07:24.599 2666 2666 D BackgroundManagerService: reload bgmusic list: [com.burningthumb.premiervideokiosk] 05-07 14:07:34.686 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:07:34.924 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:07:34.961 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:08:06.573 2666 3360 D BackgroundManagerService: readMemInfo: freeMem=1281519616,threshold=226492416 05-07 14:08:06.573 2666 3360 D BackgroundManagerService: NOTIFY_CHECK_BACKGROUND_TASK_MSG spends 13ms 05-07 14:08:19.713 2666 2709 I BackgroundManagerService: package not in whitelist: com.ttxapps.dropsync 05-07 14:08:19.714 2666 2709 I BackgroundManagerService: not whitelist service Intent { cmp=com.ttxapps.dropsync/com.ttxapps.autosync.app.SyncService (has extras) } 05-07 14:08:19.714 2666 2709 I BackgroundManagerService: skipService Intent { cmp=com.ttxapps.dropsync/com.ttxapps.autosync.app.SyncService (has extras) } because of activity not started! 05-07 14:09:06.640 2666 3360 D BackgroundManagerService: readMemInfo: freeMem=1290764288,threshold=226492416 05-07 14:09:06.641 2666 3360 D BackgroundManagerService: NOTIFY_CHECK_BACKGROUND_TASK_MSG spends 11ms 05-07 14:09:35.581 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:09:35.610 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:09:35.694 2666 2666 D BackgroundManagerService: reload bgmusic list: [com.burningthumb.premiervideokiosk] 05-07 14:09:57.745 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:09:57.828 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:09:57.862 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:09:57.974 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:09:58.003 2666 2666 D BackgroundManagerService: reload bgmusic list: [] 05-07 14:09:58.049 2666 2666 D BackgroundManagerService: reload bgmusic list: [com.burningthumb.premiervideokiosk]

On May 7, 2017, at 1:35 PM, Kamil Trzciński <notifications@github.com mailto:notifications@github.com> wrote:

Do you have any relevant logs?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ayufan-pine64/android-6.0/issues/12#issuecomment-299732765, or mute the thread https://github.com/notifications/unsubscribe-auth/AGvl8DmHgffNgydIsXAJgjE0VmMi0Na_ks5r3isqgaJpZM4NTSeO.

ayufan commented 7 years ago

Last time I saw these errors there were related to missing /system/etc/permissions entry to one of the permission groups.

Google has tendency to ship them separately outside of AOSP and include in their own builds.

burningthumb commented 7 years ago

Well I'll look into the source code, once the repo is downloaded, to see where the logcat messages are coming and then I'll have a better idea. But, as I said, the Pine64 Android v5 works perfectly without any of these errors.

burningthumb commented 7 years ago

Its so odd. I looked through the repo but found nothing. There is a specific string in the log "NOTIFY_CHECK_BACKGROUND_TASK_MSG" that seems to be no where in the source code. Do you know where this is coming from ?

burningthumb commented 7 years ago

I tried to work around this using the BOOT_COMPLETED notification but again this is being blocked:

BackgroundManagerService: prevent from boot complete broadcast: com.burningthumb.videokioskrsswidget

If you google "prevent from boot complete broadcast" you will find this StackOverflow post: http://stackoverflow.com/questions/43363918/android-6-preventing-boot-complete-broadcast

Which indicates its device specific, I guess the Pine64, is just one of those devices that doesn't work. Sigh. I'll try the Android 7 image and see if it has the same issue.

burningthumb commented 7 years ago

OK, well I just installed the Community Beta r20 and its fine. Please close this issue.

ayufan commented 7 years ago

Is not present on r20, but it is on r21?

burningthumb commented 7 years ago

No.

I had, incorrectly, installed Android 6.0 Image (HDMI Video Output) Release 20170112 ver 2.0.1.

I went back today and saw above that was your version Android 6.0 Beta ver 1.0.1 build 20 Direct download from pine64.org http://pine64.org/ (US) and when I installed this version its fine.

On May 9, 2017, at 2:16 PM, Kamil Trzciński <notifications@github.com mailto:notifications@github.com> wrote:

Is not present on r20, but it is on r21?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ayufan-pine64/android-6.0/issues/12#issuecomment-300304091, or mute the thread https://github.com/notifications/unsubscribe-auth/AGvl8KIH2ua9-exb0IvbXagtCbiXLr_Hks5r4NexgaJpZM4NTSeO.

ayufan commented 7 years ago

OK. So you were using the AW version? not mine?

burningthumb commented 7 years ago

Yes now I think so. Sorry for my confusion. I’ve been running build 20 of your version and its behaving correctly. All the problems of the last days are fixed.

The issue is wrong, the software is correct.

On May 9, 2017, at 2:30 PM, Kamil Trzciński notifications@github.com wrote:

OK. So you were using the AW version? not mine?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ayufan-pine64/android-6.0/issues/12#issuecomment-300307430, or mute the thread https://github.com/notifications/unsubscribe-auth/AGvl8NeJTlLCTJUkEk5Nk_hZsZ1FRzQdks5r4NrlgaJpZM4NTSeO.