Skip to content

Commit

Permalink
feat(android): support API 31 (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Oct 11, 2021
1 parent b879744 commit fb64ca5
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/android/data/avds/Pixel_3_API_31.json
@@ -0,0 +1,40 @@
{
"id": "Pixel_3_API_31",
"ini": {
"avd.ini.encoding": "UTF-8",
"target": "android-31"
},
"configini": {
"AvdId": "Pixel_3_API_31",
"abi.type": "x86",
"avd.ini.displayname": "Pixel 3 API 31",
"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"
}
}
32 changes: 32 additions & 0 deletions src/android/utils/sdk/api.ts
Expand Up @@ -6,6 +6,7 @@ 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_3_API_31 from '../../data/avds/Pixel_3_API_31.json';
import type * as Pixel_API_25 from '../../data/avds/Pixel_API_25.json';

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

export type PartialAVDSchematic =
| typeof Pixel_3_API_31
| typeof Pixel_3_API_30
| typeof Pixel_3_API_29
| typeof Pixel_2_API_28
Expand All @@ -104,6 +106,35 @@ export interface APISchema {
readonly validate: (packages: readonly SDKPackage[]) => APISchemaPackage[];
readonly loadPartialAVDSchematic: () => Promise<PartialAVDSchematic>;
}

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

const missingPackages = findUnsatisfiedPackages(packages, schemas);

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

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

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

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

0 comments on commit fb64ca5

Please sign in to comment.