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
3 # found in the LICENSE file.
5 """Manages intents and associated information.
7 This is generally intended to be used with functions that calls Android's
13 def __init__(self, action='android.intent.action.VIEW', activity=None,
14 category=None, component=None, data=None, extras=None,
15 flags=None, package=None):
19 action: A string containing the action.
20 activity: A string that, with |package|, can be used to specify the
22 category: A string or list containing any categories.
23 component: A string that specifies the component to send the intent to.
24 data: A string containing a data URI.
25 extras: A dict containing extra parameters to be passed along with the
27 flags: A string containing flags to pass.
28 package: A string that, with activity, can be used to specify the
32 self._activity = activity
33 if isinstance(category, list) or category is None:
34 self._category = category
36 self._category = [category]
37 self._component = component
41 self._package = package
43 if self._component and '/' in component:
44 self._package, self._activity = component.split('/', 1)
45 elif self._package and self._activity:
46 self._component = '%s/%s' % (package, activity)
62 return self._component