New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Temporary whitelist support for Doze #732
Conversation
Allow MicroG to add the notified apps into temporarily whitelist
Hey @Nanolx , could you please make a test build of your fork with this PR? Any way, it's time to bump version to 15.1.80 |
I'll roll-out a new custom test build later today. |
@Vavun uploaded custom microG build |
@Nanolx Thanks. Managed profiles/work profiles remain untested. Any feedback, especially if someone happens to use managed profiles, is appreciated. |
@voidstarstar I'll leave a message over at XDA for people to test. From my experience I've had some "problem apps" since some months now, which I had push notification issues with (namely XDA Labs, Bandcamp and Nintendo's Games (Fire Emblem: Heroes, Super Mario Run, Animal Crossing: Pocket Camp); though XDA Labs is the only one which push messages would be nice to have, I don't need games to ping me), I have not yet unininstalled and re-installed them, will report later (and also check the logs). For the others I can confirm that push messages reliably appear in time when device is in Doze, as before there's been kind of delay for some. |
@ale5000-git Couldn't that be included in Microg itself? So many people ask on how to reset or mess it up after an upgrade? |
@chris42 Also this is needed just one time. |
Would it be possible for an app running as root to do that? It would be nice if this was done on first launch of microG or even manually via a GUI button within the microG settings. |
An app running as root would technically be possible to do so, yes, but it's questionable whether something like this would be included. |
If something like this is included, it may led antivirus apps to flag it as virus, if it is really needed I think a separate app is better. |
I've added it to my Providing it as a script is better I suppose. |
I think this commit can be improved with this |
Hello again. One user from russian 4pda community reported problems with push messages on nanolx microg fork starting 192 build and newer. (167 works fine) the only difference in the way messages work is this pull request (I did not miss anything?) Build 167, push notification tester run Build 192/227/241, push notification tester run I tried to figure out something but I found nothing useful except PS @Nanolx it's time to enable issues on your fork page =) |
@Vavun Are you able to reliably reproduce this? Did you reinstall the Push Notification Tester app after installing the new version of GmsCore? I see a I'm also wondering if the device was not registered yet. Did Google Cloud Messaging say it was connected before you opened the Push Notification Tester app? Is the Google Cloud Messaging -> Advanced -> Confirm new apps setting enabled or disabled? I could be wrong, but I don't think this is caused by this PR. Edit: To clarify, I think this |
I can't reproduce this either. It works perfect for me with build 241. Any adblocker or DNS denying access to mtalk.google.com?
Am 8. April 2019 16:41:11 MESZ schrieb voidstarstar <notifications@github.com>:
…
@Vavun Are you able to reliably reproduce this?
Did you reinstall the Push Notification Tester app after installing the
new version of GmsCore?
I see a `SERVICE_NOT_AVAILABLE` error. I think the issue is probably
related to this.
I'm also wondering if the device was not registered yet. Did Google
Cloud Messaging say it was connected before you opened the Push
Notification Tester app?
Is the Google Cloud Messaging -> Advanced -> Confirm new apps setting
enabled or disabled?
I could be wrong, but I don't think this is caused by this PR.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#732 (comment)
--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
|
@Vavun I've enabled 'Issues' over at my fork, but as stated earlier: I don't experience any issue with 0.2.6.15180-dirty-241 |
Thank you very much, I also can't reproduce this problem.
GCM enabled and Confirm new apps disabled in both cases. @voidstarstar @Nanolx I will give your responses to user with this issue. Thanks. |
play-services-core/src/main/java/org/microg/gms/gcm/McsService.java
Outdated
Show resolved
Hide resolved
play-services-core/src/main/java/org/microg/gms/gcm/McsService.java
Outdated
Show resolved
Hide resolved
play-services-core/src/main/java/org/microg/gms/gcm/McsService.java
Outdated
Show resolved
Hide resolved
play-services-core/src/main/java/org/microg/gms/gcm/McsService.java
Outdated
Show resolved
Hide resolved
play-services-core/src/main/java/org/microg/gms/gcm/McsService.java
Outdated
Show resolved
Hide resolved
Also use the proper logging method.
@mar-v-in Thanks for the feedback. I made changes based on the review above. Please let me know if I missed anything or if these should be squashed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small comment.
I'll do the squashing directly during the merge, don't worry about it.
play-services-core/src/main/java/org/microg/gms/gcm/McsService.java
Outdated
Show resolved
Hide resolved
play-services-core/src/main/java/org/microg/gms/gcm/McsService.java
Outdated
Show resolved
Hide resolved
https://stackoverflow.com/a/435568/490687 This is why I have placed some code in onCreate(), the latest code do everything in handleAppMessage(). |
It's definitely much more expensive on the Oracle JVM and I can only assume it would be at least as much of a performance hit on Dalvik/ART. I think calling |
I created a new commit voidstarstar@627d8ab that I think will move as much reflection as possible to If this looks good, should I open a new PR for this? |
I don't think the performance penalty of using a bit more reflection is relevant here. But prefetching certainly doesn't hurt either. Just open a new PR (as this one is merged already and cannot be reused) with a single commit with your changes. |
I have successfully installed microg with temporary whitelisting. Great work! I would like to suggest two documentation changes on the installation wiki page:
The last bullet point was described by @ccaapton here.
10073 is indeed the ID of my microg installation. I had manually disabled battery optimization for microg before, but it was necessary to whitelist it on a system level by the XML to not get the I am obviously open to do the necessary changes in the wiki, I just wanted to ask whether my suggestions are correct (and welcome :-) ) |
I can confirm that this solved a long standing delayed-notifications issue for me as well, on Android 9.
@Tentos, thanks for pointing this out!
* on Thursday, 2019-12-26 09:44 -0800, Tentos ***@***.***> wrote:
… I have successfully installed microg with temporary whitelisting. Great work!
I would like to suggest two documentation changes [on the installation wiki page](https://github.com/microg/android_packages_apps_GmsCore/wiki/Installation):
- It is necessary to install microg as a system app. This is quite obvious because Android does not grant the right for temporary whitelisting otherwise. (Still, I had to look at the logcat and see the `SecurityException`s to realize this.)
- Additionally, I had to add an XML with the following content to `/system/etc/permissions/` (named e.g. `microg.xml`):
```
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<allow-in-power-save package="com.google.android.gms" />
</permissions>
```
The last bullet point was described by @ccaapton [here](#338 (comment)).
When the XML was missing, I again got a `SecurityException`:
```
12-22 23:16:37.699 26505 26542 W GmsGcmMcsSvc: java.lang.reflect.InvocationTargetException
12-22 23:16:37.699 26505 26542 W GmsGcmMcsSvc: at java.lang.reflect.Method.invoke(Native Method)
...
12-22 23:16:37.699 26505 26542 W GmsGcmMcsSvc: Caused by: java.lang.SecurityException: Calling app u0a73 is not on whitelist
12-22 23:16:37.699 26505 26542 W GmsGcmMcsSvc: at android.os.Parcel.readException(Parcel.java:1692)
```
10073 is indeed the ID of my microg installation. I had manually disabled battery optimization for microg before, but it was necessary to whitelist it on a system level by the XML to not get the `SecurityException`, i.e., to get a working temporary whitelisting.
I am obviously open to do the necessary changes in the wiki, I just wanted to ask whether my suggestions are correct (and welcome :-) )
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#732 (comment)
|
I'm not that familiar with Doze as I'm a neophyte when it comes to Android development. Would the changes in this PR have any impact for an app that is always running in the foreground on an always-on device (no battery)? We have a driver assistance application running on custom hardware, so we don't have to worry about the device "sleeping" or different apps being in focus. |
This contains commits by @ccaapton @ale5000-git and myself.
Tested was done in a single user and multi-user setting. Further testing is welcome.
This will likely fix issues many users are having involving delayed push notifications. Some users might have even reported that their push notifications were not working at all when in fact Doze was really the issue.
This fixes #338.