apsun / RemotePreferences

A drop-in solution for inter-app access to SharedPreferences.
MIT License
138 stars 32 forks source link

Bootloop on some device #1

Closed arifhn closed 8 years ago

arifhn commented 8 years ago

I created an app with list of package that enable or disable feature. When the module get called (I hook onCreate for all Application.class) it will use RemotePreference with context from the Application. The problem occurs when com.android.systemui get loaded before my content provider start (it happen on some device) then the boot process keep waiting for the CP.

apsun commented 8 years ago

Does it throw an exception or just never return from the call?

If possible, try delaying your preference loading to a later point in the initialization process. If that isn't possible however, here are some alternatives:

  1. From the hook running in the SystemUI process, use sendBroadcast() and pass a ResultReceiver as an extra. In your app (with access to the preferences), handle the broadcast and pass the necessary data back through the ResultReceiver. This is how GravityBox does it, IIRC. Note that this is asynchronous, so you must be able to handle the callback running at an unknown point in the future (or maybe even not at all if things go wrong).
  2. Create a file on disk which is readable by the SystemUI process and writable by your app. You can try using UNIX permissions to limit write access to your app only. I'm not entirely sure how this interacts with SELinux, though. If that doesn't work, you can always store the configuration on the SD card (be warned that this is insecure, since any app with external storage write permissions can modify it).
arifhn commented 8 years ago

Hello, Its not throwing any Exception, just waiting for it and never return.

Yes, I think ContentProvider is not the proper way to store preference if we need it immediately while package is loading (including system packages). On my case, I'm still using your CP solution but ignoring all system packages so it will not try to query the CP.

For now I think we can not do anything for this issue, so I will close it. We need to think another way how to provide best configuration db for Xposed modules.

Thank you.