1312 Commits

Author SHA1 Message Date
Dianne Hackborn
78a369c90f Improve process tracking.
We now keep track of when each process is running, batched
by the current memory status of the device.  In addition,
the stats are organized by package first, and then processes
associated with each package inside of that.  Finally, we
also keep track of the overall time spent in each memory
status.

This should start to actually get us to some information
we can reach some conclusions about.  The total time spent
in each memory status gives us some indication of how much
we are running while memory is low; the new package organization
batched by memory status lets us see what packages have
what processes running when memory is low.

Change-Id: I389d62d39d115a846126cf354e4c20070d8f1180
2013-06-12 11:45:27 -07:00
Jeff Sharkey
126713d8d7 Merge "Explicit locale when formatting machine strings." 2013-06-11 23:52:17 +00:00
Dianne Hackborn
a283fc9518 Merge "Add new API to retrieve a dumpsys of a single package." 2013-06-11 23:33:32 +00:00
Jeff Sharkey
fea17de7aa Explicit locale when formatting machine strings.
Bug: 9390451
Change-Id: I3581c53407554a1dffd541fb42b06d68f20a7be0
2013-06-11 14:36:41 -07:00
Dianne Hackborn
cbfd23ee6f Add new API to retrieve a dumpsys of a single package.
Adds a platform API, and pm command.  Fixes some issues with
dumping per-package data in package manager, makes battery
stats able to dump per-package state.

Change-Id: I76ee6d059f0ba17f7a7061886792b1b716d46d2d
2013-06-11 14:26:53 -07:00
Craig Mautner
7873300a2b Don't change task type for launcher activities.
When the launcher starts a new activity don't let it change the task
type. This would cause the stacks to get confused.

Fixes bug 9323103.

Change-Id: Ie1d9c3bf85461827c7255e68003f11ed5a38f63b
2013-06-10 13:54:49 -07:00
Dianne Hackborn
be4e6aaa02 Initial super-primitive process tracker.
The goal of this is to keep track of what app processes
are doing, to determine who is being abusive, when the system
is getting into memory constrained situations, and help the
user determine how to resolve this.

Right now it doesn't really do any of that, just keeps track
of how long every process has been running since boot.

Also update the activity manager to use "cached" as the terminology
for what it used to interchangeably call hidden and background
processes, and switch ProcessMap over to using ArrayMap.

Change-Id: I270b0006aab1f38e17b7d9b65728679173c343f2
2013-06-07 15:09:17 -07:00
Jeff Sharkey
7a1c3fce47 Accumulate network statistics based on deltas.
Network stats are now read out of the kernel in one sweep, instead of
reading per-UID.  We now accumulate the delta traffic between each
stats snapshot using the well-tested SamplingCounter pattern.

Since Wi-Fi and mobile traffic have different costs, track each
separately.  Avoids counting misc interfaces like loopback and
ethernet under total.

Bug: 5543387
Change-Id: I642004dc530113c27ef79f2abbae51d8af30117f
2013-06-06 14:35:34 -07:00
Dianne Hackborn
7ad34e5fb2 Improve debug printing in activity manager.
Dumping per-package data is now much cleaning, and only really
prints information related to the package.  Also clean up the
formatting and such of the new activity stack states.

Change-Id: Ie5f31d72b7e77b34fd9acd835f28ed1db1dff328
2013-06-06 11:05:50 -07:00
Adam Powell
3f7a6935d3 Merge "Fix a bug resolving the correct icon/logo in action bars" 2013-06-01 00:07:05 +00:00
Adam Powell
04fe6ebb9f Fix a bug resolving the correct icon/logo in action bars
Remove some abstraction-breaking magic in ActionBarView and replace it
with proper resolution of the icon/logo when creating a window. The
old implementation relied on the ActionBarView's context being an
Activity.

Bug 9171554

