Relationships among apps, tasks, and activities

by Dianne Hackborn » Sat, 02 May 2009 13:10:13 GMT


Sponsored Links
 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).






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

--~--~---------~--~----~------------~-------~--~----~



Relationships among apps, tasks, and activities

by devi prasad » Sat, 02 May 2009 13:30:12 GMT


 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"





--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Relationships among apps, tasks, and activities

by devi prasad » Sat, 02 May 2009 16:07:44 GMT


 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=0x10200000

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=0x10000000
        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 (0x10000000) 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





--~--~---------~--~----~------------~-------~--~----~



Relationships among apps, tasks, and activities

by devi prasad » Sun, 03 May 2009 07:47:53 GMT


 ell, 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:

--~--~---------~--~----~------------~-------~--~----~



Relationships among apps, tasks, and activities

by devi prasad » Sun, 03 May 2009 08:14:54 GMT


 ome 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:

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Is it possible to upgrade HTC Magic G2 from 1.5-Cupcake to 1.6-Donut ?

At some point, when 1.6 is finished, the update will be pushed to your
phone and it will ask you if you want to update.

Otherwise I think you can either flash your phone or apply the update
manually.



--~--~---------~--~----~------------~-------~--~----~

2. Mediastore Thumbnails not generated until Gallery app is launched ?

Is that normal that Images indexed in the MediaStore do not have
thumbnails generated until the Gallery app is launched and the user
actively navigates to the bucket where the image is stored ?

I think it's quite odd as I thought thulbnails generation was part of
media indexing.


--~--~---------~--~----~------------~-------~--~----~

3. Golf App for Android

4. documentation issue

5. download layoutlib.jar

6. record and store the recording to remote server

7. Sharing YM id, lagiii...