From 890e7722e7cd64ed7b380500784ae558354daf06 Mon Sep 17 00:00:00 2001 From: Hsin-Yi Chen Date: Tue, 5 Mar 2024 15:56:44 +0800 Subject: [PATCH] Allow PrevVendorApiLevel to be less than 34 Some developers need to set VendorApiLevel to 34. Though the configuration is not officially supported, the ABI checker supports it on a best-effort basis. Test: make Bug: 320347314 Change-Id: Ic3f5ea2028329f5d04606760b07947b7c98b2e51 --- android/config.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/android/config.go b/android/config.go index f0854f9c4..9f009e4c0 100644 --- a/android/config.go +++ b/android/config.go @@ -1348,13 +1348,16 @@ func (c *config) PrevVendorApiLevel() string { panic(fmt.Errorf("Cannot parse vendor API level %s to an integer: %s", c.VendorApiLevel(), err)) } - if vendorApiLevel < 202404 || vendorApiLevel%100 != 4 { - panic("Unknown vendor API level " + c.VendorApiLevel()) - } // The version before trunk stable is 34. if vendorApiLevel == 202404 { return "34" } + if vendorApiLevel >= 1 && vendorApiLevel <= 34 { + return strconv.Itoa(vendorApiLevel - 1) + } + if vendorApiLevel < 202404 || vendorApiLevel%100 != 4 { + panic("Unknown vendor API level " + c.VendorApiLevel()) + } return strconv.Itoa(vendorApiLevel - 100) }