Commit Graph

61 Commits

Author SHA1 Message Date
junyulai
5864a3f0aa [SP07] Remove reference of NetworkStatsService in IpServer
Currently NetworkStatsService is notified when downstream is
updated. However, it seems unnecessary given that tether stats
is persist since boot, and there is no any upstream change when
downstream is changed.

Test: atest NetworkStatsServiceTest IpServerTest
Bug: 130855321
Change-Id: Ie300bfeb0a04678fcfcf300843b6f859af9df91d
2020-01-14 20:14:59 +08:00
junyulai
15d8bb03fe [SP06.1] Add UPDATE_DEVICE_STATS permission to Tethering
Add corresponding permission to allow tether offload to update
network usage through new API that requires UPDATE_DEVICE_STATS
permission.

This is the minimum permission that required to update network
usage with the new system api.

Test: atest FrameworksNetTests OffloadControllerTest TetheringTest
Bug: 130855321
Change-Id: I9c0c86e20d4797ea3570feed741be3a07f839c7d
2020-01-14 20:14:47 +08:00
junyulai
b7da74af88 [SP06] Use system API to communicate with NSS in OffloadController
Test: atest FrameworksNetTests OffloadControllerTest TetheringTest
Bug: 130855321

Change-Id: I294be3a2874f8c8120857e308e629199af014fcd
2020-01-14 20:14:33 +08:00
markchien
2fbb412b28 Use Context#getSystemService to get network stack binder
Bug: 143195885
Test: -build, flash, boot
      -atest TetheringTests

Change-Id: Ic5fabeae27677344d691449c31ad9337c0e6d92c
2020-01-14 20:13:53 +08:00
Treehugger Robot
63647c2d7a Merge "Migrate legacy dhcp server config to DeviceConfig" 2020-01-13 19:12:25 +00:00
Treehugger Robot
d9768c7111 Merge "Replace setCapability usage in Tethering" 2020-01-13 17:56:25 +00:00
markchien
6df8068085 Replace setCapability usage in Tethering
Bug: 147413518
Test: build, flash, boot
Change-Id: I7abec2d7cf03d0675749e8379d624504ceb3d9af
2020-01-13 23:34:20 +08:00
markchien
9a0b95d294 Migrate legacy dhcp server config to DeviceConfig
Legacy dhcp server can also be enabled by resource config.

Bug: 144814607
Test: -build, flash, boot
      -atest TetheringTests

Change-Id: I8ae5fa3d5bbd88129bd0890f71be6f8a1bfec0eb
2020-01-13 15:07:03 +00:00
markchien
6fbbdff5bc Add config_tether_* and entitlement resources
Copies config_tether_* and entitlement resources from
framework/base/core/res to tethering package. Will have
follow up changes to move overlay and switch tethering to
use this internal resource. duplicated resource in framework
will be removed after fixing all of users(e.g. test, TetherUtil,
Settings, ....).

Bug: 147399354
Test: build

Change-Id: I2a77e5070d53566d5ec3697358a6dbbebb4ff59f
2020-01-13 15:03:11 +00:00
Treehugger Robot
5e9d0685dc Merge "Use new UnsupportedAppUsage annotation." 2020-01-13 13:05:17 +00:00
Lorenzo Colitti
5b55209300 Merge changes I0c45635b,I2201d0e4
* changes:
  Remove SystemMessageProto usage
  Replace PendingIntent/NotificationManager @hide APIs
2020-01-13 12:04:44 +00:00
Treehugger Robot
f5869fac5a Merge "Replace SystemNotificationChannels on Tethering" 2020-01-13 09:10:36 +00:00
paulhu
7d1b8db6c0 Remove SystemMessageProto usage
Tethering can use SystemMessageProto which is @hide Class. Hence,
use drawable resource id to replace SystemMessageProto usage.

Bug: 122085773
Test: atest TetheringTests
Change-Id: I0c45635b52f86a261e1ac7aaaa9b2cc3a256c222
2020-01-13 15:48:08 +08:00
paulhu
ffa6e34395 Replace PendingIntent/NotificationManager @hide APIs
Tethering used some PendingIntent/NotificationManager @hide APIs
but they are not able to call now. Replace them with similar
System APIs.

Bug: 122085773
Test: atest TetheringTests
Change-Id: I2201d0e44a6356b8b1974ce0ed80d9913a7aeff5
2020-01-13 15:29:12 +08:00
paulhu
8ee55d43de Replace SystemNotificationChannels on Tethering
Tethering used SystemNotificationChannels for showing
notification before. But SystemNotificationChannels is used for
system package only, tethering package is not able to use it now.
Thus, replace it with tethering own notification channel.

Bug: 122085773
Test: atest TetheringTests
Change-Id: I854a102795c19351a4137360414926c461cc604c
2020-01-13 15:28:18 +08:00
Jiyong Park
c1b762b97d Merge "Platform shouldn't directly link to jars in APEXes" 2020-01-13 01:16:16 +00:00
Jiyong Park
1eb8933d3e Platform shouldn't directly link to jars in APEXes
The non-updatable part of the platform shouldn't directly link to the
boot jars in APEXes. Ensure this by

1) setting the visibility property for the boot jars so that they are
not visible to non-APEX modules and
2) setting the apex_available property so that the boot jars are only
built for the corresponding APEXes, but not for others.

Bug: b/146167933
Bug: b/146218515
Bug: b/147200698
Test: m
Change-Id: I251fabd773bc31f46d572d143c72dd9162f3f0a6
Merged-In: I251fabd773bc31f46d572d143c72dd9162f3f0a6
2020-01-10 15:15:24 +00:00
markchien
3470487207 Fix hidden usage of networkCapabilitiesForType
After this change, tethering only support below legacy type:
  - TYPE_BLUETOOTH
  - TYPE_ETHERNET
  - TYPE_MOBILE
  - TYPE_MOBILE_DUN
  - TYPE_MOBILE_HIPRI
  - TYPE_WIFI

Bug: 144753389
Test: build
Change-Id: I394c8306d9f88a6648580b3b410069ad219f0074
2020-01-10 14:55:54 +08:00
markchien
373e5639aa Give tethering TETHER_PRIVILEGED permission
This fix the crash when perform "Reset Wi-Fi,mobile & Bluetooth"

Bug: 146900199
Test: -build, flash, boot
      -atest TetheringTests
      -atest CtsTetheringTest
      -manual perform "Reset Wi-Fi,mobile & Bluetooth"

Change-Id: I036409358ed15a797bdb751bb66513425350d066
2020-01-10 14:49:24 +08:00
Artur Satayev
4784fb0f7d Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
Merged-In: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
2020-01-09 15:08:18 +00:00
Mark Chien
50bd8a4938 Merge "Expose some tethering constants in Settings" 2020-01-09 11:10:49 +00:00
markchien
5ea11dbcdc Expose some tethering constants in Settings
Make some tethering constants @systemApi because tethering
cannot use hide Api.

Bug: 144814607
Test: build, flash, boot
Change-Id: I8b46e2483eec575cddaad392d055551b75ca71ef
2020-01-09 08:48:55 +00:00
Mark Chien
4a12a12918 Merge "Fix some @hide usage in Tethering(Cont.)" 2020-01-09 08:47:07 +00:00
Junyu Lai
2073d24a99 Merge "[SP01] Add NetworkStats to system API" 2020-01-09 08:33:24 +00:00
markchien
b799fa3e95 Fix some @hide usage in Tethering(Cont.)
Using alternative way to fix @hide usage. Do not have API change.

Bug: 144814072
Test: buid
Change-Id: Ia23e319ad3779318471d01cbfa17b8c6df4960d3
2020-01-09 05:40:42 +00:00
junyulai
c244d7a660 [SP01] Add NetworkStats to system API
In order to let external module report their network stats,
expose necessary APIs to construct NetworkStats object.

Test: atest FrameworksNetTests CtsUsageStatsTestCases
Test: m doc-comment-check-docs
Bug: 130855321
Change-Id: Id3ec8aaff3df67948c25eac2319a74cf33a27979
2020-01-09 03:11:22 +00:00
markchien
9b4d7577d8 Replace ConnectivityManager constants to TetheringManager
Replace some ConnectivityManager constants as TetheringManager inside
tethering module. No API change, will have follow up CL to delete
@hide tethering constants in ConnectivityManager and replace caller
to using TetheringManager.

Bug: 144753389
Test: build
Change-Id: Ia1b963669722c32d147375763205ed2f3af52fed
2020-01-08 15:06:09 +00:00
markchien
12c5bb8103 [Tether09] Use INetd to call netd directly
- Using INetd to communicate with netd directly instead of using
NetworkManagementService which is a wrapper of INetd and don't have plan
to be updatable.
- Also replace InterfaceConfiguration by InterfaceController.
- Remove redundant interface flags. Only set interface up/down flag to
netd because netd only use these two flags for INetd#interfaceSetCfg.
- Note that tethering still use NetworkManagementService
to register tethering stats provider and it would also be replaced with
other way in follow up change.

Bug: 136040414
Test: -build, flash, boot
      -atest TetheringTests

Change-Id: I4ab0ad387d4bd1773ff94d3b380c1720df07f8d5
Merged-In: I4ab0ad387d4bd1773ff94d3b380c1720df07f8d5
2020-01-08 12:33:58 +00:00
Mark Chien
e13d884aa3 Merge "Fix some @hide usage in Tethering" 2020-01-08 00:37:43 +00:00
Treehugger Robot
10f50b79fd Merge "Both build 32 and 64 architecture for TetheringTests" 2020-01-07 20:30:15 +00:00
markchien
6cf0e550c7 Fix some @hide usage in Tethering
Using alternative way to replace some @hide API.

Bug: 144814072
Test: build, flash, boot
      atest TetheringTests

Change-Id: I1e12d69db1ad91dff553e142e17c6a70808e1639
2020-01-07 21:29:52 +08:00
Treehugger Robot
b2bb37098f Merge "Change tetheroffloadjni to tetheringutilsjni" 2020-01-07 09:05:43 +00:00
markchien
f87ebdcbb4 Change tetheroffloadjni to tetheringutilsjni
Rename tetheroffloadjni to tetheringutilsjni and move setupRaSocket
jni method from NetUtils into tetheringutilsjni.

Bug: 143195885
Test: -build, flash, boot
      -atest TetheringTests
      -Off/On hotspot with ipv6 upstream

Change-Id: Ib68eb6999bbe2d3ca97e68712f22b105311ef800
2020-01-07 07:42:13 +00:00
markchien
d67c55642e Remove FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT in tethering
Tethering is started after system ready that AMS is ready to deal with
intent broadcast, mProcessesReady is true.

Bug: 143195885
Test: build, flash, boot
Change-Id: Ib9a6008654267b6d0fca78923247c336e90b5534
2020-01-06 14:42:52 +00:00
markchien
2d4cd2d8bd Both build 32 and 64 architecture for TetheringTests
Compile as multilib is neccessary, otherwise mts-tethering-coverage
test plan will fail on armeabi-v7a because of failing to extract
native libraries. This change also add mts tag to TetheringTests.

Bug: 145490751
Test: -atest TetheringTests
      -m mts && mts-tradefed run mts-tethering-coverage

Change-Id: I6425c135ca17213bcdd5198177993daf8280504e
2019-12-24 10:21:15 +00:00
markchien
c6485f8368 Add UpstreamNetworkState for tethering
Previous tethering use NetworkState to encapsulate network states.
But NetworkState is hide API and Tethering just use NetworkState
locally that it don't interact with other module by NetworkState.
To avoid hide API accessing and reduce dependency, replace
NetworkState as UpstreamNetworkState in tethering.

Bug: 144758082
Test: atest TetheringTests
     OFF/ON hotspot

Change-Id: Ia1837b6ed983a64c3ed72ecf0e6f46d91b3af7da
2019-12-23 17:38:40 +08:00
Treehugger Robot
62fa7a179d Merge "Fix clean InProcessTethering fail problem" 2019-12-20 16:34:23 +00:00
markchien
2000bfe8a7 Fix clean InProcessTethering fail problem
CleanSpec only respect root of a git project.
Remove packages/Tethering/CldanSpec.mk because it never
be read.

Bug: 144320246
Test: manual build InProcessTethering and observed it is removed
      after adding new clean step.

Change-Id: I58750e4a1fe11018d83da1ebf828d1b3134ec765
Merged-In: I58750e4a1fe11018d83da1ebf828d1b3134ec765
2019-12-20 22:18:01 +08:00
markchien
9d3538260b [Tether13] Move TetheringManager into framework
Move tethering out of ConnectivityService. All client would
use TetheringManager to talk with TetheringService directly.

Bug: 144320246
Test: -build, flash, boot
      -atest TetheringTests

Change-Id: Ib051bea724a256f9c4572b566e46ae7b9c4abe6e
Merged-In: Ib051bea724a256f9c4572b566e46ae7b9c4abe6e
2019-12-19 20:53:06 +08:00
markchien
8f831c09e5 Change Tethering package name
".apex" is easy to confuse.
Rename as below:
apex: com.android.tethering.apex -> com.android.tethering
apk: com.android.tethering -> com.android.networkstack.tethering

Bug: 146471733
Test: build

Change-Id: I2c7647abb996539a3af6cfe0e0214a5e8927c0d6
Merged-In: I2c7647abb996539a3af6cfe0e0214a5e8927c0d6
2019-12-19 13:06:50 +08:00
Treehugger Robot
4cd05d9fdc Merge "Protect early access before tethering ready" 2019-12-13 03:25:41 +00:00
markchien
59aa54a9b0 Protect early access before tethering ready
Bug: 145876447
Test: build, flash, boot
Change-Id: Ic40b6080a662e312e4efd7246d964710d9f07bef
2019-12-13 10:12:59 +08:00
Artur Satayev
2b6d27a838 Add new UnsupportedAppUsage annotation as lib dependency.
Bug: 145132366
Test: m
Change-Id: Ibb7f8424186149365354a96249c06c9fccde66bd
Merged-In: Ibb7f8424186149365354a96249c06c9fccde66bd
2019-12-11 19:44:16 +00:00
Paul Hu
b385c965db Merge "Migrate tethering notification resources" 2019-12-04 09:00:03 +00:00
paulhu
8224d9f2af Migrate tethering notification resources
Migrate the resources which are only used by tethering notification
from framework/base/core/res to tethering package resource
folder.

Bug: 122085773
Bug: 139763854
Test: build pass
Change-Id: I832103090d500fd8e2e2efb9dc7151426da3f88d
Merged-In: I832103090d500fd8e2e2efb9dc7151426da3f88d
2019-12-04 14:29:38 +08:00
markchien
0abdd119f2 [Tether17] create com.android.tethering.apex package
Add APEX com.android.tethering.apex for tethering module.
It have tethering apk now and would have jar and library
in follow up CL.

Bug:144320626
Test: build
Change-Id: Ie6158639886e90180dd90347e802a5fe062031b2
2019-12-02 01:54:31 +00:00
markchien
147186daff [Tether10]Remove UserManagerInternal usage in Tethering
To be the unbundled application, tethering can not use UserManagerInternal
method anymore. Replace it by listening user restriction change intent.

Also fix some cleanup from
https://android-review.googlesource.com/c/platform/frameworks/base/+/1131002

Bug: 143195885
Test: -build, flash, boot
      -atest TetheringTests
      -manual test. Add a trigger point to call
       UserManager.setUserRestriction(DISALLOW_CONFIG_TETHERING) from
       Settings. Open hotspot -> restrict tethering from new adding trigger
       point -> hotspot is OFF and Tethering settings are not available.

Change-Id: I4ed08d20f8b7476b8ecd5d018b75806dd2f22cc1
Merged-In: I4ed08d20f8b7476b8ecd5d018b75806dd2f22cc1
2019-11-30 10:06:23 +00:00
markchien
ee6ad37837 [Tether07] Migrate Tethering into module
Now tethering would be run in dedicated service.
TetheringManager is the interface used to communicate with
TetheringService. The new call flow would be: ConnectivityManager
-> ConnectivityService -> TetheringManager -> TetheringService.
Note: the return value of #tether(), #untether() and #setUsbTethering()
APIs would always be no error. Client can use #getLastTetherError()
or #getTetheredIfaces or listen tether state change to check
status of corresponding interface.

Bug: 136040414
Bug: 144742179
Test: -build, flash, boot
      -atest TetheringTests
      -atest FrameworksNetTests

Change-Id: I7e78c0e0a3e70f940a749ba2a39ece7c7ec5b9b3
Merged-In: I7e78c0e0a3e70f940a749ba2a39ece7c7ec5b9b3
2019-11-30 10:03:08 +00:00
markchien
810aa68d27 [Tether07] Clean up build rule for libtetheroffloadjni
- Statically include android.hardware.tetheroffload.config@1.0,
  libcutils and their dependency library.
- Use shared-lib if there is NDK or NDK-compliant version
- Remove android.hardware.tetheroffload.control-V1.0-java from
  service.core because it is already statically built in tethering apk

Bug: 143195885
Test: -build, flash, boot
Change-Id: Ic082045bc04d3989f7f095c7a499bc0d943e4031
Merged-In: Ic082045bc04d3989f7f095c7a499bc0d943e4031
2019-11-30 09:57:36 +00:00
Remi NGUYEN VAN
226aed20f7 Merge "Move shared packages to NetworkStack project" 2019-11-22 06:50:22 +00:00