I have an application that works fine from pre-gingerbread through 4.2. In 
fact, it also works fine on 4.3 as well as long as it is run in the system 
user's context (the default user). If I create a user profile (not a 
restricted profile) and install my app in that user context, my app fails 
under a series of strange behaviors.

First, a bit about the app. It has 4 activities, 2 of which switch back and 
forth frequently as the user moves between a series of tasks. The 
activities are started explicitly to switch between each other at the 
appropriate times. So Activity A starts Activity B which then starts 
Activity A again later, which then starts B. It uses 
FLAG_ACTIVITY_REORDER_TO_FRONT to keep the activity stack sane (it is 
always A B or B A). I also have a button that will bring up Activity C from 
Activity A and another that brings up Activity D from Activity B. (C and D 
aren't at play when things go wrong).

As I said, when run on any version other than 4.3 in a user profile, it 
works just fine. When run in a separate user profile, I see the following 
behavior out of my Activity A:

   - The activity is created just fine, onStart, onResume, etc along the 
   Android lifecycle.
   - It never re-orients any longer. If a change the physical orientation 
   of the device, it used to stop and then recreate the activity in the new 
   orientation. Now, it just sits there. No onPause, onStop, onDestroy, 
   onCreate, onStart, onResume chain of calls.
   - When Activity A calls startActivity for B, I see that Activity B gets 
   its onResume call (and even an onCreate for the first one) but I never see 
   a call to onStart. I see that Activity A gets its onPause and 
   onUserLeaveHint calls, but never receives an onStop call. I never see 
   Activity B show up on the screen. Activity A just sits there on top of 
   Activity B. I presume this is because of the missing onStop and onStart 
   calls
   - If I leave my app while stuck in Activity A via the home button and 
   re-enter it via the Recents button, I re-enter on Activity B. I see the 
   onStop
   - Once I re-enter Activity B, I click on a button and try to go to 
   Activity A but it gets hung in much the same way - Activity B's 
   onUserLeaveHint and onPause are called and Activity B's onResume is called. 
   No onStop or onStart for B and A respectively.

It would seem that the activity lifecycle is messed up - I'm not seeing the 
onStart and onStop calls to my Activities when they are supposed to be 
switching.

But I wish I were done here. If I were to go back to my main user profile 
(the default/system user) and install my application in it in addition to 
the installation in the second user profile, switch back to the second 
profile, and restart my application, it all works just fine. No issues at 
all. To be clear, I have now installed my app twice - once in the default 
system user context and one in the user profile I created - and it now 
works.

So while I do have a work around, does any one have any idea what may be 
going on? Is there some incompatibility that I am tripping on that is 
overcome by installing the app in both user profiles? I do see other apps 
that seem to work fine in that user profile, but as I think about it, most 
of them are installed in both places. That said, I can't imagine this is 
common (but I could be surprised). 

Does anyone have any idea what may be going wrong?

Brian


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to