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

Unified Diff: build/android/pylib/android_commands.py

Issue 143263017: Make api_strict_mode the default in AndroidCommands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more cases Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/gyp/util/build_device.py ('k') | build/android/pylib/utils/test_environment.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/android_commands.py
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index 1099eb0992b4fba4b35ae47e6add6e01247296dc..a62812877de7bb5bd3c24830cc0ec464b83bc944 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -231,14 +231,12 @@ def GetLogTimestamp(log_line, year):
class AndroidCommands(object):
"""Helper class for communicating with Android device via adb."""
- def __init__(self, device=None, api_strict_mode=False):
+ def __init__(self, device=None):
"""Constructor.
Args:
device: If given, adb commands are only send to the device of this ID.
Otherwise commands are sent to all attached devices.
- api_strict_mode: A boolean indicating whether fatal errors should be
- raised if this API is used improperly.
"""
adb_dir = os.path.dirname(constants.GetAdbPath())
if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep):
@@ -257,16 +255,9 @@ class AndroidCommands(object):
self._actual_push_size = 0
self._external_storage = ''
self._util_wrapper = ''
- self._api_strict_mode = api_strict_mode
self._system_properties = system_properties.SystemProperties(self.Adb())
self._push_if_needed_cache = {}
- if not self._api_strict_mode:
- logging.warning(
- 'API STRICT MODE IS DISABLED.\n'
- 'It should be enabled as soon as possible as it will eventually '
- 'become the default.')
-
@property
def system_properties(self):
return self._system_properties
@@ -281,7 +272,8 @@ class AndroidCommands(object):
def Adb(self):
"""Returns our AdbInterface to avoid us wrapping all its methods."""
- # TODO(tonyg): Disable this method when in _api_strict_mode.
+ # TODO(tonyg): Goal should be to git rid of this method by making this API
+ # complete and alleviating the need.
return self._adb
def GetDevice(self):
@@ -611,12 +603,9 @@ class AndroidCommands(object):
(base_command not in whitelisted_callers or
whitelisted_callers[base_command] not in [
f[3] for f in inspect.stack()])):
- error_msg = ('%s cannot be run directly. Instead use: %s' %
+ error_msg = ('%s should not be run directly. Instead use: %s' %
(base_command, preferred_apis[base_command]))
- if self._api_strict_mode:
- raise ValueError(error_msg)
- else:
- logging.warning(error_msg)
+ raise ValueError(error_msg)
# It is tempting to turn this function into a generator, however this is not
# possible without using a private (local) adb_shell instance (to ensure no
« no previous file with comments | « build/android/gyp/util/build_device.py ('k') | build/android/pylib/utils/test_environment.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698