Skip to content

Put app into temporary whitelist when high priority gcm received #338

Closed

Description

@ccaapton

Activity

  1. changed the title [-]Put app into temporary whitelist when high priority gcm received[/-] [+]Put app into temporary whitelist when high priority gcm received [$5][/+] on Apr 2, 2017
  2. EinsteinXXL commented on Jun 20, 2017

    @EinsteinXXL

    I offer 75$!!

  3. ale5000-git commented on Jan 27, 2018

    @ale5000-git
    Member

    @Catfriend1: I think it is unrelated, this one is related to Doze / energy saving that cause delayed messages.

  4. ccaapton commented on Jan 28, 2018

    @ccaapton
    ContributorAuthor

    @Catfriend1 This is definitely because of this issue.

    I have a working commit to solve this, but it uses private api, and needs microg to be priv-app. In addition a seperate file need to be placed into /system/etc/permissions. So it is unlikely to be accepted by microg

  5. ale5000-git commented on Jan 28, 2018

    @ale5000-git
    Member

    @ccaapton: Could you please explain in details your fix and post a link?

  6. ale5000-git commented on Jan 29, 2018

    @ale5000-git
    Member

    @ccaapton

    I just found your code.

    What about the file in /system/etc/permissions ?

  7. ccaapton commented on Jan 29, 2018

    @ccaapton
    ContributorAuthor

    @ale5000-git My code is out of sync with the github one, and not easy to get sync. There are more parts need to be done, including adding a new aidl and manually convert to java stub. I have not touch the code for quite long time, and got a bit rusty.

    For the xml in /etc/permissions, you need to grep "com.android.providers.download", and give microg the same treatment as that package.

    If you know how to code, perhaps we can chat in email so you could help me to get this upstream.

  8. ale5000-git commented on Jun 20, 2018

    @ale5000-git
    Member

    @ccaapton: I have made it compile successfully as Travis CI reported but I haven't tested it.

  9. added a commit that references this issue on Jun 20, 2018
  10. ccaapton commented on Jun 21, 2018

    @ccaapton
    ContributorAuthor

    @ale5000-git Your commit 67de6f4 is basically what I previously did. It should be able to put other apps into temporary whitelist, together with a new permission file /system/etc/permissions/microg.xml:

    <permissions>
      <allow-in-power-save package="com.google.android.gms" />
    </permissions>
    

    (There is also equivalent /system/etc/sysconfig/microg-a5k.xml with <config/> syntax)

    You can use adb shell dumpsys deviceidle whitelist and adb shell dumpsys deviceidle tempwhitelist to test&verify.

    In the AIDL file IDeviceIdleController.aidl, the method addPowerSaveTempWhitelistApp need a userID argument, it will usually be zero for normal apps, but none-zero for managed-profile apps or apps installed by non-primary users. I did not know how to get the userID of the target app, so I always use 0, but it is problematic in multi-user or managed-profile scenario. In fact this is the major reason why I did not push my work upstream. @ale5000-git @mar-v-in Do you know how to solve this?

  11. nicman23 commented on Jan 5, 2019

    @nicman23

    Any progress on this?

  12. voidstarstar commented on Feb 28, 2019

    @voidstarstar
    Contributor

    Related to #650

  13. voidstarstar commented on Mar 17, 2019

    @voidstarstar
    Contributor

    @ccaapton @ale5000-git

    I think I may have fixed a bug that caused mDeviceIdleController to remain null. The Context.DEVICE_IDLE_CONTROLLER field is hidden and wasn't properly being passed.

    Using the command adb shell dumpsys deviceidle, an app that receives a push notification now appears in the temp whitelist for 10 seconds! The branch is available here. I also have a compiled binary here for testing purposes. (These will be deleted once merged upstream.)

    In the AIDL file IDeviceIdleController.aidl, the method addPowerSaveTempWhitelistApp need a userID argument, it will usually be zero for normal apps, but none-zero for managed-profile apps or apps installed by non-primary users. I did not know how to get the userID of the target app, so I always use 0, but it is problematic in multi-user or managed-profile scenario.

    Does the userID need to be the UID of the receiving app or the UID of microG? I tried modifying the code to use the UID of the receiving app, but in the logcat the ActivityManager said it expected a 0. I'm not running in a multi-user or managed profile setting, so I didn't test those configurations, but using 0 seemed to work for me (once I fixed the bug mentioned above).

    Hopefully someone can test this out to confirm it works. Testing in a multi-user and managed profile environment would be great too. I'd love to see this get merged in before the next microG release since this likely affects nearly all users. If this looks good, let me know if you'd like me to open a PR.

  14. voidstarstar commented on Mar 18, 2019

    @voidstarstar
    Contributor

    I think I solved the multi-user problem too. It required some ugly reflection, due to more hidden APIs, but it seems to work. I am unable to test this for managed profiles, however. Since this seems to me like it's now working, I've opened a PR #732.

  15. added a commit that references this issue on Apr 21, 2019
    6002388
  16. added this to the 0.2.7 milestone on Jun 2, 2019
  17. voidstarstar commented on Jun 2, 2019

    @voidstarstar
    Contributor

    @ale5000-git It looks like you were involved in this one too.

    I just did some general refactoring and code maintenance for the most part. I fixed a couple bugs and figured out how to get the userID, but this isn't really a significant contribution. One of you two should claim it. 🎉

  18. ale5000-git commented on Jun 2, 2019

    @ale5000-git
    Member

    My contribution was minimal in this issue, maybe it should be left to @ccaapton that was the original creator.

  19. changed the title [-]Put app into temporary whitelist when high priority gcm received [$5][/-] [+]Put app into temporary whitelist when high priority gcm received[/+] on Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions