Bug 1219512 - Bump Android version code computation check. r=nalexander

This commit is contained in:
Richard Newman 2015-10-28 18:38:55 -07:00
parent 47fe0edc70
commit a26cfa8435
2 changed files with 10 additions and 3 deletions

View File

@ -55,9 +55,12 @@ def android_version_code_v1(buildid, cpu_arch=None, min_sdk=0, max_sdk=0):
The bit labelled 'p' is a placeholder that is always 0 (for now).
The bit labelled 'g' is 1 if the build is targetting Android API 11+ and 0
The bit labelled 'g' is 1 if the build is targeting Android API 11/14+ and 0
otherwise, which means the build targets Android API 9-10 (Gingerbread).
(Fennec no longer supports below Android API 9.)
Fennec no longer supports Android API 8 or earlier. After Bug 1155801 it
no longer supports API 11-13. API 9 is still supported due to significant usage.
We temporarily treat both 11 and 14 the same: Bug 1219512.
We throw an explanatory exception when we are within one calendar year of
running out of build events. This gives lots of time to update the version
@ -107,7 +110,9 @@ def android_version_code_v1(buildid, cpu_arch=None, min_sdk=0, max_sdk=0):
# 0 is interpreted as SDK 9.
if not min_sdk or min_sdk == 9:
pass
elif min_sdk == 11:
# This used to compare to 11. The 14+ APK directly supersedes 11+, so
# we reuse this check.
elif min_sdk == 14 or min_sdk == 11:
version |= 1 << 0
else:
raise ValueError("Don't know how to compute android:versionCode "

View File

@ -25,9 +25,11 @@ class TestAndroidVersionCode(unittest.TestCase):
buildid = '20150825141628'
arm_api9 = 0b01111000001000000001001001110000
arm_api11 = 0b01111000001000000001001001110001
arm_api14 = 0b01111000001000000001001001110001
x86_api9 = 0b01111000001000000001001001110100
self.assertEqual(android_version_code_v1(buildid, cpu_arch='armeabi', min_sdk=9, max_sdk=None), arm_api9)
self.assertEqual(android_version_code_v1(buildid, cpu_arch='armeabi-v7a', min_sdk=11, max_sdk=None), arm_api11)
self.assertEqual(android_version_code_v1(buildid, cpu_arch='armeabi-v7a', min_sdk=14, max_sdk=None), arm_api14)
self.assertEqual(android_version_code_v1(buildid, cpu_arch='x86', min_sdk=9, max_sdk=None), x86_api9)
def test_android_version_code_v1_underflow(self):