68 Commits

Author SHA1 Message Date
Jeff Brown
e8eea12a24 Allow system server to bind to USB devices.
Change-Id: I31f9ed1ff3fcda53f62f08ae198d18d0df3321b7
2013-03-28 03:15:40 -07:00
Benoit Goby
cd7a17c645 UsbDebuggingManager: Add interface to clear secure adb keys
This is called from Settings that has a button to clear secure
adb public keys installed on the device.

Change-Id: I63ef499c049766ef13ea6cb0594ed6719f35e5f3
2013-01-28 19:15:30 -08:00
Benoit Goby
78a9687fc2 UsbDeviceManager: Don't start UsbDebuggingManager when data is encrypted
This avoids showing the confirmation dialog from the decryption screen

Bug: 8019508
Change-Id: I7ff364437f6b8aeea26fa8308aa4fe35b7ede5d7
2013-01-25 16:58:13 -08:00
Dianne Hackborn
fd7adedebf Add new disabled state for "optional" built-in apps.
The disabled state allows you to make an app disabled
except for whatever parts of the system still want to
provide access to them and automatically enable them
if the user want to use it.

Currently the input method manager service is the only
part of the system that supports this, so you can put
an IME in this state and it will generally look disabled
but still be available in the IME list and once selected
switched to the enabled state.

Change-Id: I77f01c70610d82ce9070d4aabbadec8ae2cff2a3
2013-01-22 17:10:23 -08:00
Jeff Sharkey
8b2c3a1460 Useful annotations for code documentation.
Bug: 6537978
Change-Id: I806c3c09e3255f8789455f13bf37c1dde2a93f1f
2012-11-12 12:42:17 -08:00
Dianne Hackborn
7ff30113de Remove extraneous logs.
Change-Id: I4c47d36748de91bd6fddc419afbf59552bf63e9a
2012-11-08 13:13:48 -08:00
Jeff Sharkey
fc3f24b4b6 Make USB services multi-user aware.
USB settings are now isolated per-user, since they revolve around
installed packages.  User-specific settings are returned based on
calling user, or referenced by UserHandle passed to SystemUI.  Each
settings Context is wrapped as a specific user, so all broadcasts are
sent correctly.  Upgrades any existing USB settings to OWNER.

Physical events, like new devices, are routed to the currently active
user.  Switch to using AtomicFile when persisting settings.

Bug: 7244888
Change-Id: I8a723ad3d55ac1bff99276c5f3a3f5e8f013432f
2012-10-02 18:09:10 -07:00
Jeff Brown
bf6f6f9de7 Update references to migrated global settings.
Fixed one setting that was migrated but not marked deprecated.

Removed a hidden setting that is no longer used by the new
power manager service.

Bug: 7231172
Change-Id: I332f020f876a18d519a1a20598a172f1c98036f7
2012-09-25 15:27:51 -07:00
Dianne Hackborn
50cdf7c306 Fix issue #7214090: Need to be able to post notifications to all users
Also fix a bunch of system services that should be doing this.  And
while doing that, found I needed to fix PendingIntent to evaluate
USER_CURRENT at the point of sending, not creation.

Note that this may end up with us having some notification shown to
non-primary users that lead to settings UI that should only be for
the primary user (such as the vpn notification).  I'm not sure what
to do about this, maybe we need a different UI to come up there or
something, but showing the actual notification for those users at
least seems less broken than not telling them at all.

Change-Id: Iffc51e2d7c847e3d05064d292ab93937646a1ab7
2012-09-24 10:55:46 -07:00
Jeff Sharkey
27bd34d9d9 Multi-user MTP.
The current MTP kernel driver at /dev/mtp_usb is exclusive, meaning
only one process can have it open. In addition, each MTP session
with a desktop requires unique object IDs, which doesn't hold true
across users on the device.

To solve these two issues, when switching users we cycle the USB host
stack to disconnect both local and remote MTP connections, giving the
new user's media process a chance to claim /dev/mtp_usb, and causing
the desktop to initiate a new MTP session.

This change also allows BroadcastReceivers to registerReceiver()
allow retrieval of a current sticky broadcast. Adds a system property
to override maximum users. Removes MOUNTED broadcasts for secondary
users. Allows INTERACT_ACROSS_USERS to getCurrentUser().

Bug: 6925114
Change-Id: I02b4a1b535af95fb2142655887b6d15a8068d18a
2012-09-18 13:26:26 -07:00
Jeff Sharkey
b049e212ab Include user identifier in external storage paths.
When building external storage paths, always include user in path
to enable cross-user paths and aid debugging.

Each Zygote process continues to only have access to the appropriate
user-specific emulated storage through bind mounts. A second set of
mounts continue supporting legacy /sdcard-style paths. For example,
a process running as owner has these mount points:

/storage/emulated_legacy
/storage/emulated_legacy/Android/obb
/storage/emulated/0
/storage/emulated/obb

Since Environment is created before Zygote forks, we need to update
its internal paths after each process launches.

Bug: 7131382
Change-Id: I6f8c6971f2a8edfb415c14cb4ed05ff97e587a21
2012-09-11 23:11:14 -07:00
Dianne Hackborn
5ac72a2959 Improve multi-user broadcasts.
You can now use ALL and CURRENT when sending broadcasts, to specify
where the broadcast goes.

Sticky broadcasts are now correctly separated per user, and registered
receivers are filtered based on the requested target user.

New Context APIs for more kinds of sending broadcasts as users.

Updating a bunch of system code that sends broadcasts to explicitly
specify which user the broadcast goes to.

Made a single version of the code for interpreting the requested
target user ID that all entries to activity manager (start activity,
send broadcast, start service) use.

Change-Id: Ie29f02dd5242ef8c8fa56c54593a315cd2574e1c
2012-08-30 14:33:22 -07:00
Benoit Goby
509bf2d2cf UsbDebuggingManager: Fix restart when toggling USB debugging
Change-Id: Iaaec9162b03c4ea77735d096eec670392c61308a
2012-08-29 15:43:51 -07:00
Benoit Goby
37ce5c5d5e UsbDebuggingManager: add missing break in switch
Bug: 7079044
Change-Id: Icf4090e79af47db7d068981537c97f2028d8e405
2012-08-29 13:52:17 -07:00
Benoit Goby
4e68bd420b Add UsbDebuggingManager and UsbDebuggingActivity
The UsbDebuggingManager listens to adbd requests and displays a dialog
when the public key authentification fails, for the user to confirm if it
wants to allow USB debugging from the attached host. If the user chooses
to always allow USB debugging, the UsbDebuggingManager writes the public
key to adbd's config file so that the public key authenfication succeeds
next time.

Change-Id: I115c828331d8e326c380844ee33915d5dff22260
2012-08-20 13:44:34 -07:00
Mike Lockwood
9064a48365 Merge "Added missing USB_DEVICE_ATTACHED broadcast to running Activity" 2012-08-13 19:59:38 -07:00
Robin Cutshaw
8299105457 Added missing USB_DEVICE_ATTACHED broadcast to running Activity
If an Activity programatically adds an ACTION_USB_DEVICE_ATTACHED intent,
it will never be delivered when the device is attached.  This change adds
the missing intent broadcast to running Activities.

File changes:
	modified:   services/java/com/android/server/usb/UsbSettingsManager.java

Change-Id: I767ee4d0765a7901c36e4c6f4aaf6583da2ac6f4
Signed-off-by: Robin Cutshaw <robin.cutshaw@gmail.com>
2012-06-18 09:28:29 -04:00
Mike Lockwood
b86bc1058b Merge "UsbService: Fix problem detecting audio accessory mode when connected at boot" into jb-dev 2012-05-10 11:02:20 -07:00
Mike Lockwood
bf91046872 UsbService: Fix problem detecting audio accessory mode when connected at boot
Change-Id: Ie0e23b8ec88f1dd29bb956bc1d21c241f3545059
Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-05-10 10:09:12 -07:00
Daniel Sandler
a25079e6ba Show the ADB icon in the status bar again.
Bug: 6440323
Change-Id: I3b1972d18be4ad77a87c4b71673b6cfb7735c59e
2012-05-10 11:01:34 -04:00
Mike Lockwood
166b05e0ce UsbService: Add support for accessory initiating USB audio support
Change-Id: I0e468f4b841de9e1ca7b75a05fc58299dbc78222
Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-04-26 15:09:35 -07:00
Dianne Hackborn
d0d7503fd3 Move handling of package changes to a background thread.
Helps get rid of some jank when installing applications.

Change-Id: I97d0022f82d67796e334d37086e5911dd6ca6b62
2012-04-19 23:12:09 -07:00
Mike Lockwood
9d5a4be05b Add Intents to notify when USB audio devices or accessories are attached
In this change, only the USB audio accessory support is implemented.

Change-Id: Id9b411319b07a96dc56649ca74cc5f3f89a55a7c
Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-04-06 11:00:27 -07:00
Daniel Sandler
49a2ad1f40 Stop showing ADB and MTP/PTP/USB notifications at the top.
Two parts to this:
1. Stop treating FLAG_ONGOING_EVENT notifications specially
   (in particular, ordering them at the top of the panel).
2. Set the priority bits on the system UI notifications
   appropriately (low).

Change-Id: I3bde7e573654c5aad5e1c5d29e6a21ba94edcc5b
2012-03-29 00:42:16 -04:00
RoboErik
dab2072365 fix setting only usb mode
If you cleared the last usb mode it would fail (and so would setting
it if you started with none). This fixes it to set and unset the
last property correctly.

Change-Id: Ice5be6e57b6ca6b8c9241b0ac62071a3bc72606a
2012-03-22 15:09:36 -07:00
Kazuhiro Ondo
afd8f1820e Add OEM specific USB mode enumeration based on ro.bootmode property
This patch is adding a capability so that OEM can override USB mode
in case the device is boot up with OEM specific mode. (i.e. modem
debug, factory test etc.)

Bug:5964042
Change-Id: Ic8e23d302563ce71eedb74ce94cca8c65838a4f7
2012-02-10 12:29:12 -08:00
Christopher Tate
765f97d5e6 Make sure to go to the right Settings panel when tapping a notification
We now use Intent.makeRestartActivityTask() to build the notification
PendingIntent objects, so that when tapped they restart the activity
in the desired state.

Fixes bug 5011926

Change-Id: Ie1ec3543cc0f49d1bd407622a617316cf53a078c
2011-08-24 14:06:00 -07:00
Mike Lockwood
fadd2b8e0f UsbManager: Use resource IDs for notification IDs
to avoid ID collisions with other system services.

Bug: 5161005

Change-Id: I069fbc40a8764bc85cceeacd04264abd32b62668
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-08-16 13:45:51 -07:00
Mike Lockwood
1984e79d15 UsbDeviceManager: Fix typo that broke adb on/off setting persistence
Bug: 5108784

Change-Id: I68ed4d442ce4d3f4651cb618902fb226ac5a3673
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-08-03 17:10:43 -04:00
Mike Lockwood
8b4d36e866 USB: Fix NPE that occurred when restoring default function in UsbManager.setEnabledFunctions
Bug: 5110020

Change-Id: I5e4b5c27e4675fa6830823832ae51411dc448191
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-08-02 18:18:09 -04:00
Mike Lockwood
68736cbf93 Clean up USB configuration switching logic and beef up error handling
Bug: 5050853

Change-Id: Ia00698e2adbb8a7d7698e2ae306413f6c715fbdb
2011-07-29 14:41:14 -04:00
Mike Lockwood
a5010431bf UsbDeviceManager: Don't show USB notification for RNDIS
since USB tethering already has a notification.

Bug: 4988511

Change-Id: I928cb1e1d191c77340f7f05edfa80a74cdabe6ed
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-27 09:56:06 -04:00
Mike Lockwood
6e680dea3b UsbDeviceManager: Add USB notification string for USB accessory mode
Bug: 5062341

Change-Id: I93af8274e538009dd8f00d1cea782b62334e43f1
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-21 15:36:09 -07:00
Mike Lockwood
d462ecf8f8 USB: Fix handling USB accessory attached when device is booting
Also defer anything that could start an activity from "system ready"
to "boot completed" time.

Bug: 5051683

Change-Id: I69db751cb991dd247bd0ac3c70a0d84c0d71f365
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-21 14:30:36 -07:00
Mike Lockwood
875c24b897 UsbManager: document that passing null setCurrentFunction restores default function
Change-Id: I4340b336f3e91b3b8242f2a66c34a7a7f5c3021f
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-18 10:54:32 -07:00
Mike Lockwood
3fd13eb632 UsbDeviceManager: clean up HandlerThread creation
Change-Id: I84683b1753fcf3c3b501f8a506d6d890edf2eb37
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-13 09:39:54 -04:00
Mike Lockwood
6ea146c239 UsbDeviceManager: Include kernel USB state in dumpsys output
Change-Id: Ia7f015057e24f376e285a40e583644f9d0b9213e
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-11 18:23:44 -04:00
Mike Lockwood
c264afeb55 UsbDeviceManager: Initialize state based on persist.sys.usb.config rather than current kernel state
This makes it more robust when recovering from runtime restarts

Bug: 4986841

Change-Id: I54b94213447130ca881c66da2d0ce490242f0c96
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-11 18:23:44 -04:00
Mike Lockwood
abc4ac6d48 UsbDeviceManager: Fix indentation
Change-Id: I3eb1d407bdb4bf885d1765eedbfb30555f558b3b
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-11 13:40:08 -04:00
Mike Lockwood
629b149ff5 UsbDeviceManager: Initialize RNDIS ethernet address based on device serial number
Change-Id: I4775e5d8350385777f70f1b28ac00aa22dbd9487
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-06 12:52:49 -04:00
Mike Lockwood
c50bff8528 UsbService: USB connected notification now redirects to USB screen in Settings
Change-Id: I2dc6d1294da53acfa7589ba5b693ec671695cd21
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-02 22:07:35 -04:00
Mike Lockwood
de296f6448 UsbDeviceManager: Reset sys.usb.config if it is "none" at boot
This will allow us to recover if we crash while changing USB configurations

Change-Id: I22ba9a1ff0a8bcbfd4a0f18af0c95a3b66b99060
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-01 14:55:23 -04:00
Mike Lockwood
fdc0c2984d UsbService: Use Slog instead of Log, and disable some logging
Change-Id: I094ab99919055848a9fa76363eae6d0df51de9fd
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-01 14:55:23 -04:00
Mike Lockwood
d8404d2fdd USB: Update strings for USB connected notifications
We now have different strings depending on the current USB mode.

Change-Id: Icc6392d5700a6fee008b75287d8eb0f06db1d880
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-01 14:55:23 -04:00
Mike Lockwood
f59717ddb5 Combine UsbManager.setPrimaryFunction and setDefaultFunction
Due to the property trigger on persist.sys.usb.config,
setting the default function also sets the current function.
Now we combine both of these methods into setCurrentFunction, which has
a "makeDefault" option to make the new function the default.

This change should eliminate some problems with setting properties due to
multiple property triggers happening at the same time.

Change-Id: I9851299e9c2ee20475eada1a8104c0d50bf5a9e1
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-22 15:19:33 -04:00
Mike Lockwood
5787a2d5b4 USB connected notification and temporary USB options dialog
This change adds a notification when USB is connected.
Selecting the notification brings up a dialog to allow switching between
MTP and PTP modes, and also allows mounting a CD image for installing AFT.
The UI design is not final - this is a temporary implementation of the UI.

Change-Id: Idd678537aba595fd4cb183ea755bf437f372d826
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-17 19:49:05 -04:00
Mike Lockwood
02e4569b5f USB: Support for new USB gadget drivers
Change-Id: Id08df50acb873a94f4765a991ee6a6f5b898ddf5
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-17 19:49:05 -04:00
Mike Lockwood
541c9949ae Move adb related functionality from SystemServer and NotificationManagerService to UsbDeviceManager
Change-Id: I9e64b54bc2d027d88ae2d2cd893068e29b6fe237
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-13 22:20:06 -04:00
Mike Lockwood
9eb014aeb0 UsbManager: Clean up extras for ACTION_USB_STATE broadcast
Also added name for new PTP USB function

Change-Id: Ia2775ba2b23ef6a6108ca7e060239eb51c2eecc8
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-08 09:17:45 -07:00
Mike Lockwood
46d0adf825 UsbService: Refactor USB host and device support into two separate classes
Host support is in UsbHostManager, device support is in UsbDeviceManager

Renamed UsbDeviceSettingsManager to UsbSettingsManager

Change-Id: Ib76e72957c233fa7f08f454d4d9a2a1da6368cc7
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-05-31 20:52:06 -04:00