zacharee / MastodonRedirect

Deep linking proxy for Mastodon and Lemmy on Android, allowing you to launch your selected client automatically.
MIT License
134 stars 3 forks source link

Excessive battery drain and a lot of errors in the logcat #8

Closed dgudim closed 1 year ago

dgudim commented 1 year ago

After installing your app I noticed that google play services started eating 24% of battery per day. I looked in the logcat and saw A LOT of this:

Legacy cross-profile verification enabled [CONTEXT service_id=244 ]
2023-08-01 18:44:47.087 13744-13920 AppLinksAsyncVerifierV2 com.google.android.gms               I  (REDACTED) Verification result: checking for a statement with source %s, relation delegate_permission/common.handle_all_urls, and target %s --> %b.
2023-08-01 18:44:47.102 13744-13928 AppLinksAsyncVerifierV2 com.google.android.gms               I  (REDACTED) Verification result: checking for a statement with source %s, relation delegate_permission/common.handle_all_urls, and target %s --> %b.
2023-08-01 18:44:47.131 13744-16441 AppLinksAsyncVerifierV2 com.google.android.gms               I  (REDACTED) Verification result: checking for a statement with source %s, relation delegate_permission/common.handle_all_urls, and target %s --> %b.
2023-08-01 18:44:47.133 13744-13873 AppLinksAsyncVerifierV2 com.google.android.gms               I  (REDACTED) Verification result: checking for a statement with source %s, relation delegate_permission/common.handle_all_urls, and target %s --> %b.
2023-08-01 18:44:47.135 13744-23856 AppLinksAsyncVerifierV2 com.google.android.gms               I  (REDACTED) Verification result: checking for a statement with source %s, relation delegate_permission/common.handle_all_urls, and target %s --> %b.
2023-08-01 18:44:47.136 13744-23773 AppLinksHostsVerifierV2 com.google.android.gms               I  (REDACTED) Verification %s complete. Successful hosts: %s. Failed hosts: %s. Error hosts: %s.

I nuked google services for now, but unfortunately I need them for some apps

zacharee commented 1 year ago

Did you use Shizuku to enable all domains?

dgudim commented 1 year ago

No, i use this app. https://github.com/1fexd/LinkSheet Basically the setting to "Open link in app" is disabled, and I can still open mastodon links in a more convenient way I tried without LinkSheet. The issue persists

zacharee commented 1 year ago

I'll see if removing android:autoVerify="true" from the manifest maintains current functionality, since that's likely what's causing Google to try to fetch all the domains and fail because of a platform bug.

dgudim commented 1 year ago

Just updated, I think it's fixed now, thanks!

zacharee commented 1 year ago

I'll give it a few more days, and if there's still no log spam, I'll close this issue.

zacharee commented 1 year ago

Would you mind trying the version before I removed autoVerify and just waiting a few minutes? In my testing, it looks like having that tag will cause GMS to spam the logs for a few minutes, but then it'll quiet down. It may take a lot of battery initially, but it should only be a one-time thing.

zacharee commented 1 year ago

Actually, I'm not sure that will work, since the domain verification will still be unset and can cause it to try to reverify.

Unfortunately, there's an issue with removing autoVerify="true": it requires uninstalling and reinstalling the app after using Shizuku to verify domains. The two approaches (LinkSheet vs. Shizuku) are incompatible with each other. I'm not sure if the better option is to tell people to download LinkSheet or to require Shizuku/ADB/root.

zacharee commented 1 year ago

Sorry for the spam. I believe this should be resolved now. I found a new method that doesn't rely on autoVerify="true" being set, so now it should be compatible with both Shizuku and LinkSheet.