1 /* 2 * Copyright (C) 2020 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.Nullable; 21 import android.annotation.UserIdInt; 22 import android.content.pm.SigningDetails; 23 import android.util.SparseArray; 24 25 import com.android.server.pm.InstallSource; 26 import com.android.server.pm.PackageKeySetData; 27 import com.android.server.pm.parsing.pkg.AndroidPackage; 28 import com.android.server.pm.permission.LegacyPermissionState; 29 30 import java.util.UUID; 31 32 /** 33 * Exposes internal types for internal usage of {@link PackageState}. 34 */ 35 public interface PackageStateInternal extends PackageState { 36 37 @NonNull getPkg()38 AndroidPackage getPkg(); 39 40 // TODO: Remove in favor of exposing APIs directly? 41 @NonNull getTransientState()42 PackageStateUnserialized getTransientState(); 43 44 @NonNull getDomainSetId()45 UUID getDomainSetId(); 46 47 @NonNull getSigningDetails()48 SigningDetails getSigningDetails(); 49 50 @NonNull getInstallSource()51 InstallSource getInstallSource(); 52 53 // TODO: Remove this in favor of boolean APIs getFlags()54 int getFlags(); getPrivateFlags()55 int getPrivateFlags(); 56 57 @NonNull getUserStates()58 SparseArray<? extends PackageUserStateInternal> getUserStates(); 59 60 /** 61 * @return the result of {@link #getUserStates()}.get(userId) or 62 * {@link PackageUserState#DEFAULT} if the state doesn't exist. 63 */ 64 @NonNull getUserStateOrDefault(@serIdInt int userId)65 default PackageUserStateInternal getUserStateOrDefault(@UserIdInt int userId) { 66 PackageUserStateInternal userState = getUserStates().get(userId); 67 return userState == null ? PackageUserStateInternal.DEFAULT : userState; 68 } 69 70 @NonNull getLegacyPermissionState()71 LegacyPermissionState getLegacyPermissionState(); 72 73 @Nullable getRealName()74 String getRealName(); 75 isLoading()76 boolean isLoading(); 77 78 @NonNull getPathString()79 String getPathString(); 80 getLoadingProgress()81 float getLoadingProgress(); 82 83 @NonNull getKeySetData()84 PackageKeySetData getKeySetData(); 85 } 86