1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.tradefed.device; 18 19 import com.android.ddmlib.IDevice; 20 import com.android.tradefed.util.ConditionPriorityBlockingQueue.IMatcher; 21 22 import java.util.Collection; 23 import java.util.List; 24 import java.util.Map; 25 26 /** 27 * Interface for device selection criteria. 28 */ 29 public interface IDeviceSelection extends IMatcher<IDevice> { 30 31 /** 32 * Gets a copy of the serial numbers 33 * 34 * @param device The {@link IDevice} representing the device considered for selection. 35 * @return a {@link Collection} of serial numbers 36 */ getSerials(IDevice device)37 public Collection<String> getSerials(IDevice device); 38 39 /** Returns the list of requested serials. */ getSerials()40 public List<String> getSerials(); 41 42 /** 43 * Gets a copy of the serial numbers exclusion list 44 * 45 * @return a {@link Collection} of serial numbers 46 */ getExcludeSerials()47 public Collection<String> getExcludeSerials(); 48 49 /** 50 * Gets a copy of the product type list 51 * 52 * @return a {@link Collection} of product types 53 */ getProductTypes()54 public Collection<String> getProductTypes(); 55 56 /** 57 * Returns a map of the property list 58 * 59 * @return a {@link Map} of device property names to values 60 */ getProperties()61 public Map<String, String> getProperties(); 62 63 /** 64 * @return <code>true</code> if an emulator has been requested 65 */ emulatorRequested()66 public boolean emulatorRequested(); 67 68 /** 69 * @return <code>true</code> if a device has been requested 70 */ deviceRequested()71 public boolean deviceRequested(); 72 73 /** 74 * @return <code>true</code> if an stub emulator has been requested. A stub emulator is a 75 * placeholder to be used when config has to launch an emulator. 76 */ stubEmulatorRequested()77 public boolean stubEmulatorRequested(); 78 79 /** 80 * @return <code>true</code> if a null device (aka no device required) has been requested 81 */ nullDeviceRequested()82 public boolean nullDeviceRequested(); 83 84 /** @return <code>true</code> if a tcp device (aka a adb connected device) has been requested */ tcpDeviceRequested()85 public boolean tcpDeviceRequested(); 86 87 /** @return <code>true</code> if a gce device (aka a remote device) has been requested */ gceDeviceRequested()88 public boolean gceDeviceRequested(); 89 90 /** 91 * Gets the given devices product type 92 * 93 * @param device the {@link IDevice} 94 * @return the device product type or <code>null</code> if unknown 95 */ getDeviceProductType(IDevice device)96 public String getDeviceProductType(IDevice device); 97 98 /** 99 * Gets the given devices product variant 100 * 101 * @param device the {@link IDevice} 102 * @return the device product variant or <code>null</code> if unknown 103 */ getDeviceProductVariant(IDevice device)104 public String getDeviceProductVariant(IDevice device); 105 106 /** 107 * Retrieves the battery level for the given device 108 * 109 * @param device the {@link IDevice} 110 * @return the device battery level or <code>null</code> if unknown 111 */ getBatteryLevel(IDevice device)112 public Integer getBatteryLevel(IDevice device); 113 114 /** 115 * Set the serial numbers inclusion list, replacing any existing values. 116 */ setSerial(String... serialNumber)117 public void setSerial(String... serialNumber); 118 119 } 120