Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Anton Persson
What phone are you using? I do that stuff on my HTC Magic everyday, no
issues. (Android 1.5 FTW? ;-)

On Sat, Jun 5, 2010 at 3:00 PM, bemymonkey simonbroen...@gmail.com wrote:

 Hello everyone!

 First of all, I hope this is at least somewhat on-topic for this
 discussion group, as it seems to be the only way to reach Android
 developers easily.

 The problem I would like to discuss is the way Android handles running
 multiple applications at the same time. Take the following scenario,
 for instance:

 1. Open the browser
 2. Open a few links that you want to read later in new windows/tabs
 3. Open another app (Say you received an SMS, for instance)
 4. Reopen the browser, expecting to continue where you left off
 5. Browser has closed all open windows WITHOUT saving the state or
 notifying the user

 This happens even if you're only jumping between completely Android-
 Native apps that came with the OS. There are various other similar
 scenarios, but this is easily the most annoying, since it results in
 complete loss of stuff I was actually planning on reading later.


 Why would anyone consider this to be actual multitasking? If there's
 no guarantee that the app you just left will still have the same state
 when you come back to it from your other tasks, it's NOT MULTITASKING.

 How is it that this is still an issue? We've arrived at Android 2.2,
 and we still can't minimize a program without running the risk of
 losing everything we just did?

 Are there at least plans to integrate proper multitasking in the
 future? Or a way to allow users to specifically select tasks that are
 not to be killed under any circumstances?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Simon Broenner
I'm using a Motorola Milestone, running Android 2.1 (stock  unrooted).


Does your browser stay active if you open up the maximum amount of tabs,
launch a different application and then come back? Do all the tabs stay
open, and not refresh (or close altogether) when you reopen the browser?


On Sat, Jun 5, 2010 at 4:10 PM, Anton Persson don.juan...@gmail.com wrote:

 What phone are you using? I do that stuff on my HTC Magic everyday, no
 issues. (Android 1.5 FTW? ;-)

 On Sat, Jun 5, 2010 at 3:00 PM, bemymonkey simonbroen...@gmail.comwrote:

 Hello everyone!

 First of all, I hope this is at least somewhat on-topic for this
 discussion group, as it seems to be the only way to reach Android
 developers easily.

 The problem I would like to discuss is the way Android handles running
 multiple applications at the same time. Take the following scenario,
 for instance:

 1. Open the browser
 2. Open a few links that you want to read later in new windows/tabs
 3. Open another app (Say you received an SMS, for instance)
 4. Reopen the browser, expecting to continue where you left off
 5. Browser has closed all open windows WITHOUT saving the state or
 notifying the user

 This happens even if you're only jumping between completely Android-
 Native apps that came with the OS. There are various other similar
 scenarios, but this is easily the most annoying, since it results in
 complete loss of stuff I was actually planning on reading later.


 Why would anyone consider this to be actual multitasking? If there's
 no guarantee that the app you just left will still have the same state
 when you come back to it from your other tasks, it's NOT MULTITASKING.

 How is it that this is still an issue? We've arrived at Android 2.2,
 and we still can't minimize a program without running the risk of
 losing everything we just did?

 Are there at least plans to integrate proper multitasking in the
 future? Or a way to allow users to specifically select tasks that are
 not to be killed under any circumstances?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Simon Broenner
Kasinostr. 94, 52066 Aachen, Germany
+4917661249070 (Mobile)
+492415903431 (Home)

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Mark Murphy
Simon Broenner wrote:
 Does your browser stay active if you open up the maximum amount of tabs,
 launch a different application and then come back?

The standard Android browser does not have tabs. Perhaps you installed a
different browser.

If by tabs you mean windows, then, yes, they stay open on every
Android device I have used, including the DROID (CDMA equivalent of the
Milestone).

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.5 Available!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Simon Broenner
Obviously the windows (which is what I meant - I _am_ using the native
Android browser) stay open as they should in most scenarios - it's usually
when the memory starts to get low and the OS starts killing tasks that this
becomes a problem.

There are a few similar experiences listed in this thread:
http://androidforums.com/android-lounge/23356-multitasking.html

The problem seems to be that Android is killing the task to free up memory
even though it was in use until 10 seconds ago, and doesn't bother to save
the state so that it can restore it when the app is restarted...


As a reference, I have around 30-40MB of free memory when this starts
happening - so it's not likely to be caused by too much stuff running in the
background.



On Sat, Jun 5, 2010 at 5:02 PM, Mark Murphy mmur...@commonsware.com wrote:

 Simon Broenner wrote:
  Does your browser stay active if you open up the maximum amount of tabs,
  launch a different application and then come back?

 The standard Android browser does not have tabs. Perhaps you installed a
 different browser.

 If by tabs you mean windows, then, yes, they stay open on every
 Android device I have used, including the DROID (CDMA equivalent of the
 Milestone).

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 _The Busy Coder's Guide to *Advanced* Android Development_
 Version 1.5 Available!

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Simon Broenner

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Mark Murphy
Simon Broenner wrote:
 Obviously the windows (which is what I meant - I _am_ using the native
 Android browser) stay open as they should in most scenarios - it's
 usually when the memory starts to get low and the OS starts killing
 tasks that this becomes a problem.

I use Android devices a fair bit, and I have not encountered this
problem. That does not mean that the problem does not exist for you, but
that the situation is probably a wee bit more complex than your subject
line indicates.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 2.2 Programming Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Simon Broenner
Hmmm, I'm beginning to get that feeling too.

Any idea what the cause could be? Obviously I'm not using any auto task
killers or anything like that... :(

On Sat, Jun 5, 2010 at 5:26 PM, Mark Murphy mmur...@commonsware.com wrote:

 Simon Broenner wrote:
  Obviously the windows (which is what I meant - I _am_ using the native
  Android browser) stay open as they should in most scenarios - it's
  usually when the memory starts to get low and the OS starts killing
  tasks that this becomes a problem.

 I use Android devices a fair bit, and I have not encountered this
 problem. That does not mean that the problem does not exist for you, but
 that the situation is probably a wee bit more complex than your subject
 line indicates.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 Android 2.2 Programming Books: http://commonsware.com/books

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Simon Broenner

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Mark Murphy
Simon Broenner wrote:
 Hmmm, I'm beginning to get that feeling too.
 
 Any idea what the cause could be? Obviously I'm not using any auto task
 killers or anything like that... :(

Off the top of my head, no.

If you're a developer, and you can get it to happen, plug it into USB
and scan logcat for any interesting messages. Usually, Android logs when
it is killing off processes, and it feels like your Browser process is
getting killed.

If you're not a developer, the only advice I can offer is for you to
come up with a repeatable scenario that consistently causes the problem,
preferably from a freshly-rebooted phone.

(even more ideally would be a phone with no third-party apps, but I'm
guessing this is your personal phone, so having you wipe it would be a
bit intrusive)

If you can find such a scenario, post it here or on [android-discuss],
so we can see if other devices exhibit the same behavior. If we can find
cases across several devices, it's probably an Android bug. If the only
other cases are Milestones, it might be a Motorola bug. If we can't
reproduce the problem, I'd start taking a real close look at any
third-party apps you have installed.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Simon Broenner
I just went through the whole process and logged it:

1. Open browser
2. Open maximum number of windows by using open in new window (set to open
new windows in background, in case that matters), all with different content
(so not all the same link)
3. Switch to a different application (in my case I clicked an e-mail address
from the browser, which launched the Gmail app)
4. Then switch back to the browser, either via a long hold on the Home key
or from the Home Screen Launcher

Log: http://www.narcotic-symphony.de/simon/androidlog.txt

Relaunching the browser (Step 4) takes place at around line line 161.

Can you make heads or tails of it?


Thanks for your help so far!

On Sat, Jun 5, 2010 at 5:51 PM, Mark Murphy mmur...@commonsware.com wrote:

 Simon Broenner wrote:
  Hmmm, I'm beginning to get that feeling too.
 
  Any idea what the cause could be? Obviously I'm not using any auto task
  killers or anything like that... :(

 Off the top of my head, no.

 If you're a developer, and you can get it to happen, plug it into USB
 and scan logcat for any interesting messages. Usually, Android logs when
 it is killing off processes, and it feels like your Browser process is
 getting killed.

 If you're not a developer, the only advice I can offer is for you to
 come up with a repeatable scenario that consistently causes the problem,
 preferably from a freshly-rebooted phone.

 (even more ideally would be a phone with no third-party apps, but I'm
 guessing this is your personal phone, so having you wipe it would be a
 bit intrusive)

 If you can find such a scenario, post it here or on [android-discuss],
 so we can see if other devices exhibit the same behavior. If we can find
 cases across several devices, it's probably an Android bug. If the only
 other cases are Milestones, it might be a Motorola bug. If we can't
 reproduce the problem, I'd start taking a real close look at any
 third-party apps you have installed.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 Android Training...At Your Office: http://commonsware.com/training

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Simon Broenner

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Simon Broenner
This is the relevant part of the log, as far as I can tell:

06-05 18:02:21.531: INFO/ActivityManager(1282): Displayed activity
com.google.android.gm/.ComposeActivity: 2025 ms (total 2631 ms)
06-05 18:02:22.101: ERROR/cache(2780): disableTransaction is out of sync
06-05 18:02:22.242: INFO/ActivityManager(1282): Process com.android.browser
(pid 2780) has died.
06-05 18:02:22.242: INFO/ActivityManager(1282): Low Memory: No more
background processes.
06-05 18:02:22.242: INFO/WindowManager(1282): WIN DEATH: Window{4507b368
com.android.browser/com.android.browser.BrowserActivity paused=false}
06-05 18:02:25.187: WARN/KeyCharacterMap(4253): Can't open keycharmap file
06-05 18:02:25.187: WARN/KeyCharacterMap(4253): Error loading keycharmap
file '/system/usr/keychars/qtouch-touchscreen.kcm.bin'.
hw.keyboards.65538.devname='qtouch-touchscreen'
06-05 18:02:25.187: WARN/KeyCharacterMap(4253): Using default keymap:
/system/usr/keychars/qwerty.kcm.bin
06-05 18:02:26.555: INFO/NotificationService(1282): enqueueToast pkg=
com.google.android.gmcallback=android.app.itransientnotification$stub$pr...@44de28d0duration=0
06-05 18:02:26.601: ERROR/Workspace(1364): mCurrentScreen = 1
06-05 18:02:26.633: WARN/InputManagerService(1282): Starting input on
non-focused client
com.android.internal.view.iinputmethodclient$stub$pr...@44e4edb0 (uid=10007
pid=4253)
06-05 18:02:26.633: WARN/IInputConnectionWrapper(4253): showStatusIcon on
inactive InputConnection
06-05 18:02:28.000: INFO/ActivityManager(1282): Starting activity: Intent {
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
flg=0x1020 cmp=com.android.browser/.BrowserActivity
bnds=[125,446][235,564] }
06-05 18:02:28.055: INFO/ActivityManager(1282): Start proc
com.android.browser for activity com.android.browser/.BrowserActivity:
pid=4265 uid=10045 gids={3003, 1015}
06-05 18:02:28.109: INFO/dalvikvm(4265): Debugger thread not active,
ignoring DDM send (t=0x41504e4d l=38)
06-05 18:02:28.180: INFO/dalvikvm(4265): Debugger thread not active,
ignoring DDM send (t=0x41504e4d l=42)
06-05 18:02:28.289: INFO/ActivityThread(4265): Publishing provider browser:
com.android.browser.BrowserProvider
06-05 18:02:29.164: DEBUG/BrowserSettings(4265): Enter
getFactoryResetHomeUrl()
06-05 18:02:29.164: DEBUG/BrowserSettings(4265): http index is 14
06-05 18:02:29.164: DEBUG/BrowserSettings(4265): Preload homepage is
http://www.google.com
06-05 18:02:29.398: DEBUG/dalvikvm(4265): GC freed 1981 objects / 142280
bytes in 175ms
06-05 18:02:30.453: INFO/ActivityManager(1282): Displayed activity
com.android.browser/.BrowserActivity: 2410 ms (total 2410 ms)

It starts more or less at the launching of the Gmail app and ends at the
browser being relaunched after it was killed due to low memory.



On Sat, Jun 5, 2010 at 6:09 PM, Simon Broenner simonbroen...@gmail.comwrote:

 I just went through the whole process and logged it:

 1. Open browser
 2. Open maximum number of windows by using open in new window (set to
 open new windows in background, in case that matters), all with different
 content (so not all the same link)
 3. Switch to a different application (in my case I clicked an e-mail
 address from the browser, which launched the Gmail app)
 4. Then switch back to the browser, either via a long hold on the Home key
 or from the Home Screen Launcher

 Log: http://www.narcotic-symphony.de/simon/androidlog.txt

 Relaunching the browser (Step 4) takes place at around line line 161.

 Can you make heads or tails of it?


 Thanks for your help so far!


 On Sat, Jun 5, 2010 at 5:51 PM, Mark Murphy mmur...@commonsware.comwrote:

 Simon Broenner wrote:
  Hmmm, I'm beginning to get that feeling too.
 
  Any idea what the cause could be? Obviously I'm not using any auto task
  killers or anything like that... :(

 Off the top of my head, no.

 If you're a developer, and you can get it to happen, plug it into USB
 and scan logcat for any interesting messages. Usually, Android logs when
 it is killing off processes, and it feels like your Browser process is
 getting killed.

 If you're not a developer, the only advice I can offer is for you to
 come up with a repeatable scenario that consistently causes the problem,
 preferably from a freshly-rebooted phone.

 (even more ideally would be a phone with no third-party apps, but I'm
 guessing this is your personal phone, so having you wipe it would be a
 bit intrusive)

 If you can find such a scenario, post it here or on [android-discuss],
 so we can see if other devices exhibit the same behavior. If we can find
 cases across several devices, it's probably an Android bug. If the only
 other cases are Milestones, it might be a Motorola bug. If we can't
 reproduce the problem, I'd start taking a real close look at any
 third-party apps you have installed.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 Android Training...At Your Office: 

Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Frank Weiss
This might be a longshot. Perhaps it's not the browser, but the web pages.
If you have many browser windows open, each web page contributes to memory
pressure. I have the same experience on my desktop with 2 GB. After power
browsing for a while - that is, having multiple open tabs for several
days - I frequently have to close the browser because the system gets
sluggish. This happens for both IE and FF. In my case, I keep SFGate and
Gmail open.

Of course, I'm just speculating. Is there any easy way to check the Android
browser's memory usage relative to the other applications?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Simon Broenner
I'm pretty sure the browser is using a lot of memory, and the OS is
perfectly within its rights to close the application when it's in the
background - but not without saving the state first.

I'm currently testing with more free phone storage memory (previously about
22MB free, now 53MB), and so far I haven't been able to reproduce the
problem (only the reloading - the entire browser just being gone hasn't
happened so far).

Is it possible that the saved states are placed in the same storage space
that installed applications occupy? That would explain the change in
symptoms... will get another log when I get home later.

On 5 Jun 2010 19:02, Frank Weiss fewe...@gmail.com wrote:

This might be a longshot. Perhaps it's not the browser, but the web pages.
If you have many browser windows open, each web page contributes to memory
pressure. I have the same experience on my desktop with 2 GB. After power
browsing for a while - that is, having multiple open tabs for several
days - I frequently have to close the browser because the system gets
sluggish. This happens for both IE and FF. In my case, I keep SFGate and
Gmail open.

Of course, I'm just speculating. Is there any easy way to check the Android
browser's memory usage relative to the other applications?



-- 

You received this message because you are subscribed to the Google
Groups Android Developers group...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Kostya Vasilyev

05.06.2010 20:09, Simon Broenner пишет:
2. Open maximum number of windows by using open in new window (set 
to open new windows in background, in case that matters), all with 
different content (so not all the same link)

What do you mean by maximum number of windows ?

How many is that? What happens if you try to open one more?

--
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Simon Broenner
When I reach the max., the new window and open new window buttons just
disappear. Max. is something like 8 or 10 windows.

On 5 Jun 2010 19:11, Kostya Vasilyev kmans...@gmail.com wrote:

05.06.2010 20:09, Simon Broenner пишет:



 2. Open maximum number of windows by using open in new window (set to
open new windows in bac...
What do you mean by maximum number of windows ?

How many is that? What happens if you try to open one more?

-- 
Kostya Vasilev -- WiFi Manager + pretty widget --
http://kmansoft.wordpress.com

-- 

You received this message because you are subscribed to the Google
Groups Android Developers group...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Simon Broenner
Just reproduced again with all the newly freed program memory (albeit with
relatively memory-heavy web sites like Engadget and Slashdot) :(

Looks like having more free application memory delays the process somewhat
though...



 On 5 Jun 2010 19:11, Kostya Vasilyev kmans...@gmail.com wrote:

 05.06.2010 20:09, Simon ...



 2. Open maximum number of windows by using open in new window (set to
open new windows in bac...



 What do you mean by maximum number of windows ?

 How many is that? What happens if you try...


 You received this message because you are subscribed to the Google
Groups Android Developers group...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Mark Murphy
Simon Broenner wrote:
 1. Open browser
 2. Open maximum number of windows by using open in new window (set to
 open new windows in background, in case that matters), all with
 different content (so not all the same link)

 3. Switch to a different application (in my case I clicked an e-mail
 address from the browser, which launched the Gmail app)
 4. Then switch back to the browser, either via a long hold on the Home
 key or from the Home Screen Launcher
 
 Log: http://www.narcotic-symphony.de/simon/androidlog.txt
 
 Relaunching the browser (Step 4) takes place at around line line 161.
 
 Can you make heads or tails of it?

Well...

First, your Browser process dies. It's not a hard crash (e.g., SIGSEGV),
so I am guessing it is dying due to low memory -- more on this below.

Then, ActivityManager#appDiedLocked() is checking to see if there are
any background processes. Finding none, it logs the Low Memory: No more
background processes message, then is ripping through all existing
processes, telling each to garbage collect. The combination of that plus
the Browser process being gone has freed up enough memory to allow the
Browser to re-open when you return to it, albeit sans state.

-

You stated in an earlier message:

 As a reference, I have around 30-40MB of free memory when this starts
 happening - so it's not likely to be caused by too much stuff running in
 the background.

Bear in mind that not all memory is created equal, and Browser is likely
to be stranger than your average app. Most apps are Java apps (either
SDK or internal Android apps), with limited heap sizes (16-24MB).

The Browser is based on WebKit. It's memory management has little to do
with Java -- WebKit is written in C/C++. Hence, I'm not sure that the
30-40MB of free memory necessarily represents memory that WebKit is
able to use. And, as Frank Weiss noted, Web pages can chew up a fair bit
of RAM.

You then wrote:

 I'm pretty sure the browser is using a lot of memory, and the OS is
 perfectly within its rights to close the application when it's in the
 background - but not without saving the state first.

I do not think it is getting a chance to complete saving its state
before it dies. Android has the right to terminate processes directly to
free up RAM if it needs it.

 Is it possible that the saved states are placed in the same storage
 space that installed applications occupy?

That's fairly likely. And, as Brad Fitzpatrick noted at Google I|O 2010,
flash writes get slower as flash gets closer to full.

So, one possible scenario is that the Browser is trying to save its
state across all your windows but runs out of time due to slower flash
writes, and Android winds up having to proactively kill it off to free
up the RAM for Gmail.

Generally speaking, memory management works more smoothly. However, this
is one of the reasons why I advise developers to go with more smaller
activities than one big fat one, so that state-saving and memory
reclamation can be done in tiny chunks.

The tactical workaround: limit yourself to only a few Browser windows,
or try an alternative browser that might do it state-saving in a
different way that will hold up better with more windows open.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 2.0 Available!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Frank Weiss
I think the OP's issue is that the Andorid Browser doesn't save the open
windows state upon close (force close in the OP's case). I've confirmed this
with just a reboot - but that may be a different syndrome.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Mark Murphy
Frank Weiss wrote:
 I think the OP's issue is that the Andorid Browser doesn't save the open
 windows state upon close (force close in the OP's case). 

The Browser rarely goes through a normal close, because Browser uses the
BACK button for browser operations, so eventually people just start
using the HOME key rather than BACK their way to the beginning.

BrowserActivity does have an onSaveInstanceState() implementation and
uses it. Apparently, when a device is low on some memory resource, with
a Browser with a lot of windows open, the Browser process gets
terminated without going through the normal activity-destroy operation.

 I've confirmed
 this with just a reboot - but that may be a different syndrome.

Nothing saves its state after a reboot, at least in the same
state-saving that it would after being kicked out of RAM. That state
is held in RAM itself and is not persisted AFAIK.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Frank Weiss
The state save I'm refering to is via SharedPreferences. I've observed this
in my own application. Indeed, the Android Browser's bookmarks are saved
across reboots, and I'd suppose across force closes as well, However, I
think Mark is correct that some state may not be correctly saved in a FC
situation.

I think my theory still stands that the browser is not saving windows across
reboots and FCs. If you think about it, it may not even be possible,
depending on how you define saving windows, although FF and IE are able to
restore tabs.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Dianne Hackborn
I am pretty sure the browser saves its state in onSaveInstanceState, not
persistently, and this is currently as intended.  That is, it will retain
its state when its process gets killed and restarted, but it is deliberately
not trying to retain its state across reboots.

Note that instance state is always saved before pause, BEFORE an app goes to
the background.  So that is the key point for state saving; after that, it
doesn't matter when the process gets killed, nor is there a need to let the
app do anything before it gets killed, the activity manager already has its
saved state so it can be used to restore the activity in a new process.

There are two main ways the browser could be losing its state:

(1) The activity itself gets finished.  Most likely the browser isn't doing
this, but others can cause it to happen -- such as by hitting the Force
Stop button which (prior to Froyo) is the API that task managers have been
abusing.

(2) Just a big in the browser (or less likely in the activity manager) that
is causing the state to be lost or not correctly restored.

To investigate these, you can use adb shell dumpsys activity to see the
activity stack (in particular the browser activity entry) at various points.
 When it is in the background, does it say it has the saved state?  Right
before restarting it, is the entry still there will the saved state?  If so,
then there is most likely something going on when the browser tries to
restore its state.  If not, then something earlier is going buggy when the
state is saved.

On Sat, Jun 5, 2010 at 12:25 PM, Frank Weiss fewe...@gmail.com wrote:

 The state save I'm refering to is via SharedPreferences. I've observed
 this in my own application. Indeed, the Android Browser's bookmarks are
 saved across reboots, and I'd suppose across force closes as well, However,
 I think Mark is correct that some state may not be correctly saved in a FC
 situation.

 I think my theory still stands that the browser is not saving windows
 across reboots and FCs. If you think about it, it may not even be possible,
 depending on how you define saving windows, although FF and IE are able to
 restore tabs.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Multitasking on Android - Why So Incredibly Bad?

2010-06-05 Thread Simon Broenner
Hello everyone!

First of all I'd like to thank you all for your helpful tips and information
about what could be causing the problem.


That said, I'd like to address a few points that have been mentioned:

1. I'm not concerned about reboots or Force Closes - if the device is
rebooted or the browser has a FC fit, I don't expect all of my windows to be
restored. It'd be a nice feature, but not something necessary, like being
able to resume a browser session after only having minimized it.

2. The primary suspect, in my eyes, is still the free program memory (not
RAM but the Flash in which applications are installed) - it seems to me that
if the browser cannot find enough free phone memory to save its state, the
saving process fails silently. This is supported by the observation I made
earlier - with 20MB of phone memory free, I was able to reproduce the
problem with 8-10 simple forum/e-mail pages open. With 50MB of phone memory
free, I was only able to reduce the problem if at least 4 or 5 of the open
tabs were very graphically intensive (and therefore memory intensive) sites.

Diane wrote:

*To investigate these, you can use adb shell dumpsys activity to see the
activity stack (in particular the browser activity entry) at various points.
 When it is in the background, does it say it has the saved state?  Right
before restarting it, is the entry still there will the saved state?  If so,
then there is most likely something going on when the browser tries to
restore its state.  If not, then something earlier is going buggy when the
state is saved.

*I'll give this a try tomorrow... can't make any promises, however, as I'm
still very new to Android development - haven't gotten much farther than
Hello World and a few pages of the Developer's Guide so far ;)


Thanks again for all your help!


On Sat, Jun 5, 2010 at 11:29 PM, Dianne Hackborn hack...@android.comwrote:

 I am pretty sure the browser saves its state in onSaveInstanceState, not
 persistently, and this is currently as intended.  That is, it will retain
 its state when its process gets killed and restarted, but it is deliberately
 not trying to retain its state across reboots.

 Note that instance state is always saved before pause, BEFORE an app goes
 to the background.  So that is the key point for state saving; after that,
 it doesn't matter when the process gets killed, nor is there a need to let
 the app do anything before it gets killed, the activity manager already has
 its saved state so it can be used to restore the activity in a new process.

 There are two main ways the browser could be losing its state:



 To investigate these, you can use adb shell dumpsys activity to see the
 activity stack (in particular the browser activity entry) at various points.
  When it is in the background, does it say it has the saved state?  Right
 before restarting it, is the entry still there will the saved state?  If so,
 then there is most likely something going on when the browser tries to
 restore its state.  If not, then something earlier is going buggy when the
 state is saved.


 On Sat, Jun 5, 2010 at 12:25 PM, Frank Weiss fewe...@gmail.com wrote:

 The state save I'm refering to is via SharedPreferences. I've observed
 this in my own application. Indeed, the Android Browser's bookmarks are
 saved across reboots, and I'd suppose across force closes as well, However,
 I think Mark is correct that some state may not be correctly saved in a FC
 situation.

 I think my theory still stands that the browser is not saving windows
 across reboots and FCs. If you think about it, it may not even be possible,
 depending on how you define saving windows, although FF and IE are able to
 restore tabs.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Simon Broenner

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.