From 5ab650800820efec13d2e36d0ae25a4e4240ac00 Mon Sep 17 00:00:00 2001 From: Jaewoong Jung Date: Fri, 2 Apr 2021 00:16:54 +0000 Subject: [PATCH] Revert "Add min_sdk_version to java_import." This reverts commit 6d15d635569d420035e924c12a08091f0e9c579d. Reason for revert: Broke git_sc-mainline-prod on test_suites_x86_64 Fixes: 184305592 Change-Id: I4b2e2675e0dd9e2e84966f545a52f45d5b731bab --- android/apex.go | 118 +++++++++++++++++++++------------------------- apex/apex_test.go | 36 +------------- java/java.go | 24 +--------- 3 files changed, 56 insertions(+), 122 deletions(-) diff --git a/android/apex.go b/android/apex.go index 01ac9b3f8..257bdad03 100644 --- a/android/apex.go +++ b/android/apex.go @@ -803,70 +803,60 @@ var minSdkVersionAllowlist = func(apiMap map[string]int) map[string]ApiLevel { } return list }(map[string]int{ - "adbd": 30, - "android.net.ipsec.ike": 30, - "androidx.annotation_annotation-nodeps": 29, - "androidx.arch.core_core-common-nodeps": 29, - "androidx.collection_collection-nodeps": 29, - "androidx.collection_collection-ktx-nodeps": 30, - "androidx.lifecycle_lifecycle-common-java8-nodeps": 30, - "androidx.lifecycle_lifecycle-common-nodeps": 29, - "androidx-constraintlayout_constraintlayout-solver-nodeps": 29, - "apache-commons-compress": 29, - "bouncycastle_ike_digests": 30, - "brotli-java": 29, - "captiveportal-lib": 28, - "error_prone_annotations": 30, - "flatbuffer_headers": 30, - "framework-permission": 30, - "gemmlowp_headers": 30, - "ike-internals": 30, - "kotlinx-coroutines-android": 28, - "kotlinx-coroutines-android-nodeps": 30, - "kotlinx-coroutines-core": 28, - "kotlinx-coroutines-core-nodeps": 30, - "libadb_crypto": 30, - "libadb_pairing_auth": 30, - "libadb_pairing_connection": 30, - "libadb_pairing_server": 30, - "libadb_protos": 30, - "libadb_tls_connection": 30, - "libadbconnection_client": 30, - "libadbconnection_server": 30, - "libadbd_core": 30, - "libadbd_services": 30, - "libadbd": 30, - "libapp_processes_protos_lite": 30, - "libasyncio": 30, - "libbrotli": 30, - "libbuildversion": 30, - "libcrypto_static": 30, - "libcrypto_utils": 30, - "libdiagnose_usb": 30, - "libeigen": 30, - "liblz4": 30, - "libmdnssd": 30, - "libneuralnetworks_common": 30, - "libneuralnetworks_headers": 30, - "libneuralnetworks": 30, - "libprocpartition": 30, - "libprotobuf-java-lite": 30, - "libprotoutil": 30, - "libqemu_pipe": 30, - "libsync": 30, - "libtextclassifier_hash_headers": 30, - "libtextclassifier_hash_static": 30, - "libtflite_kernel_utils": 30, - "libwatchdog": 29, - "libzstd": 30, - "metrics-constants-protos": 28, - "net-utils-framework-common": 29, - "permissioncontroller-statsd": 28, - "philox_random_headers": 30, - "philox_random": 30, - "service-permission": 30, - "tensorflow_headers": 30, - "xz-java": 29, + "adbd": 30, + "android.net.ipsec.ike": 30, + "apache-commons-compress": 29, + "bouncycastle_ike_digests": 30, + "brotli-java": 29, + "captiveportal-lib": 28, + "flatbuffer_headers": 30, + "framework-permission": 30, + "gemmlowp_headers": 30, + "ike-internals": 30, + "kotlinx-coroutines-android": 28, + "kotlinx-coroutines-core": 28, + "libadb_crypto": 30, + "libadb_pairing_auth": 30, + "libadb_pairing_connection": 30, + "libadb_pairing_server": 30, + "libadb_protos": 30, + "libadb_tls_connection": 30, + "libadbconnection_client": 30, + "libadbconnection_server": 30, + "libadbd_core": 30, + "libadbd_services": 30, + "libadbd": 30, + "libapp_processes_protos_lite": 30, + "libasyncio": 30, + "libbrotli": 30, + "libbuildversion": 30, + "libcrypto_static": 30, + "libcrypto_utils": 30, + "libdiagnose_usb": 30, + "libeigen": 30, + "liblz4": 30, + "libmdnssd": 30, + "libneuralnetworks_common": 30, + "libneuralnetworks_headers": 30, + "libneuralnetworks": 30, + "libprocpartition": 30, + "libprotobuf-java-lite": 30, + "libprotoutil": 30, + "libqemu_pipe": 30, + "libsync": 30, + "libtextclassifier_hash_headers": 30, + "libtextclassifier_hash_static": 30, + "libtflite_kernel_utils": 30, + "libwatchdog": 29, + "libzstd": 30, + "metrics-constants-protos": 28, + "net-utils-framework-common": 29, + "permissioncontroller-statsd": 28, + "philox_random_headers": 30, + "philox_random": 30, + "service-permission": 30, + "tensorflow_headers": 30, + "xz-java": 29, }) // Function called while walking an APEX's payload dependencies. diff --git a/apex/apex_test.go b/apex/apex_test.go index a220a063c..407faa1a8 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -1808,30 +1808,6 @@ func TestApexMinSdkVersion_ErrorIfIncompatibleVersion(t *testing.T) { min_sdk_version: "30", } `) - - testApexError(t, `module "libfoo".*: should support min_sdk_version\(29\)`, ` - apex { - name: "myapex", - key: "myapex.key", - java_libs: ["libfoo"], - min_sdk_version: "29", - } - - apex_key { - name: "myapex.key", - public_key: "testkey.avbpubkey", - private_key: "testkey.pem", - } - - java_import { - name: "libfoo", - jars: ["libfoo.jar"], - apex_available: [ - "myapex", - ], - min_sdk_version: "30", - } - `) } func TestApexMinSdkVersion_Okay(t *testing.T) { @@ -1869,10 +1845,7 @@ func TestApexMinSdkVersion_Okay(t *testing.T) { name: "libbar", sdk_version: "current", srcs: ["a.java"], - static_libs: [ - "libbar_dep", - "libbar_import_dep", - ], + static_libs: ["libbar_dep"], apex_available: ["myapex"], min_sdk_version: "29", } @@ -1884,13 +1857,6 @@ func TestApexMinSdkVersion_Okay(t *testing.T) { apex_available: ["myapex"], min_sdk_version: "29", } - - java_import { - name: "libbar_import_dep", - jars: ["libbar.jar"], - apex_available: ["myapex"], - min_sdk_version: "29", - } `) } diff --git a/java/java.go b/java/java.go index a7fbed2cb..9786947f7 100644 --- a/java/java.go +++ b/java/java.go @@ -1074,14 +1074,8 @@ func BinaryHostFactory() android.Module { type ImportProperties struct { Jars []string `android:"path,arch_variant"` - // The version of the SDK that the source prebuilt file was built against. Defaults to the - // current version if not specified. Sdk_version *string - // The minimum version of the SDK that this module supports. Defaults to sdk_version if not - // specified. - Min_sdk_version *string - Installable *bool // List of shared java libs that this module has dependencies to @@ -1145,9 +1139,6 @@ func (j *Import) systemModules() string { } func (j *Import) minSdkVersion() sdkSpec { - if j.properties.Min_sdk_version != nil { - return sdkSpecFrom(*j.properties.Min_sdk_version) - } return j.sdkVersion() } @@ -1359,20 +1350,7 @@ func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Modu // Implements android.ApexModule func (j *Import) ShouldSupportSdkVersion(ctx android.BaseModuleContext, sdkVersion android.ApiLevel) error { - sdkSpec := j.minSdkVersion() - if !sdkSpec.specified() { - return fmt.Errorf("min_sdk_version is not specified") - } - if sdkSpec.kind == sdkCore { - return nil - } - ver, err := sdkSpec.effectiveVersion(ctx) - if err != nil { - return err - } - if ver.ApiLevel(ctx).GreaterThan(sdkVersion) { - return fmt.Errorf("newer SDK(%v)", ver) - } + // Do not check for prebuilts against the min_sdk_version of enclosing APEX return nil }