[android-developers] Re: Relationships among apps, tasks, and activities

2009-05-02 Thread devi prasad

Hi, Dianne: this is the portion of the dump that I get by executing
adb shell dumpsys activity :
--
Activities in Current Activity Manager State:
Task{3 com.robosoft.example}
clearOnBackground=false numActivities=3 rootWasReset=true
affinity=com.robosoft.example
intent=Intent { action=android.intent.action.MAIN
categories={android.intent.category.LAUNCHER}
 flags=0x1020

comp={com.robosoft.example/com.robosoft.example.AppRootActivity} }

History #3:
HistoryRecord{434d2090
{com.robosoft.example/com.robosoft.example.SingleTaskActivity}}
packageName=com.robosoft.example processName=com.robosoft.example
app=ProcessRecord{43516130 181:com.robosoft.example/10018}
Intent { flags=0x1000
comp={com.robosoft.example/com.robosoft.example.SingleTaskActivity} }

History #2:
HistoryRecord{434fb848
{com.robosoft.example/com.robosoft.example.ChildActivityOfRoot}}
packageName=com.robosoft.example processName=com.robosoft.example
app=ProcessRecord{43516130 181:com.robosoft.example/10018}
Intent {
comp={com.robosoft.example/com.robosoft.example.ChildActivityOfRoot} }

History #1:
HistoryRecord{434fe2e8
{com.robosoft.example/com.robosoft.example.AppRootActivity}}
packageName=com.robosoft.example processName=com.robosoft.example
app=ProcessRecord{43516130 181:com.robosoft.example/10018}
Intent { action=android.intent.action.MAIN
categories={android.intent.category.LAUNCHER}
---
As I gather, this shows that all three activities are part of the same
task, even though I use FLAG_ACTIVITY_NEW_TASK while starting
'SingleTaskActivity' and mark it with 'singleTask' launch mode. The
intent flag value (0x1000) indicates this in the top most activity
entry above.

I cannot explain this behavior with my current understanding derived
from the documentation. What am I missing here?

thanks


On Sat, May 2, 2009 at 10:50 AM, devi prasad dpras...@gmail.com wrote:
 Hi, Dianne: ok, thanks.
 I use the following functions to determine the task id and if it is
 the root of a task:

 activity.getTaskId();
 activity.isTaskRoot();

 I used logcat looking for useful hints. Let me see if I understand it
 better if I use
 adb shell dumpsys activity


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Relationships among apps, tasks, and activities

2009-05-02 Thread devi prasad

Well, I DO think that Android documentation speaks about tasks and
their affinities, contrary to what I said previously :)

I defined a non-default value for the taskAffinity attribute of the
activity in question:
activity android:name=.SingleTaskActivity
 android:label=ChildActivity:SingleTaskActivity
 android:launchMode=singleTask
 android:taskAffinity=com.robosoft.example.taskByIteself
/activity

and the activity gets to run in a separate task.

Both 'taskAffinity' and 'launchMode' are necessary if we want to have
an activity run in a separate task. Alternatively,
Intent.FLAG_ACTIVITY_NEW_TASK may be used in the intent, in case only
'taskAffinity' is mentioned in the manifest.

This is really interesting :)


On Sat, May 2, 2009 at 1:37 PM, devi prasad dpras...@gmail.com wrote:
 Hi, Dianne: this is the portion of the dump that I get by executing
 adb shell dumpsys activity :
 --
 Activities in Current Activity Manager State:
    Task{3 com.robosoft.example}
    clearOnBackground=false numActivities=3 rootWasReset=true
    affinity=com.robosoft.example
    intent=Intent { action=android.intent.action.MAIN
 categories={android.intent.category.LAUNCHER}
                         flags=0x1020

 comp={com.robosoft.example/com.robosoft.example.AppRootActivity} }

    History #3:
        HistoryRecord{434d2090
 {com.robosoft.example/com.robosoft.example.SingleTaskActivity}}
        packageName=com.robosoft.example processName=com.robosoft.example
        app=ProcessRecord{43516130 181:com.robosoft.example/10018}
        Intent { flags=0x1000
        comp={com.robosoft.example/com.robosoft.example.SingleTaskActivity} }

    History #2:
        HistoryRecord{434fb848
 {com.robosoft.example/com.robosoft.example.ChildActivityOfRoot}}
        packageName=com.robosoft.example processName=com.robosoft.example
        app=ProcessRecord{43516130 181:com.robosoft.example/10018}
        Intent {
 comp={com.robosoft.example/com.robosoft.example.ChildActivityOfRoot} }

    History #1:
        HistoryRecord{434fe2e8
 {com.robosoft.example/com.robosoft.example.AppRootActivity}}
        packageName=com.robosoft.example processName=com.robosoft.example
        app=ProcessRecord{43516130 181:com.robosoft.example/10018}
        Intent { action=android.intent.action.MAIN
 categories={android.intent.category.LAUNCHER}
 ---
 As I gather, this shows that all three activities are part of the same
 task, even though I use FLAG_ACTIVITY_NEW_TASK while starting
 'SingleTaskActivity' and mark it with 'singleTask' launch mode. The
 intent flag value (0x1000) indicates this in the top most activity
 entry above.

 I cannot explain this behavior with my current understanding derived
 from the documentation. What am I missing here?

 thanks


 On Sat, May 2, 2009 at 10:50 AM, devi prasad dpras...@gmail.com wrote:
 Hi, Dianne: ok, thanks.
 I use the following functions to determine the task id and if it is
 the root of a task:

 activity.getTaskId();
 activity.isTaskRoot();

 I used logcat looking for useful hints. Let me see if I understand it
 better if I use
 adb shell dumpsys activity



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Relationships among apps, tasks, and activities

2009-05-02 Thread devi prasad

some more thoughts...
What I've said about taskAffinity and launchMode attributes, in
general, makes sense when the activities are in the same app since the
default value of taskAffinity will be set to the package name. When
the activities across apps activate one another, just the launch mode
value tells if the launched activity would be the root of  the new
task. Again, this is because the package names of the apks would be
different.

On Sun, May 3, 2009 at 5:17 AM, devi prasad dpras...@gmail.com wrote:
 Well, I DO think that Android documentation speaks about tasks and
 their affinities, contrary to what I said previously :)

 I defined a non-default value for the taskAffinity attribute of the
 activity in question:
        activity android:name=.SingleTaskActivity
                     android:label=ChildActivity:SingleTaskActivity
                     android:launchMode=singleTask
                     android:taskAffinity=com.robosoft.example.taskByIteself
        /activity

 and the activity gets to run in a separate task.

 Both 'taskAffinity' and 'launchMode' are necessary if we want to have
 an activity run in a separate task. Alternatively,
 Intent.FLAG_ACTIVITY_NEW_TASK may be used in the intent, in case only
 'taskAffinity' is mentioned in the manifest.

 This is really interesting :)


 On Sat, May 2, 2009 at 1:37 PM, devi prasad dpras...@gmail.com wrote:
 Hi, Dianne: this is the portion of the dump that I get by executing
 adb shell dumpsys activity :
 --
 Activities in Current Activity Manager State:
    Task{3 com.robosoft.example}
    clearOnBackground=false numActivities=3 rootWasReset=true
    affinity=com.robosoft.example
    intent=Intent { action=android.intent.action.MAIN
 categories={android.intent.category.LAUNCHER}
                         flags=0x1020

 comp={com.robosoft.example/com.robosoft.example.AppRootActivity} }

    History #3:
        HistoryRecord{434d2090
 {com.robosoft.example/com.robosoft.example.SingleTaskActivity}}
        packageName=com.robosoft.example processName=com.robosoft.example
        app=ProcessRecord{43516130 181:com.robosoft.example/10018}
        Intent { flags=0x1000
        comp={com.robosoft.example/com.robosoft.example.SingleTaskActivity} }

    History #2:
        HistoryRecord{434fb848
 {com.robosoft.example/com.robosoft.example.ChildActivityOfRoot}}
        packageName=com.robosoft.example processName=com.robosoft.example
        app=ProcessRecord{43516130 181:com.robosoft.example/10018}
        Intent {
 comp={com.robosoft.example/com.robosoft.example.ChildActivityOfRoot} }

    History #1:
        HistoryRecord{434fe2e8
 {com.robosoft.example/com.robosoft.example.AppRootActivity}}
        packageName=com.robosoft.example processName=com.robosoft.example
        app=ProcessRecord{43516130 181:com.robosoft.example/10018}
        Intent { action=android.intent.action.MAIN
 categories={android.intent.category.LAUNCHER}
 ---
 As I gather, this shows that all three activities are part of the same
 task, even though I use FLAG_ACTIVITY_NEW_TASK while starting
 'SingleTaskActivity' and mark it with 'singleTask' launch mode. The
 intent flag value (0x1000) indicates this in the top most activity
 entry above.

 I cannot explain this behavior with my current understanding derived
 from the documentation. What am I missing here?

 thanks


 On Sat, May 2, 2009 at 10:50 AM, devi prasad dpras...@gmail.com wrote:
 Hi, Dianne: ok, thanks.
 I use the following functions to determine the task id and if it is
 the root of a task:

 activity.getTaskId();
 activity.isTaskRoot();

 I used logcat looking for useful hints. Let me see if I understand it
 better if I use
 adb shell dumpsys activity




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Relationships among apps, tasks, and activities

2009-05-01 Thread Dianne Hackborn
The behavior you are describing is not how things work.  What do you mean
you don't see another task?  How are you telling?  adb shell dumpsys
activity will show you the current activity state with the exact task
organization (in the first part of the output).

On Fri, May 1, 2009 at 9:17 PM, devi prasad dpras...@gmail.com wrote:


 Hi
 I am trying to understand the interactions among apps, processes,
 activities,
 and tasks. After reading 'Application Fundamentals' many times, I wrote a
 tiny
 piece of code with three different activities. Here's my manifest file:

 application android:icon=@drawable/icon android:label=ABC
activity android:name=.AppRootActivity
  android:label=App1
intent-filter
action android:name=android.intent.action.MAIN /
category android:name=android.intent.category.LAUNCHER/
/intent-filter
/activity

activity android:name=.ChildActivityOfRoot
  android:label=ChildActivity:ChildOfAppRootActivity
/activity

activity android:name=.SingleTaskActivity
  android:label=ChildActivity:SingleTaskActivity
  android:launchMode=singleTask
/activity
 /application

 The AppRootActivity starts ChildActivityOfRoot which in turn starts
 SingleTaskActivity.

 Since 'SingleTaskActivity' is marked with 'singleTask' launchMode I
 expected
 two different tasks with the following activity sets:
 Task1 -- AppRootActivity - ChildActivityOfRoot
 Task2 -- SingleTaskActivity

 However, I was surprised to see all three activities running in the same
 task.
 This doesn't change even if I use Intent.FLAG_ACTIVITY_NEW_TASK flag in the
 intent used to activate 'SingleTaskActivity'. I use the getTaskId() to
 determine
 the task the activity is running.

 IMO this behavior is not at all apparent from the documentation. Can
 someone
 shed more light?

 Thanks

 



-- 
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
-~--~~~~--~~--~--~---



[android-developers] Re: Relationships among apps, tasks, and activities

2009-05-01 Thread devi prasad

Hi, Dianne: ok, thanks.
I use the following functions to determine the task id and if it is
the root of a task:

activity.getTaskId();
activity.isTaskRoot();

I used logcat looking for useful hints. Let me see if I understand it
better if I use
adb shell dumpsys activity

On Sat, May 2, 2009 at 10:39 AM, Dianne Hackborn hack...@android.com wrote:
 The behavior you are describing is not how things work.  What do you mean
 you don't see another task?  How are you telling?  adb shell dumpsys
 activity will show you the current activity state with the exact task
 organization (in the first part of the output).

 On Fri, May 1, 2009 at 9:17 PM, devi prasad dpras...@gmail.com wrote:

 Hi
 I am trying to understand the interactions among apps, processes,
 activities,
 and tasks. After reading 'Application Fundamentals' many times, I wrote a
 tiny
 piece of code with three different activities. Here's my manifest file:

 application android:icon=@drawable/icon android:label=ABC
        activity android:name=.AppRootActivity
                  android:label=App1
            intent-filter
                action android:name=android.intent.action.MAIN /
                category android:name=android.intent.category.LAUNCHER/
            /intent-filter
        /activity

        activity android:name=.ChildActivityOfRoot
                  android:label=ChildActivity:ChildOfAppRootActivity
        /activity

        activity android:name=.SingleTaskActivity
                  android:label=ChildActivity:SingleTaskActivity
                  android:launchMode=singleTask
        /activity
 /application

 The AppRootActivity starts ChildActivityOfRoot which in turn starts
 SingleTaskActivity.

 Since 'SingleTaskActivity' is marked with 'singleTask' launchMode I
 expected
 two different tasks with the following activity sets:
 Task1 -- AppRootActivity - ChildActivityOfRoot
 Task2 -- SingleTaskActivity

 However, I was surprised to see all three activities running in the same
 task.
 This doesn't change even if I use Intent.FLAG_ACTIVITY_NEW_TASK flag in
 the
 intent used to activate 'SingleTaskActivity'. I use the getTaskId() to
 determine
 the task the activity is running.

 IMO this behavior is not at all apparent from the documentation. Can
 someone
 shed more light?

 Thanks





 --
 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
-~--~~~~--~~--~--~---