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. How i can migrate my app from 1.5 to 1.6 api fast and safe???

Hi, i am making a gigantic app for android, and i start doing it some
moths ago for android 1.5, but now i know that some of the things i
need for my app only can be done if you are programming for 1.6 api.

there is a easy, fast and safe way to migrate my app from 1.5 to 1.6
without having to lose time?

thanks

-- 

2. How to push the code changes to review.source.android.com

Hi all,

I try to push my changes to eview.source.android.com as method described in
site http://source.android.com/source/submit-patches.html.
But when I do "repo upload", error occurred.

Is anyone know something about this?

Or is anyone can provide a details about how to push the code changes to
review.source.android.com?

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
bash$repo upload
Upload project cts/:
  branch IKSTABLETWOV-1853_CTS ( 1 commit, Wed Nov 24 17:49:09 2010 +0800):
         ab4b8b7e Test
to review.source.android.com (y/n)? y
Traceback (most recent call last):
  File "/localrepo/hpqg67/Android/platform/.repo/repo/main.py", line 235, in
?
    _Main(sys.argv[1:])
  File "/localrepo/hpqg67/Android/platform/.repo/repo/main.py", line 217, in
_Main
    repo._Run(argv)
  File "/localrepo/hpqg67/Android/platform/.repo/repo/main.py", line 123, in
_Run
    cmd.Execute(copts, cargs)
  File "/localrepo/hpqg67/Android/platform/.repo/repo/subcmds/upload.py",
line 402, in Execute
    self._SingleBranch(opt, pending[0][1][0], people)
  File "/localrepo/hpqg67/Android/platform/.repo/repo/subcmds/upload.py",
line 165, in _SingleBranch
    self._UploadAndReport(opt, [branch], people)
  File "/localrepo/hpqg67/Android/platform/.repo/repo/subcmds/upload.py",
line 346, in _UploadAndReport
    branch.UploadForReview(people, auto_topic=opt.auto_topic)
  File "/localrepo/hpqg67/Android/platform/.repo/repo/project.py", line 156,
in UploadForReview
    auto_topic=auto_topic)
  File "/localrepo/hpqg67/Android/platform/.repo/repo/project.py", line 584,
in UploadForReview
    if branch.remote.ReviewProtocol == 'ssh':
  File "/localrepo/hpqg67/Android/platform/.repo/repo/git_config.py", line
505, in ReviewProtocol
    info = urlopen(u).read()
  File "/apps/android/python/lib/python2.4/urllib2.py", line 130, in urlopen
    return _opener.open(url, data)
  File "/apps/android/python/lib/python2.4/urllib2.py", line 358, in open
    response = self._open(req, data)
  File "/apps/android/python/lib/python2.4/urllib2.py", line 376, in _open
    '_open', req)
  File "/apps/android/python/lib/python2.4/urllib2.py", line 337, in
_call_chain
    result = func(*args)
  File "/apps/android/python/lib/python2.4/urllib2.py", line 1021, in
http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/apps/android/python/lib/python2.4/urllib2.py", line 996, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error (-2, 'Name or service not known')>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Thanks,
Chris

-- 

3. On disale logging status of Looper.getMainLooper().setMessageLogging(new Printer()) remains enable or becomes disable.

4. cara bikin aplikasi

5. Market gk mau update dan download aplikasi

6. [WTShare] Dungeon Hunter HD.. FREE!!

7. OOT : apk untuk syncronize prof pic di contact hh sama facebook