fix(android): check preference key before reading#14248
Conversation
|
@m1ga I doubt this would actually resolve that ANR because the try-catch is essentially doing the same thing. If there's no property in systemProperties, it would go to catch block anyways. Is it possible to share more details of that ANR here, or on Slack to me in DM? |
|
I've added the crashlytics stack to the first post. The last Ti place is before going into the native preferences to fetch the value. I don't know if the property doesn't exists but since it's throwing that error in the native code it might not be there and then my check would prevent it from trying to read it at all (thought it might even be quicker if not waiting for a catch exception) |
|
Looks like in your case there are some other ops going on that same property as I see a Timer runnable (seems unusual here). SharedPref ops are still I/O blocking in Titanium SDK which are often the root cause of many ANRs. For now, you can also use the |
|
oh, interesting! I thought #13944 was already helping here but that makes sense that it is blocked somewhere. |
Have an app that has an ANR that points to
getBooland a JSONException when reading the value. While I'm not 100% sure if this is the fix for that it will improve reading the properties a bit.Exception:
and
Current way
Currently Ti SDK flow is:
(source)
It tries to read it from systemProperties, that fails and then it reads it from the preferences.
With this PR
This PR will check if systemProperties has the key and if not just it will just go to the else case and not waiting for the try/catch error to happen.
Test code to read/write some properties: