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

Unified Diff: build/android/pylib/device/intent.py

Issue 2392643003: Removes files from //build that we don't need (Closed)
Patch Set: Created 4 years, 2 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/pylib/device/device_utils_test.py ('k') | build/android/pylib/device/logcat_monitor.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/intent.py
diff --git a/build/android/pylib/device/intent.py b/build/android/pylib/device/intent.py
deleted file mode 100644
index 333b9f1f10878aded59556f25fe045495a3f4221..0000000000000000000000000000000000000000
--- a/build/android/pylib/device/intent.py
+++ /dev/null
@@ -1,113 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Manages intents and associated information.
-
-This is generally intended to be used with functions that calls Android's
-Am command.
-"""
-
-class Intent(object):
-
- def __init__(self, action='android.intent.action.VIEW', activity=None,
- category=None, component=None, data=None, extras=None,
- flags=None, package=None):
- """Creates an Intent.
-
- Args:
- action: A string containing the action.
- activity: A string that, with |package|, can be used to specify the
- component.
- category: A string or list containing any categories.
- component: A string that specifies the component to send the intent to.
- data: A string containing a data URI.
- extras: A dict containing extra parameters to be passed along with the
- intent.
- flags: A string containing flags to pass.
- package: A string that, with activity, can be used to specify the
- component.
- """
- self._action = action
- self._activity = activity
- if isinstance(category, list) or category is None:
- self._category = category
- else:
- self._category = [category]
- self._component = component
- self._data = data
- self._extras = extras
- self._flags = flags
- self._package = package
-
- if self._component and '/' in component:
- self._package, self._activity = component.split('/', 1)
- elif self._package and self._activity:
- self._component = '%s/%s' % (package, activity)
-
- @property
- def action(self):
- return self._action
-
- @property
- def activity(self):
- return self._activity
-
- @property
- def category(self):
- return self._category
-
- @property
- def component(self):
- return self._component
-
- @property
- def data(self):
- return self._data
-
- @property
- def extras(self):
- return self._extras
-
- @property
- def flags(self):
- return self._flags
-
- @property
- def package(self):
- return self._package
-
- @property
- def am_args(self):
- """Returns the intent as a list of arguments for the activity manager.
-
- For details refer to the specification at:
- - http://developer.android.com/tools/help/adb.html#IntentSpec
- """
- args = []
- if self.action:
- args.extend(['-a', self.action])
- if self.data:
- args.extend(['-d', self.data])
- if self.category:
- args.extend(arg for cat in self.category for arg in ('-c', cat))
- if self.component:
- args.extend(['-n', self.component])
- if self.flags:
- args.extend(['-f', self.flags])
- if self.extras:
- for key, value in self.extras.iteritems():
- if value is None:
- args.extend(['--esn', key])
- elif isinstance(value, str):
- args.extend(['--es', key, value])
- elif isinstance(value, bool):
- args.extend(['--ez', key, str(value)])
- elif isinstance(value, int):
- args.extend(['--ei', key, str(value)])
- elif isinstance(value, float):
- args.extend(['--ef', key, str(value)])
- else:
- raise NotImplementedError(
- 'Intent does not know how to pass %s extras' % type(value))
- return args
« no previous file with comments | « build/android/pylib/device/device_utils_test.py ('k') | build/android/pylib/device/logcat_monitor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698