From 52eac028fce78e16a0815a12d23156196bf8010c Mon Sep 17 00:00:00 2001 From: Andrei Onea <andreionea@google.com> Date: Fri, 3 Dec 2021 15:11:27 +0000 Subject: [PATCH] Move permissions allowlist for Tethering The allowlist will now be in the apex instead. Test: boots && check permissions.xml is bundled Bug: 190375768 Change-Id: Ia7434cba54d2b51479e52323f22c7f454499991d --- Tethering/Android.bp | 4 ++-- Tethering/apex/Android.bp | 5 +++- Tethering/apex/permissions/Android.bp | 28 ++++++++++++++++++++++ Tethering/apex/permissions/OWNERS | 2 ++ Tethering/apex/permissions/permissions.xml | 28 ++++++++++++++++++++++ 5 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 Tethering/apex/permissions/Android.bp create mode 100644 Tethering/apex/permissions/OWNERS create mode 100644 Tethering/apex/permissions/permissions.xml diff --git a/Tethering/Android.bp b/Tethering/Android.bp index 0b54783d13..2d7f28f553 100644 --- a/Tethering/Android.bp +++ b/Tethering/Android.bp @@ -177,7 +177,7 @@ android_app { // The permission configuration *must* be included to ensure security of the device required: [ "NetworkPermissionConfig", - "privapp_whitelist_com.android.networkstack.tethering", + "privapp_allowlist_com.android.tethering", ], apex_available: ["com.android.tethering"], lint: { strict_updatability_linting: true }, @@ -197,7 +197,7 @@ android_app { // The permission configuration *must* be included to ensure security of the device required: [ "NetworkPermissionConfig", - "privapp_whitelist_com.android.networkstack.tethering", + "privapp_allowlist_com.android.tethering", ], apex_available: ["com.android.tethering"], lint: { strict_updatability_linting: true }, diff --git a/Tethering/apex/Android.bp b/Tethering/apex/Android.bp index 7863572c52..608f9322d3 100644 --- a/Tethering/apex/Android.bp +++ b/Tethering/apex/Android.bp @@ -62,7 +62,10 @@ apex { apps: [ "ServiceConnectivityResources", ], - prebuilts: ["current_sdkinfo"], + prebuilts: [ + "current_sdkinfo", + "privapp_allowlist_com.android.tethering", + ], manifest: "manifest.json", key: "com.android.tethering.key", // Indicates that pre-installed version of this apex can be compressed. diff --git a/Tethering/apex/permissions/Android.bp b/Tethering/apex/permissions/Android.bp new file mode 100644 index 0000000000..ac9ec65dd5 --- /dev/null +++ b/Tethering/apex/permissions/Android.bp @@ -0,0 +1,28 @@ +// +// Copyright (C) 2022 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. +// + +package { + default_applicable_licenses: ["Android-Apache-2.0"], + default_visibility: ["//packages/modules/Connectivity/Tethering:__subpackages__"], +} + +prebuilt_etc { + name: "privapp_allowlist_com.android.tethering", + sub_dir: "permissions", + filename: "permissions.xml", + src: "permissions.xml", + installable: false, +} \ No newline at end of file diff --git a/Tethering/apex/permissions/OWNERS b/Tethering/apex/permissions/OWNERS new file mode 100644 index 0000000000..8b7e2e5d0c --- /dev/null +++ b/Tethering/apex/permissions/OWNERS @@ -0,0 +1,2 @@ +per-file *.xml,OWNERS = set noparent +per-file *.xml,OWNERS = file:platform/frameworks/base:/data/etc/OWNERS diff --git a/Tethering/apex/permissions/permissions.xml b/Tethering/apex/permissions/permissions.xml new file mode 100644 index 0000000000..f26a9616e0 --- /dev/null +++ b/Tethering/apex/permissions/permissions.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2021 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 +--> + +<permissions> + <privapp-permissions package="com.android.networkstack.tethering"> + <permission name="android.permission.BLUETOOTH_PRIVILEGED" /> + <permission name="android.permission.MANAGE_USB"/> + <permission name="android.permission.MODIFY_PHONE_STATE"/> + <permission name="android.permission.READ_NETWORK_USAGE_HISTORY"/> + <permission name="android.permission.TETHER_PRIVILEGED"/> + <permission name="android.permission.UPDATE_APP_OPS_STATS"/> + <permission name="android.permission.UPDATE_DEVICE_STATS"/> + </privapp-permissions> +</permissions> -- GitLab