Commit Graph

2689 Commits

Author SHA1 Message Date
Dianne Hackborn
0cc4425b3b Start collecting mobile radio activity from the radio.
Hook in to the new radio API to find out when the radio
is active and use that to track its state in batter stats.
We also still have the data being tracked from the kernel's
emulation, and continue to use that if we don't get data from
the radio.

Currently this monitoring is turned off until some issues
in the radio can be fixed that are providing bad data.

Also add a new API to get estimated drain and charge times.

Change-Id: Ifc4900fabb8f848f9cda361dce698664ea75f175
2014-04-24 11:21:30 -07:00
Mark Salyzyn
7837dd43a3 am a5403454: am 936e87e1: am d75a6909: Merge "frameworks: 64 bit compile issues"
* commit 'a54034547dfae92afcde7420d0a492586d3b21b8':
  frameworks: 64 bit compile issues
2014-04-16 19:58:26 +00:00
Mark Salyzyn
a54034547d am 936e87e1: am d75a6909: Merge "frameworks: 64 bit compile issues"
* commit '936e87e12dd1335c6f773705fd0a7edb32bc4385':
  frameworks: 64 bit compile issues
2014-04-16 19:51:10 +00:00
Mark Salyzyn
d75a69095a Merge "frameworks: 64 bit compile issues" 2014-04-16 19:21:44 +00:00
Mark Salyzyn
af9766d226 frameworks: 64 bit compile issues
ToDo: core/jni/com_android_internal_net_NetworkStatsFactory.cpp (merge issues)

Change-Id: I5cf0bbb868e6c18e86c97c6491b6ee983a8ee1a2
2014-04-16 10:43:48 -07:00
Christopher Lane
b6e0448851 Fix build
Change-Id: I20168fb1c29ba6eb695f0d24c6ca512420b2b319
2014-04-14 16:31:27 -07:00
Christopher Lane
6f34914b4c resolved conflicts for merge of 468c0578 to master
Change-Id: I779c49c48980ba7737ee4e7b04a9e4c3e02fca21
2014-04-14 15:14:01 -07:00
Christopher Lane
468c05787e am 62538940: Merge "Add support for custom TXT records in NSD" into klp-modular-dev
* commit '62538940de1755c71c56b0e5d81e12397e5de58a':
  Add support for custom TXT records in NSD
2014-04-14 21:16:27 +00:00
Christopher Lane
0f2cc36572 Add support for custom TXT records in NSD
Change-Id: I8e6dc9852ad4d273c71ad6a63a7fbd28a206806d
2014-04-14 14:10:36 -07:00
Jesse Gunsch
136905ec1b am fa912df1: am 8d31358f: Merge "Merge "NsdService does not clean up after exiting clients"" into klp-modular-dev
* commit 'fa912df1a45742543408ee8de3eb5568bd3410c6':
  Merge "NsdService does not clean up after exiting clients"
2014-04-10 01:07:23 +00:00
Jesse Gunsch
fa912df1a4 am 8d31358f: Merge "Merge "NsdService does not clean up after exiting clients"" into klp-modular-dev
* commit '8d31358fb4f0f948fcfd07399d4247375dc5eea9':
  Merge "NsdService does not clean up after exiting clients"
2014-04-09 23:50:35 +00:00
Dave Platt
5da9a41811 Merge "NsdService does not clean up after exiting clients" 2014-04-08 17:35:57 -07:00
Dave Platt
4cba56df4e Document and enforce "one request per Listener" rule
The API and implementation of NsdManager imply that a separate
Listener is to be used for each active registration or discovery
request.  This isn't formally documented or properly enforced, and
weird and unpredictable things happen if an application uses a
Listener for more than one request at a time.

Update documentation to make this an explicit requirement.

Enforce the restriction when a new request is submitted for
processing; if the Listener is already being used to track an active
request, throw an exception.

Document the fact that apps should unregister services and cancel
service discoveries when the app is stopped (in KitKat and prior
releases, they'll leak if this isn't done.)

Re-order "release the Listener" operation to occur before the Listener
callback, so that the Listener can be reused by the application once
the callback has been entered - this eliminates a race condition.
Document this.

Pass 2: typos, added documentation about API level, changed to using
an explicitly defined return value for "busy listener".

Bug: 13512512
Change-Id: Ic164110759204b27d8a14376777b593ebe1865fa
2014-03-31 13:43:45 -07:00
Dianne Hackborn
87522f50e1 Battery stats: wake locks, radio active, cleanup.
- Improve wake lock work source updates to also update the current
  history tag, in case the new work source gets recorded in the
  history.

- Fix bug in recording radio active time that was not distributing
  any time to apps.

- No longer hold a wake lock while dispatching data conn active call,
  since it comes with its own timestamp.

- Fix issue where the top app was not being cleared while the screen
  was off.

- Remove obsolete STATS_LAST stats type.

- Fix bug that was not clearing the total run time when resetting
  the stats.

Change-Id: Iabe17a9edf34f762374ae09fcffb8a819cf72e30
2014-03-24 13:36:46 -07:00
Dave Platt
9767de0513 am eac88aae: am 1e4cee76: am 21a9e3d0: am 17e7c407: am 98a027a5: Merge "Harden NsdManager against null-dereference crashes" into klp-dev
* commit 'eac88aae957c72e02ea9f2747ffc290829bcacb1':
  Harden NsdManager against null-dereference crashes
2014-03-19 01:30:23 +00:00
Dave Platt
1e4cee76b0 am 21a9e3d0: am 17e7c407: am 98a027a5: Merge "Harden NsdManager against null-dereference crashes" into klp-dev
* commit '21a9e3d022728915da10342efbb9b95866d86ae7':
  Harden NsdManager against null-dereference crashes
2014-03-19 01:07:46 +00:00
Dave Platt
21a9e3d022 am 17e7c407: am 98a027a5: Merge "Harden NsdManager against null-dereference crashes" into klp-dev
* commit '17e7c4076b8f1617ed397dae570e9d5240cd9c1b':
  Harden NsdManager against null-dereference crashes
2014-03-19 00:59:47 +00:00
Dave Platt
1da390ede1 am 17e7c407: am 98a027a5: Merge "Harden NsdManager against null-dereference crashes" into klp-dev
* commit '17e7c4076b8f1617ed397dae570e9d5240cd9c1b':
  Harden NsdManager against null-dereference crashes
2014-03-19 00:59:44 +00:00
Dave Platt
cf4709a694 am cb1254f1: am 20caa09c: am 21384faa: am 694f219c: Merge "NsdService does not clean up after exiting clients"
* commit 'cb1254f1abc44b82e2a9da0d9a73230eb46e129e':
  NsdService does not clean up after exiting clients
2014-03-14 13:13:38 +00:00
Dave Platt
febcdae1ba Harden NsdManager against null-dereference crashes
Due to race conditions or programming errors, the NsdManager
can attempt to process an asynchronous status message (and issue
a callback to the listener) after the listener has already been
removed from the NsdManager state.  This causes dereferencing of
null objects, and a crash.

Split out the three async-queue message cases:  these are ones
in which message.arg2 does not hold an NsdManager array index
and the code should not interpret this field as if it were.

Add an explicit check for "null listener" (the array index in the
message has already been released), log a warning, and exit early.

Safeguard accesses to the "NSD service type" string from a possibly
null) NsdServiceInfo object... return a constant "?" string rather
than crashing.

Bug: 9016259

Manual cherrypick of commit b1fbb14122a99c62363a949dd634294f5e887ef,
change-ID I7a6ff6842cf035cefbafe2a023ae1fd43734081e in master.

Change-Id: I8d9b7a1763d47d061a0f46b3cb453de4bdb8c2ed
2014-03-13 17:27:03 -07:00
Dave Platt
20caa09c61 am 21384faa: am 694f219c: Merge "NsdService does not clean up after exiting clients"
* commit '21384faa2b3da619a54b35f15936c00593b30694':
  NsdService does not clean up after exiting clients
2014-03-13 23:42:03 +00:00
Dave Platt
694f219c26 Merge "NsdService does not clean up after exiting clients" 2014-03-13 23:35:15 +00:00
Dave Platt
feff2af5c0 NsdService does not clean up after exiting clients
When a client of the NsdService exits, NsdService should
clean up the requests it has sent to the mDNS daemon:
cancel any pending resource-discovery and resource-resolution
queries, and remove any services registered by this client.

If this isn't done, several bad things happen. The daemon will
continue to run unnecessarily, will report service discoveries
that can't be forwarded on to the client, and will continue to
advertise service ports for an application which is no longer
running until the device is rebooted (mDNS pollution).

Bug: 9801184
Change-Id: I0aa7311480322aefcff16f902fbbf34f50985d38
2014-03-13 23:16:30 +00:00
Dave Platt
1ce9dccb13 am bf588bda: am b4a78de4: am 7d8262cb: am 6948cb40: Merge "Harden NsdManager against null-dereference crashes"
* commit 'bf588bda2c4dc98919439946e905e98ad4d352dd':
  Harden NsdManager against null-dereference crashes
2014-03-04 23:51:51 +00:00
Dave Platt
b4a78de40f am 7d8262cb: am 6948cb40: Merge "Harden NsdManager against null-dereference crashes"
* commit '7d8262cb554c41892794f23b92e01b52458288bb':
  Harden NsdManager against null-dereference crashes
2014-03-04 22:02:55 +00:00
Dave Platt
6948cb4073 Merge "Harden NsdManager against null-dereference crashes" 2014-03-04 21:55:56 +00:00
Dave Platt
a6dc93df7b Harden NsdManager against null-dereference crashes
Due to race conditions or programming errors, the NsdManager
can attempt to process an asynchronous status message (and issue
a callback to the listener) after the listener has already been
removed from the NsdManager state.  This causes dereferencing of
null objects, and a crash.

Split out the three async-queue message cases:  these are ones
in which message.arg2 does not hold an NsdManager array index
and the code should not interpret this field as if it were.

Add an explicit check for "null listener" (the array index in the
message has already been released), log a warning, and exit early.

Safeguard accesses to the "NSD service type" string from a (possibly
null) NsdServiceInfo object... return a constant "?" string rather
than crashing.

Bug: 9016259

Change-Id: I40aabdfc65d86fdd0eaac7a1e7e56e6ff69796cf
2014-03-04 13:25:02 -08:00
Dianne Hackborn
9cd0fea519 Hold a wake lock while dispatching network activity events.
Also add new API for determining whether the current data network
is active, and thus better scheduling network operations.  This
API is designed to not be tied to a mobile network -- regardless
of the network, apps can use it to determine whether they should
initiate activity or wait.  On non-mobile networks, it simply always
reports as the network being active.

This changed involved reworking how the idle timers are done so
that we only register an idle timer with the current default
network.  This way, we can know whether we currently expect to
get callbacks about the network being active, or should just always
report that it is active.  (Ultimately we need to be getting this
radio active data from the radio itself.)

Change-Id: Iaf6cc91a960d7542a70b72f87a7db26d12c4ea8e
2014-02-28 15:19:39 -08:00
Dianne Hackborn
4cba7916fa Collect per-uid mobile radio usage.
We now compute radio active time per application, by distributing
the active time across all applications each time the radio goes
down, weighting it by the number of packets transferred.

Per-app radio power use is now computed using this radio active
time.

This also gives us a new metric "ms per packet", which give an
idea of how effectively an application is using the radio.  This
is collected and reported as a new set of stats in the human-
readable checkin.  (It can be computed from the raw checkin data).

Also improve sync reporting to include the sync source as used
in wake locks, not just the component name.

Change-Id: I0b0185fadd1e47ae749090ed36728ab78ac24c5e
2014-02-26 15:53:44 -08:00
Dianne Hackborn
fe6e53b48c Improve how battery stats collects network stats.
This optimizes the path for battery stats to collect
per-uid network usage.  It now collects wifi and mobile
usage separately, with a path that allows it to recycle
all data structures and filter out stats it isn't
interested in before they come back to java.

This is setting us up for the actual goal, to collect
mobile stats independently each time the mobile radio
goes down, allowing us to distribute mobile radio usage
across uids based on the number of packets they transferred
during a session.

Change-Id: I21a0f517cf087ea5aa8b8dd535e20b46e361a52b
2014-02-24 11:35:20 -08:00
Amith Yamasani
4181c2f47e am 59e808f5: Move some system services to separate directories
* commit '59e808f5491ded962445be7bff490e1fb32480ab':
  Move some system services to separate directories
2013-12-19 23:30:35 +00:00
Amith Yamasani
59e808f549 Move some system services to separate directories
Refactored the directory structure so that services can be optionally
excluded. This is step 1. Will be followed by another change that makes
it possible to remove services from the build.

Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
2013-12-19 15:25:37 -08:00
Kenny Root
83711c2ea9 resolved conflicts for merge of e0b14ea7 to master
Change-Id: Ie018d3e2eba1eb2d655c153880e1951b68c2bd51
2013-12-13 15:59:51 -08:00
Kenny Root
8e53441de7 Merge "Use java.util.Objects instead on internal API" 2013-12-13 22:12:52 +00:00
Kenny Root
9254db342a Use java.util.Objects instead on internal API
Not needed since java.util.Objects implements all the needed
functionality.

