1 /* 2 * Copyright (C) 2010 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.result.InputStreamSource; 21 import com.android.tradefed.util.KeyguardControllerState; 22 23 import java.io.File; 24 import java.util.ArrayList; 25 import java.util.Arrays; 26 import java.util.List; 27 import java.util.Map; 28 import java.util.Set; 29 30 /** 31 * Provides an reliable and slightly higher level API to a ddmlib {@link IDevice}. 32 * <p/> 33 * Retries device commands for a configurable amount, and provides a device recovery 34 * interface for devices which are unresponsive. 35 */ 36 public interface ITestDevice extends INativeDevice { 37 38 public enum RecoveryMode { 39 /** don't attempt to recover device. */ 40 NONE, 41 /** recover device to online state only */ 42 ONLINE, 43 /** 44 * Recover device into fully testable state - framework is up, and external storage is 45 * mounted. 46 */ 47 AVAILABLE 48 } 49 50 /** 51 * A simple struct class to store information about a single mountpoint 52 */ 53 public static class MountPointInfo { 54 public String filesystem; 55 public String mountpoint; 56 public String type; 57 public List<String> options; 58 59 /** Simple constructor */ MountPointInfo()60 public MountPointInfo() {} 61 62 /** 63 * Convenience constructor to set all members 64 */ MountPointInfo(String filesystem, String mountpoint, String type, List<String> options)65 public MountPointInfo(String filesystem, String mountpoint, String type, 66 List<String> options) { 67 this.filesystem = filesystem; 68 this.mountpoint = mountpoint; 69 this.type = type; 70 this.options = options; 71 } 72 MountPointInfo(String filesystem, String mountpoint, String type, String optString)73 public MountPointInfo(String filesystem, String mountpoint, String type, String optString) { 74 this(filesystem, mountpoint, type, splitMountOptions(optString)); 75 } 76 splitMountOptions(String options)77 public static List<String> splitMountOptions(String options) { 78 List<String> list = Arrays.asList(options.split(",")); 79 return list; 80 } 81 82 @Override toString()83 public String toString() { 84 return String.format("%s %s %s %s", this.filesystem, this.mountpoint, this.type, 85 this.options); 86 } 87 } 88 89 /** 90 * Install an Android package on device. 91 * 92 * @param packageFile the apk file to install 93 * @param reinstall <code>true</code> if a reinstall should be performed 94 * @param extraArgs optional extra arguments to pass. See 'adb shell pm install --help' for 95 * available options. 96 * @return a {@link String} with an error code, or <code>null</code> if success. 97 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 98 * recovered. 99 */ installPackage(File packageFile, boolean reinstall, String... extraArgs)100 public String installPackage(File packageFile, boolean reinstall, String... extraArgs) 101 throws DeviceNotAvailableException; 102 103 /** 104 * Install an Android package on device. 105 * <p>Note: Only use cases that requires explicit control of granting runtime permission at 106 * install time should call this function. 107 * @param packageFile the apk file to install 108 * @param reinstall <code>true</code> if a reinstall should be performed 109 * @param grantPermissions if all runtime permissions should be granted at install time 110 * @param extraArgs optional extra arguments to pass. See 'adb shell pm install --help' for 111 * available options. 112 * @return a {@link String} with an error code, or <code>null</code> if success. 113 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 114 * recovered. 115 * @throws UnsupportedOperationException if runtime permission is not supported by the platform 116 * on device. 117 */ installPackage(File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs)118 public String installPackage(File packageFile, boolean reinstall, boolean grantPermissions, 119 String... extraArgs) throws DeviceNotAvailableException; 120 121 /** 122 * Install an Android package on device for a given user. 123 * 124 * @param packageFile the apk file to install 125 * @param reinstall <code>true</code> if a reinstall should be performed 126 * @param userId the integer user id to install for. 127 * @param extraArgs optional extra arguments to pass. See 'adb shell pm install --help' for 128 * available options. 129 * @return a {@link String} with an error code, or <code>null</code> if success. 130 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 131 * recovered. 132 */ installPackageForUser(File packageFile, boolean reinstall, int userId, String... extraArgs)133 public String installPackageForUser(File packageFile, boolean reinstall, int userId, 134 String... extraArgs) throws DeviceNotAvailableException; 135 136 /** 137 * Install an Android package on device for a given user. 138 * <p>Note: Only use cases that requires explicit control of granting runtime permission at 139 * install time should call this function. 140 * @param packageFile the apk file to install 141 * @param reinstall <code>true</code> if a reinstall should be performed 142 * @param grantPermissions if all runtime permissions should be granted at install time 143 * @param userId the integer user id to install for. 144 * @param extraArgs optional extra arguments to pass. See 'adb shell pm install --help' for 145 * available options. 146 * @return a {@link String} with an error code, or <code>null</code> if success. 147 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 148 * recovered. 149 * @throws UnsupportedOperationException if runtime permission is not supported by the platform 150 * on device. 151 */ installPackageForUser(File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs)152 public String installPackageForUser(File packageFile, boolean reinstall, 153 boolean grantPermissions, int userId, String... extraArgs) 154 throws DeviceNotAvailableException; 155 156 /** 157 * Uninstall an Android package from device. 158 * 159 * @param packageName the Android package to uninstall 160 * @return a {@link String} with an error code, or <code>null</code> if success. 161 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 162 * recovered. 163 */ uninstallPackage(String packageName)164 public String uninstallPackage(String packageName) throws DeviceNotAvailableException; 165 166 /** 167 * Grabs a screenshot from the device. 168 * 169 * @return a {@link InputStreamSource} of the screenshot in png format, or <code>null</code> if 170 * the screenshot was not successful. 171 * @throws DeviceNotAvailableException 172 */ getScreenshot()173 public InputStreamSource getScreenshot() throws DeviceNotAvailableException; 174 175 /** 176 * Grabs a screenshot from the device. 177 * Recommended to use getScreenshot(format) instead with JPEG encoding for smaller size 178 * @param format supported PNG, JPEG 179 * @return a {@link InputStreamSource} of the screenshot in format, or <code>null</code> if 180 * the screenshot was not successful. 181 * @throws DeviceNotAvailableException 182 */ getScreenshot(String format)183 public InputStreamSource getScreenshot(String format) throws DeviceNotAvailableException; 184 185 /** 186 * Grabs a screenshot from the device. Recommended to use {@link #getScreenshot(String)} instead 187 * with JPEG encoding for smaller size. 188 * 189 * @param format supported PNG, JPEG 190 * @param rescale if screenshot should be rescaled to reduce the size of resulting image 191 * @return a {@link InputStreamSource} of the screenshot in format, or <code>null</code> if the 192 * screenshot was not successful. 193 * @throws DeviceNotAvailableException 194 */ getScreenshot(String format, boolean rescale)195 public InputStreamSource getScreenshot(String format, boolean rescale) 196 throws DeviceNotAvailableException; 197 198 /** 199 * Clears the last connected wifi network. This should be called when starting a new invocation 200 * to avoid connecting to the wifi network used in the previous test after device reboots. 201 */ clearLastConnectedWifiNetwork()202 public void clearLastConnectedWifiNetwork(); 203 204 /** 205 * Connects to a wifi network. 206 * <p/> 207 * Turns on wifi and blocks until a successful connection is made to the specified wifi network. 208 * Once a connection is made, the instance will try to restore the connection after every reboot 209 * until {@link ITestDevice#disconnectFromWifi()} or 210 * {@link ITestDevice#clearLastConnectedWifiNetwork()} is called. 211 * 212 * @param wifiSsid the wifi ssid to connect to 213 * @param wifiPsk PSK passphrase or null if unencrypted 214 * @return <code>true</code> if connected to wifi network successfully. <code>false</code> 215 * otherwise 216 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 217 * recovered. 218 */ connectToWifiNetwork(String wifiSsid, String wifiPsk)219 public boolean connectToWifiNetwork(String wifiSsid, String wifiPsk) 220 throws DeviceNotAvailableException; 221 222 /** 223 * Connects to a wifi network. 224 * <p/> 225 * Turns on wifi and blocks until a successful connection is made to the specified wifi network. 226 * Once a connection is made, the instance will try to restore the connection after every reboot 227 * until {@link ITestDevice#disconnectFromWifi()} or 228 * {@link ITestDevice#clearLastConnectedWifiNetwork()} is called. 229 * 230 * @param wifiSsid the wifi ssid to connect to 231 * @param wifiPsk PSK passphrase or null if unencrypted 232 * @param scanSsid whether to scan for hidden SSID for this network. 233 * @return <code>true</code> if connected to wifi network successfully. <code>false</code> 234 * otherwise 235 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 236 * recovered. 237 */ connectToWifiNetwork(String wifiSsid, String wifiPsk, boolean scanSsid)238 public boolean connectToWifiNetwork(String wifiSsid, String wifiPsk, boolean scanSsid) 239 throws DeviceNotAvailableException; 240 241 /** 242 * A variant of {@link #connectToWifiNetwork(String, String)} that only connects if device 243 * currently does not have network connectivity. 244 * 245 * @param wifiSsid 246 * @param wifiPsk 247 * @return <code>true</code> if connected to wifi network successfully. <code>false</code> 248 * otherwise 249 * @throws DeviceNotAvailableException 250 */ connectToWifiNetworkIfNeeded(String wifiSsid, String wifiPsk)251 public boolean connectToWifiNetworkIfNeeded(String wifiSsid, String wifiPsk) 252 throws DeviceNotAvailableException; 253 254 /** 255 * A variant of {@link #connectToWifiNetwork(String, String)} that only connects if device 256 * currently does not have network connectivity. 257 * 258 * @param wifiSsid 259 * @param wifiPsk 260 * @param scanSsid whether to scan for hidden SSID for this network 261 * @return <code>true</code> if connected to wifi network successfully. <code>false</code> 262 * otherwise 263 * @throws DeviceNotAvailableException 264 */ connectToWifiNetworkIfNeeded(String wifiSsid, String wifiPsk, boolean scanSsid)265 public boolean connectToWifiNetworkIfNeeded(String wifiSsid, String wifiPsk, boolean scanSsid) 266 throws DeviceNotAvailableException; 267 268 /** 269 * Disconnects from a wifi network. 270 * <p/> 271 * Removes all networks from known networks list and disables wifi. 272 * 273 * @return <code>true</code> if disconnected from wifi network successfully. <code>false</code> 274 * if disconnect failed. 275 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 276 * recovered. 277 */ disconnectFromWifi()278 public boolean disconnectFromWifi() throws DeviceNotAvailableException; 279 280 /** 281 * Test if wifi is enabled. 282 * <p/> 283 * Checks if wifi is enabled on device. Useful for asserting wifi status before tests that 284 * shouldn't run with wifi, e.g. mobile data tests. 285 * 286 * @return <code>true</code> if wifi is enabled. <code>false</code> if disabled 287 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 288 * recovered. 289 */ isWifiEnabled()290 public boolean isWifiEnabled() throws DeviceNotAvailableException; 291 292 /** 293 * Gets the device's IP address. 294 * 295 * @return the device's IP address, or <code>null</code> if device has no IP address 296 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 297 * recovered. 298 */ getIpAddress()299 public String getIpAddress() throws DeviceNotAvailableException; 300 301 /** 302 * Enables network monitoring on device. 303 * 304 * @return <code>true</code> if monitoring is enabled successfully. <code>false</code> 305 * if it failed. 306 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 307 * recovered. 308 */ enableNetworkMonitor()309 public boolean enableNetworkMonitor() throws DeviceNotAvailableException; 310 311 /** 312 * Disables network monitoring on device. 313 * 314 * @return <code>true</code> if monitoring is disabled successfully. <code>false</code> 315 * if it failed. 316 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 317 * recovered. 318 */ disableNetworkMonitor()319 public boolean disableNetworkMonitor() throws DeviceNotAvailableException; 320 321 /** 322 * Check that device has network connectivity. 323 * 324 * @return <code>true</code> if device has a working network connection, 325 * <code>false</code> overwise. 326 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 327 * recovered. 328 */ checkConnectivity()329 public boolean checkConnectivity() throws DeviceNotAvailableException; 330 331 /** 332 * Attempt to dismiss any error dialogs currently displayed on device UI. 333 * 334 * @return <code>true</code> if no dialogs were present or dialogs were successfully cleared. 335 * <code>false</code> otherwise. 336 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 337 * recovered. 338 */ clearErrorDialogs()339 public boolean clearErrorDialogs() throws DeviceNotAvailableException; 340 341 /** 342 * Return an object to get the current state of the keyguard or null if not supported. 343 * 344 * @return a {@link KeyguardControllerState} containing a snapshot of the state of the keyguard 345 * and returns Null if the Keyguard query is not supported. 346 * @throws DeviceNotAvailableException if connection with device is lost and cannot be 347 * recovered. 348 */ getKeyguardState()349 public KeyguardControllerState getKeyguardState() throws DeviceNotAvailableException; 350 351 /** 352 * Fetch the test options for the device. 353 * 354 * @return {@link TestDeviceOptions} related to the device under test. 355 */ getOptions()356 public TestDeviceOptions getOptions(); 357 358 /** 359 * Fetch the application package names present on the device. 360 * 361 * @return {@link Set} of {@link String} package names currently installed on the device. 362 * @throws DeviceNotAvailableException 363 */ getInstalledPackageNames()364 public Set<String> getInstalledPackageNames() throws DeviceNotAvailableException; 365 366 /** 367 * Fetch the application package names that can be uninstalled. This is presently defined as 368 * non-system packages, and updated system packages. 369 * 370 * @return {@link Set} of uninstallable {@link String} package names currently installed on the 371 * device. 372 * @throws DeviceNotAvailableException 373 */ getUninstallablePackageNames()374 public Set<String> getUninstallablePackageNames() throws DeviceNotAvailableException; 375 376 /** 377 * Fetch information about a package installed on device. 378 * 379 * @return the {@link PackageInfo} or <code>null</code> if information could not be retrieved 380 * @throws DeviceNotAvailableException 381 */ getAppPackageInfo(String packageName)382 public PackageInfo getAppPackageInfo(String packageName) throws DeviceNotAvailableException; 383 384 /** 385 * Determines if multi user is supported. 386 * 387 * @return true if multi user is supported, false otherwise 388 * @throws DeviceNotAvailableException 389 */ isMultiUserSupported()390 public boolean isMultiUserSupported() throws DeviceNotAvailableException; 391 392 /** 393 * Create a user with a given name and default flags 0. 394 * 395 * @param name of the user to create on the device 396 * @return the integer for the user id created 397 * @throws DeviceNotAvailableException 398 */ createUser(String name)399 public int createUser(String name) throws DeviceNotAvailableException, IllegalStateException; 400 401 /** 402 * Create a user with a given name and the provided flags 403 * 404 * @param name of the user to create on the device 405 * @param guest enable the user flag --guest during creation 406 * @param ephemeral enable the user flag --ephemeral during creation 407 * @return id of the created user 408 * @throws DeviceNotAvailableException 409 */ createUser(String name, boolean guest, boolean ephemeral)410 public int createUser(String name, boolean guest, boolean ephemeral) 411 throws DeviceNotAvailableException, IllegalStateException; 412 413 /** 414 * Remove a given user from the device. 415 * 416 * @param userId of the user to remove 417 * @return true if we were successful in removing the user, false otherwise. 418 * @throws DeviceNotAvailableException 419 */ removeUser(int userId)420 public boolean removeUser(int userId) throws DeviceNotAvailableException; 421 422 /** 423 * Gets the list of users on the device. Will throw {@link DeviceRuntimeException} if output 424 * from device is not as expected. 425 * 426 * @return the list of user ids. 427 * @throws DeviceNotAvailableException 428 * @throws DeviceRuntimeException 429 */ listUsers()430 ArrayList<Integer> listUsers() throws DeviceNotAvailableException; 431 432 /** 433 * Get the maximum number of supported users. Defaults to 0. 434 * 435 * @return an integer indicating the number of supported users 436 * @throws DeviceNotAvailableException 437 */ getMaxNumberOfUsersSupported()438 public int getMaxNumberOfUsersSupported() throws DeviceNotAvailableException; 439 440 /** 441 * Get the maximum number of supported simultaneously running users. Defaults to 0. 442 * 443 * @return an integer indicating the number of simultaneously running users 444 * @throws DeviceNotAvailableException 445 */ getMaxNumberOfRunningUsersSupported()446 public int getMaxNumberOfRunningUsersSupported() throws DeviceNotAvailableException; 447 448 /** 449 * Starts a given user in the background if it is currently stopped. If the user is already 450 * running in the background, this method is a NOOP. 451 * @param userId of the user to start in the background 452 * @return true if the user was successfully started in the background. 453 * @throws DeviceNotAvailableException 454 */ startUser(int userId)455 public boolean startUser(int userId) throws DeviceNotAvailableException; 456 457 /** 458 * Stops a given user. If the user is already stopped, this method is a NOOP. 459 * Cannot stop current and system user. 460 * 461 * @param userId of the user to stop. 462 * @return true if the user was successfully stopped. 463 * @throws DeviceNotAvailableException 464 */ stopUser(int userId)465 public boolean stopUser(int userId) throws DeviceNotAvailableException; 466 467 /** 468 * Stop a given user. Possible to provide extra flags to wait for the operation to have effect, 469 * and force terminate the user. Cannot stop current and system user. 470 * 471 * @param userId of the user to stop. 472 * @param waitFlag will make the command wait until user is stopped. 473 * @param forceFlag will force stop the user. 474 * @return true if the user was successfully stopped. 475 * @throws DeviceNotAvailableException 476 */ stopUser(int userId, boolean waitFlag, boolean forceFlag)477 public boolean stopUser(int userId, boolean waitFlag, boolean forceFlag) 478 throws DeviceNotAvailableException; 479 480 /** 481 * Returns the primary user id. 482 * 483 * @return the userId of the primary user if there is one, and null if there is no primary user. 484 * @throws DeviceNotAvailableException 485 * @throws DeviceRuntimeException if the output from the device is not as expected. 486 */ getPrimaryUserId()487 public Integer getPrimaryUserId() throws DeviceNotAvailableException; 488 489 /** 490 * Return the id of the current running user. 491 * 492 * @throws DeviceNotAvailableException 493 */ getCurrentUser()494 public int getCurrentUser() throws DeviceNotAvailableException; 495 496 /** 497 * Find and return the flags of a given user. 498 * Flags are defined in "android.content.pm.UserInfo" class in Android Open Source Project. 499 * 500 * @return the flags associated with the userId provided if found, -10000 in any other cases. 501 * @throws DeviceNotAvailableException 502 */ getUserFlags(int userId)503 public int getUserFlags(int userId) throws DeviceNotAvailableException; 504 505 /** 506 * Return the serial number associated to the userId if found, -10000 in any other cases. 507 * 508 * @throws DeviceNotAvailableException 509 */ getUserSerialNumber(int userId)510 public int getUserSerialNumber(int userId) throws DeviceNotAvailableException; 511 512 /** 513 * Switch to another userId with a default timeout. {@link #switchUser(int, long)}. 514 * 515 * @return True if the new userId matches the userId provider. False otherwise. 516 * @throws DeviceNotAvailableException 517 */ switchUser(int userId)518 public boolean switchUser(int userId) throws DeviceNotAvailableException; 519 520 /** 521 * Switch to another userId with the provided timeout as deadline. 522 * Attempt to disable keyguard after user change is successful. 523 * 524 * @param timeout to wait before returning false for switch-user failed. 525 * @return True if the new userId matches the userId provider. False otherwise. 526 * @throws DeviceNotAvailableException 527 */ switchUser(int userId, long timeout)528 public boolean switchUser(int userId, long timeout) throws DeviceNotAvailableException; 529 530 /** 531 * Check if a given user is running. 532 * 533 * @return True if the user is running, false in every other cases. 534 * @throws DeviceNotAvailableException 535 */ isUserRunning(int userId)536 public boolean isUserRunning(int userId) throws DeviceNotAvailableException; 537 538 /** 539 * Check if a feature is available on a device. 540 * 541 * @param feature which format should be "feature:<name>". 542 * @return True if feature is found, false otherwise. 543 * @throws DeviceNotAvailableException 544 */ hasFeature(String feature)545 public boolean hasFeature(String feature) throws DeviceNotAvailableException; 546 547 /** 548 * See {@link #getSetting(int, String, String)} and performed on system user. 549 * 550 * @throws DeviceNotAvailableException 551 */ getSetting(String namespace, String key)552 public String getSetting(String namespace, String key) throws DeviceNotAvailableException; 553 554 /** 555 * Return the value of the requested setting. 556 * namespace must be one of: {"system", "secure", "global"} 557 * 558 * @return the value associated with the namespace:key of a user. Null if not found. 559 * @throws DeviceNotAvailableException 560 */ getSetting(int userId, String namespace, String key)561 public String getSetting(int userId, String namespace, String key) 562 throws DeviceNotAvailableException; 563 564 /** 565 * See {@link #setSetting(int, String, String, String)} and performed on system user. 566 * 567 * @throws DeviceNotAvailableException 568 */ setSetting(String namespace, String key, String value)569 public void setSetting(String namespace, String key, String value) 570 throws DeviceNotAvailableException; 571 572 /** 573 * Add a setting value to the namespace of a given user. Some settings will only be available 574 * after a reboot. 575 * namespace must be one of: {"system", "secure", "global"} 576 * 577 * @throws DeviceNotAvailableException 578 */ setSetting(int userId, String namespace, String key, String value)579 public void setSetting(int userId, String namespace, String key, String value) 580 throws DeviceNotAvailableException; 581 582 /** 583 * Find and return the android-id associated to a userId, null if not found. 584 * 585 * @throws DeviceNotAvailableException 586 */ getAndroidId(int userId)587 public String getAndroidId(int userId) throws DeviceNotAvailableException; 588 589 /** 590 * Create a Map of android ids found matching user ids. There is no insurance that each user 591 * id will found an android id associated in this function so some user ids may match null. 592 * 593 * @return Map of android ids found matching user ids. 594 * @throws DeviceNotAvailableException 595 */ getAndroidIds()596 public Map<Integer, String> getAndroidIds() throws DeviceNotAvailableException; 597 598 /** 599 * Set a device admin component as device owner in given user. 600 * 601 * @param componentName of device admin to be device owner. 602 * @param userId of the user that the device owner lives in. 603 * @return True if it is successful, false otherwise. 604 * @throws DeviceNotAvailableException 605 */ setDeviceOwner(String componentName, int userId)606 public boolean setDeviceOwner(String componentName, int userId) 607 throws DeviceNotAvailableException; 608 609 /** 610 * Remove given device admin in given user and return {@code true} if it is successful, {@code 611 * false} otherwise. 612 * 613 * @param componentName of device admin to be removed. 614 * @param userId of user that the device admin lives in. 615 * @return True if it is successful, false otherwise. 616 * @throws DeviceNotAvailableException 617 */ removeAdmin(String componentName, int userId)618 public boolean removeAdmin(String componentName, int userId) throws DeviceNotAvailableException; 619 620 /** 621 * Remove all existing device profile owners with the best effort. 622 * 623 * @throws DeviceNotAvailableException 624 */ removeOwners()625 public void removeOwners() throws DeviceNotAvailableException; 626 627 /** 628 * Attempts to disable the keyguard. 629 * <p> 630 * First wait for the input dispatch to become ready, this happens around the same time when the 631 * device reports BOOT_COMPLETE, apparently asynchronously, because current framework 632 * implementation has occasional race condition. Then command is sent to dismiss keyguard (works 633 * on non-secure ones only) 634 */ disableKeyguard()635 public void disableKeyguard() throws DeviceNotAvailableException; 636 637 /** 638 * Attempt to dump the heap from the system_server. It is the caller responsibility to clean up 639 * the dumped file. 640 * 641 * @param process the name of the device process to dumpheap on. 642 * @param devicePath the path on the device where to put the dump. This must be a location where 643 * permissions allow it. 644 * @return the {@link File} containing the report. Null if something failed. 645 * @throws DeviceNotAvailableException 646 */ dumpHeap(String process, String devicePath)647 public File dumpHeap(String process, String devicePath) throws DeviceNotAvailableException; 648 } 649