File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,20 @@ def image_works_with_device(supported_device_codes: List[str], image_path: str)
5959 )
6060 return False
6161
62+ def image_sdk_level (image_path : str ) -> int :
63+ """
64+ Determine Android version of the selected image.
65+ Android 13 : 33
66+ """
67+ with zipfile .ZipFile (image_path ) as image_zip :
68+ with image_zip .open (
69+ "META-INF/com/android/metadata" , mode = "r"
70+ ) as image_metadata :
71+ metadata = image_metadata .readlines ()
72+ for line in metadata :
73+ if b"sdk-level" in line :
74+ return int (line [line .find (b'=' )+ 1 :- 1 ].decode ("utf-8" ))
75+ return 0
6276
6377def recovery_works_with_device (device_code : str , recovery_path : str ) -> bool :
6478 """Determine if a recovery works for the given device.
You can’t perform that action at this time.
0 commit comments