Change-Id: Icd31d49a9801d1705427f028e9ac927d58e7d34c
2013-12-13 13:40:30 -08:00
Kristian Monsen
57dfa66b95 resolved conflicts for merge of 800d4d72 to master
Change-Id: Ib1defc447745e5406d64c0d99c962832c79d15ef
2013-12-12 23:59:37 -08:00
Kristian Monsen
fb4d3e7a4a Fix one and hide the other warnings from core/jni
Most of the warnings are unused parameter from skia functions.

Change-Id: I9df57718d117c26b96163f751ccb056ca86ac072
2013-12-11 21:58:53 -08:00
John Spurlock
84ae0f4bc6 Remove unused imports from frameworks/base.
Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
2013-11-20 11:31:47 -05:00
John Huang
84d14ab411 am c4f535bd: am 299e011e: am 54ca9066: Merge "Get rid of a race in NsdService in stopResolveService and getAddrInfo" into klp-dev
* commit 'c4f535bddac2491aa0e354a609fcbf7c49276295':
  Get rid of a race in NsdService in stopResolveService and getAddrInfo
2013-11-13 12:19:53 -08:00
Vinit Deshapnde
4429e878fb Get rid of a race in NsdService in stopResolveService and getAddrInfo
Both requests are made using same id; and there is a chance that
stopResolve() is not fully completed when getAddrInfo() is issued. That
results getAddrInfo() failure, because both are using same requestId.

This change fixes this problem by creating a new unique id to call
getAddrInfo() with.

Bug: 11597153
Change-Id: I56bd78740e8a40bd31c52705dc797486aff53a50
2013-11-12 15:36:37 -08:00
Ashish Sharma
cbfd66262e Fix the race condition for b/11458382
Change-Id: I862da57a70283a2afd5d67751aec87fb808760d2
2013-11-04 18:51:12 -08:00
Dianne Hackborn
9a101919d9 Fix issue #11113111: dumpsys activity service is broken
Change-Id: Ie02d27b377c562085ef7eb5dea144ce2f382c11d
2013-10-09 14:34:04 -07:00
The Android Automerger
29f3254e9f merge in klp-release history after reset to klp-dev 2013-10-09 06:01:14 -07:00
Ed Heyl
1c35869939 merge in KQS81M 2013-10-08 15:40:08 -07:00
The Android Automerger
3daf65d9fb merge in klp-release history after reset to klp-dev 2013-09-22 10:51:11 -07:00
Amith Yamasani
109acc1b15 Use a separate thread for services that do NTP lookup
Some services do periodic network time lookups and can wedge the other operations on
BackgroundThread and IO Thread, causing Watchdog to kill the runtime. So best to put
those handlers on separate threads.

Going forward, should convert NTP lookups to be async with callbacks.

Bug: 10646480
Change-Id: I8c7ba6052cb3539575712c2099a706b14ff60196
2013-09-19 14:15:55 -07:00
Amith Yamasani
e91f98c61d Use a separate thread for services that do NTP lookup
Some services do periodic network time lookups and can wedge the other operations on
BackgroundThread and IO Thread, causing Watchdog to kill the runtime. So best to put
those handlers on separate threads.

Going forward, should convert NTP lookups to be async with callbacks.

Bug: 10646480
Change-Id: I8c7ba6052cb3539575712c2099a706b14ff60196
2013-09-19 10:57:16 -07:00
Jeff Sharkey
73c92d5077 Request all tethering interfaces, fix corruption.
netd now tracks statistics for tethered interfaces across tethering
sessions, so switch to asking for all tethering stats.  (Currently
we're double-counting all tethering data, ever since it started
tracking across sessions.)

Also catch OOME to handle corrupt stats files, which we then dump to
DropBox and then start over.

Bug: 5868832, 9796109
Change-Id: I2eb2a1bf01b993dd198597d770fe0e022466c6b9
2013-09-10 21:03:30 -07:00
Lorenzo Colitti
e79657d5fb Add a simple test for NetworkManagementService.
For now, this only tests network observers. It works by starting
NetworkManagementService with a fake netd socket, feeding it
inputs, and seeing if the appropriate observer methods are
called.

Bug: 10232006
Change-Id: I827681575642a4ee13ae48b81272521544b676bd
2013-08-23 18:30:19 +09:00
Colin Cross
c5697c326e replace cutils/logger.h with log/logger.h
and remove it from files that don't use it.

Change-Id: Ieb44a3f1f75c2d2b277f0d01ca926a92211e3fe6
2013-07-24 23:44:45 +00:00