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.internal.pm.parsing.pkg; 18 19 import android.content.pm.SigningDetails; 20 21 import com.android.server.pm.pkg.AndroidPackage; 22 23 /** 24 * Methods used for mutation after direct package parsing, mostly done inside 25 * {@link com.android.server.pm.PackageManagerService}. 26 * 27 * Java disallows defining this as an inner interface, so this must be a separate file. 28 * 29 * TODO: Remove extending AndroidPackage, should be an isolated interface with only the methods 30 * necessary to parse and install 31 * 32 * @hide 33 */ 34 public interface ParsedPackage extends AndroidPackage { 35 hideAsFinal()36 AndroidPackageInternal hideAsFinal(); 37 addUsesLibrary(int index, String libraryName)38 ParsedPackage addUsesLibrary(int index, String libraryName); 39 addUsesOptionalLibrary(int index, String libraryName)40 ParsedPackage addUsesOptionalLibrary(int index, String libraryName); 41 capPermissionPriorities()42 ParsedPackage capPermissionPriorities(); 43 clearAdoptPermissions()44 ParsedPackage clearAdoptPermissions(); 45 clearOriginalPackages()46 ParsedPackage clearOriginalPackages(); 47 clearProtectedBroadcasts()48 ParsedPackage clearProtectedBroadcasts(); 49 setBaseApkPath(String baseApkPath)50 ParsedPackage setBaseApkPath(String baseApkPath); 51 setPath(String path)52 ParsedPackage setPath(String path); 53 setNativeLibraryDir(String nativeLibraryDir)54 ParsedPackage setNativeLibraryDir(String nativeLibraryDir); 55 setNativeLibraryRootDir(String nativeLibraryRootDir)56 ParsedPackage setNativeLibraryRootDir(String nativeLibraryRootDir); 57 setPackageName(String packageName)58 ParsedPackage setPackageName(String packageName); 59 setPrimaryCpuAbi(String primaryCpuAbi)60 ParsedPackage setPrimaryCpuAbi(String primaryCpuAbi); 61 setSecondaryCpuAbi(String secondaryCpuAbi)62 ParsedPackage setSecondaryCpuAbi(String secondaryCpuAbi); 63 setSigningDetails(SigningDetails signingDetails)64 ParsedPackage setSigningDetails(SigningDetails signingDetails); 65 setSplitCodePaths(String[] splitCodePaths)66 ParsedPackage setSplitCodePaths(String[] splitCodePaths); 67 setNativeLibraryRootRequiresIsa(boolean nativeLibraryRootRequiresIsa)68 ParsedPackage setNativeLibraryRootRequiresIsa(boolean nativeLibraryRootRequiresIsa); 69 setAllComponentsDirectBootAware(boolean allComponentsDirectBootAware)70 ParsedPackage setAllComponentsDirectBootAware(boolean allComponentsDirectBootAware); 71 setFactoryTest(boolean factoryTest)72 ParsedPackage setFactoryTest(boolean factoryTest); 73 setApex(boolean isApex)74 ParsedPackage setApex(boolean isApex); 75 setUpdatableSystem(boolean value)76 ParsedPackage setUpdatableSystem(boolean value); 77 78 /** 79 * Sets a system app that is allowed to update another system app 80 */ setEmergencyInstaller(String emergencyInstaller)81 ParsedPackage setEmergencyInstaller(String emergencyInstaller); 82 markNotActivitiesAsNotExportedIfSingleUser()83 ParsedPackage markNotActivitiesAsNotExportedIfSingleUser(); 84 setOdm(boolean odm)85 ParsedPackage setOdm(boolean odm); 86 setOem(boolean oem)87 ParsedPackage setOem(boolean oem); 88 setPrivileged(boolean privileged)89 ParsedPackage setPrivileged(boolean privileged); 90 setProduct(boolean product)91 ParsedPackage setProduct(boolean product); 92 setSignedWithPlatformKey(boolean signedWithPlatformKey)93 ParsedPackage setSignedWithPlatformKey(boolean signedWithPlatformKey); 94 setSystem(boolean system)95 ParsedPackage setSystem(boolean system); 96 setSystemExt(boolean systemExt)97 ParsedPackage setSystemExt(boolean systemExt); 98 setVendor(boolean vendor)99 ParsedPackage setVendor(boolean vendor); 100 removePermission(int index)101 ParsedPackage removePermission(int index); 102 removeUsesLibrary(String libraryName)103 ParsedPackage removeUsesLibrary(String libraryName); 104 removeUsesOptionalLibrary(String libraryName)105 ParsedPackage removeUsesOptionalLibrary(String libraryName); 106 setCoreApp(boolean coreApp)107 ParsedPackage setCoreApp(boolean coreApp); 108 setStub(boolean isStub)109 ParsedPackage setStub(boolean isStub); 110 setRestrictUpdateHash(byte[] restrictUpdateHash)111 ParsedPackage setRestrictUpdateHash(byte[] restrictUpdateHash); 112 setSecondaryNativeLibraryDir(String secondaryNativeLibraryDir)113 ParsedPackage setSecondaryNativeLibraryDir(String secondaryNativeLibraryDir); 114 115 /** 116 * This is an appId, the uid if the userId is == USER_SYSTEM 117 */ setUid(int uid)118 ParsedPackage setUid(int uid); 119 setVersionCode(int versionCode)120 ParsedPackage setVersionCode(int versionCode); 121 setVersionCodeMajor(int versionCodeMajor)122 ParsedPackage setVersionCodeMajor(int versionCodeMajor); 123 124 // TODO(b/135203078): Move logic earlier in parse chain so nothing needs to be reverted setDefaultToDeviceProtectedStorage(boolean defaultToDeviceProtectedStorage)125 ParsedPackage setDefaultToDeviceProtectedStorage(boolean defaultToDeviceProtectedStorage); 126 setDirectBootAware(boolean directBootAware)127 ParsedPackage setDirectBootAware(boolean directBootAware); 128 setPersistent(boolean persistent)129 ParsedPackage setPersistent(boolean persistent); 130 } 131