How long in milliseconds can the main thread be blocked on Android before an ANR is triggered?
Surprisingly I can't seem to find an answer to this.
That tells me that there is no fixed amount, and it probably depends on the device, Android version, and/or runtime circumstances.
Can it simply be found by checking some global variable at runtime?
If not, then, what is the formula/algorithm that Android uses to decide what the time-out length is?
An ANR will be triggered for your app when one of the following conditions occur:
While your activity is in the foreground, your app has not responded to an input event or BroadcastReceiver (such as key press or screen touch events) within 5 seconds. While you do not have an activity in the foreground, your BroadcastReceiver hasn't finished executing within a considerable amount of time.
source : https://developer.android.com/topic/performance/vitals/anr