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.Nullable; 21 import android.annotation.SystemApi; 22 import android.content.pm.SharedLibraryInfo; 23 import android.content.pm.VersionedPackage; 24 import android.processor.immutability.Immutable; 25 26 import java.util.List; 27 28 /** 29 * Information for a shared library dependency, which is resolved to a real package on the device. 30 * 31 * There are four types of shared libraries: 32 * <table> 33 * <tr><td>Built-in</td> <td>Non-updatable part of OS</td></tr> 34 * <tr><td>Dynamic</td> <td>Updatable backwards-compatible dynamically linked</td></tr> 35 * <tr><td>Static</td> <td>Non-backwards-compatible emulating static linking</td></tr> 36 * <tr><td>SDK</td> <td>Updatable backwards-incompatible dynamically loaded</td></tr> 37 * </table> 38 * 39 * This class is a clone of {@link SharedLibraryInfo} but as an interface with more guaranteed 40 * immutability. 41 * 42 * @hide 43 */ 44 @SystemApi(client = SystemApi.Client.SYSTEM_SERVER) 45 @Immutable 46 public interface SharedLibrary { 47 48 /** 49 * @see SharedLibraryInfo#getPath() 50 */ 51 @Nullable getPath()52 String getPath(); 53 54 /** 55 * @see SharedLibraryInfo#getPackageName() 56 */ 57 @Nullable getPackageName()58 String getPackageName(); 59 60 /** 61 * @see SharedLibraryInfo#getName() 62 */ 63 @Nullable getName()64 String getName(); 65 66 /** 67 * @see SharedLibraryInfo#getAllCodePaths() 68 */ 69 @NonNull getAllCodePaths()70 List<String> getAllCodePaths(); 71 72 /** 73 * @see SharedLibraryInfo#getLongVersion() 74 */ getVersion()75 long getVersion(); 76 77 /** 78 * @see SharedLibraryInfo#getType() 79 */ 80 @SharedLibraryInfo.Type getType()81 int getType(); 82 83 /** 84 * @see SharedLibraryInfo#isNative() 85 */ isNative()86 boolean isNative(); 87 88 /** 89 * @see SharedLibraryInfo#getDeclaringPackage() 90 */ 91 @Immutable.Policy(exceptions = {Immutable.Policy.Exception.FINAL_CLASSES_WITH_FINAL_FIELDS}) 92 @NonNull getDeclaringPackage()93 VersionedPackage getDeclaringPackage(); 94 95 /** 96 * @see SharedLibraryInfo#getDependentPackages() 97 */ 98 @Immutable.Policy(exceptions = {Immutable.Policy.Exception.FINAL_CLASSES_WITH_FINAL_FIELDS}) 99 @NonNull getDependentPackages()100 List<VersionedPackage> getDependentPackages(); 101 102 /** 103 * @see SharedLibraryInfo#getDependencies() 104 */ 105 @NonNull getDependencies()106 List<SharedLibrary> getDependencies(); 107 } 108