diff options
author | Evan Chen <evanxinchen@google.com> | 2022-01-27 06:57:34 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2022-01-27 06:57:34 +0000 |
commit | 119106d697571a2e4ceef1f75aae8b0252363223 (patch) | |
tree | bf6c602a706df848026c1be5c65197066875b590 /PermissionController/src/com/android/permissioncontroller/role | |
parent | e8cb28e8bb01d57496ace7f699295cea3fb7d38a (diff) | |
parent | d9478559e266b640b7a1dd929d3f33eeb05246d7 (diff) | |
download | Permission-119106d697571a2e4ceef1f75aae8b0252363223.tar.gz |
Merge "Add COMPANION_DEVICE_COMPUTER role."
Diffstat (limited to 'PermissionController/src/com/android/permissioncontroller/role')
-rw-r--r-- | PermissionController/src/com/android/permissioncontroller/role/model/CompanionDeviceComputerRoleBehavior.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/PermissionController/src/com/android/permissioncontroller/role/model/CompanionDeviceComputerRoleBehavior.java b/PermissionController/src/com/android/permissioncontroller/role/model/CompanionDeviceComputerRoleBehavior.java new file mode 100644 index 000000000..1d9409f1f --- /dev/null +++ b/PermissionController/src/com/android/permissioncontroller/role/model/CompanionDeviceComputerRoleBehavior.java @@ -0,0 +1,39 @@ +/* + * 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 com.android.permissioncontroller.role.model; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import com.android.permissioncontroller.role.utils.NotificationUtils; + +/** + * Class for behavior of the "Computer" Companion device profile role. + */ +public class CompanionDeviceComputerRoleBehavior implements RoleBehavior { + + @Override + public void grant(@NonNull Role role, @NonNull String packageName, @NonNull Context context) { + NotificationUtils.grantNotificationAccessForPackage(context, packageName); + } + + @Override + public void revoke(@NonNull Role role, @NonNull String packageName, @NonNull Context context) { + NotificationUtils.revokeNotificationAccessForPackage(context, packageName); + } +} |