From 8f1717d1a54eaf9f45688c0c243f2085abd61421 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Thu, 1 Sep 2022 13:11:31 +0200 Subject: [PATCH] feat(android): add API 33 support (#245) --- src/android/data/avds/Pixel_4_API_33.json | 40 +++++++++++++++++++++++ src/android/utils/sdk/api.ts | 31 ++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 src/android/data/avds/Pixel_4_API_33.json diff --git a/src/android/data/avds/Pixel_4_API_33.json b/src/android/data/avds/Pixel_4_API_33.json new file mode 100644 index 0000000..aa275f1 --- /dev/null +++ b/src/android/data/avds/Pixel_4_API_33.json @@ -0,0 +1,40 @@ +{ + "id": "Pixel_4_API_33", + "ini": { + "avd.ini.encoding": "UTF-8", + "target": "android-33" + }, + "configini": { + "AvdId": "Pixel_4_API_33", + "abi.type": "x86", + "avd.ini.displayname": "Pixel 4 API 33", + "avd.ini.encoding": "UTF-8", + "hw.accelerometer": "yes", + "hw.audioInput": "yes", + "hw.battery": "yes", + "hw.camera.back": "virtualscene", + "hw.camera.front": "emulated", + "hw.cpu.arch": "x86", + "hw.cpu.ncore": "4", + "hw.device.hash2": "MD5:6b5943207fe196d842659d2e43022e20", + "hw.device.manufacturer": "Google", + "hw.device.name": "pixel_4", + "hw.gps": "yes", + "hw.gpu.enabled": "yes", + "hw.gpu.mode": "auto", + "hw.initialOrientation": "Portrait", + "hw.keyboard": "yes", + "hw.lcd.density": "440", + "hw.lcd.height": "2280", + "hw.lcd.width": "1080", + "hw.ramSize": "1536", + "hw.sdCard": "yes", + "hw.sensors.orientation": "yes", + "hw.sensors.proximity": "yes", + "sdcard.size": "512M", + "showDeviceFrame": "yes", + "skin.dynamic": "yes", + "skin.name": "pixel_4", + "tag.display": "Google Play" + } +} diff --git a/src/android/utils/sdk/api.ts b/src/android/utils/sdk/api.ts index acbc335..d89d0cc 100644 --- a/src/android/utils/sdk/api.ts +++ b/src/android/utils/sdk/api.ts @@ -8,6 +8,7 @@ import type * as Pixel_3_API_29 from '../../data/avds/Pixel_3_API_29.json'; import type * as Pixel_3_API_30 from '../../data/avds/Pixel_3_API_30.json'; import type * as Pixel_3_API_31 from '../../data/avds/Pixel_3_API_31.json'; import type * as Pixel_3_API_32 from '../../data/avds/Pixel_3_API_32.json'; +import type * as Pixel_4_API_33 from '../../data/avds/Pixel_4_API_33.json'; import type * as Pixel_API_25 from '../../data/avds/Pixel_API_25.json'; import type { SDKPackage } from './'; @@ -87,6 +88,7 @@ export function findPackageBySchemaPath( } export type PartialAVDSchematic = + | typeof Pixel_4_API_33 | typeof Pixel_3_API_32 | typeof Pixel_3_API_31 | typeof Pixel_3_API_30 @@ -109,6 +111,34 @@ export interface APISchema { readonly loadPartialAVDSchematic: () => Promise; } +export const API_LEVEL_33: APISchema = Object.freeze({ + apiLevel: '33', + validate: (packages: readonly SDKPackage[]) => { + const schemas: APISchemaPackage[] = [ + { name: 'Android Emulator', path: 'emulator', version: /.+/ }, + { + name: 'Android SDK Platform 33', + path: 'platforms;android-33', + version: /.+/, + }, + ]; + + const missingPackages = findUnsatisfiedPackages(packages, schemas); + + if (!findPackageBySchemaPath(packages, /^system-images;android-33;/)) { + missingPackages.push({ + name: 'Google Play Intel x86 Atom System Image', + path: 'system-images;android-33;google_apis_playstore;x86', + version: '/.+/', + }); + } + + return missingPackages; + }, + loadPartialAVDSchematic: async () => + import('../../data/avds/Pixel_4_API_33.json'), +}); + export const API_LEVEL_32: APISchema = Object.freeze({ apiLevel: '32', validate: (packages: readonly SDKPackage[]) => { @@ -362,6 +392,7 @@ export const API_LEVEL_24: APISchema = Object.freeze({ }); export const API_LEVEL_SCHEMAS: readonly APISchema[] = [ + API_LEVEL_33, API_LEVEL_32, API_LEVEL_31, API_LEVEL_30,