Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1964] Android: kitchensink opens on a blank window after being backgrounded and device sleeps.

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-07-08T09:36:34.000+0000
Affected Version/sn/a
Fix Version/sSprint 2011-22, Release 1.7.2
ComponentsAndroid
Labelsandroid, background, defect, reported-1.4.0, rplist, sleep, tbs-1.7.1
ReporterThomas Huelbert
AssigneeOpie Cyrus
Created2011-04-15T03:06:40.000+0000
Updated2013-05-10T19:53:13.000+0000

Description

pastie of logcat:
http://pastie.org/1192004">http://pastie.org/1192004

I've sen this a few times recently.
1.Launch KS (seen on a G1 running 1.6).
2.background it, let the device fall asleep for some time (more than a few minutes anyway)
3.wake device, launch app from app drawer

results: blank window with "kitchen sink" header. Pressing the back button quits the app (next launch will show the app splash)

Attachments

FileDateSize
AndroidManifest.xml2011-05-31T13:39:45.000+00003104

Comments

  1. Thomas Huelbert 2011-04-15

    Moving to 1.5.1 as per Don

  2. Don Thorp 2011-04-15

    First step is to get a reproduction sequence and determine cause. This may take more than one milestone to fix.

  3. Don Thorp 2011-04-15

    Still don't have a good reproduction sequence.

  4. Don Thorp 2011-04-15

    Duplicates

    • #3013 - Android: Leaving app in background for several hours causes next run to hang
    • #3037 - Android: Pressing Home and resuming application gives black screen
  5. Bill Dawson 2011-04-15

    Commit:

    https://github.com/appcelerator/titanium_mobile/commit/566bdf31b8916b7323fc01fd98ecfedf8b83d2a6"> https://github.com/appcelerator/titanium_mobile/commit/566bdf31b891...

  6. Bill Dawson 2011-04-15

    This is caused by Android telling the Activities to restart without finishing. Our lifecycle implementation can't currently handle that, and a much bigger ticket will be created for that. In the meantime, to get past the blank screen, we detect this and simply restart the app.

    In my testing, it actually took several hours to "fall asleep", so to speak -- i.e, to be in the background long enough for Android to tell the activities to restart the next time the user brings the application forward. In order to save testing time, you can re-create a failcase and test the fix by doing something else on the device (either emulator or handset) which leads Android to do this special "restart without finish" sequence which we were failing to handle. Namely, you can change the language of the device.

    Follow these steps to test:

    • Launch Kitchen Sink

    • After KS loads, press the device Home button to keep Kitchen Sink running in the background.

    • Go to Settings - Language and Keyboard (whatever it's called) and change the language, i.e., from English to Spanish.

    • After the language has been changed, press and hold the device's Home button to show the list of recently used apps, then select KitchenSink. In the failcase you'll get a (mostly) blank screen. After my changes, the app should simply restart.

  7. dermike 2011-04-15

    Sounds great Bill! How does the detection work?
    I'm getting a white screen most of the time, so I hope it's got nothing to do with colour. ;)

  8. Bill Dawson 2011-04-15

    Yeah, I should've said "blank". :) It's not related to colour. It simply detects that Android is asking the application's Android Activities to destroy & restart without "finishing" (isFinishing() == false).

  9. dermike 2011-04-15

    I downloaded the build from Apr 12 2011 11:18 r61371d3f and it's still not working for my project. Neither when waiting for a while or changing the language.

  10. Ben Bahrenburg 2011-04-17

    Using the latest build from April 15th and still get the issue when the app is clicked on after being in the background for a few hours. There is a notable change though. It used to have a blank screen, now it displays the splash screen and seems to hang until you press the back button. I've used KS and a simple demo app to test. It doesn't seem App related. Is it possible that it gets catch in the restart Bill mentions? It seems like it is trying to restart but getting locked somehow. Tested on a Nexus S with 2.3
  11. Eric Merriman 2011-05-03

    [INFO] Titanium SDK version: 1.7.0 (05/03/11 10:31 41a577e) Verified with Nexus S with Android OS 2.3.2, Galaxy Tab with 2.2.1, Droid with 2.2.1, and the emulator running 2.1.
  12. Thomas Huelbert 2011-05-04

    reopened issue as per Bill/Don pastie link to logcat pulled from droid1 http://pastie.org/1862127
  13. Opie Cyrus 2011-05-31

    Issue can be resolved by adding 'android:alwaysRetainTaskState="true"' to the root activity for the application in a custom AndroidManifest.xml and including that in the /platform/android directory. An example AndroidManifest.xml for KitchenSink has been included for reference.
  14. Opie Cyrus 2011-05-31

    Example AndroidManifest.xml for KitchenSink that resolves black screen
  15. Opie Cyrus 2011-05-31

    moving to sprint 22
  16. Natalie Huynh 2011-07-11

    Tested with 1.7.2.v20110706211037 on Droid 2.2.1 and Nexus one 2.2.2
  17. Jake H 2012-01-30

    I'm seeing this in my apps as well. I just downloaded Kitchen Sink and experienced the same issue. This was using SDK 1.8.0.1 and the device was a Motorola Xoom.

JSON Source