summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/Android.bp94
-rw-r--r--api/ApiDocs.bp34
-rw-r--r--api/StubLibraries.bp157
-rw-r--r--api/api.go24
-rw-r--r--api/api_test.go2
5 files changed, 214 insertions, 97 deletions
diff --git a/api/Android.bp b/api/Android.bp
index 533f9f66434b..c7c56861894d 100644
--- a/api/Android.bp
+++ b/api/Android.bp
@@ -73,6 +73,7 @@ combined_apis {
"framework-bluetooth",
"framework-configinfrastructure",
"framework-connectivity",
+ "framework-connectivity-b",
"framework-connectivity-t",
"framework-devicelock",
"framework-graphics",
@@ -102,6 +103,11 @@ combined_apis {
"framework-crashrecovery",
],
default: [],
+ }) + select(release_flag("RELEASE_RANGING_STACK"), {
+ true: [
+ "framework-ranging",
+ ],
+ default: [],
}),
system_server_classpath: [
"service-art",
@@ -119,27 +125,54 @@ combined_apis {
}),
}
-genrule {
+// Create a single file containing the latest released version of the whole
+// Android public API.
+java_genrule {
+ name: "android.api.merged.public.latest",
+ srcs: [
+ ":android.api.combined.public.latest",
+ ],
+ out: ["public-latest.txt"],
+ tools: ["metalava"],
+ cmd: metalava_cmd + " merge-signatures --format=2.0 $(in) --out $(out)",
+}
+
+// Make sure that the Android public API is compatible with the
+// previously released public API.
+java_genrule {
name: "frameworks-base-api-current-compat",
srcs: [
- ":android.api.public.latest",
+ ":android.api.merged.public.latest",
":android-incompatibilities.api.public.latest",
":frameworks-base-api-current.txt",
],
out: ["updated-baseline.txt"],
tools: ["metalava"],
cmd: metalava_cmd +
- "--check-compatibility:api:released $(location :android.api.public.latest) " +
+ "--check-compatibility:api:released $(location :android.api.merged.public.latest) " +
"--baseline:compatibility:released $(location :android-incompatibilities.api.public.latest) " +
"--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " +
"$(location :frameworks-base-api-current.txt)",
}
-genrule {
+// Create a single file containing the latest released version of the whole
+// Android system API.
+java_genrule {
+ name: "android.api.merged.system.latest",
+ srcs: [
+ ":android.api.combined.system.latest",
+ ],
+ out: ["system-latest.txt"],
+ tools: ["metalava"],
+ cmd: metalava_cmd + " merge-signatures --format=2.0 $(in) --out $(out)",
+}
+
+// Make sure that the Android system API is compatible with the
+// previously released system API.
+java_genrule {
name: "frameworks-base-api-system-current-compat",
srcs: [
- ":android.api.public.latest",
- ":android.api.system.latest",
+ ":android.api.merged.system.latest",
":android-incompatibilities.api.system.latest",
":frameworks-base-api-current.txt",
":frameworks-base-api-system-current.txt",
@@ -147,20 +180,31 @@ genrule {
out: ["updated-baseline.txt"],
tools: ["metalava"],
cmd: metalava_cmd +
- "--check-compatibility:api:released $(location :android.api.public.latest) " +
- "--check-compatibility:api:released $(location :android.api.system.latest) " +
+ "--check-compatibility:api:released $(location :android.api.merged.system.latest) " +
"--baseline:compatibility:released $(location :android-incompatibilities.api.system.latest) " +
"--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " +
"$(location :frameworks-base-api-current.txt) " +
"$(location :frameworks-base-api-system-current.txt)",
}
-genrule {
+// Create a single file containing the latest released version of the whole
+// Android module-lib API.
+java_genrule {
+ name: "android.api.merged.module-lib.latest",
+ srcs: [
+ ":android.api.combined.module-lib.latest",
+ ],
+ out: ["module-lib-latest.txt"],
+ tools: ["metalava"],
+ cmd: metalava_cmd + " merge-signatures --format=2.0 $(in) --out $(out)",
+}
+
+// Make sure that the Android module-lib API is compatible with the
+// previously released module-lib API.
+java_genrule {
name: "frameworks-base-api-module-lib-current-compat",
srcs: [
- ":android.api.public.latest",
- ":android.api.system.latest",
- ":android.api.module-lib.latest",
+ ":android.api.merged.module-lib.latest",
":android-incompatibilities.api.module-lib.latest",
":frameworks-base-api-current.txt",
":frameworks-base-api-system-current.txt",
@@ -169,9 +213,7 @@ genrule {
out: ["updated-baseline.txt"],
tools: ["metalava"],
cmd: metalava_cmd +
- "--check-compatibility:api:released $(location :android.api.public.latest) " +
- "--check-compatibility:api:released $(location :android.api.system.latest) " +
- "--check-compatibility:api:released $(location :android.api.module-lib.latest) " +
+ "--check-compatibility:api:released $(location :android.api.merged.module-lib.latest) " +
"--baseline:compatibility:released $(location :android-incompatibilities.api.module-lib.latest) " +
"--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " +
"$(location :frameworks-base-api-current.txt) " +
@@ -179,14 +221,14 @@ genrule {
"$(location :frameworks-base-api-module-lib-current.txt)",
}
-genrule {
+java_genrule {
name: "frameworks-base-api-current.srcjar",
tools: ["merge_zips"],
out: ["current.srcjar"],
cmd: "$(location merge_zips) $(out) $(in)",
srcs: [
":api-stubs-docs-non-updatable{.exportable}",
- ":all-modules-public-stubs-source",
+ ":all-modules-public-stubs-source-exportable",
],
visibility: ["//visibility:private"], // Used by make module in //development, mind
}
@@ -204,7 +246,7 @@ genrule_defaults {
"$(location soong_zip) -o $(out) -C $(genDir)/out -D $(genDir)/out",
}
-genrule {
+java_genrule {
name: "sdk-annotations.zip",
defaults: ["sdk-annotations-defaults"],
srcs: [
@@ -213,7 +255,7 @@ genrule {
],
}
-genrule {
+java_genrule {
name: "sdk-annotations-system.zip",
defaults: ["sdk-annotations-defaults"],
srcs: [
@@ -222,7 +264,7 @@ genrule {
],
}
-genrule {
+java_genrule {
name: "sdk-annotations-module-lib.zip",
defaults: ["sdk-annotations-defaults"],
srcs: [
@@ -231,7 +273,7 @@ genrule {
],
}
-genrule {
+java_genrule {
name: "sdk-annotations-system-server.zip",
defaults: ["sdk-annotations-defaults"],
srcs: [
@@ -240,7 +282,7 @@ genrule {
],
}
-genrule {
+java_genrule {
name: "combined-removed-dex",
visibility: [
"//frameworks/base/boot",
@@ -455,7 +497,7 @@ genrule_defaults {
tools: ["extract-flagged-apis"],
}
-genrule {
+java_genrule {
name: "flag-api-mapping-PublicApi",
defaults: ["flag-api-mapping-generation-defaults"],
srcs: [":frameworks-base-api-current.txt"],
@@ -465,7 +507,7 @@ genrule {
},
}
-genrule {
+java_genrule {
name: "flag-api-mapping-SystemApi",
defaults: ["flag-api-mapping-generation-defaults"],
srcs: [":frameworks-base-api-system-current.txt"],
@@ -475,7 +517,7 @@ genrule {
},
}
-genrule {
+java_genrule {
name: "flag-api-mapping-ModuleLibApi",
defaults: ["flag-api-mapping-generation-defaults"],
srcs: [":frameworks-base-api-module-lib-current.txt"],
@@ -485,7 +527,7 @@ genrule {
},
}
-genrule {
+java_genrule {
name: "flag-api-mapping-SystemServerApi",
defaults: ["flag-api-mapping-generation-defaults"],
srcs: [":frameworks-base-api-system-server-current.txt"],
diff --git a/api/ApiDocs.bp b/api/ApiDocs.bp
index e8fcf4b2b32d..796c8412b26c 100644
--- a/api/ApiDocs.bp
+++ b/api/ApiDocs.bp
@@ -129,7 +129,11 @@ droidstubs {
droidstubs {
name: "framework-doc-stubs",
defaults: ["android-non-updatable-doc-stubs-defaults"],
- srcs: [":all-modules-public-stubs-source"],
+ flags: [
+ // Ignore any compatibility errors, see check_api.last_released below for more information.
+ "--hide-category Compatibility",
+ ],
+ srcs: [":all-modules-public-stubs-source-exportable"],
api_levels_module: "api_versions_public",
aidl: {
include_dirs: [
@@ -137,13 +141,39 @@ droidstubs {
"packages/modules/Media/apex/aidl/stable",
],
},
+
+ // Pass the previously released API to support reverting flagged APIs. Without this, reverting
+ // a flagged API will cause it to be removed, even if it had previously been released. This
+ // has the side effect of causing compatibility issues to be reported but they are already
+ // checked elsewhere so they will be ignored, see `--hide-category Compatibility` above.
+ check_api: {
+ last_released: {
+ api_file: ":android.api.combined.public.latest",
+ removed_api_file: ":android-removed.api.combined.public.latest",
+ },
+ },
}
droidstubs {
name: "framework-doc-system-stubs",
defaults: ["framework-doc-stubs-sources-default"],
- flags: ["--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)"],
+ flags: [
+ "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)",
+ // Ignore any compatibility errors, see check_api.last_released below for more information.
+ "--hide-category Compatibility",
+ ],
api_levels_module: "api_versions_system",
+
+ // Pass the previously released API to support reverting flagged APIs. Without this, reverting
+ // a flagged API will cause it to be removed, even if it had previously been released. This
+ // has the side effect of causing compatibility issues to be reported but they are already
+ // checked elsewhere so they will be ignored, see `--hide-category Compatibility` above.
+ check_api: {
+ last_released: {
+ api_file: ":android.api.combined.system.latest",
+ removed_api_file: ":android-removed.api.combined.system.latest",
+ },
+ },
}
/////////////////////////////////////////////////////////////////////
diff --git a/api/StubLibraries.bp b/api/StubLibraries.bp
index b3a674fbd70e..3314b4aa0d71 100644
--- a/api/StubLibraries.bp
+++ b/api/StubLibraries.bp
@@ -364,19 +364,14 @@ java_defaults {
java_library {
name: "android-non-updatable.stubs",
defaults: ["android-non-updatable_defaults"],
- static_libs: [
- "android-non-updatable.stubs.from-source",
- ],
- product_variables: {
- build_from_text_stub: {
- static_libs: [
- "android-non-updatable.stubs.from-text",
- ],
- exclude_static_libs: [
- "android-non-updatable.stubs.from-source",
- ],
- },
- },
+ static_libs: select(product_variable("build_from_text_stub"), {
+ true: [
+ "android-non-updatable.stubs.from-text",
+ ],
+ default: [
+ "android-non-updatable.stubs.from-source",
+ ],
+ }),
}
java_library {
@@ -390,19 +385,14 @@ java_library {
java_library {
name: "android-non-updatable.stubs.system",
defaults: ["android-non-updatable_defaults"],
- static_libs: [
- "android-non-updatable.stubs.system.from-source",
- ],
- product_variables: {
- build_from_text_stub: {
- static_libs: [
- "android-non-updatable.stubs.system.from-text",
- ],
- exclude_static_libs: [
- "android-non-updatable.stubs.system.from-source",
- ],
- },
- },
+ static_libs: select(product_variable("build_from_text_stub"), {
+ true: [
+ "android-non-updatable.stubs.system.from-text",
+ ],
+ default: [
+ "android-non-updatable.stubs.system.from-source",
+ ],
+ }),
}
java_library {
@@ -416,19 +406,14 @@ java_library {
java_library {
name: "android-non-updatable.stubs.module_lib",
defaults: ["android-non-updatable_defaults"],
- static_libs: [
- "android-non-updatable.stubs.module_lib.from-source",
- ],
- product_variables: {
- build_from_text_stub: {
- static_libs: [
- "android-non-updatable.stubs.module_lib.from-text",
- ],
- exclude_static_libs: [
- "android-non-updatable.stubs.module_lib.from-source",
- ],
- },
- },
+ static_libs: select(product_variable("build_from_text_stub"), {
+ true: [
+ "android-non-updatable.stubs.module_lib.from-text",
+ ],
+ default: [
+ "android-non-updatable.stubs.module_lib.from-source",
+ ],
+ }),
}
java_library {
@@ -442,19 +427,14 @@ java_library {
java_library {
name: "android-non-updatable.stubs.test",
defaults: ["android-non-updatable_defaults"],
- static_libs: [
- "android-non-updatable.stubs.test.from-source",
- ],
- product_variables: {
- build_from_text_stub: {
- static_libs: [
- "android-non-updatable.stubs.test.from-text",
- ],
- exclude_static_libs: [
- "android-non-updatable.stubs.test.from-source",
- ],
- },
- },
+ static_libs: select(product_variable("build_from_text_stub"), {
+ true: [
+ "android-non-updatable.stubs.test.from-text",
+ ],
+ default: [
+ "android-non-updatable.stubs.test.from-source",
+ ],
+ }),
}
java_library {
@@ -466,6 +446,27 @@ java_library {
}
java_library {
+ name: "android-non-updatable.stubs.system_server",
+ defaults: ["android-non-updatable_defaults"],
+ static_libs: select(product_variable("build_from_text_stub"), {
+ true: [
+ "android-non-updatable.stubs.system_server.from-text",
+ ],
+ default: [
+ "android-non-updatable.stubs.system_server.from-source",
+ ],
+ }),
+}
+
+java_library {
+ name: "android-non-updatable.stubs.exportable.system_server",
+ defaults: ["android-non-updatable_defaults"],
+ static_libs: [
+ "android-non-updatable.stubs.exportable.system_server.from-source",
+ ],
+}
+
+java_library {
name: "android-non-updatable.stubs.from-source",
defaults: [
"android-non-updatable_defaults",
@@ -561,6 +562,30 @@ java_library {
},
}
+java_library {
+ name: "android-non-updatable.stubs.system_server.from-source",
+ defaults: [
+ "android-non-updatable_defaults",
+ "android-non-updatable_from_source_defaults",
+ ],
+ srcs: [":services-non-updatable-stubs"],
+ libs: non_updatable_api_deps_on_modules,
+}
+
+java_library {
+ name: "android-non-updatable.stubs.exportable.system_server.from-source",
+ defaults: [
+ "android-non-updatable_defaults",
+ "android-non-updatable_from_source_defaults",
+ "android-non-updatable_exportable_from_source_defaults",
+ ],
+ srcs: [":services-non-updatable-stubs{.exportable}"],
+ libs: non_updatable_api_deps_on_modules,
+ dist: {
+ dir: "apistubs/android/system-server",
+ },
+}
+
java_defaults {
name: "android-non-updatable_from_text_defaults",
defaults: ["android-non-updatable-stubs-libs-defaults"],
@@ -623,7 +648,7 @@ java_api_library {
java_api_library {
name: "android-non-updatable.stubs.module_lib.from-text",
- api_surface: "module_lib",
+ api_surface: "module-lib",
api_contributions: [
"api-stubs-docs-non-updatable.api.contribution",
"system-api-stubs-docs-non-updatable.api.contribution",
@@ -643,7 +668,7 @@ java_api_library {
// generated from this module, as this module is strictly used for hiddenapi only.
java_api_library {
name: "android-non-updatable.stubs.test_module_lib",
- api_surface: "module_lib",
+ api_surface: "module-lib",
api_contributions: [
"api-stubs-docs-non-updatable.api.contribution",
"system-api-stubs-docs-non-updatable.api.contribution",
@@ -662,6 +687,25 @@ java_api_library {
libs: ["all-modules-system-stubs"],
}
+java_api_library {
+ name: "android-non-updatable.stubs.system_server.from-text",
+ api_surface: "system-server",
+ api_contributions: [
+ "api-stubs-docs-non-updatable.api.contribution",
+ "system-api-stubs-docs-non-updatable.api.contribution",
+ "module-lib-api-stubs-docs-non-updatable.api.contribution",
+ "services-non-updatable-stubs.api.contribution",
+ ],
+ defaults: [
+ "module-classpath-java-defaults",
+ "android-non-updatable_everything_from_text_defaults",
+ ],
+
+ // Use full Android API not just the non-updatable API as the latter is incomplete
+ // and can result in incorrect behavior.
+ previous_api: ":android.api.combined.system-server.latest",
+}
+
java_defaults {
name: "android_stubs_dists_default",
dist: {
@@ -813,9 +857,9 @@ java_library {
defaults: [
"android.jar_defaults",
],
- srcs: [":services-non-updatable-stubs"],
installable: false,
static_libs: [
+ "android-non-updatable.stubs.system_server",
"android_module_lib_stubs_current",
],
visibility: ["//frameworks/base/services"],
@@ -827,9 +871,9 @@ java_library {
"android.jar_defaults",
"android_stubs_dists_default",
],
- srcs: [":services-non-updatable-stubs{.exportable}"],
installable: false,
static_libs: [
+ "android-non-updatable.stubs.exportable.system_server",
"android_module_lib_stubs_current_exportable",
],
dist: {
@@ -979,7 +1023,6 @@ stubs_defaults {
api_levels_annotations_enabled: true,
api_levels_annotations_dirs: [
"sdk-dir",
- "api-versions-jars-dir",
],
}
diff --git a/api/api.go b/api/api.go
index e9f1feebd899..da75e05673e2 100644
--- a/api/api.go
+++ b/api/api.go
@@ -20,7 +20,6 @@ import (
"github.com/google/blueprint/proptools"
"android/soong/android"
- "android/soong/genrule"
"android/soong/java"
)
@@ -103,8 +102,9 @@ func (a *CombinedApis) DepsMutator(ctx android.BottomUpMutatorContext) {
}
func (a *CombinedApis) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- ctx.WalkDeps(func(child, parent android.Module) bool {
- if _, ok := child.(java.AndroidLibraryDependency); ok && child.Name() != "framework-res" {
+ ctx.WalkDepsProxy(func(child, parent android.ModuleProxy) bool {
+ javaInfo, ok := android.OtherModuleProvider(ctx, child, java.JavaInfoProvider)
+ if ok && javaInfo.AndroidLibraryDependencyInfo != nil && child.Name() != "framework-res" {
// Stubs of BCP and SSCP libraries should not have any dependencies on apps
// This check ensures that we do not run into circular dependencies when UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true
ctx.ModuleErrorf(
@@ -138,9 +138,10 @@ type libraryProps struct {
}
type fgProps struct {
- Name *string
- Srcs proptools.Configurable[[]string]
- Visibility []string
+ Name *string
+ Srcs proptools.Configurable[[]string]
+ Device_common_srcs proptools.Configurable[[]string]
+ Visibility []string
}
type defaultsProps struct {
@@ -201,7 +202,7 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition, stubs
}
}
props.Visibility = []string{"//visibility:public"}
- ctx.CreateModule(genrule.GenRuleFactory, &props)
+ ctx.CreateModule(java.GenRuleFactory, &props)
}
func createMergedAnnotationsFilegroups(ctx android.LoadHookContext, modules, system_server_modules proptools.Configurable[[]string]) {
@@ -230,7 +231,7 @@ func createMergedAnnotationsFilegroups(ctx android.LoadHookContext, modules, sys
} {
props := fgProps{}
props.Name = proptools.StringPtr(i.name)
- props.Srcs = createSrcs(i.modules, i.tag)
+ props.Device_common_srcs = createSrcs(i.modules, i.tag)
ctx.CreateModule(android.FileGroupFactory, &props)
}
}
@@ -428,8 +429,9 @@ func createMergedFrameworkSystemServerExportableStubs(ctx android.LoadHookContex
func createPublicStubsSourceFilegroup(ctx android.LoadHookContext, modules proptools.Configurable[[]string]) {
props := fgProps{}
- props.Name = proptools.StringPtr("all-modules-public-stubs-source")
- props.Srcs = createSrcs(modules, "{.public.stubs.source}")
+ props.Name = proptools.StringPtr("all-modules-public-stubs-source-exportable")
+ transformConfigurableArray(modules, "", ".stubs.source")
+ props.Device_common_srcs = createSrcs(modules, "{.exportable}")
props.Visibility = []string{"//frameworks/base"}
ctx.CreateModule(android.FileGroupFactory, &props)
}
@@ -514,7 +516,7 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
func combinedApisModuleFactory() android.Module {
module := &CombinedApis{}
module.AddProperties(&module.properties)
- android.InitAndroidModule(module)
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
android.AddLoadHook(module, func(ctx android.LoadHookContext) { module.createInternalModules(ctx) })
return module
}
diff --git a/api/api_test.go b/api/api_test.go
index fb26f821eec1..166f053978f2 100644
--- a/api/api_test.go
+++ b/api/api_test.go
@@ -253,7 +253,7 @@ func TestCombinedApisDefaults(t *testing.T) {
`)
subModuleDependsOnSelectAppendedModule := java.CheckModuleHasDependency(t,
- result.TestContext, "foo-current.txt", "", "framework-foo")
+ result.TestContext, "foo-current.txt", "android_common", "framework-foo")
android.AssertBoolEquals(t, "Submodule expected to depend on the select-appended module",
true, subModuleDependsOnSelectAppendedModule)
}