Change-Id: Idbbb1942622195dcb55e8119f2d64287b07bb509
2013-05-31 15:00:24 -07:00
Dianne Hackborn
390517be2d Clean up some temporary allocations.
Yay to ArrayMap, letting me get rid of a bunch of temporary
iterators in core code paths like updateOomAdj.  (Now I definitely
need an ArraySet to finish that up.)

Also clean up various other things that are doing unnecessary
allocations, clean up some debug output, make more of the debug
output respect package filtering.

Change-Id: Ib4979faf4de8c7912739bc0937c3fa9e7bfcde67
2013-05-30 19:26:42 -07:00
Amith Yamasani
ce863c6fe1 am 096d3843: am 3ec14d9c: am 9b76b2d2: Merge "framework:base: iterator error in singletone provider"
* commit '096d3843994dfef99a2670c38d72c31e96cdad74':
  framework:base: iterator error in singletone provider
2013-05-29 15:25:44 -07:00
Amith Yamasani
3ec14d9cf1 am 9b76b2d2: Merge "framework:base: iterator error in singletone provider"
* commit '9b76b2d29fa338a128f699a1f40f7f5916a512af':
  framework:base: iterator error in singletone provider
2013-05-29 15:18:50 -07:00
Amith Yamasani
9b76b2d29f Merge "framework:base: iterator error in singletone provider" 2013-05-29 22:04:01 +00:00
Jun Su
cca0965a1b framework:base: iterator error in singletone provider
In case of singletone provider, we don't count it in the guset user.
After we remove it from the array, and resize the array, need to move
iterator back.

Change-Id: I99920a6beccc9de0e67ffeb632b1940efaee10b9
2013-05-29 14:33:59 +08:00
Dianne Hackborn
21d9b56692 Add more details about why a force stop is happening.
Change-Id: Ia938cf6fc37ad22fc7447dc538968c7bd234be7d
2013-05-28 17:46:59 -07:00
Craig Mautner
41c0f353c6 Replace mFocusedStack with getFocusedStack()
mFocusedStack should not be used directly as it may be null. Added
a note to the declaration to remind future self of that.

Fixes bug 9165949.

Change-Id: I8fad428d93b50909be9e7ec51df81149c11313b3
2013-05-28 08:39:25 -07:00
Dianne Hackborn
087384b0af am f3251033: Merge "Framework/base: Added synchronization block to avoid race condition"
* commit 'f325103356c559d6378da7fb7db3b2a49aba5d13':
  Framework/base: Added synchronization block to avoid race condition
2013-05-26 00:02:24 -07:00
Dianne Hackborn
f325103356 Merge "Framework/base: Added synchronization block to avoid race condition" 2013-05-26 06:30:26 +00:00
Craig Mautner
18f8530486 Merge "Convert API refs to StackBox from ActivityStack." 2013-05-24 23:14:52 +00:00
Craig Mautner
5a449154d1 Convert API refs to StackBox from ActivityStack.
- Removed IActivityManager.getStacks() since getStackBoxes() is better.
- Made createStacks operate relative to StackBox instead of TaskStack.
- Made resizeStack into resizeStackBox.

Change-Id: I7a0e1f4e34f399b4fd1180c60cc3989f9c2433f3
2013-05-24 16:12:57 -07:00
Craig Mautner
8cec2bcef9 Merge "Add retrieval of StackBox info for more flexibility" 2013-05-24 19:54:18 +00:00
Craig Mautner
5ff1210172 Add retrieval of StackBox info for more flexibility
First step in permitting StackBoxes to be manipulated by user.
Necessary for Configuration changes coming down.

Change-Id: I4029926a35e4fdc59a5759fd9e4bae10bb308413
2013-05-24 12:50:15 -07:00
Dianne Hackborn
64770d16b0 Some improvements to meminfo output.
- Rename "Swappable PSS" to "PSS Clean" which I think is what it
  means and is consistent with the other memory metrics.
- Split at the top level the dalvik heap from other dalvik allocations,
  so when you look on the dalvik allocations line things are consistent
  with the allocator's data and it is clear what are app allocations vs.
  other data in dalvik.
- Don't print lines that are all 0.
- Don't print the detailed Dalvik allocation data by default; add a new
  option to have it printed.

Here's what a typical system process dump now looks like:

** MEMINFO in pid 6358 [system] **
                   Pss      Pss   Shared  Private   Shared  Private     Heap     Heap     Heap
                 Total    Clean    Dirty    Dirty    Clean    Clean     Size    Alloc     Free
                ------   ------   ------   ------   ------   ------   ------   ------   ------
  Native Heap        0        0        0        0        0        0     6964     3599     2048
  Dalvik Heap     7541        0     4344     7356        0        0    11768    11194      574
 Dalvik Other     3553        0     2792     3448        0        0
        Stack       28        0        8       28        0        0
       Cursor        4        0        0        4        0        0
       Ashmem        5        0       12        0        0        0
    Other dev     4004        0       24     4000        0        4
     .so mmap     3959      684     2500     2280     5468      684
    .apk mmap      173       68        0        0      692       68
    .dex mmap     4358     3068        0        0     9276     3068
   Other mmap       60        0        8        8      244       36
      Unknown     4387        0      508     4380        0        0
        TOTAL    28072     3820    10196    21504    15680     3860    18732    14793     2622

 Objects
               Views:       10         ViewRootImpl:        1
         AppContexts:        8           Activities:        0
              Assets:        3        AssetManagers:        3
       Local Binders:      176        Proxy Binders:      341
    Death Recipients:      141
     OpenSSL Sockets:        0

 SQL
         MEMORY_USED:      473
  PAGECACHE_OVERFLOW:       98          MALLOC_SIZE:       62

 DATABASES
      pgsz     dbsz   Lookaside(b)          cache  Dbname
         4       68             49         7/21/7  /data/data/com.android.providers.settings/databases/settings.db
         4       20             17         0/13/1  /data/system/locksettings.db
         4       20             21        96/14/2  /data/system/locksettings.db (1)
         4       20             21        75/13/2  /data/system/locksettings.db (2)
         4       80             29         4/17/3  /data/system/users/0/accounts.db

Change-Id: Ifd511a7baaa8808f82f39509a5a15c71c41d1bac
2013-05-24 10:47:03 -07:00
Craig Mautner
6d90fed076 Add stackId to RecentTaskInfo
Necessary for multi-stack activity overview.

Fixes bug 9092356.

Change-Id: I3d51a7b5cbca6166017759401bb5d31b4ae96f07
2013-05-22 17:23:25 -07:00
Craig Mautner
9d851de6cc Revert "Add stackId to RecentTaskInfo"
Need to modify the API as well.
This reverts commit b9b9477581ce5f72a679dd1cd9a85e6c8f73944a

Change-Id: I34ea371408930b6b1bf4c53ad9ab8418b0070dbc
2013-05-22 23:14:05 +00:00
Craig Mautner
b9b9477581 Add stackId to RecentTaskInfo
Necessary for multi-stack activity overview.

Fixes bug 9092356.

Change-Id: I91fc68ebf72114224c8e651261101ac14517ff86
2013-05-22 15:03:10 -07:00
Dianne Hackborn
713df150b9 Add app ops for wake locks.
Currently only supports auditing, not disabling.

Change-Id: Ie85f02c29b490d96e073f54d59e165d48c7c00c9
2013-05-20 16:49:46 -07:00
Craig Mautner
b3b36ba138 Resize all changed windows and fix moveTaskToStack
- Add all changing windows to mResizingWindows when an ActivityStack
is resized.

- Stop calling TaskStack.setBounds if the bounds haven't changed.

- Make moving a task from one stack to another work properly.

- Eliminate unused methods and redundant variables in WindowState and
WindowStateAnimator.

