1#!/bin/bash 2 3# Copyright (C) 2020 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17# Creates an car AVD configuration 18# 19# Arguments: 20# $1: (AVD_NAME) Name of the AVD 21# $2: (WORKDIR) where to store the avd config 22# $3: (AVD_IMAGE_DIR) AVD System image dir 23# $4: (DISPLAY_DENSITY) Display density 24# $5: (DISPLAY_WIDTH) Display width px 25# $6: (DISPLAY_HEIGHT) Display height px 26# $7: (RAM_MB) AVD RAM size in MB 27# $8: (ABD) AVD ABI, e.g. x86 or x86_64 28 29AVD_NAME=$1 30WORKDIR=$2 31AVD_IMAGE_DIR=$3 32DISPLAY_DENSITY=$4 33DISPLAY_WIDTH=$5 34DISPLAY_HEIGHT=$6 35RAM_MB=$7 36ABI=$8 37 38mkdir -p ${WORKDIR}/.android/avd/${AVD_NAME}.avd 39 40# avd_name.ini 41AVD_INI_FILE=${WORKDIR}/.android/avd/${AVD_NAME}.ini 42echo Creating $AVD_INI_FILE 43echo "avd.ini.encoding=UTF-8" >> $AVD_INI_FILE 44echo "path=${WORKDIR}/.android/avd/${AVD_NAME}.avd" >> $AVD_INI_FILE 45echo "path.rel=avd/${AVD_NAME}.avd" >> $AVD_INI_FILE 46 47# avd_name.avd/config.ini 48AVD_CONFIG_INI=${WORKDIR}/.android/avd/${AVD_NAME}.avd/config.ini 49echo Creating $AVD_CONFIG_INI $DISPLAY_WIDTH x $DISPLAY_HEIGHT @ $DISPLAY_DENSITY with $RAM_MB 50echo AVD Img: $AVD_IMAGE_DIR 51cat <<EOT >> $AVD_CONFIG_INI 52 53image.sysdir.1 = ${AVD_IMAGE_DIR} 54hw.lcd.density = ${DISPLAY_DENSITY} 55hw.lcd.width = ${DISPLAY_WIDTH} 56hw.lcd.height = ${DISPLAY_HEIGHT} 57AvdId = ${AVD_NAME} 58avd.ini.displayname = ${AVD_NAME} 59hw.ramSize = ${RAM_MB} 60abi.type = ${ABI} 61 62tag.display = Automotive 63tag.id = android-automotive 64hw.device.manufacturer = google 65hw.device.name = hawk 66avd.ini.encoding = UTF-8 67disk.dataPartition.size = 6442450944 68fastboot.chosenSnapshotFile = 69fastboot.forceChosenSnapshotBoot = no 70fastboot.forceColdBoot = no 71fastboot.forceFastBoot = yes 72hw.accelerometer = no 73hw.arc = false 74hw.audioInput = yes 75hw.battery = no 76hw.camera.back = None 77hw.camera.front = None 78hw.cpu.arch = x86_64 79hw.cpu.ncore = 4 80hw.dPad = no 81hw.device.hash2 = MD5:1fdb01985c7b4d7c19ec309cc238b0f9 82hw.gps = yes 83hw.gpu.enabled = yes 84hw.gpu.mode = auto 85hw.initialOrientation = landscape 86hw.keyboard = yes 87hw.keyboard.charmap = qwerty2 88hw.keyboard.lid = false 89hw.mainKeys = no 90hw.sdCard = no 91hw.sensors.orientation = no 92hw.sensors.proximity = no 93hw.trackBall = no 94runtime.network.latency = none 95runtime.network.speed = full 96vm.heapSize = 80 97EOT 98