Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: devil/devil/android/device_utils.py

Issue 2967283002: Revert of [devil] Always set permissions on install (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Provides a variety of device interactions based on adb. 5 """Provides a variety of device interactions based on adb.
6 6
7 Eventually, this will be based on adb_wrapper. 7 Eventually, this will be based on adb_wrapper.
8 """ 8 """
9 # pylint: disable=unused-argument 9 # pylint: disable=unused-argument
10 10
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 self._cache['package_apk_paths'].pop(package_name, 0) 831 self._cache['package_apk_paths'].pop(package_name, 0)
832 self._cache['package_apk_checksums'].pop(package_name, 0) 832 self._cache['package_apk_checksums'].pop(package_name, 0)
833 if split_apks: 833 if split_apks:
834 partial = package_name if len(apks_to_install) < len(all_apks) else None 834 partial = package_name if len(apks_to_install) < len(all_apks) else None
835 self.adb.InstallMultiple( 835 self.adb.InstallMultiple(
836 apks_to_install, partial=partial, reinstall=reinstall, 836 apks_to_install, partial=partial, reinstall=reinstall,
837 allow_downgrade=allow_downgrade) 837 allow_downgrade=allow_downgrade)
838 else: 838 else:
839 self.adb.Install( 839 self.adb.Install(
840 base_apk.path, reinstall=reinstall, allow_downgrade=allow_downgrade) 840 base_apk.path, reinstall=reinstall, allow_downgrade=allow_downgrade)
841 if (permissions is None
842 and self.build_version_sdk >= version_codes.MARSHMALLOW):
843 permissions = base_apk.GetPermissions()
844 self.GrantPermissions(package_name, permissions)
845 # Upon success, we know the device checksums, but not their paths.
846 if host_checksums is not None:
847 self._cache['package_apk_checksums'][package_name] = host_checksums
841 else: 848 else:
842 # Running adb install terminates running instances of the app, so to be 849 # Running adb install terminates running instances of the app, so to be
843 # consistent, we explicitly terminate it when skipping the install. 850 # consistent, we explicitly terminate it when skipping the install.
844 self.ForceStop(package_name) 851 self.ForceStop(package_name)
845 852
846 if (permissions is None
847 and self.build_version_sdk >= version_codes.MARSHMALLOW):
848 permissions = base_apk.GetPermissions()
849 self.GrantPermissions(package_name, permissions)
850 # Upon success, we know the device checksums, but not their paths.
851 if host_checksums is not None:
852 self._cache['package_apk_checksums'][package_name] = host_checksums
853
854 @decorators.WithTimeoutAndRetriesFromInstance() 853 @decorators.WithTimeoutAndRetriesFromInstance()
855 def Uninstall(self, package_name, keep_data=False, timeout=None, 854 def Uninstall(self, package_name, keep_data=False, timeout=None,
856 retries=None): 855 retries=None):
857 """Remove the app |package_name| from the device. 856 """Remove the app |package_name| from the device.
858 857
859 This is a no-op if the app is not already installed. 858 This is a no-op if the app is not already installed.
860 859
861 Args: 860 Args:
862 package_name: The package to uninstall. 861 package_name: The package to uninstall.
863 keep_data: (optional) Whether to keep the data and cache directories. 862 keep_data: (optional) Whether to keep the data and cache directories.
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2697 on: bool to decide state to switch to. True = on False = off. 2696 on: bool to decide state to switch to. True = on False = off.
2698 """ 2697 """
2699 def screen_test(): 2698 def screen_test():
2700 return self.IsScreenOn() == on 2699 return self.IsScreenOn() == on
2701 2700
2702 if screen_test(): 2701 if screen_test():
2703 logger.info('Screen already in expected state.') 2702 logger.info('Screen already in expected state.')
2704 return 2703 return
2705 self.SendKeyEvent(keyevent.KEYCODE_POWER) 2704 self.SendKeyEvent(keyevent.KEYCODE_POWER)
2706 timeout_retry.WaitFor(screen_test, wait_period=1) 2705 timeout_retry.WaitFor(screen_test, wait_period=1)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698