Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa3379f0 authored by Winson Chiu's avatar Winson Chiu Committed by Android (Google) Code Review
Browse files

Merge "Add @Immutable"

parents c4666416 a597df86
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ java_library_static {
        "service-permission.stubs.system_server",
        "service-sdksandbox.stubs.system_server",
    ],
    plugins: ["ImmutabilityAnnotationProcessor"],

    required: [
        "default_television.xml",
@@ -172,6 +173,7 @@ java_library_static {
        "overlayable_policy_aidl-java",
        "SurfaceFlingerProperties",
        "com.android.sysprop.watchdog",
        "ImmutabilityAnnotation",
    ],
    javac_shard_size: 50,
}
+34 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.content.pm.ProviderInfo;
import android.content.pm.ServiceInfo;
import android.content.pm.SigningDetails;
import android.os.Bundle;
import android.processor.immutability.Immutable;
import android.util.ArraySet;
import android.util.Pair;
import android.util.SparseArray;
@@ -65,6 +66,7 @@ import java.util.Set;
 * @hide
 */
//@SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
@Immutable
public interface AndroidPackage {

    /**
@@ -86,6 +88,7 @@ public interface AndroidPackage {
     * @see ActivityInfo
     * @see PackageInfo#activities
     */
    @Immutable.Ignore
    @NonNull
    List<ParsedActivity> getActivities();

@@ -101,6 +104,7 @@ public interface AndroidPackage {
    /**
     * @see R.styleable#AndroidManifestApexSystemService
     */
    @Immutable.Ignore
    @NonNull
    List<ParsedApexSystemService> getApexSystemServices();

@@ -111,6 +115,7 @@ public interface AndroidPackage {
    @Nullable
    String getAppComponentFactory();

    @Immutable.Ignore
    @NonNull
    List<ParsedAttribution> getAttributions();

@@ -189,6 +194,7 @@ public interface AndroidPackage {
     * @see PackageInfo#configPreferences
     * @see R.styleable#AndroidManifestUsesConfiguration
     */
    @Immutable.Ignore
    @NonNull
    List<ConfigurationInfo> getConfigPreferences();

@@ -208,6 +214,7 @@ public interface AndroidPackage {
     * @see PackageInfo#featureGroups
     * @see R.styleable#AndroidManifestUsesFeature
     */
    @Immutable.Ignore
    @NonNull
    List<FeatureGroupInfo> getFeatureGroups();

@@ -247,6 +254,7 @@ public interface AndroidPackage {
     * @see InstrumentationInfo
     * @see PackageInfo#instrumentation
     */
    @Immutable.Ignore
    @NonNull
    List<ParsedInstrumentation> getInstrumentations();

@@ -257,6 +265,7 @@ public interface AndroidPackage {
     * @see R.styleable#AndroidManifestKeySet
     * @see R.styleable#AndroidManifestPublicKey
     */
    @Immutable.Ignore
    @NonNull
    Map<String, ArraySet<PublicKey>> getKeySetMapping();

@@ -341,6 +350,7 @@ public interface AndroidPackage {
    /**
     * TODO(b/135203078): Make all the Bundles immutable (and non-null by shared empty reference?)
     */
    @Immutable.Ignore
    @Nullable
    Bundle getMetaData();

@@ -356,6 +366,7 @@ public interface AndroidPackage {
    /**
     * @see R.styleable#AndroidManifestExtensionSdk
     */
    @Immutable.Ignore
    @Nullable
    SparseIntArray getMinExtensionVersions();

@@ -464,6 +475,7 @@ public interface AndroidPackage {
    /**
     * @see android.content.pm.PermissionGroupInfo
     */
    @Immutable.Ignore
    @NonNull
    List<ParsedPermissionGroup> getPermissionGroups();

@@ -471,6 +483,7 @@ public interface AndroidPackage {
     * @see PermissionInfo
     * @see PackageInfo#permissions
     */
    @Immutable.Ignore
    @NonNull
    List<ParsedPermission> getPermissions();

@@ -480,6 +493,7 @@ public interface AndroidPackage {
     * Map of component className to intent info inside that component. TODO(b/135203078): Is this
     * actually used/working?
     */
    @Immutable.Ignore
    @NonNull
    List<Pair<String, ParsedIntentInfo>> getPreferredActivityFilters();

@@ -493,12 +507,14 @@ public interface AndroidPackage {
    /**
     * @see android.content.pm.ProcessInfo
     */
    @Immutable.Ignore
    @NonNull
    Map<String, ParsedProcess> getProcesses();

    /**
     * Returns the properties set on the application
     */
    @Immutable.Ignore
    @NonNull
    Map<String, PackageManager.Property> getProperties();

@@ -522,6 +538,7 @@ public interface AndroidPackage {
     * @see ProviderInfo
     * @see PackageInfo#providers
     */
    @Immutable.Ignore
    @NonNull
    List<ParsedProvider> getProviders();

@@ -530,6 +547,7 @@ public interface AndroidPackage {
     *
     * @see R.styleable#AndroidManifestQueriesIntent
     */
    @Immutable.Ignore
    @NonNull
    List<Intent> getQueriesIntents();

@@ -566,6 +584,7 @@ public interface AndroidPackage {
     * @see ActivityInfo
     * @see PackageInfo#receivers
     */
    @Immutable.Ignore
    @NonNull
    List<ParsedActivity> getReceivers();

@@ -573,6 +592,7 @@ public interface AndroidPackage {
     * @see PackageInfo#reqFeatures
     * @see R.styleable#AndroidManifestUsesFeature
     */
    @Immutable.Ignore
    @NonNull
    List<FeatureInfo> getRequestedFeatures();

@@ -615,6 +635,7 @@ public interface AndroidPackage {
     *
     * @see R.styleable#AndroidManifestRestrictUpdate
     */
    @Immutable.Ignore
    @Nullable
    byte[] getRestrictUpdateHash();

@@ -662,6 +683,7 @@ public interface AndroidPackage {
     * @see ServiceInfo
     * @see PackageInfo#services
     */
    @Immutable.Ignore
    @NonNull
    List<ParsedService> getServices();

@@ -682,6 +704,7 @@ public interface AndroidPackage {
     * The signature data of all APKs in this package, which must be exactly the same across the
     * base and splits.
     */
    @Immutable.Ignore
    @NonNull
    SigningDetails getSigningDetails();

@@ -689,6 +712,7 @@ public interface AndroidPackage {
     * @see ApplicationInfo#splitClassLoaderNames
     * @see R.styleable#AndroidManifestApplication_classLoader
     */
    @Immutable.Ignore
    @Nullable
    String[] getSplitClassLoaderNames();

@@ -696,18 +720,21 @@ public interface AndroidPackage {
     * @see ApplicationInfo#splitSourceDirs
     * @see ApplicationInfo#getSplitCodePaths
     */
    @Immutable.Ignore
    @NonNull
    String[] getSplitCodePaths();

    /**
     * @see ApplicationInfo#splitDependencies
     */
    @Immutable.Ignore
    @NonNull
    SparseArray<int[]> getSplitDependencies();

    /**
     * Flags of any split APKs; ordered by parsed splitName
     */
    @Immutable.Ignore
    @Nullable
    int[] getSplitFlags();

@@ -717,12 +744,14 @@ public interface AndroidPackage {
     * @see ApplicationInfo#splitNames
     * @see PackageInfo#splitNames
     */
    @Immutable.Ignore
    @NonNull
    String[] getSplitNames();

    /**
     * @see PackageInfo#splitRevisionCodes
     */
    @Immutable.Ignore
    @NonNull
    int[] getSplitRevisionCodes();

@@ -818,6 +847,7 @@ public interface AndroidPackage {
    @NonNull
    List<String> getUsesOptionalNativeLibraries();

    @Immutable.Ignore
    @NonNull
    List<ParsedUsesPermission> getUsesPermissions();

@@ -832,12 +862,14 @@ public interface AndroidPackage {
    /**
     * @see R.styleable#AndroidManifestUsesSdkLibrary_certDigest
     */
    @Immutable.Ignore
    @Nullable
    String[][] getUsesSdkLibrariesCertDigests();

    /**
     * @see R.styleable#AndroidManifestUsesSdkLibrary_versionMajor
     */
    @Immutable.Ignore
    @Nullable
    long[] getUsesSdkLibrariesVersionsMajor();

@@ -852,12 +884,14 @@ public interface AndroidPackage {
    /**
     * @see R.styleable#AndroidManifestUsesStaticLibrary_certDigest
     */
    @Immutable.Ignore
    @Nullable
    String[][] getUsesStaticLibrariesCertDigests();

    /**
     * @see R.styleable#AndroidManifestUsesStaticLibrary_version
     */
    @Immutable.Ignore
    @Nullable
    long[] getUsesStaticLibrariesVersions();

+10 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.SharedLibraryInfo;
import android.content.pm.SigningInfo;
import android.processor.immutability.Immutable;
import android.util.SparseArray;

import com.android.server.pm.PackageSetting;
@@ -55,6 +56,7 @@ import java.util.Set;
 * @hide
 */
//@SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
@Immutable
public interface PackageState {

    /**
@@ -109,6 +111,7 @@ public interface PackageState {
     * Keys are indexes into the array represented by {@link PackageManager.NotifyReason}, values
     * are in epoch milliseconds.
     */
    @Immutable.Ignore
    @Size(PackageManager.NOTIFY_PACKAGE_USE_REASONS_COUNT)
    @NonNull
    long[] getLastPackageUsageTime();
@@ -172,9 +175,11 @@ public interface PackageState {
     */
    int getSharedUserAppId();

    @Immutable.Ignore
    @NonNull
    SigningInfo getSigningInfo();

    @Immutable.Ignore
    @NonNull
    SparseArray<? extends PackageUserState> getUserStates();

@@ -199,30 +204,35 @@ public interface PackageState {
    /**
     * @see R.styleable#AndroidManifestUsesLibrary
     */
    @Immutable.Ignore
    @NonNull
    List<SharedLibraryInfo> getUsesLibraryInfos();

    /**
     * @see R.styleable#AndroidManifestUsesSdkLibrary
     */
    @Immutable.Ignore
    @NonNull
    String[] getUsesSdkLibraries();

    /**
     * @see R.styleable#AndroidManifestUsesSdkLibrary_versionMajor
     */
    @Immutable.Ignore
    @NonNull
    long[] getUsesSdkLibrariesVersionsMajor();

    /**
     * @see R.styleable#AndroidManifestUsesStaticLibrary
     */
    @Immutable.Ignore
    @NonNull
    String[] getUsesStaticLibraries();

    /**
     * @see R.styleable#AndroidManifestUsesStaticLibrary_version
     */
    @Immutable.Ignore
    @NonNull
    long[] getUsesStaticLibrariesVersions();

+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.annotation.Nullable;
import android.content.pm.PackageManager;
import android.content.pm.overlay.OverlayPaths;
import android.os.UserHandle;
import android.processor.immutability.Immutable;
import android.util.ArraySet;

import java.util.Map;
@@ -35,6 +36,7 @@ import java.util.Map;
 */
// TODO(b/173807334): Expose API
//@SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
@Immutable.Ignore(reason = "Exposed through PackageState pending refactor")
public interface PackageUserState {

    /** @hide */
+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.pm.PathPermission;
import android.os.PatternMatcher;
import android.processor.immutability.Immutable;

import java.util.List;

@@ -34,12 +35,14 @@ public interface ParsedProvider extends ParsedMainComponent {

    boolean isMultiProcess();

    @Immutable.Ignore
    @NonNull
    List<PathPermission> getPathPermissions();

    @Nullable
    String getReadPermission();

    @Immutable.Ignore
    @NonNull
    List<PatternMatcher> getUriPermissionPatterns();

Loading