1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.media.permission; 18 19 import com.android.media.permission.PermissionEnum; 20 import com.android.media.permission.UidPackageState; 21 22 /** 23 * This interface is used by system_server to communicate permission information 24 * downwards towards native services. 25 * {@hide} 26 */ 27 interface INativePermissionController { 28 /** 29 * Initialize app-ids and their corresponding packages, to be used for package validation. 30 */ populatePackagesForUids(in List<UidPackageState> initialPackageStates)31 void populatePackagesForUids(in List<UidPackageState> initialPackageStates); 32 /** 33 * Replace or populate the list of packages associated with a given uid. 34 * If the list is empty, the package no longer exists. 35 */ updatePackagesForUid(in UidPackageState newPackageState)36 void updatePackagesForUid(in UidPackageState newPackageState); 37 /** 38 * Populate or replace the list of uids which holds a particular permission. 39 * Runtime permissions will need additional checks, and should not use the cache as-is. 40 * Not virtual device aware. 41 * Is is possible for updates to the permission state to be delayed during high traffic. 42 * @param perm - Enum representing the permission for which holders are being supplied 43 * @param uids - Uids (not app-ids) which hold the permission. Should be sorted 44 */ populatePermissionState(in PermissionEnum perm, in int[] uids)45 void populatePermissionState(in PermissionEnum perm, in int[] uids); 46 } 47