Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): add API 32 support #232

Merged
merged 1 commit into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/android/data/avds/Pixel_3_API_32.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"id": "Pixel_3_API_32",
"ini": {
"avd.ini.encoding": "UTF-8",
"target": "android-32"
},
"configini": {
"AvdId": "Pixel_3_API_32",
"abi.type": "x86",
"avd.ini.displayname": "Pixel 3 API 32",
"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:8a60718609e0741c7c0cc225f49c5590",
"hw.device.manufacturer": "Google",
"hw.device.name": "pixel_3",
"hw.gps": "yes",
"hw.gpu.enabled": "yes",
"hw.gpu.mode": "auto",
"hw.initialOrientation": "Portrait",
"hw.keyboard": "yes",
"hw.lcd.density": "440",
"hw.lcd.height": "2160",
"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_2",
"tag.display": "Google Play"
}
}
31 changes: 31 additions & 0 deletions src/android/utils/sdk/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type * as Pixel_2_API_28 from '../../data/avds/Pixel_2_API_28.json';
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_API_25 from '../../data/avds/Pixel_API_25.json';

import type { SDKPackage } from './';
Expand Down Expand Up @@ -86,6 +87,7 @@ export function findPackageBySchemaPath(
}

export type PartialAVDSchematic =
| typeof Pixel_3_API_32
| typeof Pixel_3_API_31
| typeof Pixel_3_API_30
| typeof Pixel_3_API_29
Expand All @@ -107,6 +109,34 @@ export interface APISchema {
readonly loadPartialAVDSchematic: () => Promise<PartialAVDSchematic>;
}

export const API_LEVEL_32: APISchema = Object.freeze({
apiLevel: '32',
validate: (packages: readonly SDKPackage[]) => {
const schemas: APISchemaPackage[] = [
{ name: 'Android Emulator', path: 'emulator', version: /.+/ },
{
name: 'Android SDK Platform 32',
path: 'platforms;android-32',
version: /.+/,
},
];

const missingPackages = findUnsatisfiedPackages(packages, schemas);

if (!findPackageBySchemaPath(packages, /^system-images;android-32;/)) {
missingPackages.push({
name: 'Google Play Intel x86 Atom System Image',
path: 'system-images;android-32;google_apis_playstore;x86',
version: '/.+/',
});
}

return missingPackages;
},
loadPartialAVDSchematic: async () =>
import('../../data/avds/Pixel_3_API_32.json'),
});

export const API_LEVEL_31: APISchema = Object.freeze({
apiLevel: '31',
validate: (packages: readonly SDKPackage[]) => {
Expand Down Expand Up @@ -332,6 +362,7 @@ export const API_LEVEL_24: APISchema = Object.freeze({
});

export const API_LEVEL_SCHEMAS: readonly APISchema[] = [
API_LEVEL_32,
API_LEVEL_31,
API_LEVEL_30,
API_LEVEL_29,
Expand Down