Skip to content

Instantly share code, notes, and snippets.

@olivierlemoal
Last active February 23, 2026 11:18
Show Gist options
  • Select an option

  • Save olivierlemoal/a4dc5848b523736c50cb082184077191 to your computer and use it in GitHub Desktop.

Select an option

Save olivierlemoal/a4dc5848b523736c50cb082184077191 to your computer and use it in GitHub Desktop.
Fix: Third-party apps can't see Google account on LineageOS / Android 15+
# Fix: Third-party apps can't see Google account on LineageOS / Android 15+
## Context
On LineageOS (or other custom ROMs) with MindTheGapps, some third-party apps (WhatsApp, Signal, etc.) cannot see the Google account configured on the device. Typically, a "Choose an account" screen appears empty even though the account is present in system settings.
Tested on:
- LineageOS 22.2 (Android 15, SDK 35) + MindTheGapps
- Likely applicable to other custom ROMs with non-stock GApps
## Symptom
- An app asks to choose a Google account, but the list is **empty**
- The Google account is visible in Settings > Accounts
- `GET_ACCOUNTS` and `READ_CONTACTS` permissions are granted to the app
## Root cause
On Android 15, account visibility for third-party apps is managed through a `visibility` table in the system AccountManager's SQLite database:
```
/data/system_de/0/accounts_de.db
```
With MindTheGapps, only Google apps (GMS, Maps, Drive, etc.) are added to this visibility table when the account is created. Third-party apps are not listed and therefore cannot see the Google account via the `AccountManager.getAccountsByType("com.google")` API.
## Diagnosis
### 1. Check account visibility
```bash
adb shell dumpsys account | grep -A 20 "Account visibility"
```
If the app's package (e.g. `com.whatsapp`) does not appear under the Google account, this is the issue.
### 2. Inspect the database (root required)
```bash
adb root
adb shell sqlite3 /data/system_de/0/accounts_de.db 'SELECT * FROM accounts'
adb shell sqlite3 /data/system_de/0/accounts_de.db 'SELECT * FROM visibility'
```
- The `accounts` table gives you the `_id` of the Google account.
- The `visibility` table lists which packages are allowed to see each account (value `2` = `VISIBILITY_USER_MANAGED_VISIBLE`).
## Fix
### Prerequisites
- ADB connected to the device
- ADB root access enabled (Settings > System > Developer options > Root access via ADB)
### Steps
#### 1. Enable ADB root
```bash
adb root
```
#### 2. Back up the database
```bash
# Backup on device
adb shell cp /data/system_de/0/accounts_de.db /data/system_de/0/accounts_de.db.bak
# Backup on PC
adb pull /data/system_de/0/accounts_de.db ./accounts_de.db.bak
```
#### 3. Find the Google account's ID
```bash
adb shell sqlite3 /data/system_de/0/accounts_de.db \
"SELECT _id, name, type FROM accounts WHERE type='com.google'"
```
Example output:
```
7|myaccount@gmail.com|com.google
```
Note the `_id` (here `7`).
#### 4. Add visibility for the app
Replace `<ACCOUNT_ID>` with the ID from above and `<PACKAGE>` with the app's package name:
```bash
adb shell sqlite3 /data/system_de/0/accounts_de.db \
"INSERT INTO visibility (accounts_id, _package, value) VALUES (<ACCOUNT_ID>, '<PACKAGE>', 2);"
```
Common package names:
| App | Package |
|--------------|----------------------------------|
| WhatsApp | `com.whatsapp` |
| Signal | `org.thoughtcrime.securesms` |
| Telegram | `org.telegram.messenger` |
| Uber | `com.ubercab` |
#### 5. Reboot immediately
> **Important**: the reboot must be done right after the INSERT, otherwise `system_server` (which holds the DB open in memory) will overwrite the change.
```bash
adb reboot
```
#### 6. Verify
After reboot:
```bash
adb shell dumpsys account | grep -A 15 "Account visibility"
```
The app's package should now appear with value `2`. The app will now be able to see the Google account.
## Rollback
If something goes wrong, restore the backup:
```bash
adb root
adb push ./accounts_de.db.bak /data/system_de/0/accounts_de.db
adb reboot
```
## Notes
- To add visibility for **multiple apps at once**, chain the INSERTs before rebooting:
```bash
adb shell sqlite3 /data/system_de/0/accounts_de.db \
"INSERT INTO visibility (accounts_id, _package, value) VALUES (<ID>, 'com.whatsapp', 2);
INSERT INTO visibility (accounts_id, _package, value) VALUES (<ID>, 'org.telegram.messenger', 2);"
adb reboot
```
- If you have **multiple Google accounts**, repeat with each `accounts_id`.
- This issue does not occur on stock ROMs as the system GApps properly manage visibility for all apps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment