Commit graph

12 commits

Author SHA1 Message Date
Jiyong Park
7a66924a60 Revert "Revert "Limit System SDK to 34 for Java modules in the v..."
Revert submission 2897568-revert-2894701-limit_systemsdk-WNEMOTGMRS

Reason for revert: Forward fix was merged

Reverted changes: /q/submissionid:2897568-revert-2894701-limit_systemsdk-WNEMOTGMRS

Change-Id: Ia103db05bfaebdfd301dbf84183a89d01f58eb67
2024-01-04 23:20:49 +00:00
Sebastian Pickl
78c6e1368b Revert "Limit System SDK to 34 for Java modules in the vendor pa..."
Revert submission 2894701-limit_systemsdk

Reason for revert: might be breaking builds at 318695834

Bug: 318695834

Reverted changes: /q/submissionid:2894701-limit_systemsdk

Change-Id: Idfaec65ddfbb0091672993d6c857a06e9cfdfb13
2024-01-04 19:28:02 +00:00
Sebastian Pickl
5ef2634d5a Revert "Add BUILD_BROKEN_DONT_CHECK_SYSTEMSDK"
Revert submission 2897682-dont_limit_systemsdk

Reason for revert: blocking revert for 318695834

Bug:318695834

Reverted changes: /q/submissionid:2897682-dont_limit_systemsdk

Change-Id: Ic4a63fe81434ddb9cb57519bd11c1924224111c6
2024-01-04 19:01:29 +00:00
Jiyong Park
7a0e042276 Add BUILD_BROKEN_DONT_CHECK_SYSTEMSDK
https://android-review.git.corp.google.com/q/topic:limit_systemsdk
introduced a new check for preventing the use of system SDKs above 34
from Java modules in the vendor partition.

As this may break some unprepared targets, introduce
BUILD_BROKEN_DONT_CHECK_SYSTEMSDK as a temporary escape hatch.

This flag will be deleted eventually.

Bug: 314011075
Test: Add BUILD_BROKEN_DONT_CHECK_SYSTEMSDK := true to BoardConfig.mk
Change-Id: Ie70ce428ec3df8580099efd99e5c7c9c4f9daecb
2024-01-04 23:48:27 +09:00
Jiyong Park
e3c278844d Limit System SDK to 34 for Java modules in the vendor partition
This change disallows Java modules in the vendor partition to use System
SDK that is newer than API level 34; 34 is the latest allowed.

Background 1: with Trunk Stable, the system/vendor interface is released
at Q2 whereas the system/app interface is released at Q3. In other
words, at Q2, the APIs which will be added to the system SDK at Q3 are
not available. Since the system/vendor interface (which is fronzen at
Q2) is what the modules in the vendor partition will be building
against, they can't and shouldn't use those new APIs that will be added
in the future (Q3). Using those APIs is risky because there's a chance
that those APIs get removed or changed between Q2 and Q3. For example,
2024 Q2 is technically still Android U, not Android V.

Background 2: The use of Java APIs in the vendor partition had many
issues. Most significantly, those "vendor" Java apps are categorized as
part of the system partition because all Java app processes require
access to platform internal libraries that are prohibited to vendor
processes. Furthermore, since the Project Treble, the vendor partition
was re-purposed to a partition to host SoC-dependent bits - usually
HALs. Implementing HALs in Java has never been officially supported and
has had many loop holes.

We'd like to use both background 1 and 2 as a chance to disallow any
Java code in the vendor partition. However, since there are already some
Java modules in the partition, we can't suddenly ban it. The deprecation
will be made gradually, and this CL is the start.

This CL implements the "Make" part of the restriction. The "Soong" part
will follow.

Note that LOCAL_SDK_VERSION := current or LOCAL_SDK_VERSION :=
system_current is automatically overridden into 34 or system_34. This is
to prevent sudden breakage of vendor modules that have been targetting
the latest (i.e. current) API level. They will however fail if they use
APIs newer than API level 34.

Bug: 314011075
Test: The following Android.mk module fails as expected.
some/Android.mk:

include $(CLEAR_VARS)
LOCAL_MODULE := example_module
LOCAL_VENDOR_MODULE := true
LOCAL_SDK_VERSION := system_35
LOCAL_SRC_FILES := Foo.java
include $(BUILD_JAVA_LIBRARY)

FAILED:
some/Android.mk: error: example_module: Incompatible
LOCAL_SDK_VERSION 'system_35'. System SDK version '35' is not supported.
Supported versions are: 28 29 30 31 32 33 34

Change-Id: I44c29c6dc45b91a9a30b8a21cd2baae685fa27fb
2024-01-03 16:35:08 +09:00
Jeongik Cha
07a44f48dc Exempt RRO from the restriction on API level
As auto generated RRO, an arbitrary RRO needs to be exempted as well.
It is okay because RRO packages can access only resource defined in
public.xml, when RRO packages want to refer other package's resource.

Bug: 152926556
Test: build RRO packages
Test: check if product/vendor app still can't use hidden APIs
Change-Id: I8dc2922af5eb5c87ccd97d1b8d080b3ed48cf9a6
2020-04-27 22:36:21 +09:00
Jeongik Cha
7452979a9e Enforce hidden apis usage in product(make)
Only if PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE is set,
every app and java library in product cannot use hidden APIs anymore.

Bug: 132780927
Test: m
Test: set PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE, and check whether build
error occurs.
Change-Id: Ib6c260a16b9cbb95be70d8db3082a15e151687f1
2019-11-06 19:41:47 +09:00
Anton Hansson
cb8276fa93 Put DEVICE/PRODUCT overlays in different partitions
This change changes auto-generated RROs from DEVICE_PACKAGE_OVERLAYS
to be generated in the vendor partition, as opposed to /product where
they were generated in the past.

Note that PRODUCT_PACKAGE_OVERLAYS continue generating RRO packages
to /product, which means that a single app can be overlayed from
different partitions. These RROs have been given module and package
names based on their location.

Bug: 127758779
Test: verify noop on presubmit targets
Change-Id: I5cee70e28e3969e67b2d83eaf25d9c6e3a11102d
2019-03-22 13:25:20 +00:00
Anton Hansson
038177ba55 Exempt some RROs from building against SDK
If an RRO is depending on the source module to import its resources,
this trips up the link check because the source module may not be
building against the SDK. Exempt these RROs from the rule.

Bug: 123510624
Test: m
Change-Id: Ie0e05ce6d31dd3a0eafb14ace426da2bc15fb740
2019-01-29 15:21:25 +00:00
Anton Hansson
8549417b69 Set LOCAL_SDK_VERSION := current for RROs
For sanity, and to silence the error of not setting
PRIVATE_PLATFORM_APIS or LOCAL_SDK_VERSION.

Exempt framework-res from this, as it can't build against the SDK.
Also tweak the previous whitelisting to be more specifically for
framework-res.

Bug: 118823052
Test: make downstream products
Change-Id: Ia15aaa3b1ea95e02e3483673b668ed2cbca76ba9
2018-11-01 18:48:28 +00:00
Jiyong Park
c0ece103ec RRO for framework-res.apk is not force built against SystemSDK
When BOARD_SYSTEMSDK_VERSIONS is set, any apk in the vendor partition
is force built against SystemSDK (or Android SDK if LOCAL_SDK_VERSION is
set to current). However, there should be one exception to this: RRO for
framework-res.apk. This is because the RRO is currently overriding
resources that are not part of SystemSDK. Until SystemSDK is expanded to
cover resources that are eligible for overriding, let's allow the direct
dependency from RRO to framework-res.apk.

Bug: 35859726
Bug: 76398918
Test: m -j
Merged-In: Ib9981b107d78691eef21f4525ebdac9866d5c50e
Change-Id: Ib9981b107d78691eef21f4525ebdac9866d5c50e
(cherry picked from commit d8c4c30ba4)
2018-03-27 09:40:11 +09:00
Jiyong Park
641b6cc6b0 Add PLATFORM_SYSTEMSDK_VERSIONS and BOARD_SYSTEMSDK_VERSIONS
PLATFORM_SYSTEMSDK_VERSIONS is the list of System SDK versions that the
platform is supporting. Contrary to the public SDK where platform
essentially supports all previous SDK versions, platform support only a
few recent System SDK versions, since some of old System APIs are
gradually deprecated, removed from the following SDKs and then finally
deleted from the platform. This will be part of the framework manifest.

The list can be specified by setting PLATFORM_SYSTEMSDK_MIN_VERSION. If
it is set to an old version number, then System SDKs from the version
to the current version (PLATFORM_SDK_VERSION) are considered to be
supported by the platform. If PLATFORM_SYSTEMSDK_MIN_VERSION is not set,
only the latest System SDK version is supported.

Next, BOARD_SYSTEMSDK_VERSIONS is the list of System SDK versions that
the device is using. This is put to the device compatibility matrix
device is using. The device and the platform is considered as compatible
only BOARD_SYSTEMSDK_VERSIONS in the device compatibility matrix are
in the PLATFORM_SYSTEMSDK_VERSIONS in the framework manifest.

When BOARD_SYSTEMSDK_VERSIONS is set, a Java app or library in vendor or
odm partitions which didn't specify LOCAL_SDK_VERSION  is forced to use
System SDK. Also, the build system does the additional integrity check
to ensure that LOCAL_SDK_VERSION is within BOARD_SYSTEMSDK_VERSIONS or
PLATFORM_SYSTEMSDK_VERSIONS (if BOARD_SYSTEMSDK_VERSIONS isn't set).

Bug: 69088799
Test: m -j
Test: BOARD_SYSTEMSDK_VERSIONS=P m -j
Change-Id: If4d59f6030e4cc402e015701d0caf94aeec37263
2018-01-19 15:42:05 +09:00