Search Unity

Unity 4.3 applications freeze Android after pressed the home button

Discussion in 'Android' started by baptisteLar, Nov 14, 2013.

  1. baptisteLar

    baptisteLar

    Joined:
    Jul 26, 2012
    Posts:
    31
    Hi,

    I've just installed Unity 4.3 and even an empty projet with one empty scene cause my SGS to freeze when i press the home button to quit the application. After 30s the phone restarts...

    the most relevant log is this one :

    Code (csharp):
    1.  11-14 10:05:07.918: D/PhoneWindow(1149): couldn't save which view has focus because the focused view android.view.SurfaceView@4052b188 has no id.
    but i do not know what could cause this bug, any help would be appreciated :p


    The complete log cat is this :


    HOME BUTTON PRESSED =>

    Code (csharp):
    1. 11-14 10:05:07.734: D/InputReader(136): Input event: value=1
    2. 11-14 10:05:07.734: I/ScreenCaptureAction(136): isBackKeyPressed(), return value = false
    3. 11-14 10:05:07.738: V/WindowManager(136): isSystemKeyEventRequested() is called keyCode = 3 componentName = ComponentInfo{com.batou.ProductName/com.unity3d.player.UnityPlayerNativeActivity}
    4. 11-14 10:05:07.738: V/WindowManager(136):   in isSystemKeyEventRequested() return value is false
    5. 11-14 10:05:07.738: V/WindowManager(136): in interceptKeyBeforeDispatching() KEYCODE_HOME isSystemKeyEventRequested() is false
    6. 11-14 10:05:07.738: I/PowerManagerService(136): Ulight 3->7|0
    7. 11-14 10:05:07.738: D/LightsService(136): BUTTON : 255
    8. 11-14 10:05:07.883: D/InputReader(136): Input event: value=0
    9. 11-14 10:05:07.883: I/ScreenCaptureAction(136): isBackKeyPressed(), return value = false
    10. 11-14 10:05:07.910: I/ActivityManager(136): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.sec.android.app.twlauncher/.Launcher } from pid 136
    11. 11-14 10:05:07.918: D/PhoneWindow(1149): couldn't save which view has focus because the focused view android.view.SurfaceView@4052b188 has no id.
    12. 11-14 10:05:08.418: W/ActivityManager(136): Activity pause timeout for HistoryRecord{4082d3e0 com.batou.ProductName/com.unity3d.player.UnityPlayerNativeActivity}
    13. 11-14 10:05:08.473: I/Launcher(278): onResume(). mIsNewIntent : true
    14. 11-14 10:05:08.476: E/(278): onResume() check 0
    15. 11-14 10:05:08.476: E/(278): onResume() check 1
    16. 11-14 10:05:08.476: E/Launcher(278): setWindowOpaque()
    17. 11-14 10:05:08.512: E/(278): onResume() check 2, mRestoring : false
    18. 11-14 10:05:08.512: E/(278): onResume() check 3
    19. 11-14 10:05:08.512: E/(278): onResume() check 4
    20. 11-14 10:05:08.512: E/(278): onResume() check 5
    21. 11-14 10:05:08.512: I/Launcher(278): onResume() ended
    22. 11-14 10:05:08.590: W/ResourceType(136): Skipping entry 0x7f040004 in package table 0 because it is not complex!
    23. 11-14 10:05:08.598: W/ResourceType(136): Skipping entry 0x7f040005 in package table 0 because it is not complex!
    24. 11-14 10:05:08.609: I/ActivityManager(136): No longer want com.android.voicedialer (pid 929): hidden #16
    25. 11-14 10:05:08.613: I/Launcher(278): onWindowFocusChanged(true)
    26. 11-14 10:05:08.613: D/Launcher(278): It's image wallpaper. suggestDesiredDimensions(-1,-1)
    27. 11-14 10:05:08.613: E/Launcher(278): setWindowOpaque()
    28. 11-14 10:05:08.781: V/AudioPolicyManager(83): stopOutput() output 1, stream 3, session 3
    29. 11-14 10:05:08.781: V/AudioPolicyManager(83): getNewDevice() selected device 0
    30. 11-14 10:05:08.781: V/AudioPolicyManager(83): setOutputDevice() output 1 device 0 delayMs 0 force 0
    31. 11-14 10:05:08.781: V/AudioPolicyManager(83): setOutputDevice() setting same device 0 or null device for output 1
    32. 11-14 10:05:08.785: V/AudioPolicyManager(83): releaseOutput() 1
    33. 11-14 10:05:09.535: D/BatteryService(136): update start
    34. 11-14 10:05:09.766: W/InputManagerService(136): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@407961e0 (uid=10099 pid=1149)
    35. 11-14 10:05:10.734: W/PowerManagerService(136): Timer 0x7->0x3|0x0
    36. 11-14 10:05:10.734: I/PowerManagerService(136): Ulight 7->3|0
     
  2. Zurbarah

    Zurbarah

    Joined:
    Nov 6, 2013
    Posts:
    1
    I can confirm, have the same problem.
     
  3. ArBuZ

    ArBuZ

    Joined:
    Dec 27, 2012
    Posts:
    9
    Same problem here.
     
  4. PizzaGuy213

    PizzaGuy213

    Joined:
    Nov 23, 2010
    Posts:
    305
    Same problem here with the Galaxy S GT-I9000 with 2.3.3.

    All my other devices work fine, even the other older ones like the Sony Xperia Arc.

    Glad to read I'm not the only one, I posted a thread yesterday about the same problem: http://forum.unity3d.com/threads/21...-crash-or-reboot-when-game-runs-in-background

    The Galaxy S1 is still a huge portion of my userbase, it would be a pitty if I had to drop support for it. I guess I could rebuild all projects in a previous version of Unity, it all worked fine in 4.2, but that would be a big hassle.

    It would be awesome if someone from the Unity camp can give us some feedback; whether or not it is a bug, and whether or not we can expect a fix.
     
  5. baptisteLar

    baptisteLar

    Joined:
    Jul 26, 2012
    Posts:
    31
    Well i got to use the 4.2 version, i can't use the 4.3 as long as this bug is happening, so please Unity guys look a this thread :)
     
  6. PizzaGuy213

    PizzaGuy213

    Joined:
    Nov 23, 2010
    Posts:
    305
    Let's hope Bitter (Android Mechanic who's active on these boards) can give us a heads up. If it's a recognized bug and will be worked on in one of the future updates, that would be awesome to know.
     
  7. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    422
    Good to know because I was going to install 4.3 :). Thanks!
     
  8. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Yes - we have a bug report filed on this issue - so far the GT-I9000 is the only documented device experiencing this behavior. If anyone have any details on some other device(s) experiencing this behavior let us know - it might help us track down the issue more quickly.
     
  9. ArBuZ

    ArBuZ

    Joined:
    Dec 27, 2012
    Posts:
    9
    My device that has also this problem is Samsung Galaxy SGH-I897, firmware version 2.3.5
     
  10. PizzaGuy213

    PizzaGuy213

    Joined:
    Nov 23, 2010
    Posts:
    305
    Thanks for responding bitter. I can't report any other devices having the same problem, I did test it on about 8 other devices successfully though.
     
  11. baptisteLar

    baptisteLar

    Joined:
    Jul 26, 2012
    Posts:
    31
    Thank you Bitter, if you need more info or testing let me know, i'll be glad to help.

    FYI i use a pro version
     
  12. Ericroy

    Ericroy

    Joined:
    Oct 9, 2010
    Posts:
    11
    I don't have any video with 4.3. I have a cheap Android tablet (Uniden UTAB430 with android 4.0.4). I don't have the problem with the Home key.
    The app runs okay in the editor.
    If I convert it to Android with Unity 4.2.2f1 it works fine on my tablet.
    With Unity 4.3.0f1 I can hear the audio, but I can't see any video. I also can't see any GUI items. I have a GUI button to quit the app. It doesn't show, but if I touch it's location on the screen, the app quits. Also, when the app starts, I don't see the Unity splash screen (I'm using the free version, not pro).
    I've tried converting three different apps to Android with Unity 4.3 and I've had the same results for all of them.

    I have one app that works okay. It's a countdown timer that just uses GUI and no camera.
    The apps that show no video all use cameras.
     
    Last edited: Nov 24, 2013
  13. ruda_mb

    ruda_mb

    Joined:
    Jul 18, 2013
    Posts:
    1
    My device with the same problem is Samsung Galaxy Tab P1000, Firmware 2.3.6.
     
  14. Ericroy

    Ericroy

    Joined:
    Oct 9, 2010
    Posts:
    11
    All of my Unity 4.2 projects that functioned correctly in Android, display blank Android screens after updating to Unity 4.3.
    The updated projects seem to function correctly in Android if the 32-bit display buffer checkbox is checked before building.
    With Unity 4.2, I never needed to check the 32-bit display buffer for the apps to work correctly.
     
  15. Bero

    Bero

    Joined:
    Oct 16, 2012
    Posts:
    5
    Hi!

    I have same problem with Unity 4.3 and Samsung S GT-9000I

    I hope Unity will solve it soon.

    Thanks

    Bye
     
  16. Mikie

    Mikie

    Joined:
    Dec 27, 2011
    Posts:
    367
    Same problem with a Droid 2.
     
  17. jw-wright

    jw-wright

    Joined:
    Dec 10, 2013
    Posts:
    1
    I have ran into the same issue with Unity 4.3 using DROIDX and running 2.3.4
     
  18. MagneticStorm

    MagneticStorm

    Joined:
    Dec 10, 2013
    Posts:
    1
    Building a Unity 4.3 2d project with one scene and a single background sprite.

    My Nexus S (2.3.4) Locks up when Home is hit, unresponsive until it reboots itself or I pull the battery.

    Code (csharp):
    1. E/NativeActivity( 2906): channel '4095b280 com.MagneticStorm.MyTest/com.unity3d.player.UnityPlayerNativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
    2. D/dalvikvm( 2906): GC_CONCURRENT freed 444K, 59% free 2772K/6727K, external 1629K/2137K, paused 5ms+2ms
    3. I/ActivityManager(  110): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher } from pid 110
    4. D/PhoneWindow( 2906): couldn't save which view has focus because the focused view android.view.SurfaceView@4052cc38 has no id.
    5. I/Unity   ( 2906): onPause
    6. D/Unity   ( 2906): Sensor :        Accelerometer ( 1) ; 0.019154 / 0.02s ; KR3DM 3-axis Accelerometer / STMicroelectronics
    7. I/WindowManager(  110): Setting rotation to 0, animFlags=1
    8. I/ActivityManager(  110): Config changed: { scale=1.0 imsi=310/420 loc=en_US touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34 uiMode=17 seq=18}
    9. I/Unity   ( 2906): windowFocusChanged: false
    10. V/RenderScript_jni(  204): surfaceCreated
    11. V/RenderScript_jni(  204): surfaceChanged
    12. W/GraphicBufferAllocator(  110): free(...) failed -14 (Bad address)
    13. W/WindowManager(  110): Window freeze timeout expired.
    14. W/WindowManager(  110): Force clearing orientation change: Window{406bf6a0 StatusBarExpanded paused=false}
    15. D/AudioHardware(   76): AudioHardware pcm playback is going to standby.
    16. D/AudioHardware(   76): closePcmOut_l() mPcmOpenCnt: 1
    17. D/dalvikvm(  110): GC_EXPLICIT freed 952K, 59% free 6610K/16071K, external 4256K/5315K, paused 99ms

    My Kindle Fire (1st gen), when Home is hit, goes back to Carousel but hangs for 6 to 10 seconds before touch input is accepted.

    Code (csharp):
    1. E/NativeActivity(21638): channel '4073d298 com.MagneticStorm.MyTest/com.unity3d.player.UnityPlayerNativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
    2. D/LAB126  ( 1458): expand softkeys
    3. D/LAB126  ( 1458): collapse softkeys
    4. D/ActivityManager( 1389): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.amazon.kindle.otter/.Launcher } from pid 1389
    5. D/PhoneWindow(21638): couldn't save which view has focus because the focused view android.view.SurfaceView@4052c238 has no id.
    6. W/ActivityManager( 1389): Activity pause timeout for HistoryRecord{40accc68 com.MagneticStorm.MyTest/com.unity3d.player.UnityPlayerNativeActivity}
    7. W/ActivityManager( 1389): Unable to start service Intent { act=appStartup }: not found
    8. I/LAB126  ( 1458): StatusBarService hears intent. action: com.lab126.intent.TOP_WINDOW_CHANGED
    9. I/LAB126  ( 1458):  window changed
    10. I/Unity   (21638): onPause
    11. D/Unity   (21638): Sensor :        Accelerometer ( 1) ; 0.153281 / 0.00s ; BMA250 3-axis Accelerometer / Bosch
    12. D/dalvikvm( 1389): GC_CONCURRENT freed 1944K, 63% free 6794K/18311K, external 9428K/11262K, paused 3ms+9ms
    13. I/Unity   (21638): windowFocusChanged: false
    14. W/InputManagerService( 1389): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@40b60410 (uid=10032 pid=21638)
    15. E/Omap4ALSA( 1293): called drain&close
    16. W/GraphicBufferAllocator( 1389): free(...) failed -14 (Bad address)
    17. D/dalvikvm( 1389): GC_CONCURRENT freed 2033K, 63% free 6809K/18311K, external 9428K/11262K, paused 3ms+5ms

    Also noticed when launching the test app on both devices I get 10 seconds of black screen, then Unity splash screen pops up for less than a second.
     
  19. Hubert Cater

    Hubert Cater

    Joined:
    Dec 2, 2013
    Posts:
    1
    I'm having the same issue with my Samsung Galaxy Ace II x.

    One other oddity in case it is related to the "pause" issue seems to be with how my application handles the following, assuming the Unity app is "paused" once these calls are made:

    Application.OpenURL("mailto:" + emailAddress + "?subject=" + subject + "&body=" + body);

    and

    Application.OpenURL("sms:" + mobileNumber + "?body=" + body);

    With the first option, once the user hits send for their email the user is immediately returned to the Unity app.

    However, with the SMS option, I'm required to use the "back" button on the mobile device.

    I'm new to Unity and 4.3 so I'm not sure if this is normal but I was expecting the SMS option to behave the same way but it does not.
     
    Last edited: Dec 12, 2013
  20. PaulGregory

    PaulGregory

    Joined:
    Sep 22, 2013
    Posts:
    4
    (Hubert, mailto: and sms: are handled by the mail app and the SMS app. Them acting differently are just down to Android being inconsistent. Don't worry about that.)

    I experience the chief issue - Android locking up when you try to leave the app - on a Motorola Defy running Android 2.3.4.

    Specifically:
    1) Application.OpenURL (for both call: and weblinks) freezes the phone with a white box is zooming partially filling the screen (as if it is zooming up but got stuck)
    2) Pressing the 'home' button goes back to the homescreen but all input is dead and the clock display is frozen.

    The phone still sends stuff out through logcat however. Here's some output for pressing the home button. The 'PhoneWindow: couldn't save which view has focus' line happens after the OpenURL too.

    Code (csharp):
    1. 12-18 09:24:39.247  1644  1675 I ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.motorola.blur.home/.HomeActivity } from pid 1644
    2. 12-18 09:24:39.348  2686  2686 D PhoneWindow: couldn't save which view has focus because the focused view android.view.SurfaceView@405045d0 has no id.
    3. 12-18 09:24:39.856  1644  1655 W ActivityManager: Activity pause timeout for HistoryRecord{408b4ee0 com.[redacted]/com.unity3d.player.UnityPlayerProxyActivity}
    4. 12-18 09:24:39.919  2686  2686 I Unity   : onPause
    5. 12-18 09:24:40.286  2686  2698 D Unity   : Sensor :        Accelerometer ( 1) ; 0.009810 / 0.00s ; KXTF9 3-axis Accelerometer / Kionix
    6. 12-18 09:24:40.434  1644  1752 I ActivityManager: No longer want com.android.bluetooth (pid 2258): hidden #21
    7. 12-18 09:24:40.458  2686  2686 I Unity   : windowFocusChanged: false
    8. 12-18 09:24:40.474  1644  1650 W InputManagerService: Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@40918350 (uid=10100 pid=2686)
    9. 12-18 09:24:40.514  1492  1635 D AudioHardwareMot: AudioStreamOutMot::setParameters() fm_attenuate=0;fm_mute=0
    10. 12-18 09:24:40.544  1644  1673 I ActivityManager: Resumed Activity: com.[redacted]/com.unity3d.player.UnityPlayerProxyActivity totalTime: 1205 ms
    11. 12-18 09:24:41.059  1644  1651 W GraphicBufferAllocator: free(...) failed -14 (Bad address)
    12. 12-18 09:24:43.325  1492  1635 D AudioHardwareMot: AudioStreamOutMot::standby called
    13. 12-18 09:24:43.325  1492  1635 D AudioHardwareMot: Output 0x13d48 entering standby
    14. 12-18 09:24:43.325  1492  1635 D AudioHardwareMot: Closing Output device
    15. 12-18 09:24:45.630  2686  2686 D dalvikvm: GC_EXPLICIT freed 289K, 58% free 2958K/6919K, external 2359K/2773K, paused 65ms
    16. 12-18 09:24:55.067  1644  1805 I ActivityManager: Starting: Intent { act=com.motorola.blur.apps.ACTION_APPS flg=0x10200000 cmp=com.motorola.blur.home/com.motorola.blur.apps.AppsActivity (has extras) } from pid 1815
    17. 12-18 09:24:55.583  1644  1655 W ActivityManager: Activity pause timeout for HistoryRecord{40597688 com.motorola.blur.home/.HomeActivity}
    18. 12-18 09:25:00.106  1644  1673 W SurfaceFlinger: closeGlobalTransaction timed out!
    19. 12-18 09:25:01.208  1815  1815 W SharedBufferStack: waitForCondition(LockCondition) timed out (identity=14, status=0). CPU may be pegged. trying again.
    20. 12-18 09:25:02.208  1815  1815 W SharedBufferStack: waitForCondition(LockCondition) timed out (identity=14, status=0). CPU may be pegged. trying again.
    21. 12-18 09:25:03.211  1815  1815 W SharedBufferStack: waitForCondition(LockCondition) timed out (identity=14, status=0). CPU may be pegged. trying again.
    22. 12-18 09:25:04.211  1815  1815 W SharedBufferStack: waitForCondition(LockCondition) timed out (identity=14, status=0). CPU may be pegged. trying again.
    23. 12-18 09:25:05.083  1644  1655 W ActivityManager: Launch timeout has expired, giving up wake lock!
    24. 12-18 09:25:05.208  1815  1815 W SharedBufferStack: waitForCondition(LockCondition) timed out (identity=14, status=0). CPU may be pegged. trying again.
    25. 12-18 09:25:06.212  1815  1815 W SharedBufferStack: waitForCondition(LockCondition) timed out (identity=14, status=0). CPU may be pegged. trying again.
    26. 12-18 09:25:06.372  1644  1675 I InputDispatcher: Application is not responding: AppWindowToken{40b2ee70 token=HistoryRecord{4078f900 com.motorola.blur.home/com.motorola.blur.apps.AppsActivity}}.  10007.0ms since event, 10006.8ms since wait started
    27. 12-18 09:25:06.372  1644  1675 I WindowManager: Input event dispatching timed out sending to application AppWindowToken{40b2ee70 token=HistoryRecord{4078f900 com.motorola.blur.home/com.motorola.blur.apps.AppsActivity}}
    28. 12-18 09:25:06.427  1644  1675 I Process : Sending signal. PID: 1815 SIG: 3
    29. 12-18 09:25:06.427  1815  1827 I dalvikvm: threadid=4: reacting to signal 3
    30. 12-18 09:25:06.513  1815  1827 I dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
    31. 12-18 09:25:06.513  1644  1675 I Process : Sending signal. PID: 1644 SIG: 3
    32. 12-18 09:25:06.520  1644  1647 I dalvikvm: threadid=4: reacting to signal 3
    33. 12-18 09:25:06.708  1644  1647 I dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
    34. 12-18 09:25:06.708  1644  1675 I Process : Sending signal. PID: 1753 SIG: 3
    35. 12-18 09:25:06.708  1753  1767 I dalvikvm: threadid=4: reacting to signal 3
    36. 12-18 09:25:06.762  1753  1767 I dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
    37. 12-18 09:25:06.762  1644  1675 I Process : Sending signal. PID: 1763 SIG: 3
    38. 12-18 09:25:06.762  1763  1793 I dalvikvm: threadid=4: reacting to signal 3
    39. 12-18 09:25:06.786  1763  1793 I dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
    40. 12-18 09:25:06.786  1644  1675 I Process : Sending signal. PID: 1811 SIG: 3
    41. 12-18 09:25:06.786  1811  1817 I dalvikvm: threadid=4: reacting to signal 3
    42. 12-18 09:25:06.794  1811  1817 I dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
    43. 12-18 09:25:06.794  1644  1675 I Process : Sending signal. PID: 1760 SIG: 3
    44. 12-18 09:25:06.802  1760  1786 I dalvikvm: threadid=4: reacting to signal 3
    45. 12-18 09:25:06.833  1760  1786 I dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
    46. 12-18 09:25:06.833  1644  1675 I Process : Sending signal. PID: 1754 SIG: 3
    47. 12-18 09:25:06.833  1754  1771 I dalvikvm: threadid=4: reacting to signal 3
    48. 12-18 09:25:06.856  1754  1771 I dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
    49. 12-18 09:25:06.856  1644  1675 I Process : Sending signal. PID: 1757 SIG: 3
    50. 12-18 09:25:06.864  1757  1779 I dalvikvm: threadid=4: reacting to signal 3
    51. 12-18 09:25:06.872  1757  1779 I dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
    52. 12-18 09:25:06.872  1644  1675 I Process : Sending signal. PID: 1820 SIG: 3
    53. 12-18 09:25:06.872  1820  1830 I dalvikvm: threadid=4: reacting to signal 3
    54. 12-18 09:25:06.888  1820  1830 I dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
    55. 12-18 09:25:06.888  1644  1675 I Process : Sending signal. PID: 1769 SIG: 3
    56. 12-18 09:25:06.888  1769  1794 I dalvikvm: threadid=4: reacting to signal 3
    57. 12-18 09:25:06.895  1769  1794 I dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
    58. 12-18 09:25:06.895  1644  1675 I Process : Sending signal. PID: 1812 SIG: 3
    59. 12-18 09:25:06.895  1812  1823 I dalvikvm: threadid=4: reacting to signal 3
    60. 12-18 09:25:06.895  1812  1823 I dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
    61. 12-18 09:25:06.895  1644  1675 I Process : Sending signal. PID: 1725 SIG: 3
    62. 12-18 09:25:06.895  1725  1734 I dalvikvm: threadid=4: reacting to signal 3
    63. 12-18 09:25:06.895  1725  1734 I dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
    64. 12-18 09:25:07.161  1644  1675 D dalvikvm: GC_EXPLICIT freed 1123K, 33% free 8143K/12103K, external 3967K/4954K, paused 80ms
    65. 12-18 09:25:07.213  1815  1815 W SharedBufferStack: waitForCondition(LockCondition) timed out (identity=14, status=0). CPU may be pegged. trying again.
    66. 12-18 09:25:07.755  1644  1675 E ActivityManager: ANR in com.motorola.blur.home, pid 1815 (com.motorola.blur.home/com.motorola.blur.apps.AppsActivity)
    67. 12-18 09:25:07.755  1644  1675 E ActivityManager: Reason: keyDispatchingTimedOut
    68. 12-18 09:25:07.755  1644  1675 E ActivityManager: Load: 0.99 / 1.3 / 0.82
    69. 12-18 09:25:07.755  1644  1675 E ActivityManager: CPU usage from 6289ms to 1180ms ago:
    70. 12-18 09:25:07.755  1644  1675 E ActivityManager:   2.7% 1644/system_server: 0.9% user + 1.7% kernel / faults: 39 minor
    71. 12-18 09:25:07.755  1644  1675 E ActivityManager:     1.3% 1659/ActivityManager: 0.3% user + 0.9% kernel
    72. 12-18 09:25:07.755  1644  1675 E ActivityManager:     0.7% 1676/InputReader: 0.1% user + 0.5% kernel
    73. 12-18 09:25:07.755  1644  1675 E ActivityManager:     0.5% 1655/er.ServerThread: 0.3% user + 0.1% kernel
    74. 12-18 09:25:07.755  1644  1675 E ActivityManager:     0.1% 1673/WindowManager: 0.1% user + 0% kernel
    75. 12-18 09:25:07.755  1644  1675 E ActivityManager:     0.1% 1713/er$SensorThread: 0.1% user + 0% kernel
    76. 12-18 09:25:07.755  1644  1675 E ActivityManager:   0.3% 219/omap2_mcspi: 0% user + 0.3% kernel
    77. 12-18 09:25:07.755  1644  1675 E ActivityManager:   0% 672/mmcqd: 0% user + 0% kernel
    78. 12-18 09:25:07.755  1644  1675 E ActivityManager:   0% 1725/com.android.systemui: 0% user + 0% kernel / faults: 72 minor
    79. 12-18 09:25:07.755  1644  1675 E ActivityManager:     0% 1725/ndroid.systemui: 0% user + 0% kernel
    80. 12-18 09:25:07.755  1644  1675 E ActivityManager: 4% TOTAL: 1.3% user + 1.9% kernel + 0.3% iowait + 0.3% irq
    81. 12-18 09:25:07.755  1644  1675 E ActivityManager: CPU usage from 798ms to 1313ms later:
    82. 12-18 09:25:07.755  1644  1675 E ActivityManager:   3.7% 1644/system_server: 3.7% user + 0% kernel
    83. 12-18 09:25:07.755  1644  1675 E ActivityManager:     5.6% 1675/InputDispatcher: 0% user + 5.6% kernel
    84. 12-18 09:25:07.755  1644  1675 E ActivityManager:   1.2% 219/omap2_mcspi: 0% user + 1.2% kernel
    85. 12-18 09:25:07.755  1644  1675 E ActivityManager: 3.9% TOTAL: 0% user + 3.9% kernel
    86. 12-18 09:25:07.880  1644  2724 D dalvikvm: GC_FOR_MALLOC freed 179K, 31% free 8605K/12423K, external 3967K/4954K, paused 79ms
    87. 12-18 09:25:07.880  1644  1675 I InputDispatcher: Dropping event because the pointer is not down.
    88. 12-18 09:25:07.888  1644  1675 I InputDispatcher: Dropping event because the pointer is not down.
    89. 12-18 09:25:08.208  1815  1815 W SharedBufferStack: waitForCondition(LockCondition) timed out (identity=14, status=0). CPU may be pegged. trying again.
    90. 12-18 09:25:09.214  1815  1815 W SharedBufferStack: waitForCondition(LockCondition) timed out (identity=14, status=0). CPU may be pegged. trying again.
    Those last few lines repeat themselves over and over, along with
    Code (csharp):
    1.  
    2. 12-18 09:33:22.489  1644  1675 I InputDispatcher: Application is not responding: Window{4072c440 Sorry! paused=false}.  21841.8ms since event, 5006.2ms since wait started
    3. 12-18 09:33:22.489  1644  1675 I InputDispatcher: Dropping event because the pointer is not down.
    4. 12-18 09:33:22.489  1644  1675 I InputDispatcher: Dropping event because the pointer is not down.
    5. 12-18 09:33:22.489  1644  1675 I WindowManager: Input event dispatching timed out sending to Sorry!
    The same app builds to Android 4.x without problems, and I have previously built versions of this app under Unity 4.2 that worked OK on the Motorola Defy running 2.3.4.

    I think Android is being a bit stupid failing to recover, but obviously it is Unity 4.3 that is triggering the madness in the first place.

    @Bitter - do you mean for us to respond here or on issuetracker? Can you please link to the issue on issuetracker that you feel matches what this thread talks about.
    This one: http://issuetracker.unity3d.com/issues/application-crashes-when-calling-android-native-method
    says 'Fixed' and gives a version of '4.3.0f4'.

    I've just updated to Unity 4.3.2 and there is no improvement (admittedly there's nothing in the release notes to suggest there should be).
     
  21. codehead

    codehead

    Joined:
    Oct 21, 2012
    Posts:
    3
    Yesterday I was testing our app built with Unity 4.3.1 with Samsung Galaxy S GT-I9000, Android 2.3.3, and whenever Unity went pausing, the system froze.

    Based on what I've seen by try-catching and dumping out stack traces, thread dumps etc, UnityPlayer.pause() and UnityPlayer.quit() (which also invokes pause()) seems to be doing stuff with locks and waits and surface managers etc. Something seems to be going wrong with unregistering surface handlers or removing surface views etc.

    I started to hack around whatever possible and tried doing all this stuff in another thread and just see where it goes from there. Even app crash would be better than OS freezing :)

    Eventually, I came up with this vulgar piece of code which yet seems to be doing what I wanted it to: pause, resume and quit without freezing... AT LEAST on Samsung Galaxy S (GT-I9000) :D

    You need to:
    * override the default UnityPlayerNativeActivity
    * override the default UnityPlayer

    Instead of creating the default instance of UnityPlayer in Activity.onCreate(), do:
    Code (csharp):
    1.     if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
    2.         this.mUnityPlayer = new GingerbreadHackUnityPlayer(this);
    3.     } else {
    4.         this.mUnityPlayer = new UnityPlayer(this);
    5.     }
    The order of things seems important. Don't call Activity.finish() to quit an app but rather UnityPlayer.quit() and then let it eventually call Activity.finish().
    So then the Activity onDestroy() is simply:
    Code (csharp):
    1.     @Override
    2.     public void onDestroy() {
    3.         this.logger.fine("onDestroy()");
    4.         // If Gingerbread hack is not in use, do it the usual way
    5.         if (!(this.mUnityPlayer instanceof GingerbreadHackUnityPlayer)) {
    6.             this.mUnityPlayer.quit();
    7.         }
    8.         super.onDestroy();
    9.     }
    Also as a downside of this horrendeus hack, OnApplicationQuit() won't get fired so better take care of it yourself before quitting.

    And remember... Software development is voodoo magic, not an exact science:

    Code (csharp):
    1. package fi.onedigit.mortimer.activity;
    2.  
    3. import java.util.concurrent.Callable;
    4. import java.util.concurrent.Executors;
    5. import java.util.concurrent.ScheduledExecutorService;
    6. import java.util.concurrent.ScheduledFuture;
    7. import java.util.concurrent.TimeUnit;
    8. import java.util.logging.Logger;
    9.  
    10. import android.content.ContextWrapper;
    11.  
    12. import com.unity3d.player.UnityPlayer;
    13.  
    14. /**
    15.  * Cover your eyes... NAO !!!
    16.  *
    17.  * @see [url]http://forum.unity3d.com/threads/210864-Unity-4-3-applications-freeze-Android-after-pressed-the-home-button[/url]
    18.  * @author Samuli Piela / One Digit Ltd
    19.  */
    20. public class GingerbreadHackUnityPlayer extends UnityPlayer {
    21.     private final Logger logger = Logger.getLogger(this.getClass().getName());
    22.     private final int delay = 2;
    23.     // One for each just in case :)
    24.     private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(3);
    25.     private ScheduledFuture<Void> delayedPause = null;
    26.  
    27.     public GingerbreadHackUnityPlayer(final ContextWrapper arg0) {
    28.         super(arg0);
    29.     }
    30.  
    31.     private void cancelPause() {
    32.         if (this.delayedPause != null  !this.delayedPause.isDone()) {
    33.             this.logger.fine("cancelPause()");
    34.             this.delayedPause.cancel(true);
    35.         }
    36.     }
    37.  
    38.     @Override
    39.     public void resume() {
    40.         this.logger.fine("resume() called.");
    41.         this.cancelPause();
    42.         super.resume();
    43.     }
    44.  
    45.     @Override
    46.     public void pause() {
    47.         this.logger.fine("pause() called. delaying ...");
    48.         this.cancelPause();
    49.         this.delayedPause = this.scheduler.schedule(new Callable<Void>() {
    50.  
    51.             @Override
    52.             public Void call() throws Exception {
    53.                 Thread.currentThread().setName("Pauser");
    54.                 final Logger log = GingerbreadHackUnityPlayer.this.logger;
    55.                 log.fine("super.pause()");
    56.                 try {
    57.                     GingerbreadHackUnityPlayer.super.pause();
    58.                 } catch (Throwable t) {
    59.                     log.fine("super.pause() threw: " + t.toString());
    60.                 } finally {
    61.                     log.fine("super.pause() done.");
    62.                 }
    63.                 return null;
    64.             }
    65.  
    66.         }, this.delay, TimeUnit.SECONDS);
    67.     }
    68.  
    69.     @Override
    70.     public void quit() {
    71.         this.logger.fine("quit()");
    72.  
    73.         final Logger log = GingerbreadHackUnityPlayer.this.logger;
    74.         // Pause now so that once quit gets to run, it's paused. (quit() invokes pause() anyway)
    75.         this.pause();
    76.  
    77.         this.scheduler.schedule(new Callable<Void>() {
    78.             @Override
    79.             public Void call() throws Exception {
    80.                 try {
    81.                     log.fine("super.quit()");
    82.                     GingerbreadHackUnityPlayer.super.quit();
    83.                 } catch (Throwable t) {
    84.                     log.fine("super.quit() threw: " + t.toString());
    85.                 } finally {
    86.                     log.fine("super.quit() done.");
    87.                 }
    88.                 return null;
    89.             }
    90.         }, this.delay + 1, TimeUnit.SECONDS);
    91.  
    92.         this.scheduler.schedule(new Callable<Void>() {
    93.             @Override
    94.             public Void call() throws Exception {
    95.                 Thread.currentThread().setName("Hitman");
    96.                 final Logger log = GingerbreadHackUnityPlayer.this.logger;
    97.                 final Thread[] t = new Thread[50];
    98.                 final int tc = Thread.currentThread().getThreadGroup().enumerate(t);
    99.                 for (int i = 0; i < tc; i++) {
    100.                     log.fine("[" + t[i].getState() + "] " + t[i].getName());
    101.                     for (final StackTraceElement ste : t[i].getStackTrace()) {
    102.                         log.fine("\t" + ste.toString());
    103.                     }
    104.                 }
    105.                 log.fine("Time to finish()");
    106.                 GingerbreadHackUnityPlayer.currentActivity.finish();
    107.                 // Let it finish..
    108.                 Thread.sleep(2000);
    109.                 log.fine("Time to kill is now.");
    110.                 GingerbreadHackUnityPlayer.super.kill();
    111.                 return null;
    112.             }
    113.         }, this.delay + 2, TimeUnit.SECONDS);
    114.  
    115.     }
    116. }
     
    Last edited: Dec 20, 2013
    lchoi likes this.
  22. baptisteLar

    baptisteLar

    Joined:
    Jul 26, 2012
    Posts:
    31
    Any news about a future release with this bug corrected ?
     
  23. RobertLeonardOlogu

    RobertLeonardOlogu

    Joined:
    Nov 6, 2013
    Posts:
    1
    T869 Galaxy Tab 7.0 Plus, firmware 2.3.3
    Galaxy S GT-I9000, firmware 2.3.4
     
  24. anbaksai

    anbaksai

    Joined:
    Aug 2, 2013
    Posts:
    13
    Hello, codehead.

    I`m also having this problem. I tried updating to the latest Unity version (4.3.3) but it doesn't seem to have fixed this bug. I can't believe the haven't fixed it yet, being such a huge bug.

    I tried using your hack on my Samsung Galaxy Tab GT-P1000L running Gingerbread 2.3.3 and it seems to have worked when pausing the game. but now the tablet hangs when quitting. The log shows this error that repeats endlessly:

    Code (csharp):
    1. E/SensorService(137): dropping 1 events on the floor (Broken pipe)
    Any idea what could this be?

    Regards.
     
  25. MajidKhosravi

    MajidKhosravi

    Joined:
    Jun 21, 2013
    Posts:
    39
    I got same problem too, our app got refused on Samsung store due this issue.
     
  26. Tinnes

    Tinnes

    Joined:
    Jul 15, 2012
    Posts:
    7
    Same here, crashes on exit everytime. Using a Motorola Milestone 2 (MotoA953), running Gingerbread (2.3.4) with Unity 4.3.3f1.

    Any word from the Unity folks on if they're even looking into this issue? It's really very annoying and time consuming to pull the battery and reboot the phone every time you exit. Happy to provide any additional information if it will help.

    Not tried the hack posted above yet, but will soon.

    Thanks.
     
  27. codehead

    codehead

    Joined:
    Oct 21, 2012
    Posts:
    3
    Likewise confirming that 4.3.3f1 has not fixed this issue. My hack still seems work and we're in production with it. Feel free to get in touch if you need assistance with integrating it!
     
  28. N-i-x

    N-i-x

    Joined:
    Jan 27, 2014
    Posts:
    5
  29. CORPSEGRINDER

    CORPSEGRINDER

    Joined:
    Feb 6, 2014
    Posts:
    6
    Confirmed not fixed with 4.3.4, also application crashes when you press home and click the launcher icon to continue activity.

    Ex. Someone calls you and you click the launcher icon again to resume activity.
    This showed on my logcat:
     
  30. Groucho

    Groucho

    Joined:
    Dec 24, 2009
    Posts:
    73
    I'm still using Unity 4.3.1, but I have this same issue with my Samsung Galaxy Player 5.0.
     
  31. chrisall76

    chrisall76

    Joined:
    May 19, 2012
    Posts:
    667
    Same was happening on my Samsung G Epic, no clue the error though. I temporary fixed it with:


    Code (csharp):
    1.    
    2. void OnApplicationPause(bool pausestatus) {
    3.     if(Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer){
    4.             Application.Quit();
    5.     }
    6. }
    7.  
     
    Last edited: Feb 9, 2014
  32. Groucho

    Groucho

    Joined:
    Dec 24, 2009
    Posts:
    73
    That looks like it'll work, but I'd rather not use that big of a hammer. Can anyone at Unity give an update on this?

    Thanks,
     
  33. Groucho

    Groucho

    Joined:
    Dec 24, 2009
    Posts:
    73
    After looking at your code again, why did you include iPhone in that? Also, why tell the application to quit for every call of that method?

    This is what I did and it seems to work (although I still hate to do this)...
    Code (csharp):
    1.  
    2. #if UNITY_ANDROID
    3.     //this is a serious hack because the game hangs when the home button is pressed on some devices in Android.
    4.     void OnApplicationPause(bool pausestatus) {
    5.         if(Application.platform == RuntimePlatform.Android  pausestatus){ //pausestatus == true for a paused game
    6.             Application.Quit();
    7.         }
    8.     }
    9. #endif
    10.  
     
  34. BenoitFreslon

    BenoitFreslon

    Joined:
    Jan 16, 2013
    Posts:
    164
    Great hack Thanks.

    By the way when an Ad is showing up like Chartboost the Application quits :(.
     
  35. LiteralZero

    LiteralZero

    Joined:
    Feb 10, 2014
    Posts:
    13
    Hey,

    Could you post a bug report for me please?

    -Mark
     
  36. BenoitFreslon

    BenoitFreslon

    Joined:
    Jan 16, 2013
    Posts:
    164
    I added this script in the Update method in order to kill the application when you press a menu button on Android:

    Code (csharp):
    1.         if (Application.platform == RuntimePlatform.Android) {
    2.             if (Input.GetKey (KeyCode.Home) || Input.GetKey (KeyCode.Escape) || Input.GetKey (KeyCode.Menu)) {
    3.                 Application.Quit ();
    4.                 return;
    5.             }
    6.         }
     
  37. Groucho

    Groucho

    Joined:
    Dec 24, 2009
    Posts:
    73
    This looks like a better way to do it. Still, doing this causes some devices to pop up a "this app unexpectedly quit" dialog. That's really nasty.

    Has anyone figured out if this is limited to certain OSs?
     
  38. polako77

    polako77

    Joined:
    Apr 30, 2013
    Posts:
    1
    The same happens to me with 4.3.4, damn!
     
  39. NioFox

    NioFox

    Joined:
    Dec 28, 2012
    Posts:
    65
    Same problem:
    - Unity 4.3.4f1
    - Samsung Galaxy Tab GT-P1000
    - Firmware 2.3.6
    Worked fine before Unity 4

    @N.i.x Can't vote on a closed issue :(
     
    Last edited: Feb 16, 2014
  40. Rapskalian

    Rapskalian

    Joined:
    Jan 4, 2011
    Posts:
    45
    I have the same problem on two different Gingerbread Android phones.
     
  41. peakto

    peakto

    Joined:
    Jun 2, 2013
    Posts:
    6
    My game integrated admob InterstitialAd ads(full scree ads),and on my test android device, when the admob InterstitialAd ads page showed,i click the close button in the ads page,and then the admob ads page is closed ,but my game screen is freezed, but the audio of game is still playing well,and when i touch the game screen,i can listen the sound of my game button being clicked, and the logcat shows as following:

    01-13 10:35:45.057: E/Adreno200-EGLSUB(1482): SwapBuffers() dequeue native buffer fail: No such device
    01-13 10:35:45.057: E/Adreno200-EGLSUB(1482): GetSurfaceSize() dequeue native buffer failed: No such device.
    01-13 10:35:45.067: E/SurfaceTextureClient(1482): queueBuffer: error queuing buffer to SurfaceTexture, -19
    01-13 10:35:45.067: E/Adreno200-EGLSUB(1482): GetSurfaceSize() dequeue native buffer failed: No such device.
    01-13 10:35:45.067: E/Adreno200-EGL(1482): <eglSurfaceResize:4014>: EGL_BAD_ALLOC
    01-13 10:35:45.077: E/Adreno200-EGLSUB(1482): GetSurfaceSize() dequeue native buffer failed: No such device.
    01-13 10:35:45.077: E/Adreno200-EGLSUB(1482): GetBackBuffer() dequeue native buffer failed: No such device
    01-13 10:35:45.077: E/Adreno200-EGLSUB(1482): GetSurfaceSize() dequeue native buffer failed: No such device.
    01-13 10:35:45.077: E/Adreno200-EGL(1482): <eglSurfaceResize:4014>: EGL_BAD_ALLOC

    admob InterstitialAd ads is a full screen ads,so i guess when the full screen ads page shows,the unity3d activity is stoped , and when the ads page is closed,the unity3d activity is resumed,but the screen surface is losted.

    i export the android project with the android sdk 17,that is :

    <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17" />

    my unity3d version is 4.3.2

    can anyone tells what the problem is! Thanks a lot.
     
  42. peakto

    peakto

    Joined:
    Jun 2, 2013
    Posts:
    6


    i export the same project with unity3d 4.3.4, the freeze problem is still there, but the logcat shows different from the unity3d 4.3.2:

    W/SurfaceTexture( 95): [SurfaceView] cancelBuffer: SurfaceTexture has been abandoned!
     
  43. Tinnes

    Tinnes

    Joined:
    Jul 15, 2012
    Posts:
    7
    Not sure why the issue has been closed when it's still present in the latest release (4.3.4). Are there nightly builds somewhere we can access?
     
  44. ConjureScape

    ConjureScape

    Joined:
    Feb 14, 2013
    Posts:
    445
    Happens to me as well. Samsung Galaxy S1 (Unity 4.3.4). If I implement the fix suggested earlier the binary gets rejected by Amazon. They reckon that if the home button is pressed, the game should Pause, not quit. Does this mean that since November last year the entire Unity community could not publish to Android? Certainly this bug must get a higher priority?
     
  45. baptisteLar

    baptisteLar

    Joined:
    Jul 26, 2012
    Posts:
    31
    I don't understand either why it hasn't been fixed yet! This is a major bug!
     
  46. Tinnes

    Tinnes

    Joined:
    Jul 15, 2012
    Posts:
    7
  47. niko-belic

    niko-belic

    Joined:
    Sep 1, 2012
    Posts:
    67
    I have this same problem, my game freezing and device restart after use home button.
    this problem on Samsung S WIFI player 5 YP-G70 Android version 2.3.5

    Unity version 4.3.2f1
     
    Last edited: Mar 14, 2014
  48. Sor

    Sor

    Joined:
    Sep 25, 2013
    Posts:
    19
    Unity 4.3.4 f1, same issue with multiple 2.3.5 android devices. Works fine on android 4.x.
     
  49. Sor

    Sor

    Joined:
    Sep 25, 2013
    Posts:
    19
    Can a Unity rep chime in on this? This issue is still outstanding on 4.3.4 f1 and is a MAJOR problem for a soon-to-be released game.

    Using the Facebook API, for example, causes a crash when the login page is displayed because the application goes to the background.

     
  50. niko-belic

    niko-belic

    Joined:
    Sep 1, 2012
    Posts:
    67
    Yes I'm currently before the completion of my game.
    This is a critical issue that bothers me.

    I would also like to hear the answer