Commit Graph

529541 Commits

Author SHA1 Message Date
Lorenzo Colitti
45feed9b00 Allow tests to create TRANSPORT_TEST|TRANSPORT_VPN networks.
This CL allows an app that has the MANAGE_TEST_NETWORKS
permission to create test VPN networks.

The code enforces that such networks can never apply to any UIDs
and thus will never carry any traffic.

Bug: 173331190
Test: passes existing tests, moved tests pass
Change-Id: I5befea0e3b4b6dce4ca0c6a04471a055186b644c
2020-11-27 15:35:38 +09:00
Lorenzo Colitti
d182c40d8c Move applying underlying caps from Vpn to ConnectivityService.
Add support to ConnectivityService to track underlying networks
directly instead of through the Vpn class.

1. Communicate all information necessary to propagate underlying
   network capabilities to ConnectivityService via NetworkAgent.
   This includes:
   a. Underlying networks:
      - Add SystemApi for NetworkAgent to declare its underlying
        networks to ConnectivityService, and use it in Vpn.
      - Add a new declaredUnderlyingNetworks member to
        NetworkAgentInfo and store the underlying networks in it.
	Move propagation of underlying network capabilities to
	mixInCapabilities, which is a natural place for it.
   b. "Always metered" bit:
      - Communicate this to ConnectivityService via the existing
        NOT_METERED capability. Store it in a new declaredMetered
	boolean in NetworkAgentInfo to separate it cleanly from
	the NOT_METERED bit in the capabilities, which depends on
	whether the underlying networks are metered or not. In
	order to ensure that this is only ever changed when a NC
	update is received from a NetworkAgent, define a new
	processCapabilitiesFromAgent similar to the existing
        processLinkPropertiesFromAgent.

2. Ensure that propagating underlying network capabilities does
   not read the VPN's NetworkCapabilities. In order to do this,
   ensure that all relevant information on underlying networks
   and metering is sent to ConnectivityService at NetworkAgent
   registration time. CS still calls Vpn#updateCapabilities when
   a user is added/removed, but that is deleted in a future CL.

3. Slightly generalize propagating underlying network
   capabilities because there may be other network types that
   also have underlying networks that aren't VPNs (e.g., VCN).
   - Introduce a new supportsUnderlyingNetworks() boolean method
     in NetworkAgentInfo.
   - Rename updateAllVpnsCapabilities to
     propagateUnderlyingNetworkCapabilities.

This commit does not move the actual logic of calculating the
underlying capabilities out of Vpn.java. That can be done in a
subsequent change once CS stops calling getUnderlyingNetworks().

This commit also does not modify any of the other code in CS that
directly accesses VPNs' underlying networks.

Bug: 173331190
Test: passes existing tests in ConnectivityServiceTest
Test: CTS test in r.android.com/1511114
Test: atest CtsNetTestCases:Ikev2VpnTest HostsideVpnTests
Change-Id: I5f76cb1aa4866efed3d5c4590e931fdb0e994f8d
2020-11-27 15:35:38 +09:00
Treehugger Robot
53cfe5eb38 Merge "Move enums file to new directory" 2020-11-26 05:13:18 +00:00
Treehugger Robot
e087ceed21 Merge changes Id4632e1b,I31985822,Ibbf96a25
* changes:
  Test passing an underlying network array with null network in it.
  Make testVpnNetworkActive more deterministic.
  Add a test for restricted profile added/removed with VPN up.
2020-11-26 03:40:44 +00:00
Treehugger Robot
97c2606bbd Merge "ParcelableHolder shouldn't write anything for empty case" 2020-11-26 02:39:54 +00:00
James Lin
768384c661 Merge "[RCS UCE] Add the extra parameter retryAfterMillis in the callback method CapabilitiesCallback#onError" 2020-11-26 01:38:27 +00:00
Mathieu Chartier
36c903a480 Merge "Disable BootImageProfileTest" 2020-11-26 01:34:45 +00:00
Lorenzo Colitti
f06fff4bf8 Test passing an underlying network array with null network in it.
Current code treats these nulls as if they weren't there.

Bug: 173331190
Test: test-only change
Change-Id: Id4632e1b004c09910b4b7613f7233d2c19e2f0ac
2020-11-26 10:33:23 +09:00
Lorenzo Colitti
de20152bbf Make testVpnNetworkActive more deterministic.
This test is a bit brittle because it sets the underlying
networks while the VPN is undergoing validation by
NetworkMonitor. The test does attempt to disable validation,
but that's not actually possible - the only thing that's possible
is to tell NetworkMonitor to validate immediately without sending
any probes. So the underlying network change races with the
validation. I'm not sure why the test isn't flaky. It might be
because both the network change and the validation result in a
capabilities change, and the test expects "a capabilities change"
without expressing what change that should be.

Make this a bit more predictable by ensuring that the network
validates before the underlying networks are set.

This is useful because an upcoming CL will change the way
underlying network capabilities are propagated. With this test
CL, both the old and the new code pass.

Bug: 173331190
Test: test-only change
Change-Id: I319858228e8d097c0b60a107029f296385f91269
2020-11-26 10:33:23 +09:00
Lorenzo Colitti
52316750ed Add a test for restricted profile added/removed with VPN up.
Bug: 173331190
Test: test-only change
Change-Id: Ibbf96a259a73068d110a159d54059720121117cc
2020-11-26 10:33:23 +09:00
Treehugger Robot
27310f0340 Merge "Clarify why it's safe to add java.library.path to the classloader namespace." 2020-11-26 00:40:01 +00:00
Jeffrey Huang
17df403e9e Move enums file to new directory
Bug: 167962588
Test: m -j
Change-Id: I29b21fdc98c6c795902d23f21ef3dfd11d3f3216
Merged-In: I29b21fdc98c6c795902d23f21ef3dfd11d3f3216
2020-11-25 16:14:08 -08:00
Mathieu Chartier
8491e68a37 Disable BootImageProfileTest
Disabled until it stops failing (to unblock presubmits).

Bug: 173677667
Test: TH
Change-Id: If13ccedbd5e7eeed5bcab7d16ae4e8d0affd5e06
2020-11-25 12:51:31 -08:00
James.cf Lin
740c3bf107 [RCS UCE] Add the extra parameter retryAfterMillis in the callback method CapabilitiesCallback#onError
Add the parameter in the callback method CapabilitiesCallback#onError
When requester receive the callback CapabilitiesCallback#onError with the non-zero of the parameter retryAfterMillis, it should stop retrying until the the specified number of millisecond has passed.

Bug: 171965576
Test: atest -c CtsTelephonyTestCases:android.telephony.ims.cts.RcsUceAdapterTest
Change-Id: If59d143e56c304556aa3d8bcd5b37ffb771815b5
2020-11-25 21:56:39 +08:00
Almaz Mingaleev
08466f6151 Merge "Make manual suggestions synchronous/return result" 2020-11-25 11:21:44 +00:00
Neil Fuller
1395dffdb1 Make manual suggestions synchronous/return result
Modify the suggestManual...() methods on TimeDetector and
TimeZoneDetector to be synchronous, and have them return true/false to
indicate if the call "succeeded". This is being done before adding more
calls that will be used by apps like SettingsUI; generally all calls
that are user facing and could conceivably fail should return
success/failure information and therefore need to happen synchronously.

Test: atest services/tests/servicestests/src/com/android/server/timedetector/
Test: atest services/tests/servicestests/src/com/android/server/timezonedetector/
Bug: 140712361
Merged-In: I5b6b7fb5af2ffe88392b2ca8d1e8fff2a187521b
Change-Id: I5b6b7fb5af2ffe88392b2ca8d1e8fff2a187521b
2020-11-25 09:57:07 +00:00
Treehugger Robot
1fe717a58a Merge "Tighten up Binder.clearCallingIdentity() usage." 2020-11-25 09:14:23 +00:00
Lorenzo Colitti
d0fa499431 Tighten up Binder.clearCallingIdentity() usage.
Partial cherry-pick of ag/12771225 to avoid merge conflicts.

Test: builds
Bug: 155703208
Merged-In: I832c9d70c3dfcd8d669cf71939d97837becc973a
Change-Id: Iac7c482012639ac45658f9e32fc1b9b152b01532
2020-11-25 15:21:57 +09:00
Baligh Uddin
e72a1eb1eb Merge "Revert^2 "Delete atoms.proto from statsd"" 2020-11-25 04:45:20 +00:00
Jooyung Han
e20137fccd Merge "midi: Use std::optional instead of std::unique_ptr" 2020-11-25 02:47:45 +00:00
Junyu Lai
6ef6648cd9 Merge "Expose getTx/RxBytes in TrafficStats" 2020-11-25 02:35:20 +00:00
Jeffrey Huang
05e50cc991 Revert^2 "Delete atoms.proto from statsd"
e8552cd24a

Change-Id: I202a31ab654ca31ba9e5b73b23c5aa3d22a3e8b2
Merged-In: I81a8287ed5b055e7b6547794d01e7ac897f0f022
2020-11-24 22:47:44 +00:00
Alex Light
3f89c81e39 Merge "Revert "Delete atoms.proto from statsd"" 2020-11-24 21:57:17 +00:00
Jeffrey Huang
e8552cd24a Revert "Delete atoms.proto from statsd"
Revert "Add android bp to proto_logging"

Revert submission 1508746-delete_atoms

Reason for revert: Build Failure
Reverted Changes:
I184cf8bf8:Add android bp to proto_logging
I36ec354d2:Delete atoms.proto from statsd

Change-Id: Ifec6a57d66cbd9c37503ca47847c3ae492f3d343
2020-11-24 21:53:20 +00:00
Jeffrey Huang
b027f4818d Merge "Delete atoms.proto from statsd" 2020-11-24 21:24:22 +00:00
Treehugger Robot
da20982f89 Merge "BatteryStats: explicitly copy the wakeup reasons" 2020-11-24 19:44:56 +00:00
Jeffrey Huang
5d230a2d49 Delete atoms.proto from statsd
Use the atoms.proto in proto_logging as the source of truth. Also
migrates statsd log api gen to use the new atoms.proto

Bug: 167962588
Test: m -j && m CtsStatsdAtomHostTestCases

Change-Id: I36ec354d273dceace5245d7634c68ac63dc5a8cd
Merged-In: I36ec354d273dceace5245d7634c68ac63dc5a8cd
2020-11-24 10:57:06 -08:00
Treehugger Robot
0836d630a5 Merge "Fixed Handler Leak on DistanceClassifier" 2020-11-24 16:57:34 +00:00
Treehugger Robot
2c4a41353a Merge "Initialize mCallback in constructor and make it final." 2020-11-24 15:27:03 +00:00
Almaz Mingaleev
444551f0af Initialize mCallback in constructor and make it final.
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/timedetector/

Change-Id: I62868ad42ec0affe6ca46e5324c5d537239337e8
2020-11-24 13:59:24 +00:00
Jeongik Cha
3f5ffa615a ParcelableHolder shouldn't write anything for empty case
If neither Parcel nor Parcelable exists, ParcelableHolder'd better
write nothing like NDK and C++ backend.

In the case of empty ParcelableHolder
As-is(Java):
 4 -> Size
 -1 -> Existence(empty string)

To-be(NDK, C++ now):
 0 -> Size

Test: atest CtsNdkBinderTestCases
Bug: 173682663
Change-Id: I816108fdc59170ea7408f0633295ba978f1ef9d5
2020-11-24 22:44:42 +09:00
Michael Sun
2c7efc70d7 BatteryStats: explicitly copy the wakeup reasons
As the wakeup reasons received from binder callback are in const
reference, std::move the parameter will result in a copy operation in
order to fulfill the const restriction. Update to reflect this
explicitly.

Test: adb shell dumpsys batterystats --history
Bug: 173165219
Change-Id: I6ab995cc11600b37123651bacc2015a3bf1a4bf6
2020-11-24 06:50:51 +00:00
junyulai
e2dfbb3b65 Expose getTx/RxBytes in TrafficStats
Test: atest FrameworksNetTests TrafficStatsTest
      atest android.net.cts android.net.wifi.cts
Bug: 164965653
Change-Id: I17b9d0bc2404c5727d4c4530ad941439b7b71a54
2020-11-24 12:11:08 +08:00
Lucas Lin
72cb973ac1 Merge "Ignore verifying canBeSatisfiedBy() on Android Q" 2020-11-24 03:38:34 +00:00
Jiwon Kim
bdabd396f4 Fixed Handler Leak on DistanceClassifier
A VelocityTracker object is not recycled in case of motionEvents.size()<3 at calculateDistances function.

private DistanceVectors calculateDistances() {
    // This code assumes that there will be no missed DOWN or UP events.
    VelocityTracker velocityTracker = VelocityTracker.obtain();
...
    if (motionEvents.size() < 3) {
        logDebug("Only " + motionEvents.size() + " motion events recorded.");
        return new DistanceVectors(0, 0, 0, 0);
	}
...
}

Test: Manual

Signed-off-by: Jiwon Kim <jiwon88.kim@samsung.com>
Change-Id: Ifca0c25411f56a4de79d89d262d2b4e61045a8ed
2020-11-24 10:56:59 +09:00
Baligh Uddin
5e3a035a3d Merge "Add OWNERS block to facilitate in migration" 2020-11-23 18:47:28 +00:00
Sarah Chin
2391403601 Merge "Expose PinResult and ICC PIN/PUK APIs as SystemApi" 2020-11-23 17:50:19 +00:00
lucaslin
8c864592b8 Ignore verifying canBeSatisfiedBy() on Android Q
The method - satisfiedBy() has changed to canBeSatisfiedBy()
starting from Android R, so the method - canBeSatisfiedBy()
cannot be found when running this test on Android Q.
Ignore verifying canBeSatisfiedBy() on Android Q to fix this
problem.

Bug: 173911834
Test: Run MatchAllNetworkSpecifierTest on Android Q, R, S.
Change-Id: Ibe317b56f82d3ea100b1d78c3907dce4f2fd964d
2020-11-23 23:40:23 +08:00
Bram Bonné
6d7e4c43d6 Merge "Adds two missing Keymaster definitions." 2020-11-23 13:02:03 +00:00
Baligh Uddin
9e569671a3 Add OWNERS block to facilitate in migration
BUG: 167962588
Test: TH
Change-Id: Ia8cdeb0c2bd0e98d8d6b8a44f49d42ccd0d04908
2020-11-22 14:59:22 +00:00
Brad Ebinger
48695cb073 Merge "Add subid to SipTransportImplBase#createSipDelegate" 2020-11-21 01:38:42 +00:00
Treehugger Robot
00326a8902 Merge "Update UntaggedSocketViolation StrictMode message to reference TrafficStats.setThreadStatsTag instead of the erroneous TrafficStats.setThreadSocketTag." 2020-11-21 00:42:47 +00:00
James Mattis
2b30cd28ea Merge changes Ibed6cdd4,I51e3c00d,Ibf37f94b
* changes:
  Update toString() to use the correct request
  Update requestsSortedById() to sort by collection
  Allow a way to track the active request in an NRI
2020-11-21 00:24:11 +00:00
Sarah Chin
cafa63af2b Expose PinResult and ICC PIN/PUK APIs as SystemApi
Test: atest TelephonyManagerTest
Fix: 171884262
Change-Id: I9cdc11c49e4ca602cfa1464e5f424c4a96798cfe
Merged-In: I9cdc11c49e4ca602cfa1464e5f424c4a96798cfe
2020-11-20 15:18:03 -08:00
Brad Ebinger
d5c9dc309c Add subid to SipTransportImplBase#createSipDelegate
1) Add subId to the createSipDelegate method to make subId transitions
easier.
2) Add sub id torn down destroy reason
3) Small improvements found during implementation

Bug: b/154763999
Test: atest TeleServiceTests
Change-Id: I2d140ddfde65955a0833f610eeeeaf9d02b0f170
2020-11-20 15:12:05 -08:00
Daniel Bright
3798c10c1d Merge "Add support for pdu session id" 2020-11-20 22:54:19 +00:00
Daniel Bright
926aff5e7b Add support for pdu session id
Added startHandover and cancelHandover to DataService and DataServiceManager
so that it can be called by data connection

Test: Tested that handover still worked with logs.  IWlan -> Cell + Cell -> IWlan
Bug: 155176305
Merged-In: Ia59d7e9bf9a450da4b51a2884166d3b0fa93a7c9
Change-Id: Ia59d7e9bf9a450da4b51a2884166d3b0fa93a7c9
2020-11-20 12:23:43 -08:00
Treehugger Robot
ae44936d6a Merge "Add Audio HAL V7" 2020-11-20 19:39:55 +00:00
Martin Stjernholm
6e258a9c8b Clarify why it's safe to add java.library.path to the classloader
namespace.

Test: N/A - comment change only
Change-Id: I9ae485afc4b6b827c09bb7d65c3987eefd433492
2020-11-20 18:52:14 +00:00
Daniel Bright
5b38038d57 Merge "Added global retry support" 2020-11-20 18:48:36 +00:00