Loading Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ LOCAL_SRC_FILES += \ core/java/android/content/pm/IPackageMoveObserver.aidl \ core/java/android/content/pm/IPackageStatsObserver.aidl \ core/java/android/database/IContentObserver.aidl \ core/java/android/hardware/usb/IUsbManager.aidl \ core/java/android/net/IConnectivityManager.aidl \ core/java/android/net/INetworkManagementEventObserver.aidl \ core/java/android/net/IThrottleManager.aidl \ Loading core/java/android/app/ContextImpl.java +16 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,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; Loading Loading @@ -188,6 +190,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; Loading Loading @@ -951,6 +954,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)) { Loading Loading @@ -1145,6 +1150,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) { Loading core/java/android/content/Context.java +11 −0 Original line number Diff line number Diff line Loading @@ -1566,6 +1566,17 @@ public abstract class Context { /** @hide */ public static final String SIP_SERVICE = "sip"; /** * Use with {@link #getSystemService} to retrieve a {@link * android.hardware.usb.UsbManager} for access to USB devices (as a USB host) * and for controlling this device's behavior as a USB device. * * @see #getSystemService * @see android.harware.usb.UsbManager * @hide */ public static final String USB_SERVICE = "usb"; /** * Determine whether the given permission is allowed for a particular * process and user ID running in the system. Loading core/java/android/content/pm/PackageManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -783,6 +783,13 @@ public abstract class PackageManager { @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports connecting to USB accessories. * @hide */ public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The SIP API is enabled on the device. Loading core/java/android/hardware/usb/IUsbManager.aidl 0 → 100644 +47 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.hardware.usb; import android.hardware.usb.UsbAccessory; import android.os.Bundle; import android.os.ParcelFileDescriptor; /** @hide */ interface IUsbManager { /* Returns the currently attached USB accessory */ UsbAccessory getCurrentAccessory(); /* Returns a file descriptor for communicating with the USB accessory. * This file descriptor can be used with standard Java file operations. */ ParcelFileDescriptor openAccessory(in UsbAccessory accessory); /* Sets the default package for a USB accessory * (or clears it if the package name is null) */ void setAccessoryPackage(in UsbAccessory accessory, String packageName); /* Grants permission for the given UID to access the accessory */ void grantAccessoryPermission(in UsbAccessory accessory, int uid); /* Returns true if the USB manager has default preferences or permissions for the package */ boolean hasDefaults(String packageName, int uid); /* Clears default preferences and permissions for the package */ oneway void clearDefaults(String packageName, int uid); } Loading
Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ LOCAL_SRC_FILES += \ core/java/android/content/pm/IPackageMoveObserver.aidl \ core/java/android/content/pm/IPackageStatsObserver.aidl \ core/java/android/database/IContentObserver.aidl \ core/java/android/hardware/usb/IUsbManager.aidl \ core/java/android/net/IConnectivityManager.aidl \ core/java/android/net/INetworkManagementEventObserver.aidl \ core/java/android/net/IThrottleManager.aidl \ Loading
core/java/android/app/ContextImpl.java +16 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,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; Loading Loading @@ -188,6 +190,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; Loading Loading @@ -951,6 +954,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)) { Loading Loading @@ -1145,6 +1150,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) { Loading
core/java/android/content/Context.java +11 −0 Original line number Diff line number Diff line Loading @@ -1566,6 +1566,17 @@ public abstract class Context { /** @hide */ public static final String SIP_SERVICE = "sip"; /** * Use with {@link #getSystemService} to retrieve a {@link * android.hardware.usb.UsbManager} for access to USB devices (as a USB host) * and for controlling this device's behavior as a USB device. * * @see #getSystemService * @see android.harware.usb.UsbManager * @hide */ public static final String USB_SERVICE = "usb"; /** * Determine whether the given permission is allowed for a particular * process and user ID running in the system. Loading
core/java/android/content/pm/PackageManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -783,6 +783,13 @@ public abstract class PackageManager { @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports connecting to USB accessories. * @hide */ public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The SIP API is enabled on the device. Loading
core/java/android/hardware/usb/IUsbManager.aidl 0 → 100644 +47 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.hardware.usb; import android.hardware.usb.UsbAccessory; import android.os.Bundle; import android.os.ParcelFileDescriptor; /** @hide */ interface IUsbManager { /* Returns the currently attached USB accessory */ UsbAccessory getCurrentAccessory(); /* Returns a file descriptor for communicating with the USB accessory. * This file descriptor can be used with standard Java file operations. */ ParcelFileDescriptor openAccessory(in UsbAccessory accessory); /* Sets the default package for a USB accessory * (or clears it if the package name is null) */ void setAccessoryPackage(in UsbAccessory accessory, String packageName); /* Grants permission for the given UID to access the accessory */ void grantAccessoryPermission(in UsbAccessory accessory, int uid); /* Returns true if the USB manager has default preferences or permissions for the package */ boolean hasDefaults(String packageName, int uid); /* Clears default preferences and permissions for the package */ oneway void clearDefaults(String packageName, int uid); }