Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.18 KB | None | 0 0
  1. /** @hide */
  2. public interface IUsbManager extends android.os.IInterface
  3. {
  4. /** Local-side IPC implementation stub class. */
  5. public static abstract class Stub extends android.os.Binder implements IUsbManager
  6. {
  7. private static final String DESCRIPTOR = "android.hardware.usb.IUsbManager";
  8. /** Construct the stub at attach it to the interface. */
  9. public Stub()
  10. {
  11. this.attachInterface(this, DESCRIPTOR);
  12. }
  13. /**
  14. * Cast an IBinder object into an android.hardware.usb.IUsbManager interface,
  15. * generating a proxy if needed.
  16. */
  17. public static IUsbManager asInterface(android.os.IBinder obj)
  18. {
  19. if ((obj==null)) {
  20. return null;
  21. }
  22. android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
  23. if (((iin!=null)&&(iin instanceof IUsbManager))) {
  24. return ((IUsbManager)iin);
  25. }
  26. return new IUsbManager.Stub.Proxy(obj);
  27. }
  28. @Override
  29. public android.os.IBinder asBinder()
  30. {
  31. return this;
  32. }
  33. @Override
  34. public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
  35. {
  36. switch (code)
  37. {
  38. case INTERFACE_TRANSACTION:
  39. {
  40. reply.writeString(DESCRIPTOR);
  41. return true;
  42. }
  43. case TRANSACTION_getDeviceList:
  44. {
  45. data.enforceInterface(DESCRIPTOR);
  46. android.os.Bundle _arg0;
  47. _arg0 = new android.os.Bundle();
  48. this.getDeviceList(_arg0);
  49. reply.writeNoException();
  50. if ((_arg0!=null)) {
  51. reply.writeInt(1);
  52. _arg0.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
  53. }
  54. else {
  55. reply.writeInt(0);
  56. }
  57. return true;
  58. }
  59. case TRANSACTION_openDevice:
  60. {
  61. data.enforceInterface(DESCRIPTOR);
  62. String _arg0;
  63. _arg0 = data.readString();
  64. android.os.ParcelFileDescriptor _result = this.openDevice(_arg0);
  65. reply.writeNoException();
  66. if ((_result!=null)) {
  67. reply.writeInt(1);
  68. _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
  69. }
  70. else {
  71. reply.writeInt(0);
  72. }
  73. return true;
  74. }
  75. case TRANSACTION_getCurrentAccessory:
  76. {
  77. data.enforceInterface(DESCRIPTOR);
  78. android.hardware.usb.UsbAccessory _result = this.getCurrentAccessory();
  79. reply.writeNoException();
  80. if ((_result!=null)) {
  81. reply.writeInt(1);
  82. _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
  83. }
  84. else {
  85. reply.writeInt(0);
  86. }
  87. return true;
  88. }
  89. case TRANSACTION_openAccessory:
  90. {
  91. data.enforceInterface(DESCRIPTOR);
  92. android.hardware.usb.UsbAccessory _arg0;
  93. if ((0!=data.readInt())) {
  94. _arg0 = android.hardware.usb.UsbAccessory.CREATOR.createFromParcel(data);
  95. }
  96. else {
  97. _arg0 = null;
  98. }
  99. android.os.ParcelFileDescriptor _result = this.openAccessory(_arg0);
  100. reply.writeNoException();
  101. if ((_result!=null)) {
  102. reply.writeInt(1);
  103. _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
  104. }
  105. else {
  106. reply.writeInt(0);
  107. }
  108. return true;
  109. }
  110. case TRANSACTION_setDevicePackage:
  111. {
  112. data.enforceInterface(DESCRIPTOR);
  113. android.hardware.usb.UsbDevice _arg0;
  114. if ((0!=data.readInt())) {
  115. _arg0 = android.hardware.usb.UsbDevice.CREATOR.createFromParcel(data);
  116. }
  117. else {
  118. _arg0 = null;
  119. }
  120. String _arg1;
  121. _arg1 = data.readString();
  122. int _arg2;
  123. _arg2 = data.readInt();
  124. this.setDevicePackage(_arg0, _arg1, _arg2);
  125. reply.writeNoException();
  126. return true;
  127. }
  128. case TRANSACTION_setAccessoryPackage:
  129. {
  130. data.enforceInterface(DESCRIPTOR);
  131. android.hardware.usb.UsbAccessory _arg0;
  132. if ((0!=data.readInt())) {
  133. _arg0 = android.hardware.usb.UsbAccessory.CREATOR.createFromParcel(data);
  134. }
  135. else {
  136. _arg0 = null;
  137. }
  138. String _arg1;
  139. _arg1 = data.readString();
  140. int _arg2;
  141. _arg2 = data.readInt();
  142. this.setAccessoryPackage(_arg0, _arg1, _arg2);
  143. reply.writeNoException();
  144. return true;
  145. }
  146. case TRANSACTION_hasDevicePermission:
  147. {
  148. data.enforceInterface(DESCRIPTOR);
  149. android.hardware.usb.UsbDevice _arg0;
  150. if ((0!=data.readInt())) {
  151. _arg0 = android.hardware.usb.UsbDevice.CREATOR.createFromParcel(data);
  152. }
  153. else {
  154. _arg0 = null;
  155. }
  156. boolean _result = this.hasDevicePermission(_arg0);
  157. reply.writeNoException();
  158. reply.writeInt(((_result)?(1):(0)));
  159. return true;
  160. }
  161. case TRANSACTION_hasAccessoryPermission:
  162. {
  163. data.enforceInterface(DESCRIPTOR);
  164. android.hardware.usb.UsbAccessory _arg0;
  165. if ((0!=data.readInt())) {
  166. _arg0 = android.hardware.usb.UsbAccessory.CREATOR.createFromParcel(data);
  167. }
  168. else {
  169. _arg0 = null;
  170. }
  171. boolean _result = this.hasAccessoryPermission(_arg0);
  172. reply.writeNoException();
  173. reply.writeInt(((_result)?(1):(0)));
  174. return true;
  175. }
  176. case TRANSACTION_requestDevicePermission:
  177. {
  178. data.enforceInterface(DESCRIPTOR);
  179. android.hardware.usb.UsbDevice _arg0;
  180. if ((0!=data.readInt())) {
  181. _arg0 = android.hardware.usb.UsbDevice.CREATOR.createFromParcel(data);
  182. }
  183. else {
  184. _arg0 = null;
  185. }
  186. String _arg1;
  187. _arg1 = data.readString();
  188. android.app.PendingIntent _arg2;
  189. if ((0!=data.readInt())) {
  190. _arg2 = android.app.PendingIntent.CREATOR.createFromParcel(data);
  191. }
  192. else {
  193. _arg2 = null;
  194. }
  195. this.requestDevicePermission(_arg0, _arg1, _arg2);
  196. reply.writeNoException();
  197. return true;
  198. }
  199. case TRANSACTION_requestAccessoryPermission:
  200. {
  201. data.enforceInterface(DESCRIPTOR);
  202. android.hardware.usb.UsbAccessory _arg0;
  203. if ((0!=data.readInt())) {
  204. _arg0 = android.hardware.usb.UsbAccessory.CREATOR.createFromParcel(data);
  205. }
  206. else {
  207. _arg0 = null;
  208. }
  209. String _arg1;
  210. _arg1 = data.readString();
  211. android.app.PendingIntent _arg2;
  212. if ((0!=data.readInt())) {
  213. _arg2 = android.app.PendingIntent.CREATOR.createFromParcel(data);
  214. }
  215. else {
  216. _arg2 = null;
  217. }
  218. this.requestAccessoryPermission(_arg0, _arg1, _arg2);
  219. reply.writeNoException();
  220. return true;
  221. }
  222. case TRANSACTION_grantDevicePermission:
  223. {
  224. data.enforceInterface(DESCRIPTOR);
  225. android.hardware.usb.UsbDevice _arg0;
  226. if ((0!=data.readInt())) {
  227. _arg0 = android.hardware.usb.UsbDevice.CREATOR.createFromParcel(data);
  228. }
  229. else {
  230. _arg0 = null;
  231. }
  232. int _arg1;
  233. _arg1 = data.readInt();
  234. this.grantDevicePermission(_arg0, _arg1);
  235. reply.writeNoException();
  236. return true;
  237. }
  238. case TRANSACTION_grantAccessoryPermission:
  239. {
  240. data.enforceInterface(DESCRIPTOR);
  241. android.hardware.usb.UsbAccessory _arg0;
  242. if ((0!=data.readInt())) {
  243. _arg0 = android.hardware.usb.UsbAccessory.CREATOR.createFromParcel(data);
  244. }
  245. else {
  246. _arg0 = null;
  247. }
  248. int _arg1;
  249. _arg1 = data.readInt();
  250. this.grantAccessoryPermission(_arg0, _arg1);
  251. reply.writeNoException();
  252. return true;
  253. }
  254. case TRANSACTION_hasDefaults:
  255. {
  256. data.enforceInterface(DESCRIPTOR);
  257. String _arg0;
  258. _arg0 = data.readString();
  259. int _arg1;
  260. _arg1 = data.readInt();
  261. boolean _result = this.hasDefaults(_arg0, _arg1);
  262. reply.writeNoException();
  263. reply.writeInt(((_result)?(1):(0)));
  264. return true;
  265. }
  266. case TRANSACTION_clearDefaults:
  267. {
  268. data.enforceInterface(DESCRIPTOR);
  269. String _arg0;
  270. _arg0 = data.readString();
  271. int _arg1;
  272. _arg1 = data.readInt();
  273. this.clearDefaults(_arg0, _arg1);
  274. reply.writeNoException();
  275. return true;
  276. }
  277. case TRANSACTION_setCurrentFunction:
  278. {
  279. data.enforceInterface(DESCRIPTOR);
  280. String _arg0;
  281. _arg0 = data.readString();
  282. boolean _arg1;
  283. _arg1 = (0!=data.readInt());
  284. this.setCurrentFunction(_arg0, _arg1);
  285. reply.writeNoException();
  286. return true;
  287. }
  288. case TRANSACTION_setMassStorageBackingFile:
  289. {
  290. data.enforceInterface(DESCRIPTOR);
  291. String _arg0;
  292. _arg0 = data.readString();
  293. this.setMassStorageBackingFile(_arg0);
  294. reply.writeNoException();
  295. return true;
  296. }
  297. case TRANSACTION_allowUsbDebugging:
  298. {
  299. data.enforceInterface(DESCRIPTOR);
  300. boolean _arg0;
  301. _arg0 = (0!=data.readInt());
  302. String _arg1;
  303. _arg1 = data.readString();
  304. this.allowUsbDebugging(_arg0, _arg1);
  305. reply.writeNoException();
  306. return true;
  307. }
  308. case TRANSACTION_denyUsbDebugging:
  309. {
  310. data.enforceInterface(DESCRIPTOR);
  311. this.denyUsbDebugging();
  312. reply.writeNoException();
  313. return true;
  314. }
  315. case TRANSACTION_clearUsbDebuggingKeys:
  316. {
  317. data.enforceInterface(DESCRIPTOR);
  318. this.clearUsbDebuggingKeys();
  319. reply.writeNoException();
  320. return true;
  321. }
  322. }
  323. return super.onTransact(code, data, reply, flags);
  324. }
  325. private static class Proxy implements IUsbManager
  326. {
  327. private android.os.IBinder mRemote;
  328. Proxy(android.os.IBinder remote)
  329. {
  330. mRemote = remote;
  331. }
  332. @Override
  333. public android.os.IBinder asBinder()
  334. {
  335. return mRemote;
  336. }
  337. public String getInterfaceDescriptor()
  338. {
  339. return DESCRIPTOR;
  340. }
  341. /* Returns a list of all currently attached USB devices */
  342. @Override
  343. public void getDeviceList(android.os.Bundle devices) throws android.os.RemoteException
  344. {
  345. android.os.Parcel _data = android.os.Parcel.obtain();
  346. android.os.Parcel _reply = android.os.Parcel.obtain();
  347. try {
  348. _data.writeInterfaceToken(DESCRIPTOR);
  349. mRemote.transact(Stub.TRANSACTION_getDeviceList, _data, _reply, 0);
  350. _reply.readException();
  351. if ((0!=_reply.readInt())) {
  352. devices.readFromParcel(_reply);
  353. }
  354. }
  355. finally {
  356. _reply.recycle();
  357. _data.recycle();
  358. }
  359. }
  360. /* Returns a file descriptor for communicating with the USB device.
  361. * The native fd can be passed to usb_device_new() in libusbhost.
  362. */
  363. @Override
  364. public android.os.ParcelFileDescriptor openDevice(String deviceName) throws android.os.RemoteException
  365. {
  366. android.os.Parcel _data = android.os.Parcel.obtain();
  367. android.os.Parcel _reply = android.os.Parcel.obtain();
  368. android.os.ParcelFileDescriptor _result;
  369. try {
  370. _data.writeInterfaceToken(DESCRIPTOR);
  371. _data.writeString(deviceName);
  372. mRemote.transact(Stub.TRANSACTION_openDevice, _data, _reply, 0);
  373. _reply.readException();
  374. if ((0!=_reply.readInt())) {
  375. _result = android.os.ParcelFileDescriptor.CREATOR.createFromParcel(_reply);
  376. }
  377. else {
  378. _result = null;
  379. }
  380. }
  381. finally {
  382. _reply.recycle();
  383. _data.recycle();
  384. }
  385. return _result;
  386. }
  387. /* Returns the currently attached USB accessory */
  388. @Override
  389. public android.hardware.usb.UsbAccessory getCurrentAccessory() throws android.os.RemoteException
  390. {
  391. android.os.Parcel _data = android.os.Parcel.obtain();
  392. android.os.Parcel _reply = android.os.Parcel.obtain();
  393. android.hardware.usb.UsbAccessory _result;
  394. try {
  395. _data.writeInterfaceToken(DESCRIPTOR);
  396. mRemote.transact(Stub.TRANSACTION_getCurrentAccessory, _data, _reply, 0);
  397. _reply.readException();
  398. if ((0!=_reply.readInt())) {
  399. _result = android.hardware.usb.UsbAccessory.CREATOR.createFromParcel(_reply);
  400. }
  401. else {
  402. _result = null;
  403. }
  404. }
  405. finally {
  406. _reply.recycle();
  407. _data.recycle();
  408. }
  409. return _result;
  410. }
  411. /* Returns a file descriptor for communicating with the USB accessory.
  412. * This file descriptor can be used with standard Java file operations.
  413. */
  414. @Override
  415. public android.os.ParcelFileDescriptor openAccessory(android.hardware.usb.UsbAccessory accessory) throws android.os.RemoteException
  416. {
  417. android.os.Parcel _data = android.os.Parcel.obtain();
  418. android.os.Parcel _reply = android.os.Parcel.obtain();
  419. android.os.ParcelFileDescriptor _result;
  420. try {
  421. _data.writeInterfaceToken(DESCRIPTOR);
  422. if ((accessory!=null)) {
  423. _data.writeInt(1);
  424. accessory.writeToParcel(_data, 0);
  425. }
  426. else {
  427. _data.writeInt(0);
  428. }
  429. mRemote.transact(Stub.TRANSACTION_openAccessory, _data, _reply, 0);
  430. _reply.readException();
  431. if ((0!=_reply.readInt())) {
  432. _result = android.os.ParcelFileDescriptor.CREATOR.createFromParcel(_reply);
  433. }
  434. else {
  435. _result = null;
  436. }
  437. }
  438. finally {
  439. _reply.recycle();
  440. _data.recycle();
  441. }
  442. return _result;
  443. }
  444. /* Sets the default package for a USB device
  445. * (or clears it if the package name is null)
  446. */
  447. @Override
  448. public void setDevicePackage(android.hardware.usb.UsbDevice device, String packageName, int userId) throws android.os.RemoteException
  449. {
  450. android.os.Parcel _data = android.os.Parcel.obtain();
  451. android.os.Parcel _reply = android.os.Parcel.obtain();
  452. try {
  453. _data.writeInterfaceToken(DESCRIPTOR);
  454. if ((device!=null)) {
  455. _data.writeInt(1);
  456. device.writeToParcel(_data, 0);
  457. }
  458. else {
  459. _data.writeInt(0);
  460. }
  461. _data.writeString(packageName);
  462. _data.writeInt(userId);
  463. mRemote.transact(Stub.TRANSACTION_setDevicePackage, _data, _reply, 0);
  464. _reply.readException();
  465. }
  466. finally {
  467. _reply.recycle();
  468. _data.recycle();
  469. }
  470. }
  471. /* Sets the default package for a USB accessory
  472. * (or clears it if the package name is null)
  473. */
  474. @Override
  475. public void setAccessoryPackage(android.hardware.usb.UsbAccessory accessory, String packageName, int userId) throws android.os.RemoteException
  476. {
  477. android.os.Parcel _data = android.os.Parcel.obtain();
  478. android.os.Parcel _reply = android.os.Parcel.obtain();
  479. try {
  480. _data.writeInterfaceToken(DESCRIPTOR);
  481. if ((accessory!=null)) {
  482. _data.writeInt(1);
  483. accessory.writeToParcel(_data, 0);
  484. }
  485. else {
  486. _data.writeInt(0);
  487. }
  488. _data.writeString(packageName);
  489. _data.writeInt(userId);
  490. mRemote.transact(Stub.TRANSACTION_setAccessoryPackage, _data, _reply, 0);
  491. _reply.readException();
  492. }
  493. finally {
  494. _reply.recycle();
  495. _data.recycle();
  496. }
  497. }
  498. /* Returns true if the caller has permission to access the device. */
  499. @Override
  500. public boolean hasDevicePermission(android.hardware.usb.UsbDevice device) throws android.os.RemoteException
  501. {
  502. android.os.Parcel _data = android.os.Parcel.obtain();
  503. android.os.Parcel _reply = android.os.Parcel.obtain();
  504. boolean _result;
  505. try {
  506. _data.writeInterfaceToken(DESCRIPTOR);
  507. if ((device!=null)) {
  508. _data.writeInt(1);
  509. device.writeToParcel(_data, 0);
  510. }
  511. else {
  512. _data.writeInt(0);
  513. }
  514. mRemote.transact(Stub.TRANSACTION_hasDevicePermission, _data, _reply, 0);
  515. _reply.readException();
  516. _result = (0!=_reply.readInt());
  517. }
  518. finally {
  519. _reply.recycle();
  520. _data.recycle();
  521. }
  522. return _result;
  523. }
  524. /* Returns true if the caller has permission to access the accessory. */
  525. @Override
  526. public boolean hasAccessoryPermission(android.hardware.usb.UsbAccessory accessory) throws android.os.RemoteException
  527. {
  528. android.os.Parcel _data = android.os.Parcel.obtain();
  529. android.os.Parcel _reply = android.os.Parcel.obtain();
  530. boolean _result;
  531. try {
  532. _data.writeInterfaceToken(DESCRIPTOR);
  533. if ((accessory!=null)) {
  534. _data.writeInt(1);
  535. accessory.writeToParcel(_data, 0);
  536. }
  537. else {
  538. _data.writeInt(0);
  539. }
  540. mRemote.transact(Stub.TRANSACTION_hasAccessoryPermission, _data, _reply, 0);
  541. _reply.readException();
  542. _result = (0!=_reply.readInt());
  543. }
  544. finally {
  545. _reply.recycle();
  546. _data.recycle();
  547. }
  548. return _result;
  549. }
  550. /* Requests permission for the given package to access the device.
  551. * Will display a system dialog to query the user if permission
  552. * had not already been given.
  553. */
  554. @Override
  555. public void requestDevicePermission(android.hardware.usb.UsbDevice device, String packageName, android.app.PendingIntent pi) throws android.os.RemoteException
  556. {
  557. android.os.Parcel _data = android.os.Parcel.obtain();
  558. android.os.Parcel _reply = android.os.Parcel.obtain();
  559. try {
  560. _data.writeInterfaceToken(DESCRIPTOR);
  561. if ((device!=null)) {
  562. _data.writeInt(1);
  563. device.writeToParcel(_data, 0);
  564. }
  565. else {
  566. _data.writeInt(0);
  567. }
  568. _data.writeString(packageName);
  569. if ((pi!=null)) {
  570. _data.writeInt(1);
  571. pi.writeToParcel(_data, 0);
  572. }
  573. else {
  574. _data.writeInt(0);
  575. }
  576. mRemote.transact(Stub.TRANSACTION_requestDevicePermission, _data, _reply, 0);
  577. _reply.readException();
  578. }
  579. finally {
  580. _reply.recycle();
  581. _data.recycle();
  582. }
  583. }
  584. /* Requests permission for the given package to access the accessory.
  585. * Will display a system dialog to query the user if permission
  586. * had not already been given. Result is returned via pi.
  587. */
  588. @Override
  589. public void requestAccessoryPermission(android.hardware.usb.UsbAccessory accessory, String packageName, android.app.PendingIntent pi) throws android.os.RemoteException
  590. {
  591. android.os.Parcel _data = android.os.Parcel.obtain();
  592. android.os.Parcel _reply = android.os.Parcel.obtain();
  593. try {
  594. _data.writeInterfaceToken(DESCRIPTOR);
  595. if ((accessory!=null)) {
  596. _data.writeInt(1);
  597. accessory.writeToParcel(_data, 0);
  598. }
  599. else {
  600. _data.writeInt(0);
  601. }
  602. _data.writeString(packageName);
  603. if ((pi!=null)) {
  604. _data.writeInt(1);
  605. pi.writeToParcel(_data, 0);
  606. }
  607. else {
  608. _data.writeInt(0);
  609. }
  610. mRemote.transact(Stub.TRANSACTION_requestAccessoryPermission, _data, _reply, 0);
  611. _reply.readException();
  612. }
  613. finally {
  614. _reply.recycle();
  615. _data.recycle();
  616. }
  617. }
  618. /* Grants permission for the given UID to access the device */
  619. @Override
  620. public void grantDevicePermission(android.hardware.usb.UsbDevice device, int uid) throws android.os.RemoteException
  621. {
  622. android.os.Parcel _data = android.os.Parcel.obtain();
  623. android.os.Parcel _reply = android.os.Parcel.obtain();
  624. try {
  625. _data.writeInterfaceToken(DESCRIPTOR);
  626. if ((device!=null)) {
  627. _data.writeInt(1);
  628. device.writeToParcel(_data, 0);
  629. }
  630. else {
  631. _data.writeInt(0);
  632. }
  633. _data.writeInt(uid);
  634. mRemote.transact(Stub.TRANSACTION_grantDevicePermission, _data, _reply, 0);
  635. _reply.readException();
  636. }
  637. finally {
  638. _reply.recycle();
  639. _data.recycle();
  640. }
  641. }
  642. /* Grants permission for the given UID to access the accessory */
  643. @Override
  644. public void grantAccessoryPermission(android.hardware.usb.UsbAccessory accessory, int uid) throws android.os.RemoteException
  645. {
  646. android.os.Parcel _data = android.os.Parcel.obtain();
  647. android.os.Parcel _reply = android.os.Parcel.obtain();
  648. try {
  649. _data.writeInterfaceToken(DESCRIPTOR);
  650. if ((accessory!=null)) {
  651. _data.writeInt(1);
  652. accessory.writeToParcel(_data, 0);
  653. }
  654. else {
  655. _data.writeInt(0);
  656. }
  657. _data.writeInt(uid);
  658. mRemote.transact(Stub.TRANSACTION_grantAccessoryPermission, _data, _reply, 0);
  659. _reply.readException();
  660. }
  661. finally {
  662. _reply.recycle();
  663. _data.recycle();
  664. }
  665. }
  666. /* Returns true if the USB manager has default preferences or permissions for the package */
  667. @Override
  668. public boolean hasDefaults(String packageName, int userId) throws android.os.RemoteException
  669. {
  670. android.os.Parcel _data = android.os.Parcel.obtain();
  671. android.os.Parcel _reply = android.os.Parcel.obtain();
  672. boolean _result;
  673. try {
  674. _data.writeInterfaceToken(DESCRIPTOR);
  675. _data.writeString(packageName);
  676. _data.writeInt(userId);
  677. mRemote.transact(Stub.TRANSACTION_hasDefaults, _data, _reply, 0);
  678. _reply.readException();
  679. _result = (0!=_reply.readInt());
  680. }
  681. finally {
  682. _reply.recycle();
  683. _data.recycle();
  684. }
  685. return _result;
  686. }
  687. /* Clears default preferences and permissions for the package */
  688. @Override
  689. public void clearDefaults(String packageName, int userId) throws android.os.RemoteException
  690. {
  691. android.os.Parcel _data = android.os.Parcel.obtain();
  692. android.os.Parcel _reply = android.os.Parcel.obtain();
  693. try {
  694. _data.writeInterfaceToken(DESCRIPTOR);
  695. _data.writeString(packageName);
  696. _data.writeInt(userId);
  697. mRemote.transact(Stub.TRANSACTION_clearDefaults, _data, _reply, 0);
  698. _reply.readException();
  699. }
  700. finally {
  701. _reply.recycle();
  702. _data.recycle();
  703. }
  704. }
  705. /* Sets the current USB function. */
  706. @Override
  707. public void setCurrentFunction(String function, boolean makeDefault) throws android.os.RemoteException
  708. {
  709. android.os.Parcel _data = android.os.Parcel.obtain();
  710. android.os.Parcel _reply = android.os.Parcel.obtain();
  711. try {
  712. _data.writeInterfaceToken(DESCRIPTOR);
  713. _data.writeString(function);
  714. _data.writeInt(((makeDefault)?(1):(0)));
  715. mRemote.transact(Stub.TRANSACTION_setCurrentFunction, _data, _reply, 0);
  716. _reply.readException();
  717. }
  718. finally {
  719. _reply.recycle();
  720. _data.recycle();
  721. }
  722. }
  723. /* Sets the file path for USB mass storage backing file. */
  724. @Override
  725. public void setMassStorageBackingFile(String path) throws android.os.RemoteException
  726. {
  727. android.os.Parcel _data = android.os.Parcel.obtain();
  728. android.os.Parcel _reply = android.os.Parcel.obtain();
  729. try {
  730. _data.writeInterfaceToken(DESCRIPTOR);
  731. _data.writeString(path);
  732. mRemote.transact(Stub.TRANSACTION_setMassStorageBackingFile, _data, _reply, 0);
  733. _reply.readException();
  734. }
  735. finally {
  736. _reply.recycle();
  737. _data.recycle();
  738. }
  739. }
  740. /* Allow USB debugging from the attached host. If alwaysAllow is true, add the
  741. * the public key to list of host keys that the user has approved.
  742. */
  743. @Override
  744. public void allowUsbDebugging(boolean alwaysAllow, String publicKey) throws android.os.RemoteException
  745. {
  746. android.os.Parcel _data = android.os.Parcel.obtain();
  747. android.os.Parcel _reply = android.os.Parcel.obtain();
  748. try {
  749. _data.writeInterfaceToken(DESCRIPTOR);
  750. _data.writeInt(((alwaysAllow)?(1):(0)));
  751. _data.writeString(publicKey);
  752. mRemote.transact(Stub.TRANSACTION_allowUsbDebugging, _data, _reply, 0);
  753. _reply.readException();
  754. }
  755. finally {
  756. _reply.recycle();
  757. _data.recycle();
  758. }
  759. }
  760. /* Deny USB debugging from the attached host */
  761. @Override
  762. public void denyUsbDebugging() throws android.os.RemoteException
  763. {
  764. android.os.Parcel _data = android.os.Parcel.obtain();
  765. android.os.Parcel _reply = android.os.Parcel.obtain();
  766. try {
  767. _data.writeInterfaceToken(DESCRIPTOR);
  768. mRemote.transact(Stub.TRANSACTION_denyUsbDebugging, _data, _reply, 0);
  769. _reply.readException();
  770. }
  771. finally {
  772. _reply.recycle();
  773. _data.recycle();
  774. }
  775. }
  776. /* Clear public keys installed for secure USB debugging */
  777. @Override
  778. public void clearUsbDebuggingKeys() throws android.os.RemoteException
  779. {
  780. android.os.Parcel _data = android.os.Parcel.obtain();
  781. android.os.Parcel _reply = android.os.Parcel.obtain();
  782. try {
  783. _data.writeInterfaceToken(DESCRIPTOR);
  784. mRemote.transact(Stub.TRANSACTION_clearUsbDebuggingKeys, _data, _reply, 0);
  785. _reply.readException();
  786. }
  787. finally {
  788. _reply.recycle();
  789. _data.recycle();
  790. }
  791. }
  792. }
  793. static final int TRANSACTION_getDeviceList = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
  794. static final int TRANSACTION_openDevice = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
  795. static final int TRANSACTION_getCurrentAccessory = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
  796. static final int TRANSACTION_openAccessory = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
  797. static final int TRANSACTION_setDevicePackage = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
  798. static final int TRANSACTION_setAccessoryPackage = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
  799. static final int TRANSACTION_hasDevicePermission = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
  800. static final int TRANSACTION_hasAccessoryPermission = (android.os.IBinder.FIRST_CALL_TRANSACTION + 7);
  801. static final int TRANSACTION_requestDevicePermission = (android.os.IBinder.FIRST_CALL_TRANSACTION + 8);
  802. static final int TRANSACTION_requestAccessoryPermission = (android.os.IBinder.FIRST_CALL_TRANSACTION + 9);
  803. static final int TRANSACTION_grantDevicePermission = (android.os.IBinder.FIRST_CALL_TRANSACTION + 10);
  804. static final int TRANSACTION_grantAccessoryPermission = (android.os.IBinder.FIRST_CALL_TRANSACTION + 11);
  805. static final int TRANSACTION_hasDefaults = (android.os.IBinder.FIRST_CALL_TRANSACTION + 12);
  806. static final int TRANSACTION_clearDefaults = (android.os.IBinder.FIRST_CALL_TRANSACTION + 13);
  807. static final int TRANSACTION_setCurrentFunction = (android.os.IBinder.FIRST_CALL_TRANSACTION + 14);
  808. static final int TRANSACTION_setMassStorageBackingFile = (android.os.IBinder.FIRST_CALL_TRANSACTION + 15);
  809. static final int TRANSACTION_allowUsbDebugging = (android.os.IBinder.FIRST_CALL_TRANSACTION + 16);
  810. static final int TRANSACTION_denyUsbDebugging = (android.os.IBinder.FIRST_CALL_TRANSACTION + 17);
  811. static final int TRANSACTION_clearUsbDebuggingKeys = (android.os.IBinder.FIRST_CALL_TRANSACTION + 18);
  812. }
  813. /* Returns a list of all currently attached USB devices */
  814. public void getDeviceList(android.os.Bundle devices) throws android.os.RemoteException;
  815. /* Returns a file descriptor for communicating with the USB device.
  816. * The native fd can be passed to usb_device_new() in libusbhost.
  817. */
  818. public android.os.ParcelFileDescriptor openDevice(String deviceName) throws android.os.RemoteException;
  819. /* Returns the currently attached USB accessory */
  820. public android.hardware.usb.UsbAccessory getCurrentAccessory() throws android.os.RemoteException;
  821. /* Returns a file descriptor for communicating with the USB accessory.
  822. * This file descriptor can be used with standard Java file operations.
  823. */
  824. public android.os.ParcelFileDescriptor openAccessory(android.hardware.usb.UsbAccessory accessory) throws android.os.RemoteException;
  825. /* Sets the default package for a USB device
  826. * (or clears it if the package name is null)
  827. */
  828. public void setDevicePackage(android.hardware.usb.UsbDevice device, String packageName, int userId) throws android.os.RemoteException;
  829. /* Sets the default package for a USB accessory
  830. * (or clears it if the package name is null)
  831. */
  832. public void setAccessoryPackage(android.hardware.usb.UsbAccessory accessory, String packageName, int userId) throws android.os.RemoteException;
  833. /* Returns true if the caller has permission to access the device. */
  834. public boolean hasDevicePermission(android.hardware.usb.UsbDevice device) throws android.os.RemoteException;
  835. /* Returns true if the caller has permission to access the accessory. */
  836. public boolean hasAccessoryPermission(android.hardware.usb.UsbAccessory accessory) throws android.os.RemoteException;
  837. /* Requests permission for the given package to access the device.
  838. * Will display a system dialog to query the user if permission
  839. * had not already been given.
  840. */
  841. public void requestDevicePermission(android.hardware.usb.UsbDevice device, String packageName, android.app.PendingIntent pi) throws android.os.RemoteException;
  842. /* Requests permission for the given package to access the accessory.
  843. * Will display a system dialog to query the user if permission
  844. * had not already been given. Result is returned via pi.
  845. */
  846. public void requestAccessoryPermission(android.hardware.usb.UsbAccessory accessory, String packageName, android.app.PendingIntent pi) throws android.os.RemoteException;
  847. /* Grants permission for the given UID to access the device */
  848. public void grantDevicePermission(android.hardware.usb.UsbDevice device, int uid) throws android.os.RemoteException;
  849. /* Grants permission for the given UID to access the accessory */
  850. public void grantAccessoryPermission(android.hardware.usb.UsbAccessory accessory, int uid) throws android.os.RemoteException;
  851. /* Returns true if the USB manager has default preferences or permissions for the package */
  852. public boolean hasDefaults(String packageName, int userId) throws android.os.RemoteException;
  853. /* Clears default preferences and permissions for the package */
  854. public void clearDefaults(String packageName, int userId) throws android.os.RemoteException;
  855. /* Sets the current USB function. */
  856. public void setCurrentFunction(String function, boolean makeDefault) throws android.os.RemoteException;
  857. /* Sets the file path for USB mass storage backing file. */
  858. public void setMassStorageBackingFile(String path) throws android.os.RemoteException;
  859. /* Allow USB debugging from the attached host. If alwaysAllow is true, add the
  860. * the public key to list of host keys that the user has approved.
  861. */
  862. public void allowUsbDebugging(boolean alwaysAllow, String publicKey) throws android.os.RemoteException;
  863. /* Deny USB debugging from the attached host */
  864. public void denyUsbDebugging() throws android.os.RemoteException;
  865. /* Clear public keys installed for secure USB debugging */
  866. public void clearUsbDebuggingKeys() throws android.os.RemoteException;
  867. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement