Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apps don't appear to wake properly out of sleep mode on Android #154

Closed
codenameone opened this issue Mar 27, 2015 · 21 comments
Closed

Apps don't appear to wake properly out of sleep mode on Android #154

codenameone opened this issue Mar 27, 2015 · 21 comments

Comments

@codenameone
Copy link
Collaborator

Original issue 154 created by codenameone on 2012-04-15T01:37:05.000Z:

What steps will reproduce the problem?

  1. Create app with Resource Editor, and deploy to a physical android device.
  2. Leave app running, let the device go to sleep for a few minutes, then wake it up.

What is the expected output? What do you see instead?
When you unlock the screen, the CN1 app is locked with a blank screen, have to hit Home button to get out of it, then go to the Settings, Apps, Running, click the app and kill it.

What version of the product are you using? On what operating system?
Eclipse plug-in 1.0.0.201204122346 on Ubuntu 11.10. Android ICS 4.0.1 on Samsung Galaxy Nexus.

Please provide any additional information below.

Been meaning to enter this bug forever, have noticed this behaviour on pretty much every CN1 app.

@codenameone
Copy link
Collaborator Author

Comment #1 originally posted by codenameone on 2012-04-15T03:55:57.000Z:

I'm guessing something is wrong with out Activity.

@codenameone
Copy link
Collaborator Author

Comment #2 originally posted by codenameone on 2012-04-15T04:53:30.000Z:

An update on this one, after entering the issue, I ran the test I described on C1 apps not created by me:
C1 Live
MWC Events App
MyMusicCloud

All of them seemed to wake fine. The apps of my own that I tested were all created with ResourceEditor, not sure if that might make any difference. Or maybe something in my dev environment?

@codenameone
Copy link
Collaborator Author

Comment #3 originally posted by codenameone on 2012-04-15T04:58:56.000Z:

I'm assuming you used the build server, or did you build the application locally?

@codenameone
Copy link
Collaborator Author

Comment #4 originally posted by codenameone on 2012-04-15T05:09:01.000Z:

I used the build server, haven't attempted a local build with C1 yet.

@codenameone
Copy link
Collaborator Author

Comment #5 originally posted by codenameone on 2012-04-20T00:26:44.000Z:

Just an update here, I observed this same behavior yesterday with Codename One Live on Android, so I guess it's not just the GUI builder apps as I suggested in comment 2.

@codenameone
Copy link
Collaborator Author

Comment #6 originally posted by codenameone on 2012-04-23T12:01:11.000Z:

Live is a GUI builder app. I'm not sure how to reproduce this, it used to happen to me ages ago but I can't reproduce it on recent builds

@codenameone
Copy link
Collaborator Author

Comment #7 originally posted by codenameone on 2012-04-23T17:03:08.000Z:

On the live app it seems to happen less frequently. I put together an app last night with the latest build that exhibits the same behaviour. I'm curious, are you running on ICS? If not, I can run some tests to see if I see the same behaviour on Android 2.3 devices. I've attached a log capture off the device from the other day.

@codenameone
Copy link
Collaborator Author

Comment #8 originally posted by codenameone on 2012-04-23T17:55:40.000Z:

We are on Gingerbread devices (when will Cyanogen move already?).

@codenameone
Copy link
Collaborator Author

Comment #9 originally posted by codenameone on 2012-05-22T23:41:23.000Z:

This has happened on device of my customer as well. I'll collect info about the device. Result of this bug looks the same as I reported for some other case: http://code.google.com/p/codenameone/issues/detail?id=191

@codenameone
Copy link
Collaborator Author

Comment #10 originally posted by codenameone on 2012-05-23T10:05:38.000Z:

I was able to 100% reproduce black screen after unlocking phone when a ComboBox is open. Not sure if it is the same case as in current ticket, but I'm submitting it here because the ticket is tagged as 'critical' (bug 191 is not).
Steps to reproduce in Android SDK emulator (I used SDK 2.2):

  1. make a form with ComboBox, compile for Android on CN1 build server
  2. install in emulator (adb install )
  3. run it, open ComboBox list. Do not close the list, press 'power' button on emulator
  4. screen locks. press the power button once more, unlock screen
  5. see the black screen. The logcat has:

D/Codename One( 266): No idea why this throws a Runtime Error
D/Codename One( 266): android.util.AndroidRuntimeException: requestFeature() must be called before adding content
D/Codename One( 266): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:172)
D/Codename One( 266): at android.app.Activity.requestWindowFeature(Activity.java:2719)
D/Codename One( 266): at com.codename1.impl.android.AndroidImplementation.init(AndroidImplementation.java:168)
D/Codename One( 266): at com.codename1.impl.CodenameOneImplementation.initImpl(CodenameOneImplementation.java:124)
D/Codename One( 266): at com.codename1.ui.Display.init(Display.java:427)
D/Codename One( 266): at com.upsilon.chatup.ChatUpAppStub.onResume(ChatUpAppStub.java:40)
D/Codename One( 266): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
D/Codename One( 266): at android.app.Activity.performResume(Activity.java:3823)
D/Codename One( 266): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3118)
D/Codename One( 266): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3143)
D/Codename One( 266): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2059)
D/Codename One( 266): at android.os.Handler.dispatchMessage(Handler.java:99)
D/Codename One( 266): at android.os.Looper.loop(Looper.java:123)
D/Codename One( 266): at android.app.ActivityThread.main(ActivityThread.java:4627)
D/Codename One( 266): at java.lang.reflect.Method.invokeNative(Native Method)
D/Codename One( 266): at java.lang.reflect.Method.invoke(Method.java:521)
D/Codename One( 266): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
D/Codename One( 266): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
D/Codename One( 266): at dalvik.system.NativeStart.main(Native Method)

(I used a debug build, not sure if it matters for logging)

The same error in logs as for bug 191.

This problem happens on HTC Wildfire Android 2.2.1

I was trying to reproduce the issue without ComboBox (as originally reported in this ticket) but was not able to. On a regular Form CN1 app resumes after screen lock OK. I guess that the same issue ("requestFeature() must be called before adding content") may happen in other conditions, not only for ComboBox. Other case is bug 191, but there may be other cases too.

@codenameone
Copy link
Collaborator Author

Comment #11 originally posted by codenameone on 2012-05-24T12:41:31.000Z:

I think this is now fixed, please help me verify by verifying this.
The server is already updated with the fix.

@codenameone
Copy link
Collaborator Author

Comment #12 originally posted by codenameone on 2012-05-24T19:00:53.000Z:

Thanks Chen. I'm haven't found a pattern to reproduce this one on demand, so I'll just watch for it over time.

@codenameone
Copy link
Collaborator Author

Comment #13 originally posted by codenameone on 2012-05-24T19:34:09.000Z:

I tested it in Android SDK emulator, and it still reproducible with the same error in logs (the log is attached), unfortunately.
It would be good if I could somehow test CN1 version (or SVN revision) in the app to make sure that it was compiled against the latest SVN trunk. It could be a system property available via Display.getProperty()

@codenameone
Copy link
Collaborator Author

Comment #14 originally posted by codenameone on 2012-05-24T19:34:54.000Z:

The log

@codenameone
Copy link
Collaborator Author

Comment #15 originally posted by codenameone on 2012-05-24T20:18:10.000Z:

The exception you see in the log is harmless(I should remove the printStackTrace from there).
Are you still experiencing the black screen? is the app still stuck?

@codenameone
Copy link
Collaborator Author

Comment #16 originally posted by codenameone on 2012-05-24T20:26:06.000Z:

Sorry I didn't mention it - yes, black screen and the app is not responsible. Only killing the app in app manager allows restarting it.
The same symptoms as before

@codenameone
Copy link
Collaborator Author

Comment #17 originally posted by codenameone on 2012-05-24T20:27:06.000Z:

Can you add some more logging so we coukd see that the app is updating with your code?

@codenameone
Copy link
Collaborator Author

Comment #18 originally posted by codenameone on 2012-05-24T20:33:06.000Z:

ok, thanks I will give it another try.
in the next update I will put some log message

@codenameone
Copy link
Collaborator Author

Comment #19 originally posted by codenameone on 2012-05-24T21:09:38.000Z:

just checked open long comboboxes on the ICS emulator and it works fine.

@codenameone
Copy link
Collaborator Author

Comment #20 originally posted by codenameone on 2012-05-25T09:18:49.000Z:

I rebuilt and tested again on Android 2.2 emulator and HTC Wildfire (Android 2.2.1). Indeed, the issue doesn't happen for short lists in Combobox, but still happens for long lists. I was not able to test on Android 3 or Android 4 emulators - just some problems with SDK installations, they do not run correctly, and I was not able to fix it shortly.
Could you please test the attached APK on Android 2.2 emulator (API level 8, HVGA skin)? I can provide source code if necessary.
How to test:

  1. start the app
  2. open the second ComboBox
  3. press power button in emulator
  4. press power buton again
  5. unlock screen
  6. see the black screen

@codenameone
Copy link
Collaborator Author

Comment #21 originally posted by codenameone on 2012-05-28T07:12:09.000Z:

thanks, the bug was reproducible on <= 2.2 I made another fix to resolve this.
B.T.W - the app is super funny, well done.

@codenameone codenameone removed their assignment Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants