diff --git a/services/companion/Android.bp b/services/companion/Android.bp index 4ae9365d3b9fc..e3926b48d61d9 100644 --- a/services/companion/Android.bp +++ b/services/companion/Android.bp @@ -9,7 +9,10 @@ package { filegroup { name: "services.companion-sources", - srcs: ["java/**/*.java"], + srcs: [ + "java/**/*.java", + "java/**/*.proto", + ], path: "java", visibility: ["//frameworks/base/services"], } @@ -17,6 +20,9 @@ filegroup { java_library_static { name: "services.companion", defaults: ["platform_service_defaults"], + proto: { + type: "stream", + }, srcs: [":services.companion-sources"], libs: ["services.core"], } diff --git a/services/companion/java/com/android/server/companion/proto/companion_apps_permissions.proto b/services/companion/java/com/android/server/companion/proto/companion_apps_permissions.proto new file mode 100644 index 0000000000000..b786bcc5e0df9 --- /dev/null +++ b/services/companion/java/com/android/server/companion/proto/companion_apps_permissions.proto @@ -0,0 +1,37 @@ +/* + * 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. + */ + +syntax = "proto3"; + +option java_multiple_files = true; + +/* Represents granted permissions of a list of apps */ +message CompanionAppsPermissions { + // granted permissions of apps + repeated AppPermissions appPermissions = 1; + + /* Represents the granted permissions of an app */ + message AppPermissions { + // package name of the app + string packageName = 1; + + // signing certificates used to sign the APK contents of this app + bytes certificates = 2; + + // granted permissions + repeated string permission = 3; + } +} diff --git a/services/companion/java/com/android/server/companion/proto/companion_message.proto b/services/companion/java/com/android/server/companion/proto/companion_message.proto new file mode 100644 index 0000000000000..2309be3afd940 --- /dev/null +++ b/services/companion/java/com/android/server/companion/proto/companion_message.proto @@ -0,0 +1,43 @@ +/* + * 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. + */ + +syntax = "proto3"; + +option java_multiple_files = true; + +/* Represents a message between companion devices */ +message CompanionMessage { + // id of the message + int32 messageId = 1; + + // type of the message + CompanionMessageType type = 2; + + // data contained in the message + bytes data = 3; + + // types of CompanionMessage + enum CompanionMessageType { + // default value for proto3 + UNKNOWN = 0; + + // handshake message to establish secure channel + SECURE_CHANNEL_HANDSHAKE = 1; + + // permission sync + PERMISSION_SYNC = 2; + } +}