Project: titanium
Issue TIMOB-18464: Android: Titanium crashes if back button is hit soon enough after app launch
Based on http://developer.appcelerator.com/question/180283/always-a-crash-race-condition-with-android-back-button Summary - If you press back fast enough during app open Titanium apps will crash. Looks like the android back event that causes the app to tear down can cause the root UI element to be null when adding the first Window of the project to it. This happens on device for the bare minimum installs of Titanium project with or without Alloy. Easier to repro on Alloy as it takes a bit longer for the app to launch. TI 3.5.0.GA Mac Yosemite Samsung Galaxy S5 and Note3 (and others) 1. ti create a new android project 2. cd into root of project 3. alloy create 4. ti build -p android -T device --device-id 5. Important step: On the device (not simulator), launch app AND IMMEDIATELY start pressing back button. ** Keep closing and reopening app as fast as you can if you don't see it repro the first time in step 5 **** This happens when a Window is the default/first item created in the Activity as well Expected - App closes Actual - App crashes and closes Stack - 01-27 13:32:08.269: E/AndroidRuntime(20104): FATAL EXCEPTION: main 01-27 13:32:08.269: E/AndroidRuntime(20104): Process: com.test, PID: 20104 01-27 13:32:08.269: E/AndroidRuntime(20104): java.lang.NullPointerException 01-27 13:32:08.269: E/AndroidRuntime(20104): android.content.ComponentName.(ComponentName.java:77) 01-27 13:32:08.269: E/AndroidRuntime(20104): android.content.Intent.(Intent.java:4445) 01-27 13:32:08.269: E/AndroidRuntime(20104): ti.modules.titanium.ui.WindowProxy.handleOpen(WindowProxy.java:127) 01-27 13:32:08.269: E/AndroidRuntime(20104): org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:88) 01-27 13:32:08.269: E/AndroidRuntime(20104): ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:415) 01-27 13:32:08.269: E/AndroidRuntime(20104): android.os.Handler.dispatchMessage(Handler.java:98) 01-27 13:32:08.269: E/AndroidRuntime(20104): android.os.Looper.loop(Looper.java:146) 01-27 13:32:08.269: E/AndroidRuntime(20104): android.app.ActivityThread.main(ActivityThread.java:5678) 01-27 13:32:08.269: E/AndroidRuntime(20104): java.lang.reflect.Method.invokeNative(Native Method) 01-27 13:32:08.269: E/AndroidRuntime(20104): java.lang.reflect.Method.invoke(Method.java:515) 01-27 13:32:08.269: E/AndroidRuntime(20104): com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) 01-27 13:32:08.269: E/AndroidRuntime(20104): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 01-27 13:32:08.269: E/AndroidRuntime(20104): dalvik.system.NativeStart.main(Native Method)
Story points: 5