Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

ContentProvider on a customized process #115

Open
vliux opened this issue Jul 26, 2017 · 2 comments
Open

ContentProvider on a customized process #115

vliux opened this issue Jul 26, 2017 · 2 comments

Comments

@vliux
Copy link

vliux commented Jul 26, 2017

tray Version (E.g. 0.12.0)

The Provider of Tray is running at main process. In our app we'd like to have it running in a ":service" process so that the UI process is free to be terminated by Android in background.

Seems at present there is no way to customize this.

I tried to manifest merger to add android:process=":service" to the Provider in manifest. But it crashed the app due to:

net.grandcentrix.tray.core.TrayRuntimeException: Internal tray error Caused by: net.grandcentrix.tray.core.TrayRuntimeException: Internal tray error. Could not find the provider authority. Please fill an issue at https://github.com/grandcentrix/tray/issues 07-26 10:56:24.111 22418 22418 E AndroidRuntime: at net.grandcentrix.tray.provider.TrayContract.getAuthority(TrayContract.java:138) 07-26 10:56:24.111 22418 22418 E AndroidRuntime: at net.grandcentrix.tray.provider.TrayContract.generateContentUri(TrayContract.java:109) 07-26 10:56:24.111 22418 22418 E AndroidRuntime: at net.grandcentrix.tray.provider.TrayContract.generateContentUri(TrayContract.java:80) 07-26 10:56:24.111 22418 22418 E AndroidRuntime: at net.grandcentrix.tray.provider.TrayUri.(TrayUri.java:75) 07-26 10:56:24.111 22418 22418 E AndroidRuntime: at net.grandcentrix.tray.provider.ContentProviderStorage.(ContentProviderStorage.java:146)
---

This is because TrayContract.getAuthority() forces the query of providers in current process:
getPackageManager()
.queryContentProviders(context.getPackageName(), Process.myUid(), 0);

@vliux
Copy link
Author

vliux commented Jul 26, 2017

I have created a pull request for this issue. Pls check.

@OUCHUNYU
Copy link

OUCHUNYU commented Mar 5, 2018

Same issue here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants