Open ale5000-git opened 12 months ago
From Google's documentation:
If caller target API level is below Build.VERSION_CODES.O, it is required to hold the permission Manifest.permission.GET_ACCOUNTS or have a signature match with the AbstractAccountAuthenticator that manages the account.
I assume this applies to all apps if the OS Version is below O. The current GMail app does request GET_ACCOUNTS permission, which in the dynamic permission system is grouped into the Contacts permission. Have you granted Contacts permission to the GMail app?
Yes, I have also modified this file to get additional debug info and I can confirm that microG return 1 account and my e-mail match. The problem happens later and I don't know where.
The exception with hasFeatures
is probably the culprit. GMail uses hasFeatures
to find out if the account has the service_mail
feature = is a mail account (as you can also have Google accounts without mail account and those naturally do not show up in GMail). If hasFeatures is throwing an exception, it likely won't work. Unfortunately, hasFeatures
access is managed by the operating system before Oreo, so we can't allow the GMail app to access it.
Can you check that the GET_ACCOUNTS permission is indeed granted to the GMail app via adb?
From dumpsys package com.google.android.gm
:
com.google.android.gm.permission.READ_GMAIL: granted=true
com.google.android.gm.permission.WRITE_GMAIL: granted=true
android.permission.USE_CREDENTIALS: granted=true
android.permission.MANAGE_ACCOUNTS: granted=true
android.permission.AUTHENTICATE_ACCOUNTS: granted=true
com.google.android.googleapps.permission.GOOGLE_AUTH.mail: granted=true
android.permission.WRITE_CONTACTS: granted=true
android.permission.READ_CONTACTS: granted=true
From cmd appops get com.google.android.gm
:
READ_CONTACTS: allow; time=+4d1h42m24s887ms ago
The android.permission.GET_ACCOUNTS
permission doesn't appears at all, I also doesn't see it inside pm list permissions
but instead there is: android.permission.GET_ACCOUNTS_PRIVILEGED
Can you check if the AndroidManifest has a correspondig uses-permission? Maybe the GMail app does not request the GET_ACCOUNTS permission and relies on having the same signature as gms (which according to the docs I cited above is also possible instead of having the GET_ACCOUNTS permission)
Yes and no:
<uses-permission
android:name="android.permission.GET_ACCOUNTS"
android:maxSdkVersion="22"/>
Apparently it is only requested on old ROMs.
I was able to make it working with this version: https://www.apkmirror.com/apk/google-inc/gmail/gmail-2020-05-31-316831277-release-release/gmail-2020-05-31-316831277-release-3-android-apk-download/ (it doesn't have maxSdkVersion).
But I think we should still keep the ticket open to find better solutions.
EDIT: On Nougat if I remember correctly system apis aren't properly locked down and maybe can be accessed with reflection; so I don't know if there is something that can be done but someone with a better knowledge of Android internal maybe can help.
I have been facing this problem since last year. The application of Gmail + microg on Android Nougat. The application will not work...the only way to use Gmail is through the browser :(
Affected app Name: Gmail Package id: com.google.android.gm
Describe the bug Gmail doesn't see accounts (at least on Nougat). I have verified that microG correctly return the account and the sync adapter included in Gmail even display the notification of new e-mails but in the interface of Gmail there are no accounts.
Suspicious messages:
To Reproduce Steps to reproduce the behavior:
System Android Version: 7.1.2 Custom ROM: LineageOS 14.1
microG microG Core version: Latest code of git as of 2023/09/17 microG Self-Check results: All ticked
Additional context Logcat: