Methods Summary |
---|
public void | allowUsbDebugging(boolean alwaysAllow, java.lang.String publicKey)
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
mDeviceManager.allowUsbDebugging(alwaysAllow, publicKey);
|
public void | clearDefaults(java.lang.String packageName, int userId)
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
getSettingsForUser(userId).clearDefaults(packageName);
|
public void | clearUsbDebuggingKeys()
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
mDeviceManager.clearUsbDebuggingKeys();
|
public void | denyUsbDebugging()
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
mDeviceManager.denyUsbDebugging();
|
public void | dump(java.io.FileDescriptor fd, java.io.PrintWriter writer, java.lang.String[] args)
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
pw.println("USB Manager State:");
if (mDeviceManager != null) {
mDeviceManager.dump(fd, pw);
}
if (mHostManager != null) {
mHostManager.dump(fd, pw);
}
synchronized (mLock) {
for (int i = 0; i < mSettingsByUser.size(); i++) {
final int userId = mSettingsByUser.keyAt(i);
final UsbSettingsManager settings = mSettingsByUser.valueAt(i);
pw.increaseIndent();
pw.println("Settings for user " + userId + ":");
settings.dump(fd, pw);
pw.decreaseIndent();
}
}
pw.decreaseIndent();
|
public android.hardware.usb.UsbAccessory | getCurrentAccessory()
if (mDeviceManager != null) {
return mDeviceManager.getCurrentAccessory();
} else {
return null;
}
|
public void | getDeviceList(android.os.Bundle devices)
if (mHostManager != null) {
mHostManager.getDeviceList(devices);
}
|
private UsbSettingsManager | getSettingsForUser(int userId)
synchronized (mLock) {
UsbSettingsManager settings = mSettingsByUser.get(userId);
if (settings == null) {
settings = new UsbSettingsManager(mContext, new UserHandle(userId));
mSettingsByUser.put(userId, settings);
}
return settings;
}
|
public void | grantAccessoryPermission(android.hardware.usb.UsbAccessory accessory, int uid)
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
final int userId = UserHandle.getUserId(uid);
getSettingsForUser(userId).grantAccessoryPermission(accessory, uid);
|
public void | grantDevicePermission(android.hardware.usb.UsbDevice device, int uid)
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
final int userId = UserHandle.getUserId(uid);
getSettingsForUser(userId).grantDevicePermission(device, uid);
|
public boolean | hasAccessoryPermission(android.hardware.usb.UsbAccessory accessory)
final int userId = UserHandle.getCallingUserId();
return getSettingsForUser(userId).hasPermission(accessory);
|
public boolean | hasDefaults(java.lang.String packageName, int userId)
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
return getSettingsForUser(userId).hasDefaults(packageName);
|
public boolean | hasDevicePermission(android.hardware.usb.UsbDevice device)
final int userId = UserHandle.getCallingUserId();
return getSettingsForUser(userId).hasPermission(device);
|
public android.os.ParcelFileDescriptor | openAccessory(android.hardware.usb.UsbAccessory accessory)
if (mDeviceManager != null) {
return mDeviceManager.openAccessory(accessory);
} else {
return null;
}
|
public android.os.ParcelFileDescriptor | openDevice(java.lang.String deviceName)
if (mHostManager != null) {
return mHostManager.openDevice(deviceName);
} else {
return null;
}
|
public void | requestAccessoryPermission(android.hardware.usb.UsbAccessory accessory, java.lang.String packageName, android.app.PendingIntent pi)
final int userId = UserHandle.getCallingUserId();
getSettingsForUser(userId).requestPermission(accessory, packageName, pi);
|
public void | requestDevicePermission(android.hardware.usb.UsbDevice device, java.lang.String packageName, android.app.PendingIntent pi)
final int userId = UserHandle.getCallingUserId();
getSettingsForUser(userId).requestPermission(device, packageName, pi);
|
public void | setAccessoryPackage(android.hardware.usb.UsbAccessory accessory, java.lang.String packageName, int userId)
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
getSettingsForUser(userId).setAccessoryPackage(accessory, packageName);
|
public void | setCurrentFunction(java.lang.String function, boolean makeDefault)
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
// If attempt to change USB function while file transfer is restricted, ensure that
// the current function is set to "none", and return.
UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
if (userManager.hasUserRestriction(UserManager.DISALLOW_USB_FILE_TRANSFER)) {
if (mDeviceManager != null) mDeviceManager.setCurrentFunctions("none", false);
return;
}
if (mDeviceManager != null) {
mDeviceManager.setCurrentFunctions(function, makeDefault);
} else {
throw new IllegalStateException("USB device mode not supported");
}
|
private void | setCurrentUser(int userId)
final UsbSettingsManager userSettings = getSettingsForUser(userId);
if (mHostManager != null) {
mHostManager.setCurrentSettings(userSettings);
}
if (mDeviceManager != null) {
mDeviceManager.setCurrentSettings(userSettings);
}
|
public void | setDevicePackage(android.hardware.usb.UsbDevice device, java.lang.String packageName, int userId)
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
getSettingsForUser(userId).setDevicePackage(device, packageName);
|
public void | setMassStorageBackingFile(java.lang.String path)
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USB, null);
if (mDeviceManager != null) {
mDeviceManager.setMassStorageBackingFile(path);
} else {
throw new IllegalStateException("USB device mode not supported");
}
|
public void | systemReady()
if (mDeviceManager != null) {
mDeviceManager.systemReady();
}
if (mHostManager != null) {
mHostManager.systemReady();
}
|