• Home
  • History
  • Annotate
  • only in /frameworks/base/core/tests/coretests/src/android/net/
History log of /frameworks/base/core/tests/coretests/src/android/net/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c87ec500e3cb5e89bc6eab6a3dad872d256f1f5c 12-Apr-2017 Lorenzo Colitti <lorenzo@google.com> Move some NetworkStats tests to tests/net.

This groups them together with the rest of the networking unit
tests. It also speeds up compile/test cycles ("runtest -x" of one
file goes from 1m15s to 30s).

Bug: 33681750
Test: runtest frameworks-net passes on internal tree
Merged-In: I53cb0c51355fe4b4b30e451fa09fbbf58da39efd
Change-Id: I5ae5dbf74c94feb0fe3759681e5e6d6fba62fa32

(cherry picked from commit c86013be936f36c61fa0cdfad95141f6de3c6ef7)
etworkStatsHistoryTest.java
etworkStatsTest.java
b1a0139590448d706c778d22891efe80b05f11f2 14-Apr-2017 Jeremy Joslin <jjoslin@google.com> Remove the recommendation request impl and test code.

Removing most of the platform side request recommendation code and
its tests.

Test: adb shell am instrument -e class android.net.NetworkRecommendationProviderTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
Bug: 37357264
Change-Id: I36e592c5c82c38aa2174a51cf02c6e9825ef4f11
etworkRecommendationProviderTest.java
ecommendationRequestTest.java
631ea26c492da8673a1ee5f96b4d50eb4b27969d 08-Mar-2017 Paul Duffin <paulduffin@google.com> Merge "Replace usages of littlemock with mockito" am: 0a11c83016 am: b29311bbba
am: 48a78f4852

Change-Id: I826f98625ce3fbc57f71d72bc0bfdabd3ff92b06
b29311bbba54f6bb1de42d7c7914fdd104ca225b 08-Mar-2017 Paul Duffin <paulduffin@google.com> Merge "Replace usages of littlemock with mockito"
am: 0a11c83016

Change-Id: I1456ae3d07d396080a817de01796eefc71230981
9df5d4f715f2ba5670753b78a236ff98eff34cfb 06-Mar-2017 Paul Duffin <paulduffin@google.com> Replace usages of littlemock with mockito

Littlemock appears to have been created as an alternative to
Mockito that would work on Android. Given that Mockito does
now work on Android and Littlemock has had no activity since
Aug 2012 it seems prudent to switch over to use Mockito instead.

https://code.google.com/archive/p/littlemock/

This is being done as part of the work to upgrade Mockito.

Bug: 32912773
Test: Build and install affected APKs, test using am instrument
Change-Id: Id0e57880ea66c5681b664bbfb534c96410544665
SLSessionCacheTest.java
f621bc973380bb87013c503f7daaf25fd0b94721 16-Feb-2017 Jeremy Joslin <jjoslin@google.com> Move NetworkScorerAppManager into com.android.server.

NetworkScorerAppManager is only used internally by the
NetworkScoreService and no longer needs to be part of core.
Extracted its inner class, NetworkScorerAppData, into a top-level
class and left it in android.net as it's used as part of the
NetworkScoreManager API.

Test: runtest frameworks-services -c com.android.server.NetworkScorerAppManagerTest
Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
Bug: 35095406
Change-Id: I201f081e05d0a909b4ae3142b63afc3e21548f77
etworkScorerAppManagerTest.java
a6be43461e586f3005264d4a4f0989b39aa7971d 24-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Enforce the calling permissions within NetworkRecommendationProvider."
8160544d585467654803ab76ec64d14b5b7ac33e 22-Feb-2017 Jeremy Joslin <jjoslin@google.com> Enforce the calling permissions within NetworkRecommendationProvider.

Had to add a new ctor to get a Context instance and deprecate the
single arg ctor. Since this was being done I also took the opportunity
to replace the Handler param with an Executor which is more
appropriate in this case.

I'll remove the deprecated ctor once I've updated all of its
call points.

Test: adb shell am instrument -e class android.net.NetworkRecommendationProviderTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Bug: 34518584
Change-Id: Ic2441655d69838ae9caa7d598e876dec36e15363
etworkRecommendationProviderTest.java
bc9a8e6f5ba404261c6a7a7e49a529661e05e910 03-Feb-2017 Amin Shaikh <ashaikh@google.com> Add "Use open Wi-Fi automatically" setting.

- Add constant in NetworkScoreManager for the meta-data key required
for NetworkRecommendationProviders to specify which package provides
this feature.
- Add Setting to specify which package is enabled for providing this
feature.

Bug: 34773276
Test: make
Change-Id: I3f8209c21b8b219c242650f97ba407b5985a5250
etworkScorerAppManagerTest.java
6e820805137b139a8514577e5435d58f8f10051c 18-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move Badging from ScoredNetwork to NetworkingBadging."
fde900dbbd8c2d2863274804db287deb0af9ccc4 15-Feb-2017 Stephen Chen <stewchen@google.com> Fail safely on invalid ScanResults when creating NetworkKey

Added tests for NetworkKey#createFromScanResult

Bug: 34671341
Test: runtest --path
frameworks/base/core/tests/coretests/src/android/net/NetworkKeyTest.java
runtest --path
frameworks/base/services/tests/servicestests/src/com/android/server/NetworkScoreServiceTest.java

Change-Id: Ideac1615917649cd3934421228a82aeed37e7ad1
etworkKeyTest.java
699deaf6103d182dbd291ca2b420f30b439753d4 14-Feb-2017 Sundeep Ghuman <sghuman@google.com> Move Badging from ScoredNetwork to NetworkingBadging.

This is a non-functional refactor. The old enums will be removed once
ag/35323372 is addressed.

Bug: 35114358
Test: Ran existing tests (see files touched).
Change-Id: I08fd8c7964463b5908ce361e61f8fe811d0ff6f3
coredNetworkTest.java
bdd9ac23248a3fa746fac11a39a965af0fca5c0c 06-Feb-2017 Jeremy Joslin <jjoslin@google.com> Default the lastSelectetNetworkId to -1

Test: adb shell am instrument -e class android.net.RecommendationRequestTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Bug: 35045563
Change-Id: I04d71f2072d8a5a706f05905b580dd7af77d13d8
ecommendationRequestTest.java
37e877beccb9f3edd2a1dd33e01a76a7cd71c711 02-Feb-2017 Jeremy Joslin <jjoslin@google.com> Cache NetworkScorerAppData in the ScoringServiceConnection.

Store the entire NetworkScorerAppData instance in the
ScoringServiceConnection instead of just most of its fields.

Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
Bug: 34773276
Change-Id: Id2ed7c431dee9895e85e1966903ac919f1704eba
etworkScorerAppManagerTest.java
ba242734015ec89d434289c0905d0cc977c0a414 25-Jan-2017 Jeremy Joslin <jjoslin@google.com> Implemented network score cache filtering.

NetworkScoreCaches registered with a filter type will now only
receive updates that match their filter criteria.

Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
Bug: 34127291
Change-Id: I3d5e6e57b6682707b0734259a2530658ad75dbb7
etworkKeyTest.java
746a4de69266e280c1c637e0da5f59fd32b13ef0 21-Jan-2017 Amin Shaikh <ashaikh@google.com> Merge "Add additional fields to RecommendationRequest." am: b8f0e69ef0 am: ac05acad45
am: b7b9c6f889

Change-Id: Ieade1643bfc4c9039d6d4f702bf3ec527679ce74
b7b9c6f889ac16a6518f7e816f1ac647fc310ec8 21-Jan-2017 Amin Shaikh <ashaikh@google.com> Merge "Add additional fields to RecommendationRequest." am: b8f0e69ef0
am: ac05acad45

Change-Id: I1062446bbd085b794bfe61843e670dc5af689d32
ac05acad456ede60d532d5ac40d1b3eecc5bc559 21-Jan-2017 Amin Shaikh <ashaikh@google.com> Merge "Add additional fields to RecommendationRequest."
am: b8f0e69ef0

Change-Id: I9a50c8aca36cf740abbc62af6879b4e6ea736855
b50ade8bb0737ef9677c7e8fac82338dde8d68c7 20-Jan-2017 Amin Shaikh <ashaikh@google.com> Add additional fields to RecommendationRequest.

- Add networkId and timestamp for the last user selected network

Bug: 34467596
Test: runtest --path core/tests/coretests/src/android/net/RecommendationRequestTest.java
Change-Id: Ic81c1beede1a643cd428b6e5c57ed430a6b1ccc0
Merged-In: Ic81c1beede1a643cd428b6e5c57ed430a6b1ccc0
ecommendationRequestTest.java
261b5c4c49a10d8e0e1feed2774292232e2ffec6 20-Jan-2017 Jeremy Joslin <jjoslin@google.com> Merge "Pass more data through the recommendation request." am: 00514f1dc0 am: ddfbe07e96
am: ec630d0bf0

Change-Id: I20ce25072262a7aef36b9fdaa317210283ca495f
ec630d0bf06ee1a1b3f9bfe9736d76d41483e4a3 20-Jan-2017 Jeremy Joslin <jjoslin@google.com> Merge "Pass more data through the recommendation request." am: 00514f1dc0
am: ddfbe07e96

Change-Id: Ib831f420dd6ca976f9ce72476028b18ea61e2211
d47e6e90675335d0ca909143750434a6dd5312e8 20-Jan-2017 Amin Shaikh <ashaikh@google.com> Add additional fields to RecommendationRequest.

- Add networkId and timestamp for the last user selected network

Bug: 34467596
Test: runtest --path core/tests/coretests/src/android/net/RecommendationRequestTest.java
Change-Id: Ic81c1beede1a643cd428b6e5c57ed430a6b1ccc0
ecommendationRequestTest.java
ddfbe07e96abdfe0dc16fee6b905de6b5341bb10 20-Jan-2017 Jeremy Joslin <jjoslin@google.com> Merge "Pass more data through the recommendation request."
am: 00514f1dc0

Change-Id: I97e11e876bcb7ccdb55a333b31f9970ae5edd001
122957b0b0585068d82934afa2b02f8f0ad8a584 18-Jan-2017 Jeremy Joslin <jjoslin@google.com> Pass more data through the recommendation request.

Expanding the API so it can accept the WiFi config of the currently
connected network (if any) and the set of connectable WiFi
configurations. Also renamed currentRecommendedWifiConfig to
defaultWifiConfig so the name was more representative of the
parameter's purpose and added more documentation throughout.

Test: adb shell am instrument -e class android.net.RecommendationRequestTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: adb shell am instrument -w com.android.networkrecommendation.tests/android.support.test.runner.AndroidJUnitRunner
Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
Bug: 34387385
Change-Id: Ib8c3cab8f92b5c9da806070d32412f688690f82f
Merged-In: I1089b70303b0396def7e6bf3737fdc67e40c9dcd
ecommendationRequestTest.java
3ef77d3d0c0330288fbd5dad0618743a59a61123 19-Jan-2017 Jeremy Joslin <jjoslin@google.com> Remove NetworkScorerAppManager.isCallerActiveScorer().

The method is no longer used.

Test: adb shell am instrument -e class android.net.NetworkScorerAppManagerTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Bug: 33781558
Change-Id: I2b4acd54a747bd480a4a91bac424d39e264ea882
etworkScorerAppManagerTest.java
26a45e5b13e9d300e28c524d71675c29c50cd162 18-Jan-2017 Jeremy Joslin <jjoslin@google.com> Pass more data through the recommendation request.

Expanding the API so it can accept the WiFi config of the currently
connected network (if any) and the set of connectable WiFi
configurations. Also renamed currentRecommendedWifiConfig to
defaultWifiConfig so the name was more representative of the
parameter's purpose and added more documentation throughout.

Test: adb shell am instrument -e class android.net.RecommendationRequestTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: adb shell am instrument -w com.android.networkrecommendation.tests/android.support.test.runner.AndroidJUnitRunner
Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
Bug: 34387385
Change-Id: I1089b70303b0396def7e6bf3737fdc67e40c9dcd
ecommendationRequestTest.java
c926b7399a041fb82f15baa889bbf7ee0fa45643 21-Oct-2016 Stephen Chen <stewchen@google.com> DO NOT MERGE: Implement metered tracking for NetworkStats summary queries.

Dependent on ag/1550196 where API is defined.

Bug: 31015360
Bug: 26545374
Test: runtest --path
frameworks/base/core/tests/coretests/src/android/net/NetworkStatsTest.java,
other test classes.

(cherry picked from commit 25147878974f82f875062e99cdee85dd33f3f078)

(cherry picked from commit 963e8ddf6d5ea3bc34216fa03fe24402bf13940a)

Change-Id: I79e401fc4159264a075febba82bd8c295b8e677f
etworkStatsTest.java
b1e3c8aaf42ee3d5910d1f7b93644bf1d05b2eee 11-Jan-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge changes I1eaab5ea,I42928da8

* changes:
DO NOT MERGE Captive portal systel log improvements
DO NOT MERGE Fix flaky IpPrefixTest.
4962a3829f8c39f0eac702f4d9b54ae3ae6642dc 10-Jan-2017 Sundeep Ghuman <sghuman@google.com> Merge "Cherrypick: Create ScoredNetwork Badging API changes." am: e34e47d645
am: 3098d3839f

Change-Id: I5f7d741dbd7f91518495f02de995bca6d191aa4e
3098d3839f075994e4e93af09fc6541eaf030924 10-Jan-2017 Sundeep Ghuman <sghuman@google.com> Merge "Cherrypick: Create ScoredNetwork Badging API changes."
am: e34e47d645

Change-Id: Ibeb6c60c30c302e12c45c7f35a7e4af904a4a6d5
8bc096c09d5013c61e8e23a810e70f392b6b25b1 16-Dec-2016 Sundeep Ghuman <sghuman@google.com> Cherrypick: Create ScoredNetwork Badging API changes.

Defines an attribute bundles key to hold the badging curve, the
enums for badge values, and an API to retrieve a badge for a
specific RSSI.

OCL: ag/1727147
Bug: 33457699
Test: Unit tests
Change-Id: If9e8a60c4670b51c395fb501f55ddece8a72981e
Merged-In: If9e8a60c4670b51c395fb501f55ddece8a72981e
coredNetworkTest.java
cf9ad8352067f07d56a9b13458d30e6adf276683 06-Jan-2017 Amin Shaikh <ashaikh@google.com> Merge "Fix NetworkScorerAppManager#isCallerActiveScorer." am: 48eecdcbc4 am: 7495cf633c am: d7f371813a
am: ea7931d107

Change-Id: I193abae0fef7cb976ef970085363822f4770215c
d7f371813a6fd7e2840fc25b3b3ac80b8280ec21 06-Jan-2017 Amin Shaikh <ashaikh@google.com> Merge "Fix NetworkScorerAppManager#isCallerActiveScorer." am: 48eecdcbc4
am: 7495cf633c

Change-Id: Ie6913526fbc1b0ae63eb7c0c7be7d9eac5772f50
7495cf633ccfb9bca025c7489337290bd531ed48 06-Jan-2017 Amin Shaikh <ashaikh@google.com> Merge "Fix NetworkScorerAppManager#isCallerActiveScorer."
am: 48eecdcbc4

Change-Id: I6b9ecd35dbc0758cd45b804dc9586287428af293
2cd918a63ec87dd4e13bd803626f2742a0f35fab 05-Jan-2017 Amin Shaikh <ashaikh@google.com> Fix NetworkScorerAppManager#isCallerActiveScorer.

The current implementation checks whether the caller's uid has the
SCORE_NETWORKS permission instead of checking the passed in callingUid. I
removed this check entirely because the getActiveScorer method already checks
whether the scorer's package has the SCORE_NETWORKS permission. There is no way
callingUid can equal the active scoring package's uid without also having the
SCORE_NETWORKS permission.

Bug: 34107721
Test: runtest --path core/tests/coretests/src/android/net/NetworkScorerAppManagerTest.java
Change-Id: Ifd427792169837c84a10a76b208c76137db06ae9
etworkScorerAppManagerTest.java
f6b180ff1a2bc64ca62910a24adf4b15feb932f0 10-Nov-2016 Hugo Benichi <hugobenichi@google.com> DO NOT MERGE Fix flaky IpPrefixTest.

Test: IpPrefixTest passes
Bug: 32561414

(cherry picked from commit 32c687040301cb3601fd110281a742159a963aa9)

Change-Id: I42928da87f7f336900b3a95ebbf28563864da8d4
pPrefixTest.java
6c929621536664d6c014b177e7e6983f1fbd67ac 16-Dec-2016 Sundeep Ghuman <sghuman@google.com> Create ScoredNetwork Badging API changes.

Defines an attribute bundles key to hold the badging curve, the
enums for badge values, and an API to retrieve a badge for a
specific RSSI.

Bug: 33457699
Test: Unit tests
Change-Id: If9e8a60c4670b51c395fb501f55ddece8a72981e
coredNetworkTest.java
bfc0bfe6450eafb4083c4d19dfe1a314da45568f 22-Dec-2016 Sundeep Ghuman <sghuman@google.com> Merge "Cherrypick: Define the calculateRankingScore method and Key." am: 425af45d02
am: 41577a0029

Change-Id: I7807d92a705a8ec9d9c7b04159e1cd2290846e38
41577a00292d0ca0e6eb451c564a51ea13d007ae 22-Dec-2016 Sundeep Ghuman <sghuman@google.com> Merge "Cherrypick: Define the calculateRankingScore method and Key."
am: 425af45d02

Change-Id: Ib61f91087967f1b026cd2ba77175ccf47943bc53
425af45d0224e880380539882b1de425c5afe72c 22-Dec-2016 Treehugger Robot <treehugger-gerrit@google.com> Merge "Cherrypick: Define the calculateRankingScore method and Key."
0d79bdef27c75d06797856d3289194a5327f90e8 07-Dec-2016 Sundeep Ghuman <sghuman@google.com> Cherrypick: Define the calculateRankingScore method and Key.

Define the key to be used to store the rankingScoreOffset inside the
ScoredNetwork bundle. Implement a platform API method to calculate the
ranking score for a given rssi.

OCL: ag/1688711

Bug: 33049302
Test: Unit tests
Change-Id: Ia3fea2197d7c211a2313fced8713d79d8d5f4f6e
Merged-In: Ia3fea2197d7c211a2313fced8713d79d8d5f4f6e
Topic: ScoredNetworkRankingScore
coredNetworkTest.java
471093b58e97ab2ea310c7743acb7674a07f7391 21-Dec-2016 Amin Shaikh <ashaikh@google.com> Merge "Expose ScanResult#untrusted as a @SystemApi." am: a93e57f1ac
am: a3943850ab

Change-Id: Id763d2f82e10dd5843258ef09d0e65824e2c2de6
a3943850ab67dc2df1639202de6735c3991e4dc8 21-Dec-2016 Amin Shaikh <ashaikh@google.com> Merge "Expose ScanResult#untrusted as a @SystemApi."
am: a93e57f1ac

Change-Id: I9cac16dbceb36d6ff72e92d2ab8de20bd8d70e36
3d18c621cbff73fb6fe4bf68ae55c17c8545d3e9 10-Dec-2016 Amin Shaikh <ashaikh@google.com> Expose ScanResult#untrusted as a @SystemApi.

- Expose ScanResult#untrusted to inform NetworkRecommendationProviders
that a ScanResult does not correspond to a saved network.
- Add static construction methods and assertions to RecommendationResult

Test: runtest frameworks-services

Bug: 33490132
Change-Id: If7006040f63843c1c468c9d95c5c017383c5c5dd
Merged-In: If7006040f63843c1c468c9d95c5c017383c5c5dd
etworkRecommendationProviderTest.java
0e4b9cd97d3794b0e1cb7da41d5955ab97907520 20-Dec-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Expose ScanResult#untrusted as a @SystemApi."
f9d47b79b2a307da1a16a8e0c16b3f9847ff5414 10-Dec-2016 Amin Shaikh <ashaikh@google.com> Expose ScanResult#untrusted as a @SystemApi.

- Expose ScanResult#untrusted to inform NetworkRecommendationProviders
that a ScanResult does not correspond to a saved network.
- Add static construction methods and assertions to RecommendationResult

Test: runtest frameworks-services

Bug: 33490132
Change-Id: If7006040f63843c1c468c9d95c5c017383c5c5dd
etworkRecommendationProviderTest.java
c63d5b0c74ad7330d9893640cdfce0e03f91c0f1 07-Dec-2016 Sundeep Ghuman <sghuman@google.com> Define the calculateRankingScore method and Key.

Define the key to be used to store the rankingScoreOffset inside the
ScoredNetwork bundle. Implement a platform API method to calculate the
ranking score for a given rssi.

Bug: 33049302
Test: Unit tests
Change-Id: Ia3fea2197d7c211a2313fced8713d79d8d5f4f6e
Topic: ScoredNetworkRankingScore
coredNetworkTest.java
af811c265004184f54caedc5155b7de4c4575648 20-Dec-2016 Jeremy Joslin <jjoslin@google.com> Merge "Implement the discovery of a network recommendation provider." am: 470d256519
am: 8fbeb1d74a

Change-Id: I322592326e0a409131a4dd33ab1f907b9262dbf2
8fbeb1d74a0321f44038ec0c3c7c0bf2cd8bf302 20-Dec-2016 Jeremy Joslin <jjoslin@google.com> Merge "Implement the discovery of a network recommendation provider."
am: 470d256519

Change-Id: I804df594669be3b42704dead7007790666bef0f6
b8418ac89aa9d8e904b848d92c1729b7c7d90a16 06-Dec-2016 Jeremy Joslin <jjoslin@google.com> Implement the discovery of a network recommendation provider.

Updated the NetworkScorerAppManager to examine the list of configured
network recommendation providers and to select the first valid
provider.

As part of this update the old logic of looking for a valid network
scorer has been removed. Scorers/recommendation providers are only
selected from the configured list now. The setActiveScorer() method
has been deprecated as a result.

The NetworkScoreService has been updated to monitor the list of
potential recommendation providers and to reevaluate the binding
whenever they change. It also monitors the new setting for
NETWORK_RECOMMENDATIONS_ENABLED to connect or disconnect from the
provider as needed.

Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
BUG: 33158362
Change-Id: I450981261aa5355c1c91ec2e3a0a3b58cc65316b
Merged-In: I42aeb5223da794f71f7e58cb1bdf18817200cbf2
etworkScorerAppManagerTest.java
5b1a460b940b5a0cd4e6e0ccd0d22d380309e76b 19-Dec-2016 Jeremy Joslin <jjoslin@google.com> Merge "Fix ScanResult array parceling." am: 5fdc86fb27
am: 68764eabb7

Change-Id: I6b44179d634722828f40524c26ccf6ea51521f11
68764eabb7c7a058e9ec40a84689aedf3d4a3c0b 19-Dec-2016 Jeremy Joslin <jjoslin@google.com> Merge "Fix ScanResult array parceling."
am: 5fdc86fb27

Change-Id: I25e509ea057370c4380764c47808c0dbde85a6fc
ab60cb6a6d94db74f7ba2bd3d86ec565a2f98b95 17-Dec-2016 Jeremy Joslin <jjoslin@google.com> Fix ScanResult array parceling.

readParcelableArray() wasn't working as expected so I just parceled
the array myself.

Test: adb shell am instrument -e class android.net.RecommendationRequestTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I83939d17769930b707b8bc579542c74a05e31d19
Merged-In: I47bc31adbedea817feaa5953cb6ee48506f9c6d6
ecommendationRequestTest.java
c28e6fcf943f86569121aaee662160f8feec1c0c 17-Dec-2016 Jeremy Joslin <jjoslin@google.com> Fix ScanResult array parceling.

readParcelableArray() wasn't working as expected so I just parceled
the array myself.

Test: adb shell am instrument -e class android.net.RecommendationRequestTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I47bc31adbedea817feaa5953cb6ee48506f9c6d6
ecommendationRequestTest.java
fa4f08ecee6579b1a4e4503312956ea19dd0b80e 06-Dec-2016 Jeremy Joslin <jjoslin@google.com> Implement the discovery of a network recommendation provider.

Updated the NetworkScorerAppManager to examine the list of configured
network recommendation providers and to select the first valid
provider.

As part of this update the old logic of looking for a valid network
scorer has been removed. Scorers/recommendation providers are only
selected from the configured list now. The setActiveScorer() method
has been deprecated as a result.

The NetworkScoreService has been updated to monitor the list of
potential recommendation providers and to reevaluate the binding
whenever they change. It also monitors the new setting for
NETWORK_RECOMMENDATIONS_ENABLED to connect or disconnect from the
provider as needed.

Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
BUG: 33158362
Change-Id: I42aeb5223da794f71f7e58cb1bdf18817200cbf2
etworkScorerAppManagerTest.java
a00fda5311bc6310bacd1b6ca4ccc374ec342fdf 15-Dec-2016 Jeremy Joslin <jjoslin@google.com> Merge "Add an IPC for requesting network scores." am: e89ed4a001
am: 724b26c902

Change-Id: If6284c934cd47257367c614523d4928758ab34e1
724b26c902712eafbb23b210ee8c591ab22d56a3 14-Dec-2016 Jeremy Joslin <jjoslin@google.com> Merge "Add an IPC for requesting network scores."
am: e89ed4a001

Change-Id: I23bee3f29d3b3f71da6103e23afafc2df128ab75
e7f273d5086ca464bcf6b1aa3ae3af5387bb034e 14-Dec-2016 Jeremy Joslin <jjoslin@google.com> Add an IPC for requesting network scores.

Migrating the NetworkScoreManager.requestScores() method to use an
IPC rather than a broadcast.

Defined the new IPC in the AIDL files for NetworkScoreService and
NetworkRecommendationProvider. Added a no-op implementation in
NetworkScoreService and a full implementation in
NetworkRecommendationProvider (plus tests).

Test: adb shell am instrument -e class android.net.NetworkRecommendationProviderTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
BUG: 33593157
Change-Id: Iacf7b6d424ec3c57e8b89e5abc6bc3e8414097b9
Merged-In: I951f6186aa11ddbe5a94e374173a1fd40b2a4cce
etworkRecommendationProviderTest.java
b2087a159bad795b7d6575788800fcad3319700a 14-Dec-2016 Jeremy Joslin <jjoslin@google.com> Add an IPC for requesting network scores.

Migrating the NetworkScoreManager.requestScores() method to use an
IPC rather than a broadcast.

Defined the new IPC in the AIDL files for NetworkScoreService and
NetworkRecommendationProvider. Added a no-op implementation in
NetworkScoreService and a full implementation in
NetworkRecommendationProvider (plus tests).

Test: adb shell am instrument -e class android.net.NetworkRecommendationProviderTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
BUG: 33593157
Change-Id: I951f6186aa11ddbe5a94e374173a1fd40b2a4cce
etworkRecommendationProviderTest.java
eb0a34f26bcfde0c4cb506a8c7261efd3cc40f62 13-Dec-2016 Jeremy Joslin <jjoslin@google.com> Merge "Make the onRequestRecommendation() method async." am: fbeacb02c0
am: a6c6bc333d

Change-Id: I56a830273f8e3246b598c2ea7a027b87e3066e16
a6c6bc333d2d98bc6091250100f582c24ad8b5fa 13-Dec-2016 Jeremy Joslin <jjoslin@google.com> Merge "Make the onRequestRecommendation() method async."
am: fbeacb02c0

Change-Id: I9b98480499c2366eee06de163b561c4583e475d2
280f82c3127a331d9f8b6f61726176a380892f66 08-Dec-2016 Jeremy Joslin <jjoslin@google.com> Make the onRequestRecommendation() method async.

Converted the NetworkRecommendationProvider.onRequestRecommendation()
method into an async call to give implementors more flexibility.

Added unit tests for NetworkRecommendationProvider.

Test: Added NetworkRecommendationProviderTest.
BUG: 32909424
Change-Id: I8c1d2e11baa539744d77a012e85351f750523e3b
Merged-In: Iebe72f260133e9ad1946b0b75e2f69635e154ef3
etworkRecommendationProviderTest.java
375320edaa085230b2bf5ffec5f83ab314e85917 08-Dec-2016 Jeremy Joslin <jjoslin@google.com> Make the onRequestRecommendation() method async.

Converted the NetworkRecommendationProvider.onRequestRecommendation()
method into an async call to give implementors more flexibility.

Added unit tests for NetworkRecommendationProvider.

Test: Added NetworkRecommendationProviderTest.
BUG: 32909424
Change-Id: Iebe72f260133e9ad1946b0b75e2f69635e154ef3
etworkRecommendationProviderTest.java
963e8ddf6d5ea3bc34216fa03fe24402bf13940a 21-Oct-2016 Stephen Chen <stewchen@google.com> DO NOT MERGE: Implement metered tracking for NetworkStats summary queries.

Dependent on ag/1550196 where API is defined.

Bug: 31015360
Bug: 26545374
Test: runtest --path
frameworks/base/core/tests/coretests/src/android/net/NetworkStatsTest.java,
other test classes.

(cherry picked from commit 25147878974f82f875062e99cdee85dd33f3f078)

Change-Id: I46da93ba4afa968facf98f7c3d844fd0c469095a
etworkStatsTest.java
ffe5a46b3e65389722333482a959f98767c4c74c 09-Aug-2016 Jeremy Joslin <jjoslin@google.com> DO NOT MERGE: VPN network stat accounting changes.

Properly account for VPN apps that make heavy use of the tun
interface. Prior to this change a VPN app could be incorrectly charged
for more data than it actually used if it sent more traffic through
the tun interface than the underlying interface.

This change excludes VPN app traffic on the tun interface from the
adjustment pool and doesn't redistribute traffic to the VPN app.
Instead all of the redistributed traffic is deducted from the VPN app
which effectively represents any overhead incurred by the VPN app.

BUG: 30557871

(cherry picked from commit 8b436d865c9f287e9ae491e5278cd8874f4a865b)

Change-Id: I06f01aa8fe5fdc06b2d36cfb9c68feb244c2e5de
etworkStatsTest.java
fb0cd672645725b84dedbad8868dded57ac0ab6a 01-Dec-2016 Amin Shaikh <ashaikh@google.com> Merge "Refactor NetworkScoreAppManager for testing." am: 3af97482f1 am: a8fc97d2de am: d136025272
am: f9f477454e

Change-Id: Ied1038387d5be28a4d723b71dc633ed035125c1b
d136025272346924148da598a688e98dc2e094e9 01-Dec-2016 Amin Shaikh <ashaikh@google.com> Merge "Refactor NetworkScoreAppManager for testing." am: 3af97482f1
am: a8fc97d2de

Change-Id: I34ed2f31eaa1336990c941ee63eea0c1ddbc305c
aa09aa02103954735b432fa3f7c41ee235bac9fd 22-Nov-2016 Amin Shaikh <ashaikh@google.com> Refactor NetworkScoreAppManager for testing.

Test: runtest frameworks-services && runtest frameworks-core
Change-Id: Ie2172009e9ba0438050488fe0aea6408f852c2c2
etworkScorerAppManagerTest.java
10a092d9a38ca4e6a0f44a5af4ab2495e9fde297 28-Nov-2016 Darren Krahn <dkrahn@google.com> Revert "Introduce RoughtimeClient"

This reverts commit 89ef028898a784b71f34ed35684d8122c3f8db36.

Change-Id: I74826aa6990891df3be4f931b242398824c370d1
oughtimeClientTest.java
89ef028898a784b71f34ed35684d8122c3f8db36 17-Nov-2016 Casey Dahlin <sadmac@google.com> Introduce RoughtimeClient

Roughtime is Google's new network time protocol[1] and we'd like to
start using it for some devices in place of/in addition to NTP. This
patch gets the beginnings of an implementation off the ground, with tests.

[1] https://roughtime.googlesource.com/roughtime/

Test: New unit tests pass
Bug: 30834326
Change-Id: I401d8ad59c82dda514fd3c4be63804f46814251d
oughtimeClientTest.java
32c687040301cb3601fd110281a742159a963aa9 10-Nov-2016 Hugo Benichi <hugobenichi@google.com> Fix flaky IpPrefixTest.

Test: IpPrefixTest passes
Bug: 32561414
Change-Id: Ib4bffe9d33a6d4f5c2bd97798073de0f66d77645
pPrefixTest.java
25147878974f82f875062e99cdee85dd33f3f078 21-Oct-2016 Stephen Chen <stewchen@google.com> Implement metered tracking for NetworkStats summary queries.

Dependent on ag/1550196 where API is defined.

Bug: 31015360
Bug: 26545374
Test: runtest --path
frameworks/base/core/tests/coretests/src/android/net/NetworkStatsTest.java,
other test classes.

Change-Id: I968b9e3352d7880e3fc438f12de628a2da057e0a
etworkStatsTest.java
807102d7ffc16bb1720a336f8520cec8acfdf525 22-Oct-2016 Jeremy Joslin <jjoslin@google.com> VPN network stat accounting changes. am: 3f0d75afe8
am: 0d309b7a47

Change-Id: I797ac586581f83ada0e94639dd435122c987f1c1
3f0d75afe89f29f5352cc67e0dfdfb509bb64383 09-Aug-2016 Jeremy Joslin <jjoslin@google.com> VPN network stat accounting changes.

Properly account for VPN apps that make heavy use of the tun
interface. Prior to this change a VPN app could be incorrectly charged
for more data than it actually used if it sent more traffic through
the tun interface than the underlying interface.

This change excludes VPN app traffic on the tun interface from the
adjustment pool and doesn't redistribute traffic to the VPN app.
Instead all of the redistributed traffic is deducted from the VPN app
which effectively represents any overhead incurred by the VPN app.

BUG: 30557871
Change-Id: I62a75a0c0c0111e052b7903baa9f5d6d94ef57fd
etworkStatsTest.java
46b451fa7da6c0323e80616409cf467d5b1fd01f 19-Aug-2016 Felipe Leme <felipeal@google.com> Refactored whitelist restrict background uids.

On Android N, the list of UIDs whitelisted was kept in a separate array
and XML tag, while in reality it should be a new UID
policy (POLICY_ALLOW_METERED_BACKGROUND).

This change refactors NetworkPolicyManagerService to use the new UID
policy, although without removing any of its existing methods (but
marking them as deprecated).

Test: m -j32 FrameworksServicesTests && adb install -r -g ${ANDROID_PRODUCT_OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk && adb shell am instrument -e class "com.android.server.NetworkPolicyManagerServiceTest" -w "com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner"

Test: cts-tradefed run commandAndExit cts --skip-device-info --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker --skip-preconditions -m CtsHostsideNetworkTests --abi armeabi-v7a -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests

BUG: 28791717

Change-Id: I39869efda554ca0b736dd2380e439474f91dfbe6
etworkPolicyManagerTest.java
8546a444800b331d0c373b12aa196050049c57bb 23-Aug-2016 Felipe Leme <felipeal@google.com> Removed the POLICY_ALLOW_BACKGROUND_BATTERY_SAVE constant.

That constant was created back in 2014 in the intial Battery Saver
implementation, but it's not used anymore (since the power saving
whitelist is fetched from DeviceIdleController).

Test: m -j32 FrameworksCoreTests && adb install -r -g
${ANDROID_PRODUCT_OUT}/data/app/FrameworksCoreTests/FrameworksCoreTests.apk
&& adb shell am instrument -e class
"android.net.NetworkPolicyManagerTest" -w
"com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner"

BUG: 28791717

Change-Id: Ic2c0bcb9736ce8b40e04fd644953e68241d06a69
etworkPolicyManagerTest.java
b1e823a8527752d47365e3b9f8e190f478b6ba68 23-Aug-2016 Felipe Leme <felipeal@google.com> Fixed test case that fails because of string order.

Test: m -j32 FrameworksCoreTests && adb install -r -g
${ANDROID_PRODUCT_OUT}/data/app/FrameworksCoreTests/FrameworksCoreTests.apk
&& adb shell am instrument -e class
"android.net.NetworkPolicyManagerTest" -w
"com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner"

BUG: 28791717
Change-Id: Iaef6d8f1a82c6ab4af88f71e5b9e42e0386ed512
etworkPolicyManagerTest.java
c233963e03054010819b7f1731e0995102d41231 20-Aug-2016 Felipe Leme <felipeal@google.com> Added missing @Test

BUG: 28791717
Change-Id: I64f336652a2a32b091b17a1c9684453940bd62bd
etworkPolicyManagerTest.java
b146f7678f525d19dc3fb38790ad23a4d276113f 19-Aug-2016 Felipe Leme <felipeal@google.com> Added a uidPoliciesToString() method.

BUG: 28791717
Change-Id: Ib26e08332d011ca5414406810cec4b4936841068
etworkPolicyManagerTest.java
8b436d865c9f287e9ae491e5278cd8874f4a865b 09-Aug-2016 Jeremy Joslin <jjoslin@google.com> VPN network stat accounting changes.

Properly account for VPN apps that make heavy use of the tun
interface. Prior to this change a VPN app could be incorrectly charged
for more data than it actually used if it sent more traffic through
the tun interface than the underlying interface.

This change excludes VPN app traffic on the tun interface from the
adjustment pool and doesn't redistribute traffic to the VPN app.
Instead all of the redistributed traffic is deducted from the VPN app
which effectively represents any overhead incurred by the VPN app.

BUG: 30557871
Change-Id: I62a75a0c0c0111e052b7903baa9f5d6d94ef57fd
etworkStatsTest.java
d0dc9013416f8de61f6487332127b5fd5bf9025a 09-Aug-2016 Neil Fuller <nfuller@google.com> Merge "Tidy up MockWebServer usage"
am: 294ab080f4

Change-Id: Ia22ce1e949ba3b611c0f2be60b3dbbafef7e4bb6
294ab080f416eaf607ca47b0c0e2a548ebbabb44 09-Aug-2016 Neil Fuller <nfuller@google.com> Merge "Tidy up MockWebServer usage"
bc8d946e0964ff8b30840e0deee69b8c6f9022c6 01-Aug-2016 Hidehiko Tsuchiya <hidehiko.xa.tsuchiya@sonymobile.com> Merge \"Fix the API compatibility of \"UriMatcher#addURI\"\"
am: 3e151273a3

Change-Id: Ic06ade3ce6dd795e7d12cfba150286933512433d
5acd41d155a6fb7c0476a8b8a7c86434ff5ccb2f 25-Mar-2014 Hidehiko Tsuchiya <hidehiko.xa.tsuchiya@sonymobile.com> Fix the API compatibility of "UriMatcher#addURI"

The previous patch (ef23bf19 Allow leading slash in path...) made
a single slash path unmatchable.
To solve it, this patch stops removing a slash character if the path
only has a slash character.
Now, a single slash is a matchable path for a URI without path string.

Bug: 29524484
Change-Id: I90b357aa48be1a3e0cf36e75ed2a9d6532908972
riMatcherTest.java
6f04b2e76a81b2457d7b00cd952ab7eb248606cc 28-Jun-2016 Neil Fuller <nfuller@google.com> Tidy up MockWebServer usage

Delay creation of MockWebServer until setUp() and
add shutdown logic in one case.

Bug: 29820565
Change-Id: Iea43f8692b8425d05405a8fe86382d6d12197b2d
ttp/CookiesTest.java
ttp/DefaultHttpClientTest.java
46c4fc357ce8e686b6e7c2adda573e9870a8221f 04-May-2016 Felipe Leme <felipeal@google.com> Refactored NetworkPolicyManagerService mUidRules.

NetworkPolicyManagerService (NMPS) keeps an internal list of uid
rules (mUidRules) for network restrictions, and when these rules
changes it needs to notify external listeners (such as
ConnectivityService / CS).

Prior to Android N, both Data Saver mode (the feature previously known
as "Restrict Baground Data") and Battery Save mode used the same set of
firewall rules to implement their restrictions: when Battery Saver mode
NPMS would mark all networks as metered and set the proper firewall
rules externally.

Recently, these 2 modes were split in 2 distinct firewall rules and
NMPS.updateRuleForRestrictBackgroundLocked() was changed to update
the mUidRules logic based on the Data Saver firewall (since the Battery
Saver firewall changes are handled externally, on
updateRuleForRestrictPowerLocked()). As such, CS was not notified when
the power-related changes were made, which would cause apps to get a
state of CONNECTED / CONNECTED when querying its active connection.

This change refactores the mUidRules to use bitmasks, in preparation for
another change that will fix the issue.

It also fixes a minor bug that was preventing removed packages to be
removed from the whitelist.

BUG: 28521946
Change-Id: I9f0e1509a6192cad403f740c1cd76a6b7dab7d26
etworkPolicyManagerTest.java
dd251ef4952b6c7abbfe8cea49285d8cfe62f96e 14-Mar-2016 Jeremy Joslin <jjoslin@google.com> Have the NetworkScoreService bind to the scorer.

If the current active scorer provides a service that can handle the
android.net.scoring.SCORE_NETWORKS action then the NetworkScoreService
will bind to that service to keep the scorer alive. If no service is
discovered then no attempt to bind will be made.

BUG: 27612145
Change-Id: I3f6ed0cbd83e658f1533c3e37b0cac2692c01761
etworkScorerAppManagerTest.java
1f7e05eda687279ac9deb894f42ac927bd471ad2 10-Mar-2016 Jeff Davidson <jpd@google.com> NetworkStats.Bucket API polish.

-Add @IntDef constants for STATE_ and ROAMING_.
-Expand docs for ROAMING_ constants.
-Use ROAMING_NO/YES instead of ROAMING_DEFAULT/ROAMING.

Bug: 27531260
Change-Id: I54ecfb4148caa549214df0bee9983036ffa4cb55
etworkStatsTest.java
fe505af0488aeede4864203511338e1a14c7eb08 10-Feb-2016 Jeremy Joslin <jjoslin@google.com> Update test to stub the correct method.

NetworkScorerAppManager was recently updated to use
queryBroadcastReceiversAsUser() in place of
queryBroadcastReceivers() but its unit test wasn't changed accordingly.

Change-Id: Ib41195fe8b9cf8c8da9a9090a4f26e1cde3db4f0
etworkScorerAppManagerTest.java
a6a78076eeb27084ed815ce0492d4ffe08134bec 12-Jan-2016 Jeff Davidson <jpd@google.com> Implement roaming tracking in NetworkStats summary queries.

Whether a network is deemed roaming or not was already being tracked
as part of the NetworkIdentitySet, so the underlying data store
already tracks roaming and native data separately. However, this data
was being aggregated together in NetworkStatsCollection#getSummary,
since the NetworkIdentitySet is converted to an iface name for the
purposes of matching, and the iface name will be identical whether or
not the iface is considered roaming. Now it is separated.

Also fixes a long-standing bug in NetworkIdentitySet where an identity
read from a saved file would always be considered roaming == false,
even if it wasn't at the time it was written.

Bug: 25813438
Change-Id: I11ab5b51182ed8da7af8fde468df065f9fdc3dad
etworkStatsTest.java
1ad4e22534b3607ecca849b06efa4547dd58be63 13-Aug-2015 Erik Kline <ek@google.com> Also treat loss of IPv6 as a loss of provisioning.

Bug: 23226635
Change-Id: Icebb7d83ed5b3b796901b9f023909a02eb461941
inkPropertiesTest.java
32d52f344aa564154b96cadc2dda3f0de3d0f455 07-Oct-2015 Jerry Wong <jpwong@broadcom.com> Incorrect time used in some NTP server responses

Per RFC 4330, a NTP server response should be discarded when:
- the stratum is 0 (unspecified), or
- the leap indicator is 3 (unsync'ed), or
- the mode is not 4 (server) / 5 (broadcast), or
- the transmitted time is 0.

Update SntpClient so that such responses would be discarded.

Additionally:
- make some variables suitably "final"
- enable logging
- add alternate requestTime() for testing
- add some miniscule test coverage

Cherry-picked from Jerry Wong's

https://partner-android-review.googlesource.com/#/c/460074

Bug: 24719581
Change-Id: Id11a79a6e53ce95500ed4b4d691a29c260666f6c
ntpClientTest.java
89b6392046865e5ceaead5238b6f366cd5e9d3c5 30-Jul-2015 Lorenzo Colitti <lorenzo@google.com> Add a null check to hasIPv4AddressOnInterface.

Change-Id: Ie38505ec0a93f4060348d92db341c536b7d60ed0
inkPropertiesTest.java
02cc5a030a6f132e776b754dd5684ae632009f76 10-Aug-2015 Erik Kline <ek@google.com> Refactor netlink and IpReachabilityMonitor into services/net

- netlink from core to services/net/netlink
- IpReachabilityMonitor from core to services/net/ip

Change-Id: I45ac3f591bade45dd5ec441111b02b621234c0e4
etlink/NetlinkErrorMessageTest.java
etlink/NetlinkSocketTest.java
etlink/RtNetlinkNeighborMessageTest.java
822b4f3a8d8521ff9e003617858779caf38a1558 08-Aug-2015 Shirish Kalele <kalele@google.com> am 4ecee3f8: am 558f1030: am 74f93f9a: am d7408469: am 027e3b7f: Merge "Fix check for caller being the active network scorer" into mnc-dev

* commit '4ecee3f88e067ed0339a4e004996a3c69ce5480e':
Fix check for caller being the active network scorer
4cab12d91d120ee93e135050b78edb335e9ac91b 06-Aug-2015 Shirish Kalele <kalele@google.com> Fix check for caller being the active network scorer

Compare caller and scorer uids to decide if caller is the
active scorer instead of calling AppOps.checkPackage().

Bug: 23000690
Change-Id: I64285f965716f3aceb24f193d86ab9d6be7202c5
etworkScorerAppManagerTest.java
f90177629a5b69ca3a80466c0ab55abfeb6d26b2 01-Aug-2015 Abodunrinwa Toki <toki@google.com> Turn off failing tests in FrameworksCoreTests.

We want a green state so we can confidence in tests we write
going forward.

Change-Id: I2c8db848897b56d0c64202ad28861eb4a7572e07
inkPropertiesTest.java
b36a3131d1b05efa176f79d318197499b2c45380 26-Jun-2015 Erik Kline <ek@google.com> Fix use of reachable DNS server logic

Move reachable DNS server computation out of ConnectivityService
and split it into LinkProperties#isReachable() and a companion
change in WifiStateMachine's makeLinkProperties().

Restore previous ConnectivityService#updateDnses() behaviour, as
the pruning is done in WifiStateMachine now.

Bug: 19470192
Bug: 20733156
Bug: 22098233
Change-Id: I810ef74d504e5dc1ca2017d435cdadd6b82171e6
inkPropertiesTest.java
e1a6cf2caa628a02032be9b26462958f3769bd70 14-May-2015 Erik Kline <ek@google.com> Add a test that Network#getNetworkHandle() behaves sanely.

Additionally:
- make zero more obvious for debugging, rather than emitting
some inscrutable magic value.

Bug: 19537384
Change-Id: Iac9a3297a0dda1ba3d69fd01cf6de81f01fd837e
etworkTest.java
d895999858db47e6f2d090a94b29749fa39278c2 05-Jun-2015 Erik Kline <ek@google.com> Make public Network#bindSocket(FileDescriptor).

Code that uses android.system.Os to create sockets as FileDescriptors
should be able to bind them to networks. Note that FileDescriptors
could already be marked as "protected from VPNs" via
NetworkUtils#protectFromVpn(), but heretofore were not easily bound
to any particular network.

Bug: 21449922
Change-Id: I4bb86db5d95d5a55bb2d7e245848d11eaa351e65
etworkTest.java
cd7ed16f00d243568e3b73b7fc7f0f94cfebe8ce 21-May-2015 Erik Kline <ek@google.com> LinkProperties function to compare provisioning and remove DNS servers

Adds:
- enum ProvisioningChange
- LinkProperties#compareProvisioning()
return a ProvisioningChange value describing the delta in
provisioning between two LinkProperties objects
- LinkProperties#removeDnsServer()
- make "@hide public" isIPv4Provisioned() and isIPv6Provisioned()

Bug: 18581716
Change-Id: I3df90b2b89617f693346f2dbe72e77c88ce91ffd
inkPropertiesTest.java
cef7bc939fbc3baae5ccf78dcef63fc60e07ae21 19-May-2015 Erik Kline <ek@google.com> Set NLM_F_ACK in our RTM_NEWNEIGH requests

With NLM_F_ACK set in RTM_NEWNEIGH requests we get some response from
the kernel, whether there was an error or not.

Additionally:

[1] add IpReachabilityMonitor#probeNeighbor() as a public
static method, since it actually depends very little on the
class internals and might be of larger use.

[2] add a unittest for parsing NetlinkErrorMessages.

Bug: 18581716
Change-Id: I5d62e7a9972c7440f0483c38c77677436d3a1a25
etlink/NetlinkErrorMessageTest.java
etlink/RtNetlinkNeighborMessageTest.java
abd3142dcae02026689b939c363329b822b7cc0a 15-May-2015 Erik Kline <ek@google.com> Close netlink socket when shutting down IpReachabilityMonitor

This forces the NetlinkSocketObserver thread to exit quickly, rather
than lingering until the next random netlink neighbor multicast message
arrives.

Additionally, add a small unittest to verify that multiple calls to
NetlinkSocket#close() are safe.

Change-Id: I101730fad7eee72f9c6e8a7e7bd10c634f2ceab4
etlink/NetlinkSocketTest.java
9ce5d602cd5d732ae10efe0b648b43ddf60d65c9 16-May-2015 Erik Kline <ek@google.com> Add IpReachabilityMonitor#probeAll() to begin doing DNAv4/v6-like probing

Note that this change is not sufficient to force probing in all cases,
but does cause probing to occur on Linux if the target node hasn't been
confirmed as reachable in the past 5 seconds (delay_first_probe_time).

Bug: 18581716
Bug: 19866451
Bug: 20944464
Change-Id: I29393897118311b48c966c41e2cddb7a784f136f
etlink/RtNetlinkNeighborMessageTest.java
6193aa3305bc2aa5b7f0a983f4b08c99065cfb82 19-Jan-2015 Erik Kline <ek@google.com> Add basic netlink library code.

Add netlink socket helpers and parsing code for basic netlink messages.
Additionally, support from some neighbor discovery -specific messages
is included.

Bug: 18581716
Change-Id: Ib2aa924222b63cdbebf09a8bf8ff35ee24269fc5
etlink/NetlinkSocketTest.java
etlink/RtNetlinkNeighborMessageTest.java
172cf0243587db7baaa2502a04d403185ec50f7b 14-Apr-2015 Erik Kline <ek@google.com> am 73e056d3: am 402f2501: am 3312c6b9: Merge "Add android.net.IpPrefix#contains()"

* commit '73e056d3931b419c2653eb7365fb72b50a9a36c3':
Add android.net.IpPrefix#contains()
acc8c09d3a12d00b565a76acc26061172c3dd3c6 13-Apr-2015 Erik Kline <ek@google.com> Add android.net.IpPrefix#contains()

This was originally to avoid RuntimeException in RouteInfo#matches():
When an IPv6 prefix with a length greater than the max permitted
for IPv4 is matched against an Inet4Address, the call to
NetworkUtils throws RuntimeException.

Change-Id: I92e2bd19a4e7d656cf682fd27678da07e211850d
pPrefixTest.java
outeInfoTest.java
305ebe207a174c9f46146ad73572a601b8a28787 02-Apr-2015 Alex Klyubin <klyubin@google.com> resolved conflicts for merge of 261e7a37 to master

Change-Id: If0a3389764965fe27bf567090a6e24069b61c544
3f24a1d94a42762c245a32272c797250a804cfc3 01-Apr-2015 Alex Klyubin <klyubin@google.com> Cleanse HTTP, HTTPS, and FTP URLs in Uri.toSafeString.

This makes the hidden API android.net.Uri.toSafeString omit most parts
of HTTP, HTTPS, and FTP URLs to avoid leaking anything unsafe. Only
the host and port are retained for these URLs.

Bug: 19215516
Change-Id: I2e9e33d9afaa9de5dd07a40532d56f0a2179f62a
riTest.java
98170b0db191f916bf2a0f104f5d5057c2aaeaa9 18-Mar-2015 Wenchao Tong <tongwenchao@google.com> Keep debug information in NetworkStats files

Create two special SETs.

SET_DBG_VPN_IN is used by individual applications to know
how much traffic of the NetworkIdentity was actually moved
from a VPN app.
SET_DBG_VPN_OUT is used by the VPN app to know how much
traffic of the NetworkIdentity was deducted.

A debug application can restore the raw stats by these
entries.
raw_traffic = recorded_entry (TAG_NONE, SET_ALL)
+ recorded_entry (TAG_NONE, SET_DBF_VPN_OUT)
- recorded_entry (TAG_NONE, SET_DBF_VPN_IN)

The two debug SETs are not returned by
NetworkStatsService.openSession(). These debug entries are
retrieved by NetworkStatsCollection.dump().

Bug: 19536273
Change-Id: I03ef9f7667f5f2f48cbe3f6b11447fe7ead8ad3b
etworkStatsTest.java
e5ef28f50974320659e2ecfe3910718a9e60f317 09-Mar-2015 Lorenzo Colitti <lorenzo@google.com> Add two utility methods for IPv4 netmasks.

1. Add a validating method to convert a netmask to a prefix length.
2. Add a function to get the implicit netmask of an IPv4 address.
3. Add a unit test.

Bug: 19704592
Change-Id: Icb9f58d3903ea01df9e3720383c9bd5db6dd8f26
etworkUtilsTest.java
21377c3af8ab683abac3e43006bce74498a37c9c 27-Feb-2015 Wenchao Tong <tongwenchao@google.com> NetworkStats to support VPN accounting.

Create a new method to migrate underlying network traffic
from VPN app to other apps.

Bug: 19536273
Change-Id: I3434cad361592e26b01225edf8012f7b16afc98f
etworkStatsTest.java
b43e74bbce46f2f328e2031a7ae3447f415ef9ca 05-Feb-2015 Lorenzo Colitti <lorenzo@google.com> am 12b26c12: am 21702263: Merge "Add a unit test for StaticIpConfiguration."

* commit '12b26c12483633f7a75d1f1c9ead73eaf6056811':
Add a unit test for StaticIpConfiguration.
83faf72f846c183960ba7ac035073ff3767a13e8 23-Jan-2015 Lorenzo Colitti <lorenzo@google.com> Add a unit test for StaticIpConfiguration.

Change-Id: I68c735def8a242da0c8f95b7c5ea680ed902dab7
taticIpConfigurationTest.java
b3f73dc5179532d587f743a9831faff3584c7c5b 16-Jan-2015 Neil Fuller <nfuller@google.com> am b55011e4: am f9c04f17: Merge "Removing HttpResponseCacheTest"

* commit 'b55011e4265f866604ed0c3ffe0241436682c3d2':
Removing HttpResponseCacheTest
60cf05c1b3dd8357c1fcb5ef4f6fa0d2b497dc7d 15-Jan-2015 Neil Fuller <nfuller@google.com> Removing HttpResponseCacheTest

Moving HttpResponseCacheTest.java from
frameworks/base/core/tests/coretests/src/android/net/http
to
cts/tests/tests/net/src/android/net/http/cts

Change-Id: I61a07c53f8d0ef55d35b928f244e4680725b76ef
ttp/HttpResponseCacheTest.java
60b268f039857211333e2ea1cc68e795a12d7e07 12-Jan-2015 Neil Fuller <nfuller@google.com> am f5f345cf: am 837261cc: Merge "Fix HttpResponseCacheTest in anticipation of an OkHttp upgrade."

* commit 'f5f345cf929908bd863143815743c44778d29e4a':
Fix HttpResponseCacheTest in anticipation of an OkHttp upgrade.
62d0677b0f6cc5ae48fd0b816ea5caad82264fd6 09-Jan-2015 Neil Fuller <nfuller@google.com> Fix HttpResponseCacheTest in anticipation of an OkHttp upgrade.

OkHttp recently changed the behavior of their caching with
commit e74e3f3bf744ef7f4d8ee724a7cf2347e486cfab - it is now
neccessary to close the inputstream (or disconnect the
HttpURLConnection) for a response to be cached.

This change is (effectively) a no-op prior to the upgrade.

The behavior is undefined as to whether closing the
input stream is required for caching. OkHttp's new behavior
is consistent with other HttpURLConnection implementations
tried.

Change-Id: Iaf57371651296ac84850971ef60a9338cead57c0
ttp/HttpResponseCacheTest.java
55a442e58262e253df965d652bd8219c8d1e72d3 19-Nov-2014 Jeff Sharkey <jsharkey@android.com> Lightweight checkin output for network stats.

Define and print a compact version of network statistics when dump
is requested with the "--checkin" flag. Defaults to last 24 hours,
but included data can be tweaked with various flags.

Groups together detailed network identities into larger umbrella
terms like "mobile" and "wifi."

Bug: 18415963
Change-Id: I70cf9c828ea5c6e5bb6884837d3608f66fbad2e6
etworkStatsHistoryTest.java
161977998feebf0a855ea56558464470877040cf 04-Nov-2014 Jeff Davidson <jpd@google.com> Rename BROADCAST_SCORE_NETWORKS to BROADCAST_NETWORK_PRIVILEGED.

This is necessary/desired for two reasons:

1. UX around network scoring shipped with L despite lacking underlying
platform support. We do not want network scoring applications to
trigger this UX on L devices, and therefore we must break the contract
of what defines a network scorer so that apps build against the new
contract don't trigger the old UX.

2. As a start towards generalizing the term "score" for a potentially
broader role in the future, though that role is very much undefined.

Bug: 18160480
Change-Id: If228977513e32e45bc44dbeda24aa18436fdfca6
etworkScorerAppManagerTest.java
befe778c73e48417942fc31c06509bac8e5ca0d2 20-Oct-2014 Erik Kline <ek@google.com> Treat optimistic addresses as global preferred.

If the kernel sends notification of an optimistic address then
treat is a useable address (isGlobalPreferred()).

Note that addresses flagged as IFA_F_OPTIMISTIC are
simultaneously flagged as IFA_F_TENTATIVE (when the tentative
state has cleared either DAD has succeeded or failed, and both
flags are cleared regardless).

Additionally: do not consider RFC 4193 ULA addresses sufficient
for "global preffered". They are, by definition, of global scope
but not sufficient for global reachability.

Bug: 17769720
Change-Id: I759623b28fd52758f2d4d76d167f3cafd9319d6a
inkAddressTest.java
dd91fb44743f15ee308a4cfedeca6338b6912fdc 28-Oct-2014 Erik Kline <ek@google.com> Merge "(re)define the definition of "provisioned"" into lmp-mr1-dev
f3cab63ef2248aebf2c931cd1e84d5739791fa50 20-Oct-2014 Lorenzo Colitti <lorenzo@google.com> Change removeStackedLink to take an interface name.

This simplifies callers.

Also remove all "implementations" of addStackedLink and
removeStackedLink except the one in LinkProperties, because they
are unused.

Bug: 12111730
Change-Id: Ie294b855facba4b1436299dcb3211b72d9ba448e
inkPropertiesTest.java
d3b9fd33c69fa4fb844238c90b1fd343052946d9 24-Oct-2014 Erik Kline <ek@google.com> (re)define the definition of "provisioned"

Specifically:

[1] provide a hasIPv4(), and
[2] a hasIPv6()

each of which requires an IP address, a default route, and
address-family-specific DNS servers to evaluate to true.

Additionally:

[3] redefine isProvisioned() to return the logical OR
of [1] and [2] above.

Any external caller can still use any of the has*() methods to
construct its own, different definition of "provisioned".

Bug: 17769720
Change-Id: Ia692fb8508484ff403d3920c94d0e1db4563f807
inkPropertiesTest.java
7a8f1a32dcbd93354ba5b8987be9a9d9d0d61519 17-Sep-2014 Jeff Sharkey <jsharkey@android.com> NetworkStats always needs arrays.

Internal logic relies on Arrays.copyOf(), so always give ourselves
valid arrays, using shared empty objects to save overhead.

Bug: 17502649
Change-Id: I5dbb00545bdfe45bbd48144ab505ea08cc92cbcd
etworkStatsTest.java
1806b1fc25bcffaa005e72a55042031a42b168b1 11-Aug-2014 Lorenzo Colitti <lorenzo@google.com> Switch RouteInfo to use IpPrefix instead of LinkAddress.

This addresses a TODO and also makes it possible to create
routes to destinations that are not valid LinkAddresses, such as
multicast addresses.

Bug: 16875580
Change-Id: Id4c77b00dc3064bf27d78cdcbbe035e645748cfe
outeInfoTest.java
3824db6141c9ecabfc0ab900f2120e3aef3e9425 21-Jul-2014 Jeff Davidson <jpd@google.com> Delete most network scorer tests from coretests.

Anything which tests public API functionality will be moved to a
compatibility test suite.

The only remaining test is NetworkScorerAppManagerTest, which contains
unit tests for an internal helper class that is not (and should not
be) exposed via @SystemApi or otherwise.

Bug: 16355542
Change-Id: I478da97d3a4d09407992af37e45466dc484fa8cf
etworkKeyTest.java
ssiCurveTest.java
coredNetworkTest.java
b6646a8987a8ce6abd34cc05d9ca0193a6d7bea9 28-Jun-2014 Jeff Davidson <jpd@google.com> Allow network scorers to provide an opt-in activity.

A candidate scorer may have an activity registered to listen for the
ACTION_CUSTOM_ENABLE intent action. If so, when the user attempts to
select this scorer as the active one, this custom activity will be
launched and will be responsible for requesting that the framework
activate the scorer. This is to enable more complex opt-in flows prior
to becoming the active scorer.

Scorers which do not specify this activity will default to using the
framework switcher (currently ActiveNetworkScorerDialog, though this
may change).

Note that all switches must still go through the framework switcher;
the opt-in activity simply allows scorers to first show another screen
and perform the framework switch on their own terms.

Bug: 15775314
Change-Id: I3847e5d3161a8fcc9622abc03218795697c32778
etworkScorerAppManagerTest.java
a3b9ca5adead683eb30492f038e4e72452b6fa5a 26-Jun-2014 Jeff Davidson <jpd@google.com> Merge "Use/expose the receiver's label as the scorer name."
c741553644f8b19c63938ab9e36af1721c2cfa34 24-Jun-2014 Jeff Davidson <jpd@google.com> Use/expose the receiver's label as the scorer name.

Allows scorer apps to set a custom name for the scoring functionality,
even if the app has other non-scoring responsibilities, in which case
the application's label would be too generic.

Bug: 15775300
Change-Id: I61a7d1966742d463508e6801b7845ced8392db84
etworkScorerAppManagerTest.java
76ea6c68d3222441970ef98079ba30710ac8c595 23-Jun-2014 Lorenzo Colitti <lorenzo@google.com> Teach LinkProperties whether it's provisioned or not.

In IPv4, a link is provisioned when DHCP succeeds. In IPv6, a
there is no such signal, because addresses and DNS servers can
be notified by the kernel at different times.

Add an isProvisioned method that returns true if we believe that
enough information has configured to use a network. For IPv6,
this requires an IP address, default route, and DNS server. For
IPv4, this requires only an IPv4 address, because we support
static configuration that doesn't have a default route or DNS
server.

To do this we use the existing hasIPv4Address method, rename the
all-but unused hasIPv6Address method to hasGlobalIPv6Address
(which is what we want anyway) and add new hasIPv[46]DefaultRoute
and hasIPv[46]DnsServer methods.

Bug: 9180552
Change-Id: Ib2f5ff8af920f7b6f1edf0e2afaaa0edce9bc72d
inkPropertiesTest.java
64c43b1948a2b2fcd692cd4a48f031efbf7f7336 23-Jun-2014 Lorenzo Colitti <lorenzo@google.com> Minor changes to RouteInfo.

1. Realize that mDestination can never be null and update the
code accordingly.
2. Simplify isDefaultRoute.
3. Provide two new hidden utility methods, isIPv4Default() and
isIPv6Default(), that can be used by LinkProperties to
to determine if the system has connectivity.
4. Update tests.

Bug: 9180552
Change-Id: I85028d50556c888261d250925962bdedfe08e0c6
outeInfoTest.java
1603eadc5ad2f6d3e912ca0f20ec1bbc0b81fe01 23-Jun-2014 Lorenzo Colitti <lorenzo@google.com> Unbreak LinkPropertiesTest.

This was broken by the changes that made addRoute add routes
only if they did not already exist.

Change-Id: I1d227df9223fbecf106efde05b709f320824ee9d
inkPropertiesTest.java
8c6c2c3c929acad783b9a56b8d9efa597d0ae609 12-Jun-2014 Lorenzo Colitti <lorenzo@google.com> IpPrefix improvements.

1. Allow IpPrefixes to be created from strings. In order to do
this, factor out the code from LinkAddress which already does
this to a small utility class in NetworkUtils.
2. Truncate prefixes on creation, fixing a TODO.
3. Add a toString method.
4. Write a unit test.

While I'm at it, make RouteInfoTest pass again, and convert it
to use IpPrefix instead of LinkAddress.

Change-Id: I5f68f8af8f4aedb25afaee00e05369f01e82a70b
pPrefixTest.java
outeInfoTest.java
62388936c88840a5f1ab7a7f6dd547467e99dfad 13-Jun-2014 Lorenzo Colitti <lorenzo@google.com> Assert that RT_SCOPE_* and IFA_F_* are not zero.

If these constants are zero (or, rather, if they're not all
different), the test will fail with more cryptic error messages
whose cause is not obvious. Clearly check for that here.

Bug: 15602893
Change-Id: I7ca4a9c5e3d592fd93fbfa1b50666a1861a0031d
inkAddressTest.java
6f0ec45a3bff040790ae84345f154c65c9777610 12-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Fix Build

Change-Id: Iebbce8eaf21b3d2ba01ec720812d38018b13529e
outeInfoTest.java
130669992c5ea8d54db15f142e27578bdcf7e003 12-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Fix build breakage.

Change-Id: Ideb32704ce5dc37ef36b05609f88da2aa55b3a00
outeInfoTest.java
594b456b6e2aa4142fa31394cdd39bd4cc7a1d3a 12-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Minor changes to the LinkAddress API docs." into lmp-preview-dev
6307b35e1d3a8d577877be0b4c9cea1a909b6329 04-Jun-2014 Sreeram Ramachandran <sreeram@google.com> Add a new IpPrefix class and use it in RouteInfo.

This change uses IpPrefix only in the public API and continues
to use LinkAddress for everything else. It does not change the
callers to use the new APIs, with the exception of changing
all current uses of getDestination to getDestinationLinkAddress
to make room for the new getDestination method that returns an
IpPrefix.

Based on Sreeram's earlier change:
https://googleplex-android-review.git.corp.google.com/#/c/477874/
but a bit simplified and with a bit more documentation.

Bug: 15142362
Bug: 13885501
Change-Id: Ib4cd96b22cbff4ea31bb26a7853989f50da8de4e
(cherry picked from commit 7d3b4b9a3d4de9673119632da0ebd583e50126f7)
outeInfoTest.java
00a0fd650b7a31dffb88c229242bb04fa0b487a4 09-Jun-2014 Lorenzo Colitti <lorenzo@google.com> Minor changes to the LinkAddress API docs.

1. Rename getNetworkPrefixLength to getPrefixLength. Update all
callers in frameworks/base and add a shim method and a TODO
for the rest.
2. @hide isSameAddressAs. It doesn't add much, and it's just
one-liner that callers can implement if they want.
3. Fix the alignment of the initial paragraph (<ul> should have
been </ul>).
4. Remove the documentation that talks about creating
LinkAddresses, since there's no public API for creating them.

With these changes I think LinkAddress is fine as a public API.

Bug: 15142362
Change-Id: Iaf3b1db577745bb68a9e1dd7f96d666dd3f3ec7c
(cherry picked from commit 9ab53650cfcd91a2a151b44b3fd1381841f76269)
inkAddressTest.java
25702b39675c51dd4963eb71b66b20126a55cc05 06-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Fix public API of LinkProperties.

bug:15142362
(cherry picked from commit 51d898fd0223a4b7c728980ab987dd985c02df5f)
Change-Id: I1457111da7d3bd09998f7e010febb8bb4c45c8bc
inkPropertiesTest.java
f9cb86aebe9647e0fe0137fc198ba16c017445c6 09-Apr-2014 Robert Greenwalt <rgreenwalt@google.com> Replace LinkCapabilities with NetworkCapabilities

Also remove unused LinkSocket and LinkSocketNotifier.
bug:13885501

Change-Id: Id426e31b201fa4f29109b5fea485d8efb34519d3
inkSocketTest.java
14f1ec05b2add5ee051c0d2e7c7c3b36a6e77b92 29-Apr-2014 Jeff Davidson <jpd@google.com> API for network cache subsystems.

A network subsystem (e.g. Wi-Fi) will be responsible for implementing
INetworkScoreCache. NetworkScoreService will load caches for each
configured network subsystem. When it receives a call to update
scores, it will separate the networks by type and call updateScores on
the appropriate INetworkScoreCache.

Each subsystem will also be responsible for requesting scores for new
networks by calling NetworkScoreManager#requestScores.

Bug: 14408144
Bug: 14137255
Change-Id: I76e5e5205bc359c39d6b9c1782126fb7f465cd96
ssiCurveTest.java
10596fbcce710a76ffc7e917400df13af5c2ebcb 28-Apr-2014 Elliott Hughes <enh@google.com> resolved conflicts for merge of 3ce4f3d0 to master

Change-Id: Id5c5997ad8f801b32e1dbd97413ea42e38c27210
34385d352da19805ae948215e2edbeedd16b7941 28-Apr-2014 Elliott Hughes <enh@google.com> Track libcore.os' move to android.system.

(This is partial, but should cover everything in AOSP master except
for the zygote.)

Change-Id: I1042c99245765746a744c44e714095cb2c6cb75d
inkAddressTest.java
inkPropertiesTest.java
846318a3250fa95f47a9decfbffb05a31dbd0006 04-Apr-2014 Jeff Sharkey <jsharkey@android.com> Allow prefix-based Uri permission grants.

Define new FLAG_GRANT_PREFIX_URI_PERMISSION which indicates that a
Uri permission grant should also apply to any other Uris that have
matching scheme, authority, and path segments. For example, a prefix
grant for /foo/ would allow /foo/bar/ but not /foo2/.

Allow persistable and prefix grants to be issued directly through
grantUriPermission(). Relaxing persistable is fine, since it still
requires the receiver to actively take the permission.

Since exact- and prefix-match grants for the same Uri can coexist,
we track them separately using a new UriGrant key. (Consider the
case where an app separately extends READ|PREFIX and WRITE for
the same Uri: we can't let that become READ|WRITE|PREFIX.)

Fix revoke to always take away persisted permissions. Move prefix
matching logic to Uri and add tests. Add new flags to "am" tool, and
various internal uses around Intent and Context. Switch some lagging
users to ArraySet.

Bug: 10607375
Change-Id: Ia8ce2b88421ff9f2fe5a979a27a026fc445d46f1
riTest.java
6a4b220f1263d95fdefe6361c2bc87bbb04bbed0 17-Apr-2014 Jeff Davidson <jpd@google.com> Initial implementation of NetworkScoreManager's backing service.

This service will ultimately be responsible for propagating scores
down to lower-level network subsystems. For now, it just keeps scores
in memory and exposes these for debugging purposes via "adb shell
dumpsys network_score".

This change also adds provisioning of a default scorer. When
NetworkScoreService is first initialized, it checks to see if it has
ever set a default scorer; if not, it reads a package name from a
build config property and attempts to set it as the default.

Also add autogenerated equals/hashCode methods to all parcelables.

Bug: 14111427
Bug: 13786258
Change-Id: I02271171653d42e12acd240b73b9e23950744f6b
etworkScorerAppManagerTest.java
etworkScorerApplicationTest.java
dd6fd1e62b1792d1f96824b2fefb16d894b43197 15-Apr-2014 Jeff Davidson <jpd@google.com> Class for managing the active scorer application.

Allows listing all possible scorer apps, getting the active scorer
app, setting the active scorer app, and determining whether a given
UID is for the active scorer.

Note that setting a default scorer with a system image will be handled
separately - the plan here is to add a read-only build property
containing a package name to use as the scorer out of the box.
When NetworkScorerService is initialized, it will check a provisioning
bit; if that bit isn't set, it will set the current scorer to the
package specified in this build property (if any) and set the
provisioning bit to true.

Bug: 13769362
Change-Id: I18c0b2ba2aceccc88b70c3611a49149e0bf17ecf
etworkScorerApplicationTest.java
dc960e21ef1005fab5ef145773ddd6f40c802217 08-Apr-2014 Jeff Davidson <jpd@google.com> Data structures for communication with network scorer apps.

NetworkKey represents the necessary information to identify a network
to be scored. ScoredNetwork contains the key to identify a network as
well as a score to be used when evaluating that network (as a curve
based on RSSI).

Bug: 13767776
Change-Id: I6bfebd105c9381e615513167b4332b767b43a23a
etworkKeyTest.java
coredNetworkTest.java
4598ea4e5e6b2accce5165a76f5e2d04ce46c74c 09-Dec-2013 Lorenzo Colitti <lorenzo@google.com> am 263c4788: am 30253d7a: am 2daa0c93: Merge "Add address flags and scope to LinkAddress."

* commit '263c4788dcf45f104f8668fd6621d1a7c39689b9':
Add address flags and scope to LinkAddress.
64483947fdb03bf838e317ac0a4af5e0f53a5bbf 15-Nov-2013 Lorenzo Colitti <lorenzo@google.com> 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
inkAddressTest.java
inkPropertiesTest.java
66c621496fb2b4381e7dcf33ee3272ca3eed8da7 04-Dec-2013 Lorenzo Colitti <lorenzo@google.com> am 13d9dfb4: am 86570409: am 453a5233: Merge "Minor changes to LinkAddress."

* commit '13d9dfb495db1431623c712b36cac1fe2f3c2fc0':
Minor changes to LinkAddress.
e1ad1849f3a65c1ff06919351ef1d73e9bc8854e 27-Nov-2013 Lorenzo Colitti <lorenzo@google.com> Minor changes to LinkAddress.

1. Simplify the parceling code. Since the InetAddress inside a
LinkAddress can never be null, we don't need to special-case
the case where it is.
2. Add / update method documentation.
3. Write a unit test.

Change-Id: Iba0a8cecc683d55d736419965e72ee33dd66dc22
inkAddressTest.java
d6b37fdf6c24321a87566ad4053dad5daa3a844a 09-Sep-2013 Narayan Kamath <narayan@google.com> Allow SSL caches to be installed directly on SSLContexts.

This allows clients to enable ssl session caching without
having to use SSLCertificateSocketFactory.

Change-Id: Id63b8b31f51c96e73beefe9ecc5fd0cf0a1852c6
SLSessionCacheTest.java
fdf4bbf2d0514f8ad56ebbf06b8ebdeebe1da82b 09-Sep-2013 Narayan Kamath <narayan@google.com> Revert "Allow SSL caches to be installed directly on SSLContexts."

This reverts commit 25bef03cbf8d24c225b97202423dae75ed8b640f.

Breaks build with
cannot access com.android.org.conscrypt.SSLClientSessionCache
class file for com.android.org.conscrypt.SSLClientSessionCache not found

Change-Id: I6a89b45d5e8c7547778d7485ed02006cd4679989
SLSessionCacheTest.java
25bef03cbf8d24c225b97202423dae75ed8b640f 06-Sep-2013 Narayan Kamath <narayan@google.com> Allow SSL caches to be installed directly on SSLContexts.

This allows clients to enable ssl session caching without
having to use SSLCertificateSocketFactory.

Change-Id: Ibfb4b99fa86bc0704674437d9b860531317d2bde
SLSessionCacheTest.java
69df743f7489ca67ef1c94270325d1056f1bc546 07-Sep-2013 Robert Greenwalt <rgreenwalt@google.com> Fix the build.

Change-Id: Ia5d29de9db7ea8fd467b3bde551a8cfb95877b41
inkPropertiesTest.java
9d9b74a900696191048aa97cc3c854072640428b 01-Sep-2013 sy.yun <sy.yun@lge.com> Setting MTU size for specific network.

Able to config network specific MTU size. Normally, the default size of MTU is 1500.
US - ATT 1410, TMUS 1440, SPRINT 1422
KR - SKT 1440, KT 1450, LGU+ 1428
JP - KDDI 1420, SoftBank 1340
CA - RGS 1430, FIDO 1430, MTS 1430, BELL 1358, SaskTel 1358
AU - TEL 1400

Bug: 10195070
Change-Id: Ie18650b37a3d44af944f2dae4aa97c04fb12cd5e
inkPropertiesTest.java
22f407b11e11cfdb336e06e8c0d4a7ef1eafc783 23-Aug-2013 Lorenzo Colitti <lorenzo@google.com> Add a function to replace all the link addresses.

Bug: 10232006
Change-Id: I689ce4735999dac2ab5e1fae09d80b1f734292a1
inkPropertiesTest.java
4faa027df03c241c92a12a437f20767ab4d6ee64 08-Aug-2013 Lorenzo Colitti <lorenzo@google.com> Modify LinkProperties address update methods.

1. Make addLinkAddress a no-op if the address already exists.
2. Make addLinkAddress, addStackedLink and removeStackedLink
return a boolean indicating whether something changed.
3. Add a removeLinkAddress method (currently there is no way of
removing an address).
3. Move hasIPv6Address from ConnectivityService to
LinkProperties, where it belongs.

Bug: 9625448
Bug: 10232006
Change-Id: If641d0198432a7a505e358c059171f25bc9f13d5
inkPropertiesTest.java
3f1e1b2ce407684519f8bd070c931940fd33db4f 08-Aug-2013 Lorenzo Colitti <lorenzo@google.com> Simplify LinkPropertiesTest.

Instead of converting IP addresses to strings throughout the
test, do so once at the beginning.

Change-Id: I7f0dae5d2e9e2cdc6ec808e2cf71197ba6ade0a4
inkPropertiesTest.java
d1e0fae2bc5c98b1f00b185d7be7219dc7e1d0f7 31-Jul-2013 Lorenzo Colitti <lorenzo@google.com> Add accessors for all addresses and clarify compare* methods

1. Add a method to return all addresses and all LinkAddresses on
all links (both base links and stacked links). We already had
one for routes, but did not yet have any for addresses.
2. Rename compareRoutes to compareAllRoutes, because unlike the
other compare* methods, it looks at all interfaces. Update
what appears to be its only caller.
3. Update the documentation of the compare* methods to match
reality (they don't return lists) and clarify whether they
look at all links or only the base link.

Change-Id: Ie22e6c7f163d5de8e407248b45171dc28382d2d3
inkPropertiesTest.java
6c042b6d678edea0f936da994f85ba62f9a1950e 27-Jun-2013 Kenny Root <kroot@google.com> am a5a2de55: Merge "Add ALPN support to SSL socket factory"

* commit 'a5a2de55082b1f2a9ec0b99962a88063ac6d1bbf':
Add ALPN support to SSL socket factory
100d7290264338c6536739abd59879aaaa812537 25-Jun-2013 Kenny Root <kroot@google.com> Add ALPN support to SSL socket factory

This adds the ability to use Application-Layer Protocol Negotiation
(ALPN) through the SSLCertificateSocketFactory. ALPN is essentially
like Next Protocol Negotiation (NPN) but negotiation is done in the
clear. This allows the use of other protocols on the same port (e.g.,
SPDY instead of HTTP on port 80).

Change-Id: Ie62926b455e252c4c98670bbbecc1eb5c6f13990
SLTest.java
e9ae6822a80cb1f3bd13c785f1727c03d35da52e 30-Apr-2013 Kenny Root <kroot@google.com> resolved conflicts for merge of 1f6e789b to jb-mr2-dev-plus-aosp

Change-Id: I06c05d637613215b6d83df3e29cd495f6a5a0176
12e752225aa96888358294be0d725d499a1c9f03 24-Apr-2013 Kenny Root <kroot@google.com> Track change to JSSE provider

Change-Id: I35e824e47ad758ab6408e91e2ba5dcda053a82f5
ttp/X509TrustManagerExtensionsTest.java
213f98b6fe81c73f0d182fb5af312d4ce4a08041 01-Apr-2013 Lorenzo Colitti <lorenzo@google.com> Fix LinkProperties's equals() method.

LinkProperties's equals() method was broken by the addition of
stacked interfaces. The reason was that equals() was checking
the equality of mStackedInterfaces.keys(), which is just an
enumeration, instead of mStackedInterfaces.keySet(), which
actually contains the keys. The test was failing, but I didn't
notice.

Fix the bug and make the test check the objects more in depth
so it can give more detailed error messages when equals() fails.

Bug: 8276725
Change-Id: Ie990bd75f641c28e63e54d953dcd0f4de13f7c9f
inkPropertiesTest.java
cdee9727e26721910a44ba67980b39de4b103f7d 27-Mar-2013 Lorenzo Colitti <lorenzo@google.com> Merge "Make isHostRoute match only host routes" into jb-mr2-dev
fdadc4e242d987c09007df274e01fe678a82331f 27-Mar-2013 Lorenzo Colitti <lorenzo@google.com> Make isHostRoute match only host routes

Currently, isHostRoute returns true iff the gateway address is
the unspecified address (0.0.0.0 or ::). Thus, it will return
true for any route that has no gateway (e.g., a route pointing at
a point-to-point interface), even if the route is not a host
route.

Fix this by checking the prefix length instead. This should be
safe because:

1. mDestination cannot be null, since it's created using new.
2. Host routes created using makeHostRoute (which is what
ConnectivityService calls) always have the correct prefix
lengths (/32 or /128) set.

Bug: 8276725
Change-Id: I14285398823fa6c312349128c7cc216cad4a84c9
outeInfoTest.java
ef23bf198d14bea183c0dabd5b4fcd0a5d07d738 20-Mar-2013 Chiao Cheng <chiaocheng@google.com> Allow leading slash in path argument for addURI() method.

The original documentation for this class indicated a leading slash was possible
but the code did not support it. Since then, the docs were changed to reflect
what the code does.

The purpose of this change is to allow the use of uri.getPath() as an argument.
With this change, the following can be done

matcher.addURI(ContactsContract.AUTHORITY,
ContactsContract.CONTENT_FILTER_URI.getPath(), CONTACTS_FILTER)

instead of

matcher.addURI(ContactsContract.AUTHORITY,
"contacts/filter", CONTACTS_FILTER)

Change-Id: I76a9e3133365be9fe7a8de86eae57f9eea1cd2a3
riMatcherTest.java
b91e50c266a7eb9dd6f8171deb497931ef7aef76 15-Mar-2013 Lorenzo Colitti <lorenzo@google.com> Fix build.

Change-Id: Iac84a5f35d7fcaebd096e605a4590f8c90fe97b0
inkPropertiesTest.java
419a4ce9e461177d75eca5fd71fc8c275969e479 07-Mar-2013 Lorenzo Colitti <lorenzo@google.com> Add stacked interfaces to LinkProperties.

Bug: 8276725
Change-Id: I2f592d4c690e9af0459ae742ab16107a10d89353
inkPropertiesTest.java
1994bc14ab9fd3a3c5dca8851cfc0042bcb25d46 09-Mar-2013 Lorenzo Colitti <lorenzo@google.com> Unit test routes with interfaces in LinkProperties

Change-Id: Ie41a56bc9863ee72f4d7a8f72e436fc57e57b1af
inkPropertiesTest.java
45b9a5bb93569ca49bbd44f7a518091371687f96 08-Mar-2013 Lorenzo Colitti <lorenzo@google.com> RouteInfo changes.

- Add the interface name.
- Fix a bug where a default route would match an address of
another protocol (e.g., 0.0.0.0/0 would match 2001::).
- Tweak the hashCode method.
- Write a unit test.

Change-Id: Ida8266de440a9b1d9eaa132f182b9f1ce8978c44
outeInfoTest.java
91154ce658483488a1390e3da58cc2950fb02acb 22-Dec-2012 Brian Carlstrom <bdc@google.com> Use most specific attributes for distinguished name display

Bug: 7894348
Bug: http://code.google.com/p/android/issues/detail?id=41662
Change-Id: I8048a53b8a9a17b384f12b6a4f40071bb3dd3e04
ttp/SslCertificateTest.java
daa57e8d1866fe4579c280c41604f3660db7cd01 19-Sep-2012 Jeff Sharkey <jsharkey@android.com> Migrate network stats from removed users.

When a user is removed, migrate all network stats belonging to that
user into special UID_REMOVED bucket. Also removes those stats from
kernel to avoid double-counting if another user is created.

Bug: 7194784
Change-Id: I03f1d660fe3754566326b7749cae8068fc224ea9
etworkStatsTest.java
fd5a80f6e98124d908643a14d33b8d2fa5238da6 18-Sep-2012 Geremy Condra <gcondra@google.com> Code cleanup for X509TrustManagerExtensionsTest.java

Change-Id: I85584f7a9dbc726be811f783d125efcf70c9f6af
ttp/X509TrustManagerExtensionsTest.java
cb4c5819758a7e2951bd4818383f7c5e10a5f016 18-Sep-2012 Geremy Condra <gcondra@google.com> Fix bad isinstance check in X509TrustManagerExtensions and add test.

Change-Id: I333957186655b2543a637dafa8c51b0bba9d4dfb
ttp/X509TrustManagerExtensionsTest.java
2108ead7f125536874d6de6ca1c0c4cffbf61b44 17-May-2012 Jesse Wilson <jessewilson@google.com> Change NPN to forbid empty lists of protocols.

Bug: http://b/6438423
Change-Id: Ie89220e5bc219396c15dbe1feaa2f74fa1b243eb
SLTest.java
f5fb5e80963abeabdf0ff10dcee068344235082e 23-Mar-2012 Jesse Wilson <jessewilson@google.com> Add an API to expose Next Protocol Negotiation (NPN).

Bug: http://b/4190756
Change-Id: If904f7ff440391a6adb2963eb2ecb990140ab7cc
SLTest.java
18c227ba72406c0b69ce9925a80113060d870256 15-Feb-2012 Jesse Wilson <jessewilson@google.com> Implement the (hidden) ExtendedResponseCache interface.

Bug: http://code.google.com/p/android/issues/detail?id=25418
Change-Id: I4b20d576bac7036f94e57db7124de44f5b8d75be
ttp/HttpResponseCacheTest.java
241dde2306202e7655fdf41d5381f2874e47e108 03-Feb-2012 Jeff Sharkey <jsharkey@android.com> Unify shorthand for byte-based units.

Change-Id: If990859dee3f0973e1d4c48f05312c84071b3328
etworkStatsHistoryTest.java
5898991075ad5aa941c7c3c92467c03d28902ecf 15-Nov-2011 Jeff Sharkey <jsharkey@android.com> am bc03c74c: am d968670d: Merge "Conservatively trim data usage stats." into ics-mr1

* commit 'bc03c74c485669695805944a655795a6f9890956':
Conservatively trim data usage stats.
7ee8658453fe4efe04781bea9a14368e1d5ff41f 15-Nov-2011 Jeff Sharkey <jsharkey@android.com> Conservatively trim data usage stats.

Instead of trusting NTP time alone, use the most-conservative of
system clock and NTP.

Bug: 5584564
Change-Id: I5dd87fc009959b1cf0a7d660e385a0b1a8be238b
etworkStatsHistoryTest.java
c592a57f3ff4f4e051eef57c7fb50b8643a653e5 09-Nov-2011 Jeff Sharkey <jsharkey@android.com> am 489b4312: am 4c48d2ff: Merge "Make operation counts monotonically increase." into ics-mr1

* commit '489b431273500db81d35ed43440915187c238f92':
Make operation counts monotonically increase.
4abb1b8ef64dc4cd71966b59dc5d72a15055bf13 09-Nov-2011 Jeff Sharkey <jsharkey@android.com> Make operation counts monotonically increase.

Bug: 5585704
Change-Id: I5247a68acdb209a4ef0f5aac18944595c295e6ca
etworkStatsTest.java
4d81191dd377d30570d6c3294b0fb1f0ea681f46 03-Nov-2011 Jeff Sharkey <jsharkey@android.com> am 808ee95d: Merge "Correct proc file reader, optimizations." into ics-mr1

* commit '808ee95dd4244da6ae767d3ddd003ed7b48937d0':
Correct proc file reader, optimizations.
163e6443f27884a9bfcb9a48ef606dc635852c23 01-Nov-2011 Jeff Sharkey <jsharkey@android.com> Correct proc file reader, optimizations.

Moved away from BufferedReader, which only reads the first 8KB of
some proc files because it aggresively fills its buffer. Optimized
proc parsing, now double the speed. Tests to cover.

Log when NetworkStats counters roll backwards when subtracting, and
optimizations around findIndex(). When system removes UID, also
remove from last stats snapshot to avoid xt counters from rolling
backwards.

Bug: 5472949, 5458380
Change-Id: I07c08fe5233156fac2b84450f6291868bf9bfaf2
etworkStatsTest.java
0f28af209ac877091f4a096f7553f02a0b401596 29-Oct-2011 Jesse Wilson <jessewilson@google.com> Interpret '+' as a space char in the URL query params.

This changes Uri.decode() to use libcore's implementation
of the same behavior.

Bug: http://code.google.com/p/android/issues/detail?id=21064
Change-Id: If81005492b12d3aaecc745471e0a28679544a391
riTest.java
1059c3c30ad96a15695c1a92ae8896e078a6309f 05-Oct-2011 Jeff Sharkey <jsharkey@android.com> Move battery stats to xt_qtaguid for data stats.

Replace TrafficStats calls by reading values from xt_qtaguid kernel
module. To keep BatteryStatsImpl changes lightweight, cache recently
parsed stats. Tracks mobile ifaces from ConnectivityService.

Refactor xt_qtaguid parsing into factory outside of NMS. Add stats
grouping based on UID, and total based on limiting filters like iface
prefix and UID.

Bug: 4902271
Change-Id: I533f116c434b77f93355bf95b839e7478528505b
etworkStatsTest.java
905b5891d2aa802f447ac2ce5d77b6c5ba06277a 01-Oct-2011 Jeff Sharkey <jsharkey@android.com> Track xtables summary, move tether stats, time.

Begin tracking xtables summary of data usage to compare with values
reported from /proc/net/dev. Roll tethering directly into UID stats
to trigger UID stats persisting when crossing threshold.

Include xtables summary and authoritative time in samples.

Bug: 5373561, 5397882, 5381980
Change-Id: Ib7945522caadfbe0864fdf391582dc820f4f371e
etworkStatsTest.java
de5d7d250848b0db4119f362e2e700cb19e02293 28-Sep-2011 Jesse Wilson <jessewilson@google.com> Test to demonstrate NPE in DefaultRequestDirector

When the HTTP client encountered a server failure while
talking through a proxy, it fails with an NullPointerException
and not an IOException.

Change-Id: I4b287105bf78b832d034557e37e74ce576c7894d
Bug: http://b/5372438
ttp/AbstractProxyTest.java
69b0f63af2e3babc2e9f048c4682032a0c17d9d0 12-Sep-2011 Jeff Sharkey <jsharkey@android.com> Data usage structure optimizations.

Driven by traceview hotspots found in Settings UI.

Change-Id: I614a049523c526b7fcd12fffdf53a3e4723623e4
etworkStatsHistoryTest.java
558a23200697d306b75750cf4612cf0717e73537 25-Aug-2011 Jeff Sharkey <jsharkey@android.com> Data usage buckets active time, parsing ISE.

When recording data usage, measure the actual active time, since
buckets can be quite long. Offer incrementOperationCount() version
that reads thread stats tag for caller. Rethrow any NPE as ISE
during stats parsing, which callers already handle.

Bug: 5171812, 5184508, 5180659
Change-Id: I6da80ccc0162be68bee279529e3a23b6f98ebd87
etworkStatsHistoryTest.java
8e9992ae5053a3ac52d28a5a892aed0a0798c7ab 24-Aug-2011 Jeff Sharkey <jsharkey@android.com> Register for kernel global data usage alerts.

Instead of polling every 15 minutes, register for alerts that trigger
when system-wide traffic passes a threshold. Still mixed with polling
to persist UID stats, but relaxed to 30 minutes. Currently watches
for every 512kB.

Make persistence decision separately for network versus UID, and use
total delta bytes when making decision. Use light bootstrap during
systemReady() instead of heavy poll, which had been force-loading all
UID data unnecessarily.

Bug: 5023631
Change-Id: I04b723d6c4bf872fb1028071122dba66a8e1b576
etworkStatsTest.java
b5d55e302d2253e4bfb233ea705caf258cdc4cb9 11-Aug-2011 Jeff Sharkey <jsharkey@android.com> Foreground/background network stats using sets.

Teach NetworkStats about "counter sets" coming from kernel, and use
them to track usage in foreground/background. Add AID_NET_BW_ACCT to
system_server so it can control counter sets.

Move to composite key of NetworkIdentitySet, UID, set, and tag when
recording historical usage. Persisting still clusters by identity,
since that is heaviest object.

Request async stats poll during systemReady() to bootstrap later
delta calculations. Reset kernel counters when UID removed. Update
various tests.

Bug: 5105592, 5146067
Change-Id: Idabec9e3ffcaf212879821515602ecde0a03de8c
etworkStatsTest.java
63d27a9233fed934340231f438493746084a681d 04-Aug-2011 Jeff Sharkey <jsharkey@android.com> Network stats with varint, omit parcel fields.

Persist NetworkStatsHistory using variable-length encoding; since
most buckets have small numbers, we can encode them tighter. Initial
test showed 44% space savings. Also persist packet and operation
counters.

Let NetworkStatsHistory consumers request which fields they actually
need to reduce parcel overhead.

Tests for verify varint and history field requests, also verify end-
to-end by persisting history into byte[] and restoring. Expose
bandwidth control enabled state. Extend random generation to create
packet and operation counts. Moved operation counts to long.

Fix bug that miscalculated bytes since last persist, which would
cause partial stats loss when battery pulled.

Bug: 4581977, 5023706, 5023635, 5096903
Change-Id: If61e89f681ffa11fe5711471fd9f7c238d3d37b0
etworkStatsHistoryTest.java
a63ba59260cd1bb3f5c16e395ace45a61f1d4461 20-Jul-2011 Jeff Sharkey <jsharkey@android.com> Add operation counts to network statistics.

Provide API to increment "operation counts" for a UID and tag, used
to eventually derive bytes/operation stats. Internally is stored at
network layer, but should belong at data layer. Switch profiling
to use data layer stats, which are emulated by summarizing network
layer details.

Read packet counts from new /proc/ columns and collect them into
NetworkStatsHistory. Prevent double-counting by ignoring values from
first snapshot. Watch for duplicate /proc/ entries. Update tests
to verify packet and operation counters.

Bug: 5052136, 5097392
Change-Id: I1832f65a2b8a9188f8088f253474a667c21a2f09
etworkStatsHistoryTest.java
etworkStatsTest.java
434962e44ea93b1c4d216c55f636a435bf54aa54 13-Jul-2011 Jeff Sharkey <jsharkey@android.com> Include full network history around current time.

When requesting historical values with time ranges, always include
full values for buckets that span current time. (It doesn't make
sense to interpolate partial data.) Move getTotalData() to return
full Entry objects to prepare for packet counts.

Bug: 4691901
Change-Id: I717bd721be9f1d4a47c4121e46e07a56cb15bbf1
etworkStatsHistoryTest.java
d37948f6ed1667d077e0e3a38808f42f981ddcc2 12-Jul-2011 Jeff Sharkey <jsharkey@android.com> Hide NetworkStatsHistory internals.

Instead of exposing internal storage details, offer getValues()
accessor which populates values into a recycled structure.

Change-Id: I5228d7099a8f61b2018a435a813435a67dae49b4
etworkStatsHistoryTest.java
etworkStatsTest.java
fd8be3e5e7420f3cca591daeec8a44487f5f65aa 11-Jul-2011 Jeff Sharkey <jsharkey@android.com> Return stats from inactive ifaces, packet counts.

When an iface goes inactive, xt_qtaguid maintains historical counters
instead of discarding. Now reading and returning those values in
NetworkManagementService summary calls. Tests to verify stats are
returned.

Modify NetworkStats to include rxPackets and txPackets values, and
move to Entry to eventually hide internal storage details.

Bug: 4984539
Change-Id: I1ba0bb5580c62e946d9dff2cc2a6f64aff403efc
etworkStatsTest.java
df867f8f8025c778a2d2eb4c4e364d967808743c 24-Jun-2011 Jesse Wilson <jessewilson@google.com> Test that algorithm name is case-insensitive for digest auth.

Change-Id: I891a533ae3b16b838925fa488093c19dfeb32efa
http://code.google.com/p/android/issues/detail?id=16051
ttp/DefaultHttpClientTest.java
1b5a2a96f793211bfbd39aa29cc41031dfa23950 19-Jun-2011 Jeff Sharkey <jsharkey@android.com> Read "qtaguid" network stats, refactor templates.

Teach NMS to read qtaguid stats from kernel, but fall back to older
stats when kernel doesn't support. Add "tags" to NetworkStats entries
to support qtaguid. To work around double-reporting bug, subtract
tagged stats from TAG_NONE entry.

Flesh out stronger NetworkTemplate. All NetworkStatsService requests
now require a template, and moved matching logic into template.

Record UID stats keyed on complete NetworkIdentitySet definition,
similar to how interface stats are stored. Since previous UID stats
didn't have iface breakdown, discard during file format upgrade.

Change-Id: I0447b5e7d205d73d28e71c889c568e536e91b8e4
etworkStatsTest.java
4a97122ebf4d92a3f94402041729d77905e6c0c0 12-Jun-2011 Jeff Sharkey <jsharkey@android.com> Growable NetworkStats object instead of builder.

NetworkStats now grows in place with arraycopy() instead of callers
needing to know record count a priori. Better growth calculation for
both NetworkStats and NetworkStatsHistory; 50% each time. Better
estimates of buckets needed in calling services.

Change-Id: I3adbffa0b7407612cc6349d9135a8b4eb63cd440
etworkStatsTest.java
3f3913550c10792edb8aecf66cc83c3db5c8b311 06-Jun-2011 Jeff Sharkey <jsharkey@android.com> Persist network stats using AtomicFile.

Implements read/write of network stats using AtomicFile, along with
magic number and versioning. Stores in "/data/system/netstats.bin"
for now. Tests to verify that stats are persisted across a simulated
reboot, and to verify that TEMPLATE_WIFI is working.

Fixed bug where kernel counters rolling backwards would cause negative
stats to be recorded; now we clamp deltas at 0.

Change-Id: I53bce26fc8fd3f4ab1e34ce135d302edfa34db34
etworkStatsTest.java
19862bf5d058b6ab0c2979e7a5e0297dae6b170b 03-Jun-2011 Jeff Sharkey <jsharkey@android.com> Compute range-based usage in NetworkStatsHistory.

When given a start/end range, interpolate between buckets to return
the total network usage. Used to summarize detailed UID stats. Method
to combine NetworkStatsHistory regardless of bucket size. Used to
combine all histories matching a template.

Added tests for both methods.

Change-Id: Ia463910c0ecf7cf08dcf97c658ad99742bd6b882
etworkStatsHistoryTest.java
d2a458750e5a3d490af09cecb5c28370baf0a913 29-May-2011 Jeff Sharkey <jsharkey@android.com> Map network identity using ConnectivityService.

Instead of deriving network identity based on raw subsystem broadcasts,
listen for updates from ConnectivityService. Added atomic view of all
active NetworkState, and build map from "iface" to NetworkIdentity set
for stats tracking.

To avoid exposing internal complexity, INetworkStatsService calls use
general templates. Added TelephonyManager mapping to classify network
types using broad labels like "3G" or "4G", used to drive templates.

Cleaned up Objects and Preconditions.

Change-Id: I1d4c1403f0503bc3635a59bb378841ba42239a91
etworkStatsHistoryTest.java
7ad00e6f5ccaf975a49870cdd267d28ae144314e 07-Jun-2011 Jesse Wilson <jessewilson@google.com> Use external/mockwebserver in frameworks/base

Change-Id: Ifb45671e3e7256692c74587984ee5fe1d0eca181
ttp/AbstractProxyTest.java
ttp/CookiesTest.java
ttp/DefaultHttpClientTest.java
75279904202357565cf5a1cb11148d01f42b4569 25-May-2011 Jeff Sharkey <jsharkey@android.com> Collect historical network stats.

Periodically records delta network traffic into historical buckets to
support other services, such NetworkPolicyManager and Settings UI.

Introduces NetworkStatsHistory structure which contains sparse, uniform
buckets of data usage defined by timestamps. Service periodically
polls NetworkStats and records changes into buckets. It only persists
to disk when substantial changes have occured. Current parameters
create 4 buckets each day, and persist for 90 days, resulting in about
8kB of data per network.

Only records stats for "well known" network interfaces that have been
claimed by Telephony or Wi-Fi subsystems. Historical stats are also
keyed off identity (such as IMSI) to support SIM swapping.

Change-Id: Ia27d1289556a2bf9545fbc4f3b789425a01be53a
etworkStatsHistoryTest.java
etworkStatsTest.java
a7284f0e72745d66155e1e282fc07113332790fa 27-May-2011 Brian Carlstrom <bdc@google.com> Tracking merge of dalvik-dev to master

Adapt to change in the way MockWebServer sets up CONNECT proxies.
git cherry-pick --no-commit c7e2feee5e7908a019a0de91123c1feb9bdc38bc

React to move of Base64 in libcore
git cherry-pick --no-commit 119f7ebdd1f8df3a8ff8e3b8056bff725d569253

Expose and document android.net.HttpResponseCache.
git cherry-pick --no-commit 7b73f0fdb8c032a65c55610541d66385bd8bcbe6)

make update-api

Change-Id: Ieb48b304ea38ee8c2ec01e860d99b1404583889e
ttp/AbstractProxyTest.java
ttp/HttpResponseCacheTest.java
eedcb9525ba5befee2ba6ebb7a9ee3f13395c2a3 17-May-2011 Jeff Sharkey <jsharkey@android.com> APIs to profile network usage for current UID.

Added startDataProfiling() and stopDataProfiling() to TrafficStats,
which can be used by apps to measure network usage delta between two
points in time. Currently takes two NetworkStats snapshots and returns
delta, which will eventually include tag-level granularity. Added
tests for NetworkStats delta subtraction.

Added NMS.getNetworkStatsUidDetail() that returns stats for specific
UID. Always gives stats access for the calling UID, otherwise enforces
that caller has permission. Fix readSingleLongFromFile(), since
/proc/ files don't have well-defined lengths.

Change-Id: Ic5b6414d8effbd66846e275b00d4b8a82c74589d
etworkStatsTest.java
aa70f101e08098ed9cb190abe2d7f952561026b8 28-Apr-2011 Robert Greenwalt <rgreenwalt@google.com> Add RouteInfo objects for tracking routes.

Used to have list of gateways for default routes, but general static routes
should be supported.

Change-Id: I01730142c6139f2b833b9d48f5381d2d320b69f6
inkPropertiesTest.java
4e900091c4da26eb1c9f0d232ee0e50f4522cc69 04-Apr-2011 John Wang <johnwang@google.com> Make LinkProperties comparable.

Add equals() and hashcode() to LinkProperties and related fields.

Bug:3501569
Change-Id: Ifa737a67c16867ac43cf76bf618a483e612a189e
inkPropertiesTest.java
0cb0d7a2d43874895e764fabed6a6692818dc89d 17-Dec-2010 Jesse Wilson <jessewilson@google.com> Test that DefaultHttpClient responds gracefully when the server closes a socket.
http://b/2612240

Change-Id: Iafde060572f7865b72fc568b3b55578ed5dd9c94
ttp/DefaultHttpClientTest.java
bf1df887d4b87f7da69cd4fe9306eb0d19166d52 16-Dec-2010 Jesse Wilson <jessewilson@google.com> New tests for AndroidHttpClient with a proxy server.

Change-Id: I03ec2f1257824c8675156dd80f6045512d1a36fe
http://b/3254717
ttp/AbstractProxyTest.java
ttp/AndroidHttpClientProxyTest.java
ttp/DefaultHttpClientProxyTest.java
ttp/ProxyTest.java
ee3567558f594c9039a7605d88d5671bcf465488 07-Dec-2010 Jesse Wilson <jessewilson@google.com> Merge "Test that we use proxies specified by system properties."
10733a71c5557861160292e07de011ea9a4db25c 07-Dec-2010 Jesse Wilson <jessewilson@google.com> Test that we use proxies specified by system properties.

This tests that we use the properties and also that the
precedence prefers client and request properties.

Change-Id: I480dacaf373e3ddd7642d3c918fa50695b36cdba
http://b/3254717
ttp/HttpsThroughHttpProxyTest.java
ttp/ProxyTest.java
47413708eb42753d891882f488c2d6399b298169 01-Dec-2010 Jesse Wilson <jessewilson@google.com> Add a test to demonstrate parsing of trailing URI parameters.

Change-Id: I1fde21381cf74b5e4847bb2c2a9ef52f8ac6a2bb
http://b/3124097
riTest.java
40811b01542cec7a76bdfee79e77d1f684731d37 09-Nov-2010 Jesse Wilson <jessewilson@google.com> Test to demonstrate that HTTP cookie hostnames aren't case-sensitive.

Change-Id: I05c764876acdc1e85b41f4558bd03fff526da1b4
http://b/3167208
ttp/CookiesTest.java
ad4eeb6e76420c434c7239cc1f7df6f8a6baf63e 16-Oct-2010 Jesse Wilson <jessewilson@google.com> am 9bb8e5cc: am 8f666c2d: Merge "Test that we don\'t leak sensitive information when logging cookies." into gingerbread

Merge commit '9bb8e5cc3e9f8ae2c46967ee1fd422f3bf1e9429'

* commit '9bb8e5cc3e9f8ae2c46967ee1fd422f3bf1e9429':
Test that we don't leak sensitive information when logging cookies.
2102bde9d4afc2a7246b62ceaab495a8ec7401f3 15-Oct-2010 Jesse Wilson <jessewilson@google.com> Test that we don't leak sensitive information when logging cookies.

Change-Id: I048a785fa7209841ff1bffc365ed5e1bceb53522
http://b/3095990
ttp/CookiesTest.java
eb8be973c7982fe3ece0aeaeca379c3b3cdced0c 12-Oct-2010 Bjorn Bringert <bringert@android.com> Make fields in WebAddress private, add getters/setters

Change-Id: Iceaf3d648289344e53c37273f7324a79676fbef7
ebAddressTest.java
d58429f9acdb33f05bdb233b7bba495de80cb336 28-Sep-2010 Steve Howard <showard@google.com> Manual merge: Move DownloadManager to android.app

Changing package at hackbod's request.

Change-Id: I867017b6a9f4684d30c6c5bd1b07f9cabecddb9f
ownloadManagerBaseTest.java
ownloadManagerIntegrationTest.java
ownloadManagerStressTest.java
31fd85f39b554e09b2e6c1c2ccf5c186859880fa 28-Sep-2010 Steve Howard <showard@google.com> Move DownloadManager to android.app (DO NOT MERGE)

Changing package at hackbod's request. I'll merge this manually, as
there's some additional master-only code that will be to be
simultaneously changed.

Change-Id: Ibb629ec1c31807fbee31e0193c6a941d04be0117
ownloadManagerBaseTest.java
ownloadManagerIntegrationTest.java
ownloadManagerStressTest.java
c64c6a99fb36c6d93055d6ab5c17cdf124c9ad92 21-Sep-2010 Neal Nguyen <tommyn@google.com> am abb45e67: am b9881e6b: Merge "Adding more DL Manager tests." into gingerbread

Merge commit 'abb45e6720a035e909644941b8ef7f92faeb6f34'

* commit 'abb45e6720a035e909644941b8ef7f92faeb6f34':
Adding more DL Manager tests.
df7a865bbf45b57c60d294d5ac721e67e69a2dd6 09-Sep-2010 Neal Nguyen <tommyn@google.com> Adding more DL Manager tests.

Change-Id: I87bf91fdd7dbd058c8d619200d2826ba5e7f76fb
ownloadManagerBaseTest.java
ownloadManagerIntegrationTest.java
00cfe112b436eaafb44c0466ceacce3baf10a8f3 17-Sep-2010 Wink Saville <wink@google.com> Add LinkSocket API

Restructuring ConnectivityService to handle multiple connections.

Change-Id: Ia993fbb120bebb844fd0d603dc76fbc700b31fd1
inkSocketTest.java
1e3187c27f878c083170149e645b1e2d19bc40a6 09-Sep-2010 Neal Nguyen <tommyn@google.com> am 0c592acf: Merge "Adding Download Manager Integration, stress, and hosts-based tests." into gingerbread-plus-aosp

Merge commit '0c592acfc0ea298a0cf6c049cce4c5c10974e911'

* commit '0c592acfc0ea298a0cf6c049cce4c5c10974e911':
Adding Download Manager Integration, stress, and hosts-based tests.
5f53bca55b2c9e217dee12bff8ce55e168829783 09-Aug-2010 Neal Nguyen <tommyn@google.com> Adding Download Manager Integration, stress, and hosts-based tests.

Change-Id: I97008f6cfd95ea9950db0b4e093da02528849b63
ownloadManagerBaseTest.java
ownloadManagerIntegrationTest.java
ownloadManagerStressTest.java
cf67abbc48d6d56538dd6f2412d6aa9863a31637 08-Sep-2010 Jean-Baptiste Queru <jbq@google.com> am 6ffee9bb: Merge "Revert "resolve conflicts"" into gingerbread-plus-aosp

Merge commit '6ffee9bbba53700d33456261b986ac8a3f333b9e'

* commit '6ffee9bbba53700d33456261b986ac8a3f333b9e':
Revert "resolve conflicts"
2cc595af6542ba898ce3aa79daeee923b1a585fa 08-Sep-2010 Jean-Baptiste Queru <jbq@google.com> Revert "resolve conflicts"

This reverts commit 84f992a249491b9f755e879bf096baac3f9472f5.
ownloadManagerBaseTest.java
ownloadManagerIntegrationTest.java
ownloadManagerStressTest.java
980bd4a12d70e87cdab3c7b39b5b1d7828913933 08-Sep-2010 Jean-Baptiste Queru <jbq@google.com> am 84f992a2: resolve conflicts

Merge commit '84f992a249491b9f755e879bf096baac3f9472f5'

* commit '84f992a249491b9f755e879bf096baac3f9472f5':
Adding Download Manager Integration, stress, and hosts-based tests.
40ef0f49ea9fa7c39eb0018fdb4df4b73a11a77d 09-Aug-2010 Neal Nguyen <tommyn@google.com> Adding Download Manager Integration, stress, and hosts-based tests.

Change-Id: If75021380f4aee9c650f6e34093779e85cc4e5d8
ownloadManagerBaseTest.java
ownloadManagerIntegrationTest.java
ownloadManagerStressTest.java
8bb37f7ffb24ab06576dd4225ab0a5e1828a0d07 07-Sep-2010 Steve Block <steveblock@google.com> Adds a test case for WebAddress where the path component does not have a leading slash

When a URL is malformed because the path does not start with a slash,
we assume that the path starts with the first character that is not
valid in the host and insert a leading slash. This is the reason why
the regex for the path component does not force a leading slash.

Bug: 1011602
Change-Id: I8efe46c058d2ee2d1a6a4406ee25dc021315222b
riTest.java
ebAddressTest.java
582deec1f3c8f51b431bb2ad685c9217ffd9eaad 06-Sep-2010 Steve Block <steveblock@google.com> Fixes a problem with URL parsing when the host ends with a dot

The WebAddress class provides a lenient parser for URLs. Currently, it
identifies the host portion with the regex [<chars>]+(\.[<chars>]+)* where
<chars> is the set of characters valid for the host name. This pattern excludes
the case where the host ends with a dot, which is valid possibility. As a
result, any trailing dot is pushed into the path component. Since we add a
leading slash to the path if one is missing, the result is a path that begins
with '/.'.

This fix changes the host regex to [<chars>]+[<chars>\.]* which allows trailing
dots and fixes the problem.

Bug: 2337042
Change-Id: I310512531787e0f742988f5d815ad944fd39e059
riTest.java
ebAddressTest.java
58a345936d7e2b66bdeefb492e4f777754792d7e 19-Aug-2010 Ben Dodson <bjdodson@google.com> Added methods for managing uri query parameters

Change-Id: Ic98c1bd159740dd4d895889079f9f2abae4fc2b9
riTest.java
4d42ccd1579da53aaaf132a6ad26a06e2baa5b98 19-Aug-2010 Brian Carlstrom <bdc@google.com> Tracking merge of dalvik-dev to gingerbread

git cherry-pick --no-commit 353ab63e412dd15029143de238e9590ab35eb583)
make update-api

Change-Id: I9e61616828a3a5745421350b9a2fc78ba181d388
ttp/HttpsThroughHttpProxyTest.java
3c7c351a6217ac48b741740167c201a679a0ca65 05-Aug-2010 Brian Carlstrom <bdc@google.com> Tracking merge of dalvik-dev to gingerbread

git cherry-pick --no-commit f77cf7f0
git cherry-pick --no-commit c8f503b5285e30c1a881d0ba860ba9021f57d113
git cherry-pick --no-commit 570bb561
git cherry-pick --no-commit e2417541
git cherry-pick --no-commit e4d81f25bd4dc1a5c909b56ab56a56406290da30
git cherry-pick --no-commit 5e8a587d

Change-Id: I101a385d43f3e0f4ce5352217f92ef67a3908c88
ttp/HttpsThroughHttpProxyTest.java
9114a8bb8b241bb8d3be307b29e64ea64ab27901 11-May-2010 Keith Ito <kito@google.com> Fix for bug 2672749: StringIndexOutOfBoundsException in Uri.getQueryParameter

Change-Id: I10b02306478d9c595dbcae0767b44c403d50e24a
riTest.java
e41c317348cfe23a78bfd97609c3489c6cc4a786 21-Mar-2010 Keith Ito <kito@google.com> Advance encodedKeySearchIndex if encodedKey matches a suffix of a parameter.

Bug: 2524610
Change-Id: I51bbf8248133b61825d2ae14afe175cb4d0413b8
riTest.java
1a44d5dcabc18cd5ef111f732ccff91683a1a093 13-Jan-2010 Neal Nguyen <tommyn@google.com> Phase 2 of test cleanup: moving test files from AndroidTests closer to their sources.

Most of these are file moves; a couple notable exceptions are the changes due to the move, and fixing up test code:
- database/DatabaseCursorTest.java
- database/DatabaseStatementTest.java
- net/UriTest.java
ocalSocketTest.java
SLTest.java
riMatcherTest.java
riTest.java
6505122dfe96322bdeac4210d313b3f043c6a29a 27-Jan-2010 Brian Carlstrom <bdc@google.com> Issue 1597: browser crash possibly related to invalid SSL certificate
ttp/SslCertificateTest.java