1 /* 2 * Copyright (C) 2017 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 android.platform.helpers; 18 19 import android.support.test.uiautomator.Direction; 20 21 public interface IGoogleCameraHelper extends IAppHelper { 22 public static final int HDR_MODE_AUTO = -1; 23 public static final int HDR_MODE_OFF = 0; 24 public static final int HDR_MODE_ON = 1; 25 26 public static final int VIDEO_SD_480 = -2; 27 public static final int VIDEO_HD_720 = -1; 28 public static final int VIDEO_HD_1080 = 0; 29 public static final int VIDEO_4K_MODE_ON = 1; 30 31 public static final int VIDEO_30FPS = 0; 32 public static final int VIDEO_60FPS = 1; 33 34 public static final int HFR_MODE_OFF = 0; 35 public static final int HFR_MODE_120_FPS = 1; 36 public static final int HFR_MODE_240_FPS = 2; 37 38 public static final int FLASH_AUTO = -1; 39 public static final int FLASH_OFF = 0; 40 public static final int FLASH_ON = 1; 41 public static final int NUM_FLASH_MODES = 3; 42 43 /** 44 * Setup expectations: GoogleCamera is open and idle in camera/video mode. 45 * 46 * This method will change to portrait mode and block until the transition is complete. 47 */ goToPortraitMode()48 public default void goToPortraitMode() { 49 throw new UnsupportedOperationException("Not yet implemented."); 50 } 51 52 /** 53 * Setup expectations: GoogleCamera is open and idle in portrait/video mode. 54 * 55 * This method will change to camera mode and block until the transition is complete. 56 */ goToCameraMode()57 public void goToCameraMode(); 58 59 /** 60 * Setup expectations: GoogleCamera is open and idle in camera/portrait mode. 61 * 62 * This method will change to video mode and block until the transition is complete. 63 */ goToVideoMode()64 public void goToVideoMode(); 65 66 /** 67 * Setup expectations: GoogleCamera is open and idle in either camera/portrait/video mode. 68 * 69 * This method will change to back camera and block until the transition is complete. 70 */ goToBackCamera()71 public void goToBackCamera(); 72 73 /** 74 * Setup expectations: GoogleCamera is open and idle in either camera/portrait/video mode. 75 * 76 * This method will change to front camera and block until the transition is complete. 77 */ goToFrontCamera()78 public void goToFrontCamera(); 79 80 /** 81 * Setup expectations: GoogleCamera is open and idle in either camera/portrait/video mode. 82 * 83 * <p>This method will change to nightsight mode and block until the transition is complete. 84 */ goToNightSightMode()85 public default void goToNightSightMode() { 86 throw new UnsupportedOperationException("Not yet implemented."); 87 } 88 ; 89 90 /** 91 * Setup expectations: GoogleCamera is open and idle in either camera/portrait/video mode. 92 * 93 * <p>This method will change to slow motion mode and block until the transition is complete. 94 */ goToSlowMotionMode()95 public default void goToSlowMotionMode() { 96 throw new UnsupportedOperationException("Not yet implemented."); 97 } 98 ; 99 100 /** 101 * Setup expectation: in Camera/Portrait mode with the capture button present. 102 * 103 * This method will capture a photo and block until the transaction is complete. 104 */ capturePhoto()105 public void capturePhoto(); 106 107 /** 108 * Setup expectation: in Camera mode with the capture button present. 109 * 110 * <p>This method will capture a long shot and block until the transaction is complete. 111 * 112 * @param durationMs duration of video in milliseconds 113 */ captureLongShot(long durationMs)114 public default void captureLongShot(long durationMs) { 115 throw new UnsupportedOperationException("Not yet implemented."); 116 } 117 ; 118 119 /** 120 * Setup expectation: in Video mode with the capture button present. 121 * 122 * This method will capture a video of length timeInMs and block until the transaction is 123 * complete. 124 * @param time duration of video in milliseconds 125 */ captureVideo(long time)126 public void captureVideo(long time); 127 128 /** 129 * Clicks the shutter button without synchronizing with UI animations a number of times. Can 130 * click without waiting for button to become clickable/enabled. 131 * 132 * @param shouldWaitClickable whether to wait until button becomes clickable 133 * @param times number of times to mash button 134 */ mashShutterButton(boolean shouldWaitClickable, int times)135 public default void mashShutterButton(boolean shouldWaitClickable, int times) { 136 throw new UnsupportedOperationException("Not yet implemented."); 137 } 138 ; 139 140 /** 141 * Setup expectation: 142 * 1. in Video mode with the capture button present. 143 * 2. videoTime > snapshotStartTime 144 * 145 * This method will capture a video of length videoTime, and take a picture at snapshotStartTime. 146 * It will block until the the video is captured and the device is again idle in video mode. 147 * @param time duration of video in milliseconds 148 */ snapshotVideo(long videoTime, long snapshotStartTime)149 public void snapshotVideo(long videoTime, long snapshotStartTime); 150 151 /** 152 * Setup expectation: GoogleCamera is open and idle in camera mode. 153 * 154 * This method will set HDR to one of the following: 155 * - on (mode == HDR_MODE_ON) 156 * - auto (mode == HDR_MODE_AUTO) 157 * - off (mode == HDR_MODE_OFF) 158 * @param mode the integer value of the mode denoted above. 159 */ setHdrMode(int mode)160 public void setHdrMode(int mode); 161 162 /** 163 * Setup expectation: GoogleCamera is open and idle in video mode. 164 * 165 * This method will set 4K mode to one of the following: 166 * - on (mode == VIDEO_4K_MODE_ON) 167 * - off (mode != VIDEO_4K_MODE_ON) 168 * @param mode the integer value of the mode denoted above. 169 */ set4KMode(int mode)170 public void set4KMode(int mode); 171 172 /** 173 * Setup expectation: GoogleCamera is open and idle in video mode. 174 * 175 * This method will set HFR mode to one of the following: 176 * - off (mode == HFR_MODE_OFF) 177 * - 120 fps (mode == HFR_MODE_120_FPS) 178 * - 240 fps (mode == HFR_MODE_240_FPS) 179 * @param mode the integer value of the mode denoted above. 180 */ setHFRMode(int mode)181 public void setHFRMode(int mode); 182 183 /** 184 * 185 * Setup expectations: GoogleCamera is open and idle in either camera/portrait/video mode. 186 * 187 * This method will set EIS to on(true), or off(false). 188 * @param mode the boolean value of the mode denoted above. 189 */ setEIS(boolean mode)190 public void setEIS(boolean mode); 191 192 /** 193 * Setup expectation: GoogleCamera is open and idle in either camera/portrait/video mode. 194 * 195 * This method will set front video capture resolution to one of the following: 196 * - SD 480p (mode == VIDEO_SD_480) 197 * - HD 720p (mode == VIDEO_HD_720) 198 * - HD 1080p (mode == VIDEO_HD_1080) 199 * - UHD 4K (mode == VIDEO_4K_MODE_ON) 200 * @param mode the integer value of the mode denoted above. 201 */ selectFrontVideoResolution(int mode)202 public void selectFrontVideoResolution(int mode); 203 204 /** 205 * Setup expectation: GoogleCamera is open and idle in either camera/portrait/video mode. 206 * 207 * This method will set back video capture resolution to one of the following: 208 * - SD 480p (mode == VIDEO_SD_480) 209 * - HD 720p (mode == VIDEO_HD_720) 210 * - HD 1080p (mode == VIDEO_HD_1080) 211 * - UHD 4K (mode == VIDEO_4K_MODE_ON) 212 * @param mode the integer value of the mode denoted above. 213 */ selectBackVideoResolution(int mode)214 public void selectBackVideoResolution(int mode); 215 216 /** 217 * 218 * Setup expectations: GoogleCamera is open, idle, in video mode, 219 * using back camera, and not in 4k mode 220 * 221 * This method will set video capture framerate to one of the following: 222 * - 30 fps (mode == VIDEO_30FPS) 223 * - 60 fps (mode == VIDEO_60FPS) 224 * @param mode the integer value of the mode denoted above. 225 */ setFrameRate(int mode)226 public void setFrameRate(int mode); 227 228 /** 229 * Setup expectation: GoogleCamera is open and idle in either camera/portrait/video mode. 230 * 231 * This method will set flash to one of the following: 232 * - on (mode == FLASH_ON) 233 * - auto (mode == FLASH_AUTO) 234 * - off (mode == FLASH_OFF) 235 * @param mode the integer value of the mode denoted above. 236 */ setFlashMode(int mode)237 public void setFlashMode(int mode); 238 239 /** 240 * Setup expectation: in Camera mode with the capture button present. 241 * 242 * This method will block until the capture button is enabled for pressing. 243 */ waitForCameraShutterEnabled()244 public void waitForCameraShutterEnabled(); 245 246 /** 247 * Setup expectation: in Video mode with the capture button present. 248 * 249 * This method will block until the capture button is enabled for pressing. 250 */ waitForVideoShutterEnabled()251 public void waitForVideoShutterEnabled(); 252 253 /** 254 * Temporary function. 255 */ openWithShutterTimeString()256 public String openWithShutterTimeString(); 257 258 /** 259 * Setup expectations: in Camera mode or in Video mode 260 */ goToAlbum()261 public void goToAlbum(); 262 263 /** 264 * Setup expectations: 265 * 1. in album view 266 * 2. scroll direction is either LEFT or RIGHT 267 * 268 * @param direction scroll direction, either LEFT or RIGHT 269 */ scrollAlbum(Direction direction)270 public void scrollAlbum(Direction direction); 271 272 /** 273 * Setup expectations: Finished capture long shot in camera. 274 * 275 * <p>Clicks thumbnail of the longshot and view the top shot. 276 */ viewTopShot(long timeout)277 public default void viewTopShot(long timeout) { 278 throw new UnsupportedOperationException("Not yet implemented."); 279 } 280 } 281