diff --git a/Android.bp b/Android.bp index eb9928c5f1755..b2bfb2c7c628f 100644 --- a/Android.bp +++ b/Android.bp @@ -268,6 +268,7 @@ filegroup { ":framework-tethering-srcs", ":updatable-media-srcs", ":framework-mediaprovider-sources", + ":framework-permission-sources", ":framework-wifi-updatable-sources", ":ike-srcs", ] @@ -440,6 +441,7 @@ java_library { "framework-appsearch-stubs", // TODO(b/146167933): Use framework-statsd-stubs "framework-statsd", + "framework-permission-stubs", "framework-wifi-stubs", "ike-stubs", ], @@ -465,6 +467,7 @@ java_library { "//frameworks/base/apex/appsearch/framework", "//frameworks/base/apex/blobstore/framework", "//frameworks/base/apex/jobscheduler/framework", + "//frameworks/base/apex/permission/framework", "//frameworks/base/apex/statsd/service", "//frameworks/base/wifi", "//frameworks/opt/net/wifi/service", @@ -489,6 +492,7 @@ java_library { "updatable_media_stubs", "framework_mediaprovider_stubs", "framework-appsearch", // TODO(b/146218515): should be framework-appsearch-stubs + "framework-permission-stubs", "framework-sdkextensions-stubs-systemapi", // TODO(b/146167933): Use framework-statsd-stubs instead. "framework-statsd", diff --git a/apex/permission/Android.bp b/apex/permission/Android.bp index f232e6274eaf5..d746ea6af3972 100644 --- a/apex/permission/Android.bp +++ b/apex/permission/Android.bp @@ -22,6 +22,10 @@ apex_defaults { name: "com.android.permission-defaults", key: "com.android.permission.key", certificate: ":com.android.permission.certificate", + java_libs: [ + "framework-permission", + "service-permission", + ], apps: ["PermissionController"], } diff --git a/apex/permission/framework/Android.bp b/apex/permission/framework/Android.bp new file mode 100644 index 0000000000000..8b03da3a9530c --- /dev/null +++ b/apex/permission/framework/Android.bp @@ -0,0 +1,60 @@ +// Copyright (C) 2020 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. + +filegroup { + name: "framework-permission-sources", + srcs: [ + "java/**/*.java", + "java/**/*.aidl", + ], + path: "java", +} + +java_library { + name: "framework-permission", + srcs: [ + ":framework-permission-sources", + ], + sdk_version: "system_current", + apex_available: [ + "com.android.permission", + "test_com.android.permission", + ], + hostdex: true, + installable: true, + visibility: [ + "//frameworks/base/apex/permission:__subpackages__", + ], +} + +droidstubs { + name: "framework-permission-stubs-sources", + srcs: [ + ":framework-annotations", + ":framework-permission-sources", + ], + sdk_version: "system_current", + defaults: [ + "framework-module-stubs-defaults-systemapi", + ], +} + +java_library { + name: "framework-permission-stubs", + srcs: [ + ":framework-permission-stubs-sources", + ], + sdk_version: "system_current", + installable: false, +} diff --git a/apex/permission/framework/java/android/permission/PermissionState.java b/apex/permission/framework/java/android/permission/PermissionState.java new file mode 100644 index 0000000000000..e810db8ecbfe5 --- /dev/null +++ b/apex/permission/framework/java/android/permission/PermissionState.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2020 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 android.permission; + +/** + * @hide + */ +public class PermissionState {} diff --git a/apex/permission/service/Android.bp b/apex/permission/service/Android.bp new file mode 100644 index 0000000000000..972b362509c0c --- /dev/null +++ b/apex/permission/service/Android.bp @@ -0,0 +1,29 @@ +// Copyright (C) 2020 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. + +java_library { + name: "service-permission", + srcs: [ + "java/**/*.java", + ], + sdk_version: "system_current", + libs: [ + "framework-permission", + ], + apex_available: [ + "com.android.permission", + "test_com.android.permission", + ], + installable: true, +} diff --git a/apex/permission/service/java/com/android/server/permission/RuntimePermissionPersistence.java b/apex/permission/service/java/com/android/server/permission/RuntimePermissionPersistence.java new file mode 100644 index 0000000000000..a534e22c04cbf --- /dev/null +++ b/apex/permission/service/java/com/android/server/permission/RuntimePermissionPersistence.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2020 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 com.android.server.permission; + +/** + * Persistence for runtime permissions. + */ +public class RuntimePermissionPersistence {} diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp index 082a2892e34b9..1fcc8acb58791 100644 --- a/core/jni/fd_utils.cpp +++ b/core/jni/fd_utils.cpp @@ -39,6 +39,7 @@ static const char* kPathWhitelist[] = { "/apex/com.android.media/javalib/updatable-media.jar", "/apex/com.android.mediaprovider/javalib/framework-mediaprovider.jar", "/apex/com.android.os.statsd/javalib/framework-statsd.jar", + "/apex/com.android.permission/javalib/framework-permission.jar", "/apex/com.android.sdkext/javalib/framework-sdkextensions.jar", "/apex/com.android.wifi/javalib/framework-wifi.jar", "/apex/com.android.tethering/javalib/framework-tethering.jar", diff --git a/services/tests/mockingservicestests/Android.bp b/services/tests/mockingservicestests/Android.bp index 96fedf933a9cc..3d9f11ff6d2f1 100644 --- a/services/tests/mockingservicestests/Android.bp +++ b/services/tests/mockingservicestests/Android.bp @@ -21,6 +21,7 @@ android_test { "services.core", "services.net", "service-jobscheduler", + "service-permission", "androidx.test.runner", "mockito-target-extended-minus-junit4", "platform-test-annotations", diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp index ace15eb412617..556f6362d8728 100644 --- a/services/tests/servicestests/Android.bp +++ b/services/tests/servicestests/Android.bp @@ -44,6 +44,7 @@ android_test { "servicestests-utils", "service-appsearch", "service-jobscheduler", + "service-permission", // TODO: remove once Android migrates to JUnit 4.12, // which provides assertThrows "testng",