1 // Copyright 2020 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 #pragma once 15 16 #include "android/utils/compiler.h" 17 18 ANDROID_BEGIN_HEADER 19 20 // Implements a simple helper object used to retrieve the list of 21 // available Android Virtual Devices. 22 // 23 // Typical usage is: 24 // 25 // AvdScanner* scanner = avdScanner_new(NULL); 26 // while ((name = avdScanner_next(scanner)) != NULL) { 27 // printf("%s\n", name); 28 // } 29 // avdScanner_free(scanner); 30 // 31 32 // Opaque type to an object used to scan all available AVDs 33 // under $ANDROID_SDK_HOME. 34 typedef struct AvdScanner AvdScanner; 35 36 // Create a new AVD scanner instance, used to parse the directory 37 // at |sdk_home|. If this parameter is NULL, this will find the 38 // directory from the environment, e.g. ANDROID_SDK_HOME if it is 39 // defined, or a platform-specific location (e.g. ~/.android/ on Unix). 40 AvdScanner* avdScanner_new(const char* sdk_home); 41 42 // Return the name of the next AVD detected by the scanner. 43 // This will be NULL at the end of the scan. 44 const char* avdScanner_next(AvdScanner* scanner); 45 46 // Release an AvdScanner object and associated resources. 47 // This can be called before the end of a scan. 48 void avdScanner_free(AvdScanner* scanner); 49 50 ANDROID_END_HEADER 51