1 /* 2 * Copyright (C) 2022 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.server.pm.pkg; 18 19 import android.annotation.NonNull; 20 import android.annotation.UserIdInt; 21 import android.content.pm.SigningDetails; 22 import android.util.ArrayMap; 23 import android.util.ArraySet; 24 25 import com.android.internal.pm.pkg.component.ParsedProcess; 26 import com.android.server.pm.permission.LegacyPermissionState; 27 28 import java.util.List; 29 30 /** @hide */ 31 public interface SharedUserApi { 32 33 @NonNull getName()34 String getName(); 35 36 @UserIdInt getAppId()37 int getAppId(); 38 39 // flags that are associated with this uid, regardless of any package flags getUidFlags()40 int getUidFlags(); getPrivateUidFlags()41 int getPrivateUidFlags(); 42 43 // The lowest targetSdkVersion of all apps in the sharedUserSetting, used to assign seinfo so 44 // that all apps within the sharedUser run in the same selinux context. getSeInfoTargetSdkVersion()45 int getSeInfoTargetSdkVersion(); 46 47 /** 48 * @return the list of packages that uses this shared UID 49 */ 50 @NonNull getPackages()51 List<AndroidPackage> getPackages(); 52 53 @NonNull getPackageStates()54 ArraySet<? extends PackageStateInternal> getPackageStates(); 55 56 // It is possible for a system app to leave shared user ID by an update. 57 // We need to keep track of the shadowed PackageSettings so that it is possible to uninstall 58 // the update and revert the system app back into the original shared user ID. 59 @NonNull getDisabledPackageStates()60 ArraySet<? extends PackageStateInternal> getDisabledPackageStates(); 61 62 @NonNull getSigningDetails()63 SigningDetails getSigningDetails(); 64 65 @NonNull getProcesses()66 ArrayMap<String, ParsedProcess> getProcesses(); 67 isPrivileged()68 boolean isPrivileged(); 69 70 @NonNull getSharedUserLegacyPermissionState()71 LegacyPermissionState getSharedUserLegacyPermissionState(); 72 } 73