public void dump(IndentingPrintWriter pw) {
   if (mHandler != null) {
     mHandler.dump(pw);
   }
   if (mDebuggingManager != null) {
     mDebuggingManager.dump(pw);
   }
 }
 public void dump(FileDescriptor fd, PrintWriter pw) {
   if (mHandler != null) {
     mHandler.dump(fd, pw);
   }
   if (mDebuggingManager != null) {
     mDebuggingManager.dump(fd, pw);
   }
 }
 /* opens the currently attached USB accessory */
 public ParcelFileDescriptor openAccessory(UsbAccessory accessory) {
   UsbAccessory currentAccessory = mHandler.getCurrentAccessory();
   if (currentAccessory == null) {
     throw new IllegalArgumentException("no accessory attached");
   }
   if (!currentAccessory.equals(accessory)) {
     String error = accessory.toString() + " does not match current accessory " + currentAccessory;
     throw new IllegalArgumentException(error);
   }
   getCurrentSettings().checkPermission(accessory);
   return nativeOpenAccessory();
 }
        @Override
        public void onUEvent(UEventObserver.UEvent event) {
          if (DEBUG) Slog.v(TAG, "USB UEVENT: " + event.toString());

          String state = event.get("USB_STATE");
          String accessory = event.get("ACCESSORY");
          if (state != null) {
            mHandler.updateState(state);
          } else if ("START".equals(accessory)) {
            if (DEBUG) Slog.d(TAG, "got accessory start");
            startAccessoryMode();
          }
        }
  public void systemReady() {
    if (DEBUG) Slog.d(TAG, "systemReady");

    mNotificationManager =
        (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);

    // We do not show the USB notification if the primary volume supports mass storage.
    // The legacy mass storage UI will be used instead.
    boolean massStorageSupported = false;
    final StorageManager storageManager = StorageManager.from(mContext);
    final StorageVolume primary = storageManager.getPrimaryVolume();
    massStorageSupported = primary != null && primary.allowMassStorage();
    mUseUsbNotification = !massStorageSupported;

    // make sure the ADB_ENABLED setting value matches the current state
    Settings.Global.putInt(mContentResolver, Settings.Global.ADB_ENABLED, mAdbEnabled ? 1 : 0);

    mHandler.sendEmptyMessage(MSG_SYSTEM_READY);
  }
 public void setCurrentFunctions(String functions, boolean makeDefault) {
   if (DEBUG) Slog.d(TAG, "setCurrentFunctions(" + functions + ") default: " + makeDefault);
   mHandler.sendMessage(MSG_SET_CURRENT_FUNCTIONS, functions, makeDefault);
 }
 /* returns the currently attached USB accessory */
 public UsbAccessory getCurrentAccessory() {
   return mHandler.getCurrentAccessory();
 }
 public void setUsbDataUnlocked(boolean unlocked) {
   if (DEBUG) Slog.d(TAG, "setUsbDataUnlocked(" + unlocked + ")");
   mHandler.sendMessage(MSG_SET_USB_DATA_UNLOCKED, unlocked);
 }
 public void setCurrentFunctions(String functions) {
   if (DEBUG) Slog.d(TAG, "setCurrentFunctions(" + functions + ")");
   mHandler.sendMessage(MSG_SET_CURRENT_FUNCTIONS, functions);
 }
 public void updateUserRestrictions() {
   mHandler.sendEmptyMessage(MSG_UPDATE_USER_RESTRICTIONS);
 }
 public void setCurrentUser(int userId, UsbSettingsManager settings) {
   synchronized (mLock) {
     mCurrentSettings = settings;
     mHandler.obtainMessage(MSG_USER_SWITCHED, userId, 0).sendToTarget();
   }
 }
 public void bootCompleted() {
   if (DEBUG) Slog.d(TAG, "boot completed");
   mHandler.sendEmptyMessage(MSG_BOOT_COMPLETED);
 }
 @Override
 public void onReceive(Context context, Intent intent) {
   UsbPort port = intent.getParcelableExtra(UsbManager.EXTRA_PORT);
   UsbPortStatus status = intent.getParcelableExtra(UsbManager.EXTRA_PORT_STATUS);
   mHandler.updateHostState(port, status);
 }