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