Change-Id: I3a950c777bcc50cdeced150d44423d4d0b38af4a
2013-05-20 13:25:14 -07:00
Craig Mautner
f7bfefb598 Reformat wrapped lines and merge sendMessages.
Change-Id: I2834966196c2e6a778fc0cb71e4a56411b24c3f0
2013-05-20 13:25:14 -07:00
Craig Mautner
9bebad9147 Merge "Move sleep from ActivityStack to Supervisor" 2013-05-16 21:02:01 +00:00
Craig Mautner
0eea92c67b Move sleep from ActivityStack to Supervisor
- Move activitySleptLocked, checkReadyForSleepLocked,
mGoingToSleepActivities, mGoingToSleep, mSleepTimeout from
ActivityStack to ActivityStackSupervisor.

- Fix bug that was causing mGoingToSleepActivities to always be
empty.

- Add more debug logging.

Change-Id: Ibd57bd49bf6f468567571b390f3051faaeee1aa1
2013-05-16 13:35:39 -07:00
Craig Mautner
828f094a5f Merge "Limit screenshots to specified activity and stack." 2013-05-15 19:41:06 +00:00
Craig Mautner
76ea224678 Limit screenshots to specified activity and stack.
The screenshots were capturing the entire screen. Now they are limited
to the stack containing the activity.

Add debug for stack states.

Change-Id: I6d47cd37091bfdfd94e7abe89826b7ba8cb69b51
2013-05-15 12:40:10 -07:00
Dianne Hackborn
9a04909325 Merge "Improve watchdog error reporting." 2013-05-14 17:39:16 +00:00
Craig Mautner
86d67a4faa Move Recents into home stack.
Allows Recents activity to occupy a special place in the window/stack
hierarchy.

Change-Id: Ic11c94a075f70c7ba68bd554cd3e5fc6b7c407e7
2013-05-14 10:34:38 -07:00
Dianne Hackborn
fa012b35b8 Improve watchdog error reporting.
We now keep track of all the threads that are stopped, and
print stacks for all of them.  Also more threads are now adding
themselves to the watchdog.

Unfortunately the stack we get from threads is far less useful
than the stacks from the ANR report, because these don't include
any information about the lock the thread is blocked on and what
thread is holding that lock.  For example, here is a test of the
log output from causing a hang in the system process:

W/Watchdog( 5205): *** WATCHDOG KILLING SYSTEM PROCESS: com.android.server.am.ActivityManagerService, main thread
W/Watchdog( 5205): foreground thread stack trace:
W/Watchdog( 5205):     at com.android.server.am.ActivityManagerService.monitor(ActivityManagerService.java:14333)
W/Watchdog( 5205):     at com.android.server.Watchdog$HandlerChecker.run(Watchdog.java:142)
W/Watchdog( 5205):     at android.os.Handler.handleCallback(Handler.java:730)
W/Watchdog( 5205):     at android.os.Handler.dispatchMessage(Handler.java:92)
W/Watchdog( 5205):     at android.os.Looper.loop(Looper.java:137)
W/Watchdog( 5205):     at android.os.HandlerThread.run(HandlerThread.java:61)
W/Watchdog( 5205): main thread stack trace:
W/Watchdog( 5205):     at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:12252)
W/Watchdog( 5205):     at android.app.ContextImpl.sendBroadcastAsUser(ContextImpl.java:1158)
W/Watchdog( 5205):     at com.android.server.DropBoxManagerService$3.handleMessage(DropBoxManagerService.java:161)
W/Watchdog( 5205):     at android.os.Handler.dispatchMessage(Handler.java:99)
W/Watchdog( 5205):     at android.os.Looper.loop(Looper.java:137)
W/Watchdog( 5205):     at com.android.server.ServerThread.initAndLoop(SystemServer.java:1050)
W/Watchdog( 5205):     at com.android.server.SystemServer.init2(SystemServer.java:1125)
W/Watchdog( 5205):     at com.android.server.SystemServer.init1(Native Method)
W/Watchdog( 5205):     at com.android.server.SystemServer.main(SystemServer.java:1116)
W/Watchdog( 5205):     at java.lang.reflect.Method.invokeNative(Native Method)
W/Watchdog( 5205):     at java.lang.reflect.Method.invoke(Method.java:525)
W/Watchdog( 5205):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
W/Watchdog( 5205):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
W/Watchdog( 5205):     at dalvik.system.NativeStart.main(Native Method)
I/Process ( 5205): Sending signal. PID: 5205 SIG: 9

Change-Id: I8ff9892d8d072d8dc599a73de4bdb75e3b1a6e97
2013-05-13 18:01:54 -07:00
Craig Mautner
1602ec2188 Log stack issues and start resize effort.
- Modify Am.java to accept 'stack resize' command.

- Add logging for assigning home stack to non-home task to track down
bug. And maybe fix bug.

- Add template parameter to ArrayList.

Change-Id: Ia73182afc20e9e4430ddadebae034cecb3798eec
2013-05-13 14:39:39 -07:00
Guang Zhu
befa8b5553 Revert "Log stack issues and start resize effort."
Bug: 8935057

This reverts commit b0245edae86b5811ea743c0f4cea095488304b1a.
2013-05-12 23:10:39 -07:00
Craig Mautner
b0245edae8 Log stack issues and start resize effort.
- Modify Am.java to accept 'stack resize' command.

- Add logging for assigning home stack to non-home task to track down
bug. And maybe fix bug.

- Add template parameter to ArrayList.

Change-Id: If904c3ead623464ff5863b7241c68c1b7573bcf4
2013-05-12 10:27:38 -07:00
Christopher Tate
1965b4479d Revert "The default home intent needs CATEGORY_DEFAULT"
This reverts commit 1fea6b374f612ca8cedc17de873526f0f7c42a4e.

Bug 8895796

Change-Id: I80ecf1b718829c25e2a7adae956ebe9493cb3f33
2013-05-10 15:01:02 -07:00
Guang Zhu
6eee6ebc68 Revert "The default home intent needs CATEGORY_DEFAULT"
This reverts commit 1fea6b374f612ca8cedc17de873526f0f7c42a4e.

Bug: 8878319
2013-05-08 22:19:52 -07:00
Christopher Tate
9809e0d2d7 am 6312a196: am cfb09fac: Merge "The default home intent needs CATEGORY_DEFAULT" into jb-mr2-dev
* commit '6312a1968c5e16e193b5b6d3c2f4b92b2de9311d':
  The default home intent needs CATEGORY_DEFAULT
2013-05-08 16:15:30 -07:00
Christopher Tate
cfb09fac73 Merge "The default home intent needs CATEGORY_DEFAULT" into jb-mr2-dev 2013-05-08 23:09:49 +00:00
Christopher Tate
1fea6b374f The default home intent needs CATEGORY_DEFAULT
Because the resolve activity always assumes CATEGORY_DEFAULT, there are odd
cases where apps with malformed intent filters wind up interfering with
users' ability to specify a preferred launcher app.

Bug 8805220

Change-Id: I4c1295dc844e442eec6efd603ce11b673879dd5a
2013-05-07 18:47:38 -07:00
Craig Mautner
525f3d9df6 Do not launch home task if activities remain
When a root activity is finishing and it is supposed to return to
home make sure there are only lower activities waiting to start before
going home.

Fixes bug 8632206.

Various other refactorings for efficiency.

Change-Id: I8bbb9de78d0ea9f45a504cf4bad72c698e9cc3d8
2013-05-07 15:01:46 -07:00
Kenny Root
1d69bad411 resolved conflicts for merge of a98b0ff8 to master
Change-Id: I1f4a952d360c48426e22a7772726b6867cc19771
2013-05-07 10:14:46 -07:00
Kenny Root
add582122d resolved conflicts for merge of 485d7a31 to master
Change-Id: I058e19af8732df44457bdc614ee810a642dc25e4
2013-05-07 09:51:31 -07:00
Craig Mautner
c87a732e75 Merge "Call ensureActivitiesVisibleLocked from supervisor." 2013-05-06 23:13:12 +00:00