Skip to content

Commit

Permalink
feat(android): support API 30 (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Jun 8, 2021
1 parent 218b69f commit e90aa32
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/android/data/avds/Pixel_3_API_30.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"id": "Pixel_3_API_30",
"ini": {
"avd.ini.encoding": "UTF-8",
"target": "android-30"
},
"configini": {
"AvdId": "Pixel_3_API_30",
"abi.type": "x86",
"avd.ini.displayname": "Pixel 3 API 30",
"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"
}
}
30 changes: 30 additions & 0 deletions src/android/utils/sdk/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type * as Pixel_2_API_26 from '../../data/avds/Pixel_2_API_26.json';
import type * as Pixel_2_API_27 from '../../data/avds/Pixel_2_API_27.json';
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_API_25 from '../../data/avds/Pixel_API_25.json';

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

export type PartialAVDSchematic =
| typeof Pixel_3_API_30
| typeof Pixel_3_API_29
| typeof Pixel_2_API_28
| typeof Pixel_2_API_27
Expand All @@ -102,6 +104,33 @@ export interface APISchema {
readonly validate: (packages: readonly SDKPackage[]) => APISchemaPackage[];
readonly loadPartialAVDSchematic: () => Promise<PartialAVDSchematic>;
}
export const API_LEVEL_30: APISchema = Object.freeze({
apiLevel: '30',
validate: (packages: readonly SDKPackage[]) => {
const schemas: APISchemaPackage[] = [
{ name: 'Android Emulator', path: 'emulator', version: /.+/ },
{
name: 'Android SDK Platform 30',
path: 'platforms;android-30',
version: /.+/,
},
];

const missingPackages = findUnsatisfiedPackages(packages, schemas);

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

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

export const API_LEVEL_29: APISchema = Object.freeze({
apiLevel: '29',
Expand Down Expand Up @@ -272,6 +301,7 @@ export const API_LEVEL_24: APISchema = Object.freeze({
});

export const API_LEVEL_SCHEMAS: readonly APISchema[] = [
API_LEVEL_30,
API_LEVEL_29,
API_LEVEL_28,
API_LEVEL_27,
Expand Down

0 comments on commit e90aa32

Please # to comment.