218 Commits

Author SHA1 Message Date
Paul Jensen
7fad4eb4b5 Remove dead code, mostly DataStateTracker.
Change-Id: I1433937bffdb29bd42fb1adbfcf0a50ceffac7dd
2015-03-11 10:03:58 -04:00
Jeff Sharkey
3256601f5e Offer to "merge" subscribers for data usage.
There are some cases where multiple subscriber identities (IMSI)
should be treated as "merged together" from a data usage
perspective.  This is done by extending the template used for
matching purposes to support multiple subscribers.

Then, when we query historical usage or set network policies, we
normalize the matching template to merge to any other identities
that should be included.  When normalizing, the "lowest" identity
is always used for equality and storage purposes, which allows
identities to come and go over time.

This change also fixes data usage recording for multi-SIM devices
by passing along the concrete subscriber identity for each network
interface.  Also correctly create default policies for multi-SIM
devices.  This change also drops setPolicyDataEnable() until it can
be wired up to the right underlying NetworkAgent.  (This means we
still bring up the network, and then rely on iptables rules to block
traffic when over the limit, instead of proactively disabling the
connection.)

Bug: 18012787
Change-Id: If6acf32009fdfea2b836f5aff8e2f3e5e0248b4a
2014-12-08 08:42:59 -08:00
Sreeram Ramachandran
21b5ee3f0e Eliminate race conditions in UID-based network filtering.
The previous code retrieved information from the legacy tracker multiple
times for each user query, leading to race conditions where the info
could've changed between the calls.

Refactors the handling of legacy data types in ConnectivityService and
unifies call paths so that APIs that deal with legacy data types
(NetworkInfo and int/networkType) and newer types (such as Network) go
through common code paths, using NetworkState to hold all the necessary
data pieces. This enables follow-on bug fixes to getActiveNetworkInfo().

The changes are limited to public "query" APIs (those that retrieve some
network information or the other). More details about the specific
changes and their rationale can be found in the code review thread.

Bug: 17460017
Change-Id: I656ee7eddf2b8cace5627036452bb5748043406c
2014-11-21 08:07:13 -08:00
Adrian Roos
e542499a30 Add LockSettingsStorage tests
Bug: 18163444
Change-Id: I563276e6d445d43d05bf0d3c633440a8e0109b69
2014-11-10 21:03:12 +00:00
Jeff Sharkey
d634d39c60 Merge "Follow API removal." into lmp-mr1-dev 2014-10-27 22:01:58 +00:00
Jeff Sharkey
cff1d67339 Follow API removal.
Bug: 18118003
Change-Id: Iad73ce748e05ba0660246e8dbb041415c187f792
2014-10-27 14:53:40 -07:00
Jeff Sharkey
036ebd782c Follow ArraySet refactoring.
Bug: 18115729
Change-Id: I2c32965b621b5bb57ff3bde02b00b31b59a5cd6d
2014-10-27 13:51:23 -07:00
Matthew Williams
48a30db75d Fix lock ordering in JobScheduler
BUG: 17625667
Two part clean-up.
1) Don't try to lock in onControllerStateChanged. Do it in the handleMessage
instead where the rest of the locking is. This is sufficient to fix this bug.
2) The other side of the deadlock came b/c we lock when cancelling and calling
stopTrackingJob. Controllers handle their own locking so this isn't
necessary. B/c of a potential race from the controller side, added an explicit
check for the JSS to only run an expired job if it still exists.

Change-Id: Iaeebbc19437eb5b73e3ced3168f1fc13e564a4be
2014-09-23 17:34:46 -07:00
Amith Yamasani
0e8d7d63ba Add some @SystemApi tags for internal user-related APIs
Also added an internal isManagedProfile()

Bug: 17371392
Change-Id: Ibcc26771d954505cbd530192bf4a8a25a8d4cae0
2014-09-03 13:17:28 -07:00
Matthew Williams
d1c06753d0 Implement API review feedback for JobScheduler
BUG: 17005336

Took the opportunity to clean up some back-off logic

Change-Id: Ibc8ae34d1d44dd064ba071e4cbad17872f7e38cf
2014-08-22 16:08:45 -07:00
Narayan Kamath
31fe102d57 Remove a line that was accidentally committed.
Prevents the APK from being installed.

bug: 17153971

Change-Id: Ic53c94dc6f0583371965d5edb0b12248c915214e
2014-08-22 11:37:20 +00:00
Narayan Kamath
d8b54e831d Fix service tests.
Depending on a LOCAL_JAVA_LIBRARY doesn't do anything at runtime
unless the library is manually added to the class path. Since
system server classes (and the system server) can't be instrumented
like a normal app can, we can't really write "real" Instrumentation
Tests for its classes.

