1 /* 2 * Copyright (C) 2019 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 android.permission; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.annotation.UserIdInt; 22 23 /** 24 * Internal interfaces to be used by other components within the system server. 25 * 26 * <p>Only for use within the system server. 27 * 28 * @hide 29 */ 30 public interface PermissionManagerInternal { 31 /** 32 * Get the state of the runtime permissions as a blob. 33 * 34 * @param userId The user ID the data should be extracted for 35 * 36 * @return the state as a blob 37 */ 38 //@SystemApi(client = SystemApi.Client.SYSTEM_SERVER) 39 @Nullable backupRuntimePermissions(@serIdInt int userId)40 byte[] backupRuntimePermissions(@UserIdInt int userId); 41 42 /** 43 * Restore a permission state previously backed up via {@link #backupRuntimePermissions}. 44 * <p> 45 * If not all state can be restored, the un-restorable state will be delayed and can be 46 * retried via {@link #restoreDelayedRuntimePermissions}. 47 * 48 * @param backup the state as a blob 49 * @param userId the user ID the data should be restored for 50 */ 51 //@SystemApi(client = SystemApi.Client.SYSTEM_SERVER) restoreRuntimePermissions(@onNull byte[] backup, @UserIdInt int userId)52 void restoreRuntimePermissions(@NonNull byte[] backup, @UserIdInt int userId); 53 54 /** 55 * Try to apply permission backup of a package that was previously not applied. 56 * 57 * @param packageName the package that is newly installed 58 * @param userId the user ID the package is installed for 59 * 60 * @see #restoreRuntimePermissions 61 */ 62 //@SystemApi(client = SystemApi.Client.SYSTEM_SERVER) restoreDelayedRuntimePermissions(@onNull String packageName, @UserIdInt int userId)63 void restoreDelayedRuntimePermissions(@NonNull String packageName, 64 @UserIdInt int userId); 65 } 66