diff options
author | Mike Lockwood <lockwood@android.com> | 2011-03-01 10:23:48 -0800 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2011-03-01 23:09:12 -0800 |
commit | 40bbf9295d5245d3917629ce15f7b37670aef1ac (patch) | |
tree | 40bb301c9e739a9026a6351c3d79c80ea43ca01b /core/java/android/app | |
parent | db52ab69f22e24615eaa2e8f9845e157426d3dd6 (diff) | |
download | frameworks_base-40bbf9295d5245d3917629ce15f7b37670aef1ac.zip frameworks_base-40bbf9295d5245d3917629ce15f7b37670aef1ac.tar.gz frameworks_base-40bbf9295d5245d3917629ce15f7b37670aef1ac.tar.bz2 |
DO NOT MERGE: Backport USB accessory support to gingerbread
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'core/java/android/app')
-rw-r--r-- | core/java/android/app/ContextImpl.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 50ec34f..fb9335b 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -62,6 +62,8 @@ import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.hardware.SensorManager; +import android.hardware.usb.IUsbManager; +import android.hardware.usb.UsbManager; import android.location.ILocationManager; import android.location.LocationManager; import android.media.AudioManager; @@ -191,6 +193,7 @@ class ContextImpl extends Context { private SearchManager mSearchManager = null; private SensorManager mSensorManager = null; private StorageManager mStorageManager = null; + private UsbManager mUsbManager = null; private Vibrator mVibrator = null; private LayoutInflater mLayoutInflater = null; private StatusBarManager mStatusBarManager = null; @@ -954,6 +957,8 @@ class ContextImpl extends Context { return getSensorManager(); } else if (STORAGE_SERVICE.equals(name)) { return getStorageManager(); + } else if (USB_SERVICE.equals(name)) { + return getUsbManager(); } else if (VIBRATOR_SERVICE.equals(name)) { return getVibrator(); } else if (STATUS_BAR_SERVICE.equals(name)) { @@ -1148,6 +1153,17 @@ class ContextImpl extends Context { return mStorageManager; } + private UsbManager getUsbManager() { + synchronized (mSync) { + if (mUsbManager == null) { + IBinder b = ServiceManager.getService(USB_SERVICE); + IUsbManager service = IUsbManager.Stub.asInterface(b); + mUsbManager = new UsbManager(service); + } + } + return mUsbManager; + } + private Vibrator getVibrator() { synchronized (mSync) { if (mVibrator == null) { |