diff options
author | Mike Lockwood <lockwood@android.com> | 2011-02-28 17:05:12 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-28 17:05:12 -0800 |
commit | c93f67c2b746a6247744c8b50e8a1d5a566694c9 (patch) | |
tree | 9e31e6622b18de46611817d447b7311b974aed0f /services/java | |
parent | fae640b174f0a720690bab31a31dfd2693c67c63 (diff) | |
parent | f4ca247158ffb83139d675ac0e1d25239c310be2 (diff) | |
download | frameworks_base-c93f67c2b746a6247744c8b50e8a1d5a566694c9.zip frameworks_base-c93f67c2b746a6247744c8b50e8a1d5a566694c9.tar.gz frameworks_base-c93f67c2b746a6247744c8b50e8a1d5a566694c9.tar.bz2 |
Merge "Add platform features for USB host and USB accessory support."
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/usb/UsbService.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/services/java/com/android/server/usb/UsbService.java b/services/java/com/android/server/usb/UsbService.java index de4ac03..a093d95 100644 --- a/services/java/com/android/server/usb/UsbService.java +++ b/services/java/com/android/server/usb/UsbService.java @@ -108,13 +108,15 @@ public class UsbService extends IUsbManager.Stub { private final Context mContext; private final Object mLock = new Object(); private final UsbDeviceSettingsManager mDeviceManager; + private final boolean mHasUsbHost; + private final boolean mHasUsbAccessory; /* * Handles USB function enable/disable events (device mode) */ private final void functionEnabledLocked(String function, boolean enabled) { boolean enteringAccessoryMode = - (enabled && UsbManager.USB_FUNCTION_ACCESSORY.equals(function)); + (mHasUsbAccessory && enabled && UsbManager.USB_FUNCTION_ACCESSORY.equals(function)); if (enteringAccessoryMode) { // keep a list of functions to reenable after exiting accessory mode @@ -207,6 +209,9 @@ public class UsbService extends IUsbManager.Stub { public UsbService(Context context) { mContext = context; mDeviceManager = new UsbDeviceSettingsManager(context); + PackageManager pm = mContext.getPackageManager(); + mHasUsbHost = pm.hasSystemFeature(PackageManager.FEATURE_USB_HOST); + mHasUsbAccessory = pm.hasSystemFeature(PackageManager.FEATURE_USB_ACCESSORY); mHostBlacklist = context.getResources().getStringArray( com.android.internal.R.array.config_usbHostBlacklist); @@ -378,8 +383,7 @@ public class UsbService extends IUsbManager.Stub { public void systemReady() { synchronized (mLock) { - if (mContext.getResources().getBoolean( - com.android.internal.R.bool.config_hasUsbHostSupport)) { + if (mHasUsbHost) { // start monitoring for connected USB devices initHostSupport(); } |