You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* The root issue is that `Thread.start()` could be called a 2nd time if
there was a problem getting a Handler after starting the thread.
Getting a Handler instance was used as the deturming factor if the
thread had started or not.
* When calling `Thread.start()` there is no guarantee that the thread
has started after finishing or that is may have alrady completed.
* To overcome the following 2 changes were made
1. Override `HandlerThread`'s `onLooperPrepared`
- Moving our `getLooper()` call here guarantees it will never be `null`
- Then this means we can create a new `Handler` everytime successfully
2. Added a boolean to make sure we only call `start()` once
- `threadStartCalled` is set to `true` after `start()` is called.
- This is needed as `onLooperPrepared` may not fire by the time some
other part of the OneSignal SDK calls `scheduleFlushToDiskJob`
again.
0 commit comments