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.AndroidPackageInternal; 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 * @hide 35 */ 36 public interface PackageStateInternal extends PackageState { 37 38 @NonNull getPkg()39 AndroidPackageInternal getPkg(); 40 41 // TODO: Remove in favor of exposing APIs directly? 42 @NonNull getTransientState()43 PackageStateUnserialized getTransientState(); 44 45 @NonNull getDomainSetId()46 UUID getDomainSetId(); 47 48 @NonNull getSigningDetails()49 SigningDetails getSigningDetails(); 50 51 @NonNull getInstallSource()52 InstallSource getInstallSource(); 53 54 // TODO: Remove this in favor of boolean APIs getFlags()55 int getFlags(); getPrivateFlags()56 int getPrivateFlags(); 57 58 @NonNull getUserStates()59 SparseArray<? extends PackageUserStateInternal> getUserStates(); 60 61 /** 62 * @return the result of {@link #getUserStates()}.get(userId) or 63 * {@link PackageUserState#DEFAULT} if the state doesn't exist. 64 */ 65 @NonNull getUserStateOrDefault(@serIdInt int userId)66 default PackageUserStateInternal getUserStateOrDefault(@UserIdInt int userId) { 67 PackageUserStateInternal userState = getUserStates().get(userId); 68 return userState == null ? PackageUserStateInternal.DEFAULT : userState; 69 } 70 71 @NonNull getLegacyPermissionState()72 LegacyPermissionState getLegacyPermissionState(); 73 74 @Nullable getRealName()75 String getRealName(); 76 isLoading()77 boolean isLoading(); 78 79 @NonNull getPathString()80 String getPathString(); 81 getLoadingProgress()82 float getLoadingProgress(); 83 getLoadingCompletedTime()84 long getLoadingCompletedTime(); 85 86 @NonNull getKeySetData()87 PackageKeySetData getKeySetData(); 88 89 /** 90 * Return the exact value stored inside this object for the primary CPU ABI type. This does 91 * not fallback to the inner {@link #getAndroidPackage()}, unlike {@link #getPrimaryCpuAbi()}. 92 * 93 * @deprecated Use {@link #getPrimaryCpuAbi()} if at all possible. 94 * 95 * TODO(b/249779400): Remove and see if the fallback-only API is a usable replacement 96 */ 97 @Deprecated 98 @Nullable getPrimaryCpuAbiLegacy()99 String getPrimaryCpuAbiLegacy(); 100 101 /** 102 * Same behavior as {@link #getPrimaryCpuAbiLegacy()}, but with the secondary ABI. 103 * 104 * @deprecated Use {@link #getSecondaryCpuAbi()} if at all possible. 105 */ 106 @Nullable getSecondaryCpuAbiLegacy()107 String getSecondaryCpuAbiLegacy(); 108 109 /** 110 * @return the app metadata file path. 111 */ 112 @Nullable getAppMetadataFilePath()113 String getAppMetadataFilePath(); 114 } 115