Changes: i) Add a new constructor for NetworkCapabilities which accepts whether location sensitive fields need to be parceled or not. Defalts to false on the other constructor. This boolean should only be set on the copy of NetworkCapabilities when sent to apps that hold location permission. (Similar to how sensitive fields are handled in LinkProperties) ii) Add a new makeCopy() method in the TransportInfo interface which accepts whether location sensitive fields need to be parceled or not. iii) Migrate the existing NetworkCapabilities owner UID masking to use this new mechanism (instead of existing masking in ConnectivityService). iv) Always set parcelLocationSensitiveFields to true in the NetworkAgent surface (since that is a privileged surface from the transports to the connectivity service) v) Add a hasSensitiveFields() in TransportInfo interface to avoid perfoming location permission checks for location insensitive TrasnsportInfo. Also, migrate to the new SdkLevel util for isAtLeastR() & isAtLeastS() checks. Bug: 162602799 Test: atest android.net Test: atest com.android.server Change-Id: Ie522d8c75a82ae521ccfd5165823d0c72642e651 Merged-In: Ie522d8c75a82ae521ccfd5165823d0c72642e651
36 lines
1.2 KiB
Plaintext
36 lines
1.2 KiB
Plaintext
//
|
|
// Copyright (C) 2019 The Android Open Source Project
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
//
|
|
|
|
// Tests in this folder are included both in unit tests and CTS.
|
|
// They must be fast and stable, and exercise public or test APIs.
|
|
java_library {
|
|
name: "FrameworksNetCommonTests",
|
|
srcs: ["java/**/*.java", "java/**/*.kt"],
|
|
static_libs: [
|
|
"androidx.core_core",
|
|
"androidx.test.rules",
|
|
"junit",
|
|
"mockito-target-minus-junit4",
|
|
"modules-utils-build",
|
|
"net-tests-utils",
|
|
"net-utils-framework-common",
|
|
"platform-test-annotations",
|
|
],
|
|
libs: [
|
|
"android.test.base.stubs",
|
|
],
|
|
}
|