Given that, we can just compile the classes under test into the same
jar file as the testcases.

Change-Id: Ie4377bf81b9542ceca938e26ac78e30835fc40bc
2014-08-21 12:31:39 +01:00
Jose Lima
235510e672 Made AlarmClockInfo a nested class in AlarmManager
Bug: 16959028
Change-Id: I150eaaff765d1e214c3621c1bf50162ec0dac8ec
2014-08-14 02:10:41 +00:00
Amith Yamasani
95ab784944 Decouple user limit from guest creation
Allow Guest to be created even if there are N users.
Allow N users to be created even if there are N-1 users
   and a Guest.
Limit number of guests and managed profiles that can
be added.

Added unit tests.

Bug: 15934700
Change-Id: I1a8f0fa38a91d71ef7b2980e05c974244dfc337a
2014-08-13 20:09:20 +00:00
Robert Greenwalt
6831f1d80f Remove dead code 2.
Removing ConnectivityService.NetworkFactory.  This requires disabling
the ConnectivityServiceTest, but that's been broken since we stopped
using NetworkStateTrackers anyway.

Change-Id: I9b86bd37eb9d018c40f60dca5b00d62c36d4e3ad
2014-07-28 14:48:52 -07:00
Matthew Williams
01ac45b6ff Fix JobScheduler race condition
The loading of jobs from disk is now done sychronously.

Bug: 16372824
Change-Id: Ica0592d6de51e89662c9e49ed1eb59209b64356c
2014-07-23 15:33:09 -07:00
Chris Wren
1031c97485 Honor the sort and group keys for notification ranking.
Sort notifications naturally, then move group childen to be next their proxy.
The group proxy is the summary, or if no summary exists, the lowest-ranked
member of the group is chosen as the proxy.

Notifications with a sortKey but no group and placed into a synthetic
group that consists of all notifications from that package and user in
the same priority bucket that also have sortKeys.

Expose a new API for listeners to get the group key for the notificaiton.

Bug: 15190903
Change-Id: I324ba0c394affdabb3588ca2ebafa7cf0acad2af
2014-07-23 09:45:25 -04:00
Chris Wren
cf7ed58308 Revert "Honor the sort and group keys for notification ranking."
This reverts commit df09d4c348f9f2aea10391b27d157d8b71a9e189.

Change-Id: Idbc9ed5c5c83cd0cad5a71872bcc203321a11e9e
2014-07-23 12:41:37 +00:00
Chris Wren
4a24fd3c7b Honor the sort and group keys for notification ranking.
Sort notifications naturally, then move group childen to be next their proxy.
The group proxy is the summary, or if no summary exists, the lowest-ranked
member of the group is chosen as the proxy.

Notifications with a sortKey but no group and placed into a synthetic
group that consists of all notifications from that package and user in
the same priority bucket that also have sortKeys.

Bug: 15190903
Change-Id: I377ed65b9592079446da4a4189f5ab49d28630ec
2014-07-23 10:36:57 +00:00
Sreeram Ramachandran
03666c705d Cleanup: Delete dead code.
Bug: 15413389
Change-Id: I315468832ef18ffc84174e54774ab63b86d284dc
2014-07-22 15:46:34 -07:00
Matthew Williams
900c67fc51 Add job persistance as a setter in the API
Bug: 15936795
Change-Id: I11e5a722bab5838dc151670256ed09dfaa7fdaa7
2014-07-10 16:51:27 -07:00
Adrian Roos
c42a1e1071 Add AlarmClock API to AlarmManager
Adds a new kind of alarm that represents an alarm clock and
a way to query the next scheduled alarm clock.

Deprecates Settings.System.NEXT_ALARM_FORMATTED.

Bug: 14589952
Change-Id: I297eeeff36d07adcda010afac183d0f5ee37dc99
2014-07-10 17:07:36 +00:00
Matthew Williams
43c4f41adb am 8e8c1401: Fix build.
* commit '8e8c140114cb3a4f1cf448c4492c13769738ca12':
  Fix build.
2014-06-11 17:02:53 +00:00
Christopher Tate
0188bee2c5 am d8f71d34: Merge "Out with the old; in with the new" into lmp-preview-dev
* commit 'd8f71d34c3c7fb161a1586de8edb52161c32d672':
  Out with the old; in with the new
2014-06-11 17:02:18 +00:00
Matthew Williams
46919f3583 Fix build.
Two tests were breaking the build.

Change-Id: If424a552d3fedb912fa94870b88c60dc3750b69a
2014-06-10 16:11:08 -07:00
Christopher Tate
7060b04f6d Out with the old; in with the new
Switch to the official "JobScheduler" etc naming.

Bug 14997851

Change-Id: I73a61aaa9af0740c114d08188bd97c52f3ac86b7
2014-06-10 12:51:55 -07:00
Matthew Williams
f53c295ae3 am 3b471117: Merge "Add OnNetworkActive to TaskManager and simplify locking." into lmp-preview-dev
* commit '3b4711176e77640d697e94137e65fa93c8363f5c':
  Add OnNetworkActive to TaskManager and simplify locking.
2014-06-10 14:55:46 +00:00
Matthew Williams
effacfa75b Add OnNetworkActive to TaskManager and simplify locking.
Bug: 14993295
Hooks up a ConnectivityManager.NetworkActiveListener.
    
Previously was using 3 locks where 1 would suffice,
negligible to no performance issues b/c most of the previous locks
were nested.

Added OnNetworkActiveListener so that the ConnectivityController can kick of
tasks when it knows that the network is active.

Fixed some bugs that stopped timecontroller from executing tasks.

Requesting a retry will not add a deadline to that task. However backed-off
tasks are run as soon as they are ready, subject to their constraints.

Added receiver to listen for package removal and user removal, which will
delete any outstanding jobs for that uid.

Change-Id: I4c4523af558b927f19b8a215878fcc7198abb93f
2014-06-09 17:18:11 -07:00
Matthew Williams
38b200fe6c am 1a2f47d4: Merge "Add persistence of tasks for TaskManager & BatteryController" into lmp-preview-dev
* commit '1a2f47d4cdc0ea40dff1b88f7976d64c19d687b1':
  Add persistence of tasks for TaskManager & BatteryController
2014-06-05 20:08:54 +00:00
Matthew Williams
3d86fd2bb9 Add persistence of tasks for TaskManager & BatteryController
Tasks are persisted only if the client has the RECEIVE_BOOT_COMPLETED
permission. This applies to both periodic and one-off tasks.
Write out task as xml, using PersistableBundle for the extras data.
Todo: Add persistable bundle to xml when ag/468207 is merged.

Also added BatteryController logic.

Change-Id: I23eeeb8b3bc6ba155e7fa4ec25857a68ee8b1567
2014-06-05 18:28:43 +00:00
Amith Yamasani
5b5aa4072f Handle saving and restoring ints in application restrictions
Unit tests for restrictions types and proper escaping.

Change-Id: Iac35521faf5798398a89fecbad82fcdd256a4146
2014-06-01 20:17:37 -07:00
Chris Wren
92af372fc6 add tests for ValidateNotificationPeople.getExtraPeople()
Change-Id: Ieb8acce58574c25cccce674b4494f75d96b57125
2014-05-29 16:14:31 +00:00
Sreeram Ramachandran
4ddebf7f5b Fix build.
Change-Id: I5dab09d2d8a9cff56fa17bb4e8c14b365449399b
2014-05-14 03:56:33 -07:00
Paul Jensen
a7b9796345 Get ConnectivityServiceTest building again after 8f80cc8.
Change-Id: I4520011ba2076d8fac1ca234cb9a79c774992671
2014-05-14 03:56:33 -07:00
Narayan Kamath
629f766827 am 80edaa67: am 24c089a8: Fix build.
* commit '80edaa676bd59409f8a82e12c035bee96e653004':
  Fix build.
2014-04-11 10:57:28 +00:00
Narayan Kamath
24c089a8b5 Fix build.
isScreenOn was changed to isInteractive.

Change-Id: I381d0b0ca745b61e64ac6309c2a6307696f52be0
2014-04-11 10:50:43 +00:00
Matthew Williams
c798e4f549 am 4701b51a: am bb87ac7f: DO NOT MERGE: Downgrade expedited to normal on reschedule.
* commit '4701b51af216ce2b6fa9fa508ebba47bf13063c7':
  DO NOT MERGE: Downgrade expedited to normal on reschedule.
2014-03-25 09:57:36 +00:00
Matthew Williams
bb87ac7f97 DO NOT MERGE: Downgrade expedited to normal on reschedule.
bug: 12033540
Expedited was previously tracked by a redundant internal variable, ostensibly
as an optimisation. This variable could differ from the value in the bundle
depending on how the operation is initialised, which led to confusion. Now an
expedited sync will only be treated as such on its first execution.

Change-Id: Ibfc4e9e49b86c82f2364a6ef55f887705a053eb6
2014-03-24 14:42:06 -07:00
Matthew Williams
cde7086b90 Merge "Downgrade expedited to normal on reschedule." 2014-03-21 21:59:07 +00:00
Ashish Sharma
a3f828ba30 Update the tests to deal with the new timestamps in idletimer module.
Change-Id: I1a8368d84ef806f1501b0a1f5e817388a1d10518
2014-03-18 16:38:58 -07:00
John Spurlock
8a985d24ce Tabs -> spaces in frameworks/base.
Change-Id: I5a84e8e93ac99b5ed0212b37bf66efa5e53864be
2014-02-25 09:49:29 -05:00
David Christie
d63b4314b8 Merge "Log history of location requests in LocationManager. -Assists with debugging power issues. Bug: 12824233" 2014-02-13 20:25:01 +00:00
Matthew Williams
6428046767 Downgrade expedited to normal on reschedule.
bug: 12033540
Expedited was previously tracked by a redundant internal variable, ostensibly
as an optimisation. This variable could differ from the value in the bundle
depending on how the operation is initialised, which led to confusion. Now an
expedited sync will only be treated as such on its first execution.

Change-Id: I9979102317aecbe8bc53a36381d4b2782ac131be

Conflicts:
	services/core/java/com/android/server/content/SyncOperation.java
	services/core/java/com/android/server/content/SyncQueue.java
2014-02-06 17:22:08 +00:00
Adam Connors
776c555d95 Extend DeviceOwner concept to accommodate ProfileOwners
ProfileOwners, like DeviceOwners, are Device Admins that have
additional priviledges. ProfileOwners however are scoped per
user.

Change-Id: I1e22c85878e0672121e6ebbe97fca38591f992b2
2014-02-06 10:07:19 +00:00
David Christie
2ff96af24d Log history of location requests in LocationManager.
-Assists with debugging power issues.
Bug: 12824233

Change-Id: Iaaef0dbe00154c7668034a166587671b75d1f3c7
2014-02-03 13:53:10 -08:00
Ying Wang
ba09ada20e Include subdirectory Android.mks.
Change-Id: I6e6bc721dbcf127b52f2a60f255c9fc677d3be29
(cherry picked from commit c459bfea7e7be4343387dee137d4a5be9742fd91)
2014-01-09 20:41:57 +00:00
Ying Wang
c459bfea7e Include subdirectory Android.mks.
Change-Id: I6e6bc721dbcf127b52f2a60f255c9fc677d3be29
2014-01-09 11:02:03 -08:00
Lorenzo Colitti
4598ea4e5e am 263c4788: am 30253d7a: am 2daa0c93: Merge "Add address flags and scope to LinkAddress."
* commit '263c4788dcf45f104f8668fd6621d1a7c39689b9':
  Add address flags and scope to LinkAddress.
2013-12-09 18:34:44 +00:00
Lorenzo Colitti
64483947fd Add address flags and scope to LinkAddress.
This is necessary so that the framework can know whether an IPv6
address is likely to be usable (i.e., if it's global scope and
preferred). Also, it will simplify the address notification
methods in INetworkManagementEventObserver, which currently take
the address, the flags, and the scope as separate arguments.

1. Add flags and scope to the class and update the unit test.
   Use the IFA_F_* and RT_SCOPE_* constants defined by libcore.
   Since most callers don't know about flags and scope, provide
   constructors that default the flags to zero and determine the
   scope from the address. Addresses notified by the kernel will
   have these properly set. Make multicast addresses invalid.
   Update the class documentation.
2. Provide an isSameAddressAs() method that compares only the
   address and prefix information between two LinkAddress
   objects. This is necessary because an interface can't have
   two addresses with the same address/prefix but different
   flags.
3. Update LinkProperties's addLinkAddress and removeLinkAddress
   to identify existing addresses to add/remove using
   isSameAddressAs instead of implicit equals(). Specifically:
   - If addLinkAddress is called with an address that is already
     present, the existing address's flags and scope are updated.
     This allows, for example, an address on an interface to go
     from preferred to deprecated when it expires, without it
     having to be removed and re-added.
   - If removeLinkAddress is called with an address that is
     present but with different flags, it deletes that address
     instead of failing to find a match.
4. Update the INetworkManagementEventObserver address
   notification methods to take just a LinkAddress instead of
   LinkAddress, flags, and scope. While I'm at it, change the
   order of the arguments for consistency with the other
   functions in the interface.

Change-Id: Id8fe0f09a7e8f6bee1ea3b52102178b689a9336e
2013-12-06 13:54:35 +09:00
Lorenzo Colitti
317d15c155 am 4806fdfb: am f226bc60: Merge "Use LinkAddress in address notifications."
* commit '4806fdfbd0fecf91584396fc0f620c97a05ab837':
  Use LinkAddress in address notifications.
2013-12-02 20:53:06 +00:00