Commit Graph

2370 Commits

Author SHA1 Message Date
Lorenzo Colitti
7992b7baa6 Merge changes I3711b362,I49421183,Icc0701cb,I2f5ccc1d am: 40b4ef6dd7 am: 49038a76c2 am: 3968347b84 am: 3dea488951
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1501951

Change-Id: I5c7847bac88b574737ab80e5a20e9e22afb5b2e4
2020-11-19 12:30:34 +00:00
Lorenzo Colitti
104d9701f9 Minor fixes to NetworkCapabilities#toString.
1. The current code only prints the array of administrator UIDs
   if it's empty. This is clearly an oversight. Print it only if
   it's non-empty.
2. Only print requestor UID and package name if they are set.
   This makes output shorter in the common case that they are
   unset.
3. Reorder the output at the end: group all UIDs together, and
   place SSID and private DNS broken bit after that.
4. Make the private DNS broken indication a single word instead
   of a sentence. This saves space and makes it easier to write
   regexps.

New format:
... SignalStrength: -72 OwnerUid: 1000 AdminUids: [1000] SSID: ...
... Uid: 1000 RequestorUid: 1000 RequestorPkg: android ...

Test: manual
Change-Id: I2f5ccc1d9e4af6ddacc4d193185a17723822972b
2020-11-18 17:10:11 +09:00
James Mattis
d40282e0be Merge "Updating network preference comments" am: 5aff64e718 am: c22a6a5cd0 am: 25dfe8eb37 am: f2ba675a29
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1490233

Change-Id: Ic1b025dd4598c211a3b9c5065e034b4cc001dc99
2020-11-10 19:57:53 +00:00
James Mattis
dce028e5b5 Updating network preference comments
Updating comments for network preferences to better clarify that
preferences which include more than one network type will then rely on
scoring to determine which of those networks are chosen.

Bug: 171795464
Test: atest FrameworksNetTests
Change-Id: I9eb5683f2cd69281bbee9fb70028d45f07720914
2020-11-09 21:06:09 -08:00
Mathew Inwood
d04f969c9d Merge "Add maxTargetSdk restriction to unused APIs." 2020-11-09 14:41:20 +00:00
James Mattis
1551219663 Merge "Adding API stubs for application network routing" am: 20a9e59e25 am: d8cf074a43 am: decb412854 am: 105e23cb53
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1478963

Change-Id: Icb5f6e6124d23093ff7051d27d2fd4b9e3a1f72c
2020-11-06 19:40:05 +00:00
James Mattis
105e23cb53 Merge "Adding API stubs for application network routing" am: 20a9e59e25 am: d8cf074a43 am: decb412854
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1478963

Change-Id: I22f8b7b15a0bc7643474f5119dd34cdddf5a8376
2020-11-06 19:19:46 +00:00
James Mattis
dcea9fb2d4 Adding API stubs for application network routing
Bug: 171795464
Test: atest FrameworksNetTests
Change-Id: Ib055aa37a7bf0c48c335307afc2258aa869c4267
2020-11-06 00:08:13 -08:00
Mathew Inwood
5a09a71012 Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
2020-11-04 09:45:53 +00:00
Mathew Inwood
d771d6e94d Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Merged-In: I8285daa8530260251ecad6f3f38f98e263629ca7
Change-Id: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
2020-11-02 10:30:09 +00:00
Chalard Jean
863fb9b9d9 Move module utils to the module package.
Test: FrameworksWifiTest FrameworksNetTest
Change-Id: I067eeecd458c34b7f2fbfa439072682661ac750c
2020-11-02 10:01:30 +09:00
Mathew Inwood
ce2e083b30 Merge "Add maxTargetSdk restriction to unused APIs." 2020-10-29 15:23:24 +00:00
Chalard Jean
e9cffb6f3d Merge "Fix a bug where modern network agents start in UNKNOWN" am: 0512d7cd48 am: 8d783edbe8 am: b3dcc65424 am: 20b2858a92
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1460964

Change-Id: I4de127e0ce7f4fc0591ee59e65a60592e96efbfc
2020-10-29 14:32:37 +00:00
Chalard Jean
a7f72cbe55 Fix a bug where modern network agents start in UNKNOWN
Modern network agents are supposed to have the following
lifecycle :
• Construct the agent
• Declare itself to connectivity by calling #register()
• Possibly do some setup
• Declare connected by calling #markConnected()
• Declare disconnected by calling #unregister()

Internally ConnectivityService still manages the state
with deprecated NetworkInfo, which has a lot of possible
detailed states, most of which are now unused. Internally,
the steps above translate to the states below :
• When the agent calls #register() it starts in state
  CONNECTING
• When it calls #markConnected() it goes to CONNECTED
• When it calls #unregister() it goes to DISCONNECTED which
  triggers the flow that disconnects it immediately
• ConnectivityService also synthesizes the SUSPENDED state
  under some situations, but that's not relevant here.

The translation above is done by the NetworkAgent class,
which translates #register(), #markConnected() and
The only valid lifecyle for new agents is thus :

CONNECTING → CONNECTED → disconnect
                 ↕         ↑
             SUSPENDED ───┘

Note that in the above scheme, there is no space for the
UNKNOWN state, which is only used by legacy network agents.
However, the constructor for NetworkInfo still starts with
UNKNOWN. Ideally the constructor for NetworkInfo would set
the info to CONNECTING instead, but this would be a very
visible change in behavior affecting many apps (especially
their tests), so for backward compatibility we can't do
that.

New network agents however don't expose their NetworkInfo
to the client code, so they can just be made to start in
CONNECTING the way it was meant.

Note that this didn't really have a concrete impact beyond
printing some logs as by and large the ConnectivityService
code handles UNKNOWN and CONNECTING the same way, or more
exactly it handles transitions to CONNECTED from UNKNOWN
and CONNECTING in the same way. The exception to this is
VPNs, which are not using the new agent API yet, and the
upcoming conversion is why this fix is actually needed now.

Bug: 170904131
Test: FrameworksNetTests NetworkStackTests
Test: new test in aosp/1460705
Change-Id: Ib7d906a7b29a0b9f000b90bc78558a7402852fa3
2020-10-29 12:30:44 +00:00
Mathew Inwood
d078d3d65a Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

This is a resubmit of ag/12929664 with some APIs excluded that caused
test failures; see bugs 171886397, 171888296, 171864568.

APIs excluded:
Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord;
Landroid/os/Process;->myPpid()I
Landroid/os/SharedMemory;->getFd()I
Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I

Bug: 170729553
Test: Treehugger
Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
2020-10-29 11:51:12 +00:00
Hongwei Wang
903a7239df Merge "Revert "Add maxTargetSdk restriction to unused APIs."" 2020-10-28 23:58:21 +00:00
Hongwei Wang
1dc34ce1e6 Revert "Add maxTargetSdk restriction to unused APIs."
This reverts commit 335e158fb0.

Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397

Bug: 171886397
Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
2020-10-28 20:16:22 +00:00
Mathew Inwood
15f681fb2c Merge "Add maxTargetSdk restriction to unused APIs." 2020-10-28 09:39:20 +00:00
James Mattis
07ae51bd26 Merge "Add OEM_PRIVATE NetworkCapability" am: 7415f6f9b5 am: 32fbc09bd0 am: 73877e08a8 am: 0829a6ac61
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1472326

Change-Id: I33da7fd0b61eb0d5a6b45b4ba2140b39c377e15a
2020-10-28 00:38:12 +00:00
James Mattis
b3b4899980 Add OEM_PRIVATE NetworkCapability
Adding network capability to be used with networks to be only used by
OEM apps.

Bug: 171505922
Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest
Change-Id: Ib55ebec0e178b6317d92f17e1aff060dacdfb2b1
2020-10-27 13:14:06 -07:00
Mathew Inwood
335e158fb0 Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
2020-10-27 15:46:07 +00:00
Anton Hansson
49ca9d3ca9 Merge "Remove @TestApi from @SystemApi symbols" 2020-10-20 13:45:13 +00:00
Anton Hansson
878c9e47d3 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
2020-10-20 09:04:03 +01:00
Aaron Huang
4a19a57729 Merge "Create service-connectivity.jar" 2020-10-20 06:09:41 +00:00
Anton Hansson
f4d863eb95 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
Chalard Jean
64db0ea5b0 Merge "Remove unused methods from LinkProperties." am: 88e32a8ae6 am: f812dc9b77 am: 57899a690d am: c703b02538
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1448415

Change-Id: I7e97ed89636e22553c6b2a3a759d2bdcbed9ba24
2020-10-19 10:50:44 +00:00
Chalard Jean
f812dc9b77 Merge "Remove unused methods from LinkProperties." am: 88e32a8ae6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1448415

Change-Id: I7adcc9920cc2bdebe9a1dc22f32ce0955a4524dd
2020-10-19 09:50:44 +00:00
Aaron Huang
925d09b779 Create service-connectivity.jar
Create a new target service-connectivity to split
ConnectivityService from services.core.

Add ConnectivityServiceInitializer for initializing
ConnectivityService and add systemReady() in
ConnectivityManager so that SystemServer can call systemReady()
through ConnectivityManager which won't change current behavior.

Bug: 158268939
Test: make target-java, make host-java
      atest FrameworksNetIntegrationTests
      atest FrameworksNetTests
      make, device can boot,
      atest CtsStrictJavaPackagesTestCases
      wifi and mobile data work.
Change-Id: I99401772ba9c1c34adca20040da3c7c72d86ddd9
Merged-In: Ie732bfaf381404af0bb599ca2f421a96e7aa4257
2020-10-16 22:46:14 +08:00
Aaron Huang
42fe792772 Merge "Create service-connectivity.jar" 2020-10-16 07:03:33 +00:00
Chalard Jean
badc37d4fe Remove unused methods from LinkProperties.
LinkProperties.compare{Dnses,ValidatedPrivateDnses,AllRoutes,
AllInterfaceNames} actually have no users.

Test: LinkPropertiesTest
Change-Id: Ic54ab3c5520fbbc2be1309aeaf1e5a7857dbd194
2020-10-16 15:32:19 +09:00
Aaron Huang
dfba5d17fe Create service-connectivity.jar
Create a new target service-connectivity to split
ConnectivityService from services.core.

Add ConnectivityServiceInitializer for initializing
ConnectivityService and add systemReady() in
ConnectivityManager so that SystemServer can call systemReady()
through ConnectivityManager which won't change current behavior.

Bug: 158268939
Test: make target-java, make host-java
      atest FrameworksNetIntegrationTests
      atest FrameworksNetTests
      make, device can boot,
      atest CtsStrictJavaPackagesTestCases
      wifi and mobile data work.
Change-Id: Ie732bfaf381404af0bb599ca2f421a96e7aa4257
2020-10-16 02:29:04 +08:00
Roman Kalukiewicz
e2b9459da9 Add @Nullable annotation to the parameter of Object.equals() methods.
Those annotations could be inferred by some tools (like Kotlin), but the
https://checkerframework.org/ doesn't check inherited annotations
complaining about all equals() invocations that get nullable argument.

The change was generated by running

find . -name \*.java | xargs sed -i 's/public boolean equals(Object /public boolean equals(@Nullable Object /'

in the frameworks/base directory and by automatically adding and
formatting required imports if needed. No manual edits.

Bug: 170883422
Test: Annotation change only. Should have not impact.
Exempt-From-Owner-Approval: Mechanical change not specific to any component.
Change-Id: I5eedb571c9d78862115dfdc5dae1cf2a35343580
2020-10-15 10:48:01 -07:00
Treehugger Robot
cbca7cffe3 Merge "Fix a typo in a comment" am: 968238aa92 am: 0df34e3024 am: 173b634aab am: da629196fd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1459885

Change-Id: I084659f9f874fd7654645043c31e6f5e2b7a04de
2020-10-14 12:28:40 +00:00
Treehugger Robot
0df34e3024 Merge "Fix a typo in a comment" am: 968238aa92
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1459885

Change-Id: I9174acc91209d83526901587bf4603d61aa30acc
2020-10-14 11:24:43 +00:00
Chalard Jean
05fcb2e43e Fix a typo in a comment
Test: is not necessary for fixing typos in comments
Change-Id: Idf48d2649e728cafda5c1ca32d21102094cf23f5
2020-10-14 04:56:20 +00:00
Xin Li
7d27412dad Merge ab/6749736 in stage.
Bug: 167233921
Merged-In: Iecef31f7bf10ad97b7e0075cf302ae94e248474a
Change-Id: I9e9c873bc2e05a0cfe3af0bf74725500f3f108db
2020-10-10 20:38:57 -07:00
Remi NGUYEN VAN
c1c3e254da Merge "Move IpUtils to frameworks/libs/net" am: 1ea097fcb2 am: 5d47632002 am: ff1cfa230d am: 96c5807a35
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1440234

Change-Id: I27072c126ee7eedc2de3d1cdccd0fd503f1577a1
2020-10-09 01:58:35 +00:00
Remi NGUYEN VAN
ff1cfa230d Merge "Move IpUtils to frameworks/libs/net" am: 1ea097fcb2 am: 5d47632002
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1440234

Change-Id: I03872655d1ef3a7bb436666196ed67bd61601f65
2020-10-09 00:52:31 +00:00
Remi NGUYEN VAN
7e3efdb49c Move IpUtils to frameworks/libs/net
The utility classes are useful for mainline modules and their tests, for
example IpClientIntegrationTest.

Bug: 168868607
Test: m && atest NetworkStaticLibTests
Change-Id: If2b1613aa18a7990391e2d31cc2951ca93f1cf3c
2020-10-05 14:38:19 +09:00
Hridya Valsaraju
33b04d38e6 Revert "Move module utils to the module package."
Revert "Move util classes to their destination package"

Revert "Move PacketReader and FdEventReader"

Revert "Move static utils to a module package"

Revert "Move static utils to a module package"

Revert submission 12698912-move_packetreader

Reason for revert: Broke presubmit on git_master, b/169861635
Reverted Changes:
If5d1e4a58:Move module utils to the module package.
I44ffaad3d:Move PacketReader and FdEventReader
I93e9cfd96:Move util classes to their destination package
Ia84d64130:Move static utils to a module package
Iaac2810c7:Move static utils to a module package

Change-Id: Ibbe59075cd7bc4c38e0707ea6ae3b3703b40986f
2020-10-01 20:12:46 +00:00
Chalard Jean
9db4f74fb8 Move module utils to the module package.
Test: builds
Change-Id: If5d1e4a58fb2d6d9544e6d01995dabe445cf1f25
(cherry picked from commit 046bf639eb7728504be35e30e3dd49af3d029728)
2020-09-26 14:12:10 +09:00
Jeff Sharkey
afd130b8f9 Merge changes from topic "sep11" am: 17b739a5f7 am: 94d8d5e4ce am: 4e9a12f773 am: 5d45f311b1 am: cce3906d82
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1426195

Change-Id: Id01f468b43fd5b2aada78608010625b392c1b647
2020-09-15 21:01:48 +00:00
Jeff Sharkey
4e9a12f773 Merge changes from topic "sep11" am: 17b739a5f7 am: 94d8d5e4ce
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1426195

Change-Id: I7da537200efe31e803234bd1a0236843064186c8
2020-09-14 23:10:42 +00:00
Jeff Sharkey
814cd18388 Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Test: none
Bug: 168334533
Exempt-From-Owner-Approval: docs updates
Change-Id: I53003332717baf57dc088b2f6b969cdb1863f65e
2020-09-14 09:59:01 -06:00
Xin Li
383cdb1c99 Merge RP1A.200720.011
Bug: 167588565
Merged-In: Iec7a26ecd68aca9c7a38cc8f441197a8237b0c8c
Change-Id: Ia8f5f008bc1f77115b644ab996aedc892fab68e7
2020-09-02 12:34:37 -07:00
Xin Li
4037c36d47 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
Junyu Lai
37f7a3e160 Merge "Notify the keepalive is stopped after the slot has been released" am: 09a0f57f87 am: b5e1feccbe am: d1804f87dc am: c1d0f670f5 am: 0453d9b955
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1112851

Change-Id: I86b9c01f99eaa9497acbd4e3e481c7330cf05667
2020-08-28 12:30:17 +00:00
Junyu Lai
d1804f87dc Merge "Notify the keepalive is stopped after the slot has been released" am: 09a0f57f87 am: b5e1feccbe
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1112851

Change-Id: Icdd61fb39ebd14963f4ec6e591b3a245e6b999b2
2020-08-28 11:09:43 +00:00
Junyu Lai
09a0f57f87 Merge "Notify the keepalive is stopped after the slot has been released" 2020-08-28 10:12:44 +00:00
junyulai
72d2bd016b Notify the keepalive is stopped after the slot has been released
Currently, the callbacks of stopping were fired when stop procedure
is started, because the upper layer apps only care about the reason
of stopping instead of stopping result. Thus, there is no need to
wait for the result comes back. However, this behavior generates
races if apps want to re-start keepalive immediately since the
resources are not released yet.

Fix: 134891441
Fix: 140305589
Test: atest com.android.server.ConnectivityServiceTest#testPacketKeepalives \
      --rerun-until-failure 1000

Change-Id: I987776a9211a50e964c4675b747bc10e203750f1
2020-08-20 11:00:08 +08:00