Commit Graph

2525 Commits

Author SHA1 Message Date
junyulai
a545c35fa4 Remove unused variables
From aosp/537809, variables that used to fetch realtime
stats are defined in NetworkStatsService. These varialbles
are filled by JNI in boot up stage in order to keep
definitions sync with native layer.

However, there is still a copy in TrafficStats.java, and this
copy cannot be filled in boot-up stage since it is in app
process. Besides, making a binder call to fetch these
constants from service is considered an overkill.

Thus, since there is no caller to these variables and callers
should use definitions in TrafficStats, remove these variables.

Test: atest FrameworksNetTests
Bug: 16229221
Change-Id: I6a48d4dbb1b824cfc6c4a47395b2a76aa28cf5c9
2020-11-12 14:22:31 +08:00
junyulai
ea2363294f Return offloaded traffic when querying from TrafficStats API
TrafficStats API are being used for querying realtime network
statistics for years. However, on certain devices, some network
traffic are produced by hardware components and not be
able to seen by kernel counters.

Thus, include statistics for those missing network traffic is
necessary. Note that the included statistics might be stale
since polling newest stats from hardware might impact system
health and not suitable for TrafficStats API use cases.

Test: atest FrameworksNetTests TetheringTests
Bug: 16229221

Change-Id: I6741c41cb5145ca8748f9b083b9c15e7e2735681
2020-11-12 14:22:31 +08:00
junyulai
e3be94d65c Remove unused getTetherStats
Before Android R, getTetherStats were used to collect tethering
iface stats of all clients who extends ITetheringStatsProvider,
which typically contains NetdTetheringStatsProvider and
OffloadController.

However, this always returns 0 since Android R, because:
  1. OffloadController implemented NetworkStatsProvider and no
     longer reports stats through getTetherStats.
  2. NetdTetheringStatsProvider always return 0 by design since
     non-offloaded iface tethering stats are already included
     in native iface stats.

This change is a no-op refactoring to remove unused
getTetherStats and update test which is not pratical.
Fix for offloaded tethering stats will be in follow-up CLs.

Test: atest FrameworksNetTests TetheringTests
Bug: 162292214
Change-Id: Icd0717c5c2807ae3bd98626b897e4b148f142815
2020-11-06 19:02:44 +08:00
Eran Messeri
0c94b53855 DO NOT MERGE: Introduce DPMS shim for active DO/PO check
Introduce a shim into DevicePolicyManagerInternal &
DevicePolicyManagerService so that NetworkStatsAccessTest would not
diverge from internal development branches.

The DevicePolicyManagerService refactoring on the internal branch
removed isActiveAdminWithPolicy in favour of isActiveDeviceOwner and
isActiveProfileOwner.

These methods are being made available in AOSP for
NetworkStatsAccessTest.

Bug: 170459325
Test: atest NetworkStatsAccessTest
Change-Id: Ic7e0898989fb8222aaba2b35436765c04eb3250c
2020-11-04 10:07:06 +00:00
Ashwini Oruganti
c5c6f28294 Apply FLAG_IMMUTABLE to the PendingIntent in NetworkStatService.java
Broadcast intents sent by AlarmManager are immutable; the system
dispatches them without customization.

Fixes: 171815343
Test: TH
Change-Id: I35ccfc0f69fd98b5803da74d9eb12902b351acc7
Merged-In: I35ccfc0f69fd98b5803da74d9eb12902b351acc7
2020-10-30 10:49:45 -07:00
Baligh Uddin
b6caaa4c1e Restructure Module code [ com.android.tethering ]
Code Migration from frameworks/base/packages/Tethering ->
packages/modules/Connectivity/Tethering

BUG: 167962976
Test: m com.android.tethering + TH
Merged-In: Ib4a3a7a14d7d0e544aadf1bfb21ad390f1ba76a7
Change-Id: Ifae56d991b43c02f1e3496abbafc87d1869add8a
2020-10-30 05:44:59 +00:00
Yan Yan
27ef72a875 Merge "Require devices with first sdk 0 or later to support mandatory algorithms" 2020-10-20 22:33:37 +00:00
Yan Yan
f62269e265 Require devices with first sdk 0 or later to support mandatory algorithms
It is safe because these mandatory algorithms are already required
before new algorithms are added

It is also a quick fix to unblock b/171279612, whose root cause is
the device first sdk is wrong

Bug: 171279612
Test: atest CtsNetTestCases:IpSecManagerTest
Change-Id: I5b9d85b2bc8f13f54467c97160d138a4628265f7
2020-10-20 15:12:30 -07:00
Anton Hansson
5cedf5097c Merge "Remove @TestApi from @SystemApi symbols" 2020-10-20 13:45:13 +00:00
Anton Hansson
9001afc697 Remove @TestApi from @SystemApi symbols
I ran these commands:
    cd frameworks/base
    grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \
        's/\@SystemApi[\s\n]+(\@\w+[\s\n]+)?\@TestApi/\@SystemApi\1/gs'
    grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \
        's/\@TestApi[\s\n]+(\@\w+[\s\n]+)?\@SystemApi/\1\@SystemApi/gs'

Bug: 171179806
Test: m checkapi
Change-Id: I772790b783b0a8730b8bf680c9e569a886b8d789
Merged-In: I772790b783b0a8730b8bf680c9e569a886b8d789
2020-10-19 16:41:01 +01:00
Yan Yan
2580e7a9f1 Merge changes from topic "new-ipsec-api" am: 46f82d282a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1398433

Change-Id: I074e1cc2d9b8e38d242c4a1c9b2176d3b8338774
2020-10-16 22:52:03 +00:00
Yan Yan
46f82d282a Merge changes from topic "new-ipsec-api"
* changes:
  Expose new algorithms as public API
  Add new mandatory IPsec algorithms
2020-10-16 22:30:37 +00:00
Yan Yan
4f86de5e54 Expose new algorithms as public API
Bug: 161716062
Test: FrameworksNetTests:IpSecAlgorithmTest
Change-Id: I5041c61ad5a4aa58b259e24de80a2c63d6b19dae
2020-10-16 17:53:37 +00:00
Treehugger Robot
5ac12d9b41 Merge "Allow the network stack to read network stats history" am: 7e4a864f60
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1450457

Change-Id: Ia7a7fdbb57f44ef9ad74d3c1dcb6a273bbb6baf8
2020-10-16 04:20:39 +00:00
Treehugger Robot
7e4a864f60 Merge "Allow the network stack to read network stats history" 2020-10-16 04:12:51 +00:00
Chalard Jean
f1e2cf02ae Allow the network stack to read network stats history
Identical to ag/12843161

Bug: 168984229
Test: testNetworkStatsProvider
Change-Id: I7ad72c3b2b95f26ceec1371e7e0fdb92fa88920c
Merged-In: Ibb6342b0f263c874bb1f7ab4031a639778bad37e
2020-10-16 00:55:01 +00:00
Yan Yan
21abcd0248 Add new mandatory IPsec algorithms
This CL adds new mandatory IPsec algorithms and allows
OEM to enable them on old devices using resource overlay

Bug: 161716062
Test: FrameworksNetTests:IpSecAlgorithmTest
Change-Id: Ib827b05ea27dbe61b14ad236e858f825293ed994
2020-10-15 17:35:17 -07:00
TreeHugger Robot
9e72f3f5c7 Merge "Merge ab/6749736 in stage." into stage-aosp-master 2020-10-13 03:31:35 +00:00
Junyu Lai
3fd314dbca Merge "Support dynamically update IMSI" am: 05e92bb5ef
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1418348

Change-Id: Id06d5d37ad5f12e689643c916548e9a59089eb3b
2020-10-13 03:22:09 +00:00
Junyu Lai
05e92bb5ef Merge "Support dynamically update IMSI" 2020-10-13 02:41:47 +00:00
junyulai
f571003794 Support dynamically update IMSI
Currently, NetworkStatsSubscriptionsMonitor will skip the
listener registration until the IMSI is available to deal
with SIM PIN locked case. However, this solution can only
handle the case that IMSI changes from/to null. And it also
relies on the assumption that IMSI never changes for a subId.

Thus, support dynamically update IMSI to handle IMSI changes
more robustly.

This patch also address leftover comments at ag/12400327.

Test: enable SIM PIN and manually test
Test: atest NetworkStatsSubscriptionsMonitorTest#testSubscriberIdUnavailable
Test: atest NetworkStatsSubscriptionsMonitorTest#testSubscriberIdChanged
Test: ./out/host/linux-x86/bin/statsd_testdrive 10082
Bug: 160941101

Change-Id: I625a5b10ee4806f6fee99c2d9d6c5e7977ff785e
2020-10-12 15:31:02 +08:00
Xin Li
dace5ac894 Merge ab/6749736 in stage.
Bug: 167233921
Merged-In: Iecef31f7bf10ad97b7e0075cf302ae94e248474a
Change-Id: I9e9c873bc2e05a0cfe3af0bf74725500f3f108db
2020-10-10 20:38:57 -07:00
Bill Yi
24c8811399 Merge "Merge mainline-release 6664920 to master - DO NOT MERGE" am: 5249616425
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1431515

Change-Id: Iaa631aaca21a51d786f59801d317f27ee635c70f
2020-09-19 05:25:29 +00:00
Bill Yi
b450e2e7e3 Merge mainline-release 6664920 to master - DO NOT MERGE am: 4c6dc6bbea
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1431515

Change-Id: Id233d0d39ad2d63ae3e6d6128b631e149f68990e
2020-09-19 05:22:39 +00:00
Bill Yi
5249616425 Merge "Merge mainline-release 6664920 to master - DO NOT MERGE" 2020-09-18 18:47:48 +00:00
Bill Yi
4c6dc6bbea Merge mainline-release 6664920 to master - DO NOT MERGE
Merged-In: Id04ea331831e8b26ba99478848392b40a92548d5
Change-Id: I888da0c9475f2d00602d917d2f58169f8d7c93a4
2020-09-17 21:56:59 -07:00
Bill Yi
32271f3ab0 Merge mainline-release 6664920 to stage-aosp-master - DO NOT MERGE
Merged-In: I8f9b41ca6388fdeeda287e7919ef05e56f9da1a6
Change-Id: If78e130888b8d4653ef128d747e18cc46844d732
2020-09-13 07:58:42 -07:00
Xin Li
4e4e192c97 Merge Android R
Bug: 168057903
Merged-In: Ice3e441cc9c0df8d0a6acc016bb74375e081bd67
Change-Id: I1d85742f594be2007c99841b290e502b6ede624e
2020-09-09 20:21:10 -07:00
Xin Li
9543e82a2e Mark RP1A.200720.001 as merged
Bug: 167588565
Merged-In: I608df7327b8366fd365b11c6bdff9ed28fde99b0
Change-Id: Ie293ab2bcba5f778a7cac8476e226dc7c15e000f
2020-09-02 11:44:54 -07:00
Xin Li
8399e3d5eb Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: I3d92a6de21a938f6b352ec26dc23420c0fe02b27
Change-Id: Ifdb80563ef042738778ebb8a7581a97c4e3d96e2
2020-08-31 21:21:38 -07:00
Treehugger Robot
445d5093c6 Merge "Skip RAT type listener registration if IMSI is not available" am: ebae7edd37
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1409907

Change-Id: Ie24dee18456ee0741dbcd9330664398f0492c644
2020-08-25 20:27:30 +00:00
Treehugger Robot
ebae7edd37 Merge "Skip RAT type listener registration if IMSI is not available" 2020-08-25 19:55:09 +00:00
junyulai
a40b5dad28 Skip RAT type listener registration if IMSI is not available
Currently, if SIM is inserted but IMSI is not available, such
as SIM PIN locked state. Information of such SIM will still
be available but IMSI is not. Which makes
NetworkStatsSubscriptionMonitor failed to store IMSI locally
for later RAT type query. Hence, NETWORK_TYPE_UNKNOWN is
always returned for such SIM.

Skip the registration until the IMSI is available. This is safe
since there will be another onSubscriptionsChanged event when
that happens.

Test: enable SIM PIN and manually test
Test: atest NetworkStatsSubscriptionsMonitorTest#testSubscriberIdUnavailable
Test: ./out/host/linux-x86/bin/statsd_testdrive 10082
Bug: 160941101
Merged-In: I408379b3c432d9e62e0837d6b4f6551cc7838e29
Change-Id: I408379b3c432d9e62e0837d6b4f6551cc7838e29
(cherry-picked from ag/12400327)
2020-08-25 18:03:38 +08:00
Treehugger Robot
2c3d87e23c Merge changes I0faeda20,I726e74f5 am: c6a61f9eee
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1397954

Change-Id: I2adf488439c8aecf2d3dac2438b848bbdc868a21
2020-08-20 03:56:13 +00:00
junyulai
ea11e8a174 Add getAllCollapsedRatTypes to NetworkTemplate am: 199f353a9e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1397953

Change-Id: I4bfdd2dcc7bd6b1e15248d7ef855fc40db018c4a
2020-08-20 03:56:10 +00:00
Treehugger Robot
c6a61f9eee Merge changes I0faeda20,I726e74f5
* changes:
  Add 5G NSA to collapsed RAT types list
  Add getAllCollapsedRatTypes to NetworkTemplate
2020-08-20 03:44:07 +00:00
junyulai
fd139892de Add 5G NSA to collapsed RAT types list
Currently, getAllCollapsedRatTypes is used to retrieve
all RAT types which will be recorded into NetworkStatsService.
However, there is a missing part that 5G NSA virtual RAT type
is not added into this list. This makes callers such as statsd
do not aware of 5G NSA RAT type and missed to collect data
usage of it.

Test: atest NetworkStatsSubscriptionsMonitorTest#test5g
Test: adb shell cmd stats pull-source 10082
Test: ./out/host/linux-x86/bin/statsd_testdrive 10082
Test: atest UidAtomTests#testMobileBytesTransfer \
      UidAtomTests#testMobileBytesTransferByFgBg \
      UidAtomTests#testDataUsageBytesTransfer
Bug: 163021464
Change-Id: I0faeda20f0506a48ac1131b234c5fc40d95dfbe0
Merged-In: I0faeda20f0506a48ac1131b234c5fc40d95dfbe0
(cherry-picked from ag/12355984)
2020-08-12 10:12:48 +00:00
junyulai
199f353a9e Add getAllCollapsedRatTypes to NetworkTemplate
This is a partial cherry-pick of ag/10293594

Test: TH
Bug: 129082217

Merged-In: I726e74f5c63a6ed456cb13ea259b58c7a33bec76
Change-Id: I726e74f5c63a6ed456cb13ea259b58c7a33bec76
2020-08-12 18:01:13 +08:00
Chiachang Wang
2fea4a758b Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code
for reference.

Bug: 161896447
Test: m ; atest FrameworkNetTests
Change-Id: Ib6b4c9526992c31e05e82be80e2b9b86bc0b57ef
2020-08-12 12:23:59 +08:00
Peter Wang
a0988882c1 [automerger skipped] Merge "[Telephony Mainline] Rename getActiveAndHiddenSubscriptionIdList and guard with permission" am: b6ff6f6c2c am: 4b6112a42c -s ours am: 86383582b4 -s ours
am skip reason: Change-Id I7f3b1f5170e032336d9b39b322c49e2b92573586 with SHA-1 ceba2adbbd is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1260749

Change-Id: Ic15254afce6f13f0553faf9ec98fc16fe9563c81
2020-07-31 09:55:23 +00:00
Peter Wang
86383582b4 [automerger skipped] Merge "[Telephony Mainline] Rename getActiveAndHiddenSubscriptionIdList and guard with permission" am: b6ff6f6c2c am: 4b6112a42c -s ours
am skip reason: Change-Id I7f3b1f5170e032336d9b39b322c49e2b92573586 with SHA-1 ceba2adbbd is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1260749

Change-Id: I1e06f6cdb0e69e06cf94a543eec83478dabeda14
2020-07-31 09:34:47 +00:00
Peter Wang
b6ff6f6c2c Merge "[Telephony Mainline] Rename getActiveAndHiddenSubscriptionIdList and guard with permission" 2020-07-31 08:43:44 +00:00
Chiachang Wang
38b7647244 Merge "Update language to comply with Android's inclusive language guidance" am: ae5caa0013 am: 36a22f06b1 am: 1aafac2782
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1375618

Change-Id: Ib53b46257c7fec87c0da23832776133107f13e5d
2020-07-30 03:38:47 +00:00
Chiachang Wang
1aafac2782 Merge "Update language to comply with Android's inclusive language guidance" am: ae5caa0013 am: 36a22f06b1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1375618

Change-Id: I8426e89337e60c48ad20677e835d36622d41ed91
2020-07-30 03:17:44 +00:00
Chiachang Wang
ae5caa0013 Merge "Update language to comply with Android's inclusive language guidance" 2020-07-30 02:49:44 +00:00
Chiachang Wang
893335012c Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code
for reference.

Test: m ; atest TetheringTests
Bug: 161896447
Change-Id: Idc58697c72fb00896bee00185fefc50c1a24dd35
2020-07-29 12:05:04 +08:00
Junyu Lai
6ca6396bd7 Merge "Gracefully handle integer overflows." am: 0e0b61e92e am: aeddf47458 am: efbd79c600
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1316217

Change-Id: I9cde0d9e70b389b91bde9b3384f82887259c9c74
2020-07-29 02:14:58 +00:00
Junyu Lai
efbd79c600 Merge "Gracefully handle integer overflows." am: 0e0b61e92e am: aeddf47458
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1316217

Change-Id: I0bba17d0367ebf4e1c868a8cc7471366bc7a4408
2020-07-29 01:55:23 +00:00
Junyu Lai
0e0b61e92e Merge "Gracefully handle integer overflows." 2020-07-29 01:19:07 +00:00
Chiachang Wang
df7fb22e70 Merge "Update language to comply with Android's inclusive language guidance" am: 2ad3ca40cb am: 55c0d6e638 am: 0defe35efb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1373160

Change-Id: I2efddd398c4d7cf4d65f1c76c399a3a07a843889
2020-07-28 11:31:06 +00:00