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

Commit 76d3db4c authored by Anton Hansson's avatar Anton Hansson
Browse files

Compose the main stubs jars from module stubs

This adds stub generation for the non-updatable part of the platform,
and changes the full stub jars to be a combination of multiple jars:
the stubs of the updatable modules and the stubs of the remaining part
of the platform.

Composing the stub jars like this allows overriding the individual parts
with prebuilts rather than building everything from source. This makes
the build safer, as we can make sure that the stub of the apex that is
used is also what is used to build the rest of the platform against.

The monolithic droidstubs rules remain for now, as it has other
functions than generating stub sources (api lint, current.txt,
checklast). It remains a goal to get rid of this, but by submitting this
CL first it can be done in steps.

Bug: 144149403
Test: m android{,_system}_{monolith,merged}_stubs_current
Test: m
Change-Id: I255486112c03f237aa342cfb93f3b473a2f50470
parent c79472e2
Loading
Loading
Loading
Loading
+115 −3
Original line number Original line Diff line number Diff line
@@ -84,7 +84,7 @@ stubs_defaults {
    // finalized stub library to resolve them. If a new class gets added,
    // finalized stub library to resolve them. If a new class gets added,
    // this may be need to be revisited to use a manually maintained stub
    // this may be need to be revisited to use a manually maintained stub
    // library with empty classes in order to resolve those references.
    // library with empty classes in order to resolve those references.
    libs: ["sdk_system_29_android"],
    libs: ["sdk_system_30_android"],
    aidl: {
    aidl: {
        local_include_dirs: ["apex/media/aidl/stable"],
        local_include_dirs: ["apex/media/aidl/stable"],
    },
    },
@@ -129,6 +129,23 @@ droidstubs {
    jdiff_enabled: true,
    jdiff_enabled: true,
}
}


droidstubs {
    name: "api-stubs-docs-non-updatable",
    defaults: ["metalava-non-updatable-api-stubs-default"],
    arg_files: ["core/res/AndroidManifest.xml"],
    args: metalava_framework_docs_args,
    check_api: {
        current: {
            api_file: "non-updatable-api/current.txt",
            removed_api_file: "non-updatable-api/removed.txt",
        },
        api_lint: {
            enabled: true,
            new_since: ":android-non-updatable.api.public.latest",
        },
    },
}

priv_apps = " " +
priv_apps = " " +
    "--show-annotation android.annotation.SystemApi\\(" +
    "--show-annotation android.annotation.SystemApi\\(" +
        "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
        "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
@@ -171,6 +188,24 @@ droidstubs {
    jdiff_enabled: true,
    jdiff_enabled: true,
}
}


droidstubs {
    name: "system-api-stubs-docs-non-updatable",
    defaults: ["metalava-non-updatable-api-stubs-default"],
    arg_files: ["core/res/AndroidManifest.xml"],
    args: metalava_framework_docs_args + priv_apps,
    check_api: {
        current: {
            api_file: "non-updatable-api/system-current.txt",
            removed_api_file: "non-updatable-api/system-removed.txt",
        },
        api_lint: {
            enabled: true,
            new_since: ":android-non-updatable.api.system.latest",
            baseline_file: "non-updatable-api/system-lint-baseline.txt",
        },
    },
}

droidstubs {
droidstubs {
    name: "test-api-stubs-docs",
    name: "test-api-stubs-docs",
    defaults: ["metalava-full-api-stubs-default"],
    defaults: ["metalava-full-api-stubs-default"],
@@ -238,6 +273,22 @@ droidstubs {
    },
    },
}
}


droidstubs {
    name: "module-lib-api-stubs-docs-non-updatable",
    defaults: ["metalava-non-updatable-api-stubs-default"],
    arg_files: ["core/res/AndroidManifest.xml"],
    args: metalava_framework_docs_args + module_libs,
    check_api: {
        current: {
            api_file: "non-updatable-api/module-lib-current.txt",
            removed_api_file: "non-updatable-api/module-lib-removed.txt",
        },
        api_lint: {
            enabled: true,
            new_since: ":android-non-updatable.api.module-lib.latest",
        },
    },
}


// The following droidstub module generates source files for the API stub library for
// The following droidstub module generates source files for the API stub library for
// modules. Note that it not only includes its own APIs but also other APIs that have
// modules. Note that it not only includes its own APIs but also other APIs that have
@@ -276,17 +327,64 @@ java_defaults {
}
}


java_library_static {
java_library_static {
    name: "android_stubs_current",
    name: "android_monolith_stubs_current",
    srcs: [ ":api-stubs-docs" ],
    srcs: [ ":api-stubs-docs" ],
    defaults: ["android_defaults_stubs_current"],
    defaults: ["android_defaults_stubs_current"],
}
}


java_library_static {
java_library_static {
    name: "android_system_stubs_current",
    name: "android_merged_stubs_current",
    srcs: [ ":api-stubs-docs-non-updatable" ],
    static_libs: [
        "conscrypt.module.public.api.stubs",
        "framework-graphics-stubs-publicapi",
        "framework-media-stubs-publicapi",
        "framework-mediaprovider-stubs-publicapi",
        "framework-permission-stubs-publicapi",
        "framework-sdkextensions-stubs-publicapi",
        "framework-statsd-stubs-publicapi",
        "framework-tethering-stubs-publicapi",
        "framework-wifi-stubs-publicapi",
    ],
    defaults: ["android_defaults_stubs_current"],
}

java_library_static {
    name: "android_stubs_current",
    static_libs: ["android_merged_stubs_current"],
    defaults: ["android_defaults_stubs_current"],
}

java_library_static {
    name: "android_system_monolith_stubs_current",
    srcs: [ ":system-api-stubs-docs" ],
    srcs: [ ":system-api-stubs-docs" ],
    defaults: ["android_defaults_stubs_current"],
    defaults: ["android_defaults_stubs_current"],
}
}


java_library_static {
    name: "android_system_merged_stubs_current",
    srcs: [ ":system-api-stubs-docs-non-updatable" ],
    static_libs: [
        "conscrypt.module.public.api.stubs",
        "framework-appsearch-stubs", // TODO: standardize appsearch stubs
        "framework-graphics-stubs-systemapi",
        "framework-media-stubs-systemapi",
        "framework-mediaprovider-stubs-systemapi",
        "framework-permission-stubs-systemapi",
        "framework-sdkextensions-stubs-systemapi",
        "framework-statsd-stubs-systemapi",
        "framework-tethering-stubs-systemapi",
        "framework-wifi-stubs-systemapi",
    ],
    defaults: ["android_defaults_stubs_current"],
}

java_library_static {
    name: "android_system_stubs_current",
    static_libs: ["android_system_merged_stubs_current"],
    defaults: ["android_defaults_stubs_current"],
}

java_library_static {
java_library_static {
    name: "android_test_stubs_current",
    name: "android_test_stubs_current",
    srcs: [ ":test-api-stubs-docs" ],
    srcs: [ ":test-api-stubs-docs" ],
@@ -300,6 +398,20 @@ java_library_static {
    libs: ["sdk_system_29_android"],
    libs: ["sdk_system_29_android"],
}
}


java_library_static {
    name: "android_non_updatable_stubs_current",
    srcs: [":api-stubs-docs-non-updatable"],
    defaults: ["android_defaults_stubs_current"],
    libs: ["sdk_system_29_android"],
}

java_library_static {
    name: "android_system_non_updatable_stubs_current",
    srcs: [":system-api-stubs-docs-non-updatable"],
    defaults: ["android_defaults_stubs_current"],
    libs: ["sdk_system_29_android"],
}

/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
// hwbinder.stubs provides APIs required for building HIDL Java
// hwbinder.stubs provides APIs required for building HIDL Java
// libraries.
// libraries.
+80506 −0

File added.

Preview size limit exceeded, changes collapsed.

+67 −0
Original line number Original line Diff line number Diff line
// Signature format: 2.0
package android.annotation {

  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.FIELD}) public @interface NonNull {
  }

  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.FIELD}) public @interface Nullable {
  }

}

package android.content.rollback {

  public class RollbackManagerFrameworkInitializer {
    method public static void initialize();
  }

}

package android.graphics {

  public final class Compatibility {
    method public static void setTargetSdkVersion(int);
  }

  public final class ImageDecoder implements java.lang.AutoCloseable {
    method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(@NonNull android.content.ContentResolver, @NonNull android.net.Uri, @Nullable android.content.res.Resources);
  }

}

package android.os {

  public class StatsServiceManager {
    method @NonNull public android.os.StatsServiceManager.ServiceRegisterer getStatsCompanionServiceRegisterer();
    method @NonNull public android.os.StatsServiceManager.ServiceRegisterer getStatsManagerServiceRegisterer();
    method @NonNull public android.os.StatsServiceManager.ServiceRegisterer getStatsdServiceRegisterer();
  }

  public static class StatsServiceManager.ServiceNotFoundException extends java.lang.Exception {
    ctor public StatsServiceManager.ServiceNotFoundException(@NonNull String);
  }

  public static final class StatsServiceManager.ServiceRegisterer {
    method @Nullable public android.os.IBinder get();
    method @Nullable public android.os.IBinder getOrThrow() throws android.os.StatsServiceManager.ServiceNotFoundException;
  }

}

package android.util {

  public class AtomicFile {
    ctor public AtomicFile(@NonNull java.io.File, @Nullable android.util.SystemConfigFileCommitEventLogger);
  }

  public final class Log {
    method public static int logToRadioBuffer(int, @Nullable String, @Nullable String);
  }

  public class SystemConfigFileCommitEventLogger {
    ctor public SystemConfigFileCommitEventLogger(@NonNull String);
    method public void setStartTime(long);
  }

}
+1 −0
Original line number Original line Diff line number Diff line
// Signature format: 2.0
+588 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading