Commit Graph

3312 Commits

Author SHA1 Message Date
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
Christopher Tate
9fa19313dd Batch alarms to reduce device wakeups
The default Alarm Manager behavior for KLP+ apps will be to aggressively
coalesce alarms, trading exact timeliness of delivery for minimizing the
number of alarm-delivery points, especially wakeup points.

There is new API in AlarmManager, setExact() and setExactRepeating(),
for use by apps that absolutely *must* get their alarms at a specific
point in time.

Bug 9532215

Change-Id: I40b4eea90220211cc958172d2629664b921ff051
2013-07-17 14:37:12 -07:00
The Android Open Source Project
926bb66cc1 am c1cada76: (-s ours) Reconcile with jb-mr2-zeroday-release - do not merge
* commit 'c1cada76c3df3851eb980f728fcca872ea6eecd8':
2013-07-15 09:37:54 -07:00
The Android Open Source Project
c1cada76c3 Reconcile with jb-mr2-zeroday-release - do not merge
Change-Id: Ib08f5c3c72f9d6eee571e7f9dff130abadffbbec
2013-07-15 09:32:49 -07:00
The Android Automerger
cea09b99db merge in jb-mr2-zeroday-release history after reset to jb-mr2-dev 2013-07-15 08:19:11 -07:00
The Android Open Source Project
414c054cac am 14d0cae1: (-s ours) Reconcile with jb-mr2-zeroday-release - do not merge
* commit '14d0cae1118d8d156f710bcdc804c05f92bc158b':
  Recover from corrupt network stats.
2013-07-12 07:30:00 -07:00
The Android Open Source Project
14d0cae111 Reconcile with jb-mr2-zeroday-release - do not merge
Change-Id: Ic45c05e30f974890e8c5320393f95adaf0d0a79f
2013-07-12 07:27:43 -07:00
Jeff Sharkey
c64874ae50 Recover from corrupt network stats.
When encountering corrupt stats, throw as IOException to allow
recovery at a higher level.

Bug: 9794832
Change-Id: I38d000b3bd8a4c99389c40a87ee0699efb6e9049
2013-07-11 17:22:41 -07:00
Jeff Sharkey
d4a94ed78a am dabaef4c: am f8b69275: am f20d6b32: Recover from corrupt network stats.
* commit 'dabaef4ceb25b6ca9403f1b744225fb5a9fd97b3':
  Recover from corrupt network stats.
2013-07-11 14:23:28 -07:00
Jeff Sharkey
dabaef4ceb am f8b69275: am f20d6b32: Recover from corrupt network stats.
* commit 'f8b692754f7739e11c8438ab59c0760194cfacc5':
  Recover from corrupt network stats.
2013-07-11 11:41:24 -07:00
Jeff Sharkey
f20d6b326f Recover from corrupt network stats.
When encountering corrupt stats, throw as IOException to allow
recovery at a higher level.

Bug: 9794832
Change-Id: I38d000b3bd8a4c99389c40a87ee0699efb6e9049
2013-07-11 11:18:53 -07:00
Wink Saville
7861a9e15c Merge "Fix an NPE in NsdManager" 2013-07-01 16:53:31 +00:00
Elliott Hughes
68a7eb9f3b am fa024d1d: resolved conflicts for merge of c9517611 to jb-mr2-dev-plus-aosp
* commit 'fa024d1d0a2c4cdeb5deb691efa56fcaf0632827':
  Switch frameworks/base over from @hidden Charsets to public StandardCharsets.
2013-06-28 16:53:27 -07:00
Elliott Hughes
fa024d1d0a resolved conflicts for merge of c9517611 to jb-mr2-dev-plus-aosp
Change-Id: I3349f8d2e6715171e2677c1385122ceb2810c1f6
2013-06-28 16:50:13 -07:00
Elliott Hughes
c951761164 resolved conflicts for merge of fc136843 to stage-aosp-master
Change-Id: I4791f0ffa324a313b8390fbde6d8f82f716ecf74
2013-06-28 16:41:19 -07:00
Elliott Hughes
fc136843fc Merge "Switch frameworks/base over from @hidden Charsets to public StandardCharsets." 2013-06-28 23:31:35 +00:00
Elliott Hughes
aa40ac667e Switch frameworks/base over from @hidden Charsets to public StandardCharsets.
Bug: 3484927
Change-Id: I5d136d2ee629588538602766a182ae14ce5fc63c
2013-06-28 16:24:48 -07:00
Vinit Deshapnde
930a8513db Fix an NPE in NsdManager
The NPE happens because NSD Manager doesn't always notify with a 'good'
notification for SERVICE_FOUND. It can get in a situation where a
SERVICE_FOUND is recevied from MDnsDs demon when processing StopDiscovery
on the messaging thread. When that happens, NsdService sends a message
to NsdManager with an invalid index of the listener.

The fix is twofold. First, we fix NsdService to not generate a message if
it doesn't have a good listener index. And second, we also fix NsdManager
to watch for invalid index.

Change-Id: I3d63af10bded13c72e8e437a1ebf74a666760432
2013-06-25 19:45:03 -07:00
The Android Open Source Project
316ee71f18 am d163b18c: (-s ours) Reconcile with jb-mr2-release jb-mr2-zeroday-release - do not merge
* commit 'd163b18c155aa5bf34730bdc2467d3e759b4a269':
  Import translations. DO NOT MERGE
  Do not allow 0 or smaller periodicity for syncs. b/9295383
  Save Notification large icon to extras.
  Workaround possible use after delete
  Do not block notifications or toasts for SYSTEM_UID or PHONE_UID.
  Don't orphan footers with transient state Bug #8725945
  Avoid logging sensitive data.
2013-06-11 15:37:06 -07:00
The Android Open Source Project
d163b18c15 Reconcile with jb-mr2-release jb-mr2-zeroday-release - do not merge
Change-Id: I7100db02d39d7d91bb3c2b8eea070a48a8f7c139
2013-06-11 14:56:52 -07:00
Jeff Sharkey
0608373482 Avoid logging sensitive data.
When building commands to send across NativeDaemonConnector, scrub
sensitive arguments to prevent them from being logged.

Bug: 8609800
Change-Id: I84b16791749264a010f7e59f9918f68d71bac6b9
2013-06-10 15:17:32 -07:00
Kenny Root
c4af47ebf9 resolved conflicts for merge of e96a8207 to master
Change-Id: I90801b35ed0c00078a47faadc7fbb05d2e5fe381
2013-06-10 11:09:28 -07:00
Jeff Sharkey
682fa4bd0b Avoid logging sensitive data.
When building commands to send across NativeDaemonConnector, scrub
sensitive arguments to prevent them from being logged.

Bug: 8609800
Change-Id: I84b16791749264a010f7e59f9918f68d71bac6b9
2013-06-07 15:09:32 -07:00
Robert Greenwalt
a6f2ecd2c0 am 8c04cd04: am 341666c4: Merge "Fix sync problem in NsdManager" into jb-mr2-dev
* commit '8c04cd041dfc96ef4af662d50aad63d998314d27':
  Fix sync problem in NsdManager
2013-05-06 16:20:30 -07:00
Dianne Hackborn
f7c56ef9dd Start combining threads in system process.
This introduces four generic thread that services can
use in the system process:

- Background: part of the framework for all processes, for
work that is purely background (no timing constraint).
- UI: for time-critical display of UI.
- Foreground: normal foreground work.
- IO: performing IO operations.

I went through and moved services into these threads in the
places I felt relatively comfortable about understanding what
they are doing.  There are still a bunch more we need to look
at -- lots of networking stuff left, 3 or so different native
daemon connectors which I didn't know how much would block,
audio stuff, etc.

Also updated Watchdog to be aware of and check these new
threads, with a new API for other threads to also participate
in this checking.

Change-Id: Ie2f11061cebde5f018d7383b3a910fbbd11d5e11
2013-05-02 17:42:40 -07:00
Robert Greenwalt
7aa7bb4dfb Fix sync problem in NsdManager
The NsdManager init was thinking it was done before the AsyncChannel
was fully setup and if the setup were slow and the app fast, the app
could make calls to the NsdManager that it wasn't ready for.

bug:8545006
Change-Id: I2cb2a7c0a1c7f3d2b81ac0f66d37346e6d2d720d
2013-05-02 15:45:32 -07:00
Irfan Sheriff
54824c9538 Add support for setMiracastMode
Usage is setMiracastMode(WifiP2pManager.MIRACAST_SOURCE) or
setMiracastMode(WifiP2pManager.MIRACAST_SINK) as an example.
Only available for internal use and can be called as long as
driver is active. P2p connection is not needed for it to be
called

Bug: 8493089
Change-Id: I1f87eaf3311212aae980077de26c05651a8cc811
2013-03-28 10:27:17 -07:00
Jeff Sharkey
39fb9cd9c2 Update TrafficStats docs to reflect behavior.
Bug: 8399623
Change-Id: If9ccd305e8a077f318a09ac1bb160b8efbf903aa
2013-03-26 13:46:09 -07:00