Define BOARD_API_LEVEL and BOARD_API_LEVEL_FROZEN

BOARD_API_LEVEL and BOARD_API_LEVEL_FROZEN are set by the release
flags.
BOARD_API_LEVEL sets ro.board.api_level that shows the API level of
the vendor API surface.
BOARD_API_LEVEL_FROZEN sets ro.board.api_frozen that shows if the
ro.board.api_level is finalized.

Bug: 295269182
Test: getprop ro.board.api_level
Change-Id: Ie57c57b6c9f1fc0c98968195843059a48da8e512
This commit is contained in:
Justin Yun
2023-11-10 16:31:04 +09:00
parent 481b02106c
commit 23d52435f3
4 changed files with 34 additions and 53 deletions

View File

@@ -255,29 +255,17 @@ class PropListTestcase(unittest.TestCase):
stderr_redirect = io.StringIO()
with contextlib.redirect_stderr(stderr_redirect):
props = PropList("hello")
props.put("ro.board.first_api_level","25")
props.put("ro.board.first_api_level","202504")
props.put("ro.build.version.codename", "REL")
# ro.board.first_api_level must be less than or equal to the sdk version
self.assertFalse(validate_grf_props(props, 20))
self.assertTrue(validate_grf_props(props, 26))
self.assertTrue(validate_grf_props(props, 35))
# manually set ro.board.api_level to an invalid value
props.put("ro.board.api_level","20")
self.assertFalse(validate_grf_props(props, 26))
props.put("ro.board.api_level","202404")
self.assertFalse(validate_grf_props(props))
props.get_all_props()[-1].make_as_comment()
# manually set ro.board.api_level to a valid value
props.put("ro.board.api_level","26")
self.assertTrue(validate_grf_props(props, 26))
# ro.board.api_level must be less than or equal to the sdk version
self.assertFalse(validate_grf_props(props, 25))
# allow setting future api_level before release
props.get_all_props()[-2].make_as_comment()
props.put("ro.build.version.codename", "NonRel")
self.assertTrue(validate_grf_props(props, 24))
props.put("ro.board.api_level","202504")
self.assertTrue(validate_grf_props(props))
if __name__ == '__main__':
unittest.main(verbosity=2)