Merge "Handle API review comments from the council." into nyc-dev

This commit is contained in:
Daichi Hirono
2016-04-22 00:00:31 +00:00
committed by Android (Google) Code Review
11 changed files with 285 additions and 134 deletions

View File

@@ -23243,24 +23243,6 @@ package android.mtp {
ctor public MtpConstants();
method public static boolean isAbstractObject(int);
field public static final int ASSOCIATION_TYPE_GENERIC_FOLDER = 1; // 0x1
field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
field public static final int EVENT_STORE_FULL = 16394; // 0x400a
field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
field public static final int EVENT_UNDEFINED = 16384; // 0x4000
field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
field public static final int FORMAT_3GP_CONTAINER = 47492; // 0xb984
field public static final int FORMAT_AAC = 47363; // 0xb903
field public static final int FORMAT_ABSTRACT_AUDIO_ALBUM = 47619; // 0xba03
@@ -23393,10 +23375,11 @@ package android.mtp {
method public final int[] getOperationsSupported();
method public final java.lang.String getSerialNumber();
method public final java.lang.String getVersion();
method public boolean isEventSupported(int);
method public boolean isOperationSupported(int);
}
public class MtpEvent {
ctor public MtpEvent();
method public int getDevicePropCode();
method public int getEventCode();
method public int getObjectFormatCode();
@@ -23407,6 +23390,24 @@ package android.mtp {
method public int getParameter3();
method public int getStorageId();
method public int getTransactionId();
field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
field public static final int EVENT_STORE_FULL = 16394; // 0x400a
field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
field public static final int EVENT_UNDEFINED = 16384; // 0x4000
field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
}
public final class MtpObjectInfo {

View File

@@ -165,6 +165,31 @@ package android.media.tv {
}
package android.mtp {
public final class MtpConstants {
field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
field public static final int EVENT_STORE_FULL = 16394; // 0x400a
field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
field public static final int EVENT_UNDEFINED = 16384; // 0x4000
field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
}
}
package android.net {
public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {

View File

@@ -24979,24 +24979,6 @@ package android.mtp {
ctor public MtpConstants();
method public static boolean isAbstractObject(int);
field public static final int ASSOCIATION_TYPE_GENERIC_FOLDER = 1; // 0x1
field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
field public static final int EVENT_STORE_FULL = 16394; // 0x400a
field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
field public static final int EVENT_UNDEFINED = 16384; // 0x4000
field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
field public static final int FORMAT_3GP_CONTAINER = 47492; // 0xb984
field public static final int FORMAT_AAC = 47363; // 0xb903
field public static final int FORMAT_ABSTRACT_AUDIO_ALBUM = 47619; // 0xba03
@@ -25129,10 +25111,11 @@ package android.mtp {
method public final int[] getOperationsSupported();
method public final java.lang.String getSerialNumber();
method public final java.lang.String getVersion();
method public boolean isEventSupported(int);
method public boolean isOperationSupported(int);
}
public class MtpEvent {
ctor public MtpEvent();
method public int getDevicePropCode();
method public int getEventCode();
method public int getObjectFormatCode();
@@ -25143,6 +25126,24 @@ package android.mtp {
method public int getParameter3();
method public int getStorageId();
method public int getTransactionId();
field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
field public static final int EVENT_STORE_FULL = 16394; // 0x400a
field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
field public static final int EVENT_UNDEFINED = 16384; // 0x4000
field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
}
public final class MtpObjectInfo {

View File

@@ -163,6 +163,31 @@ package android.media.tv {
}
package android.mtp {
public final class MtpConstants {
field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
field public static final int EVENT_STORE_FULL = 16394; // 0x400a
field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
field public static final int EVENT_UNDEFINED = 16384; // 0x4000
field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
}
}
package android.net {
public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {

View File

@@ -23311,24 +23311,6 @@ package android.mtp {
ctor public MtpConstants();
method public static boolean isAbstractObject(int);
field public static final int ASSOCIATION_TYPE_GENERIC_FOLDER = 1; // 0x1
field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
field public static final int EVENT_STORE_FULL = 16394; // 0x400a
field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
field public static final int EVENT_UNDEFINED = 16384; // 0x4000
field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
field public static final int FORMAT_3GP_CONTAINER = 47492; // 0xb984
field public static final int FORMAT_AAC = 47363; // 0xb903
field public static final int FORMAT_ABSTRACT_AUDIO_ALBUM = 47619; // 0xba03
@@ -23461,10 +23443,11 @@ package android.mtp {
method public final int[] getOperationsSupported();
method public final java.lang.String getSerialNumber();
method public final java.lang.String getVersion();
method public boolean isEventSupported(int);
method public boolean isOperationSupported(int);
}
public class MtpEvent {
ctor public MtpEvent();
method public int getDevicePropCode();
method public int getEventCode();
method public int getObjectFormatCode();
@@ -23475,6 +23458,24 @@ package android.mtp {
method public int getParameter3();
method public int getStorageId();
method public int getTransactionId();
field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
field public static final int EVENT_STORE_FULL = 16394; // 0x400a
field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
field public static final int EVENT_UNDEFINED = 16384; // 0x4000
field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
}
public final class MtpObjectInfo {

View File

@@ -165,6 +165,31 @@ package android.media.tv {
}
package android.mtp {
public final class MtpConstants {
field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
field public static final int EVENT_STORE_FULL = 16394; // 0x400a
field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
field public static final int EVENT_UNDEFINED = 16384; // 0x4000
field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
}
}
package android.net {
public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {

View File

@@ -583,41 +583,41 @@ public final class MtpConstants {
*/
public static final int ASSOCIATION_TYPE_GENERIC_FOLDER = 0x0001;
/** Event code for UNDEFINED event */
/** @removed */
public static final int EVENT_UNDEFINED = 0x4000;
/** Event code for CANCEL_TRANSACTION event */
/** @removed */
public static final int EVENT_CANCEL_TRANSACTION = 0x4001;
/** Event code for OBJECT_ADDED event */
/** @removed */
public static final int EVENT_OBJECT_ADDED = 0x4002;
/** Event code for OBJECT_REMOVED event */
/** @removed */
public static final int EVENT_OBJECT_REMOVED = 0x4003;
/** Event code for STORE_ADDED event */
/** @removed */
public static final int EVENT_STORE_ADDED = 0x4004;
/** Event code for STORE_REMOVED event */
/** @removed */
public static final int EVENT_STORE_REMOVED = 0x4005;
/** Event code for DEVICE_PROP_CHANGED event */
/** @removed */
public static final int EVENT_DEVICE_PROP_CHANGED = 0x4006;
/** Event code for OBJECT_INFO_CHANGED event */
/** @removed */
public static final int EVENT_OBJECT_INFO_CHANGED = 0x4007;
/** Event code for DEVICE_INFO_CHANGED event */
/** @removed */
public static final int EVENT_DEVICE_INFO_CHANGED = 0x4008;
/** Event code for REQUEST_OBJECT_TRANSFER event */
/** @removed */
public static final int EVENT_REQUEST_OBJECT_TRANSFER = 0x4009;
/** Event code for STORE_FULL event */
/** @removed */
public static final int EVENT_STORE_FULL = 0x400A;
/** Event code for DEVICE_RESET event */
/** @removed */
public static final int EVENT_DEVICE_RESET = 0x400B;
/** Event code for STORAGE_INFO_CHANGED event */
/** @removed */
public static final int EVENT_STORAGE_INFO_CHANGED = 0x400C;
/** Event code for CAPTURE_COMPLETE event */
/** @removed */
public static final int EVENT_CAPTURE_COMPLETE = 0x400D;
/** Event code for UNREPORTED_STATUS event */
/** @removed */
public static final int EVENT_UNREPORTED_STATUS = 0x400E;
/** Event code for OBJECT_PROP_CHANGED event */
/** @removed */
public static final int EVENT_OBJECT_PROP_CHANGED = 0xC801;
/** Event code for OBJECT_PROP_DESC_CHANGED event */
/** @removed */
public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 0xC802;
/** Event code for OBJECT_REFERENCES_CHANGED event */
/** @removed */
public static final int EVENT_OBJECT_REFERENCES_CHANGED = 0xC803;
/** Operation code for GetDeviceInfo */

View File

@@ -169,8 +169,8 @@ public final class MtpDevice {
* @param objectHandle handle of the object to read
* @param offset Start index of reading range. It must be a non-negative value at most
* 0xffffffff.
* @param size Size of reading range. It must be a non-negative value at most 0xffffffff. If
* 0xffffffff is specified, the method obtains the full bytes of object.
* @param size Size of reading range. It must be a non-negative value at most Integer.MAX_VALUE
* or 0xffffffff. If 0xffffffff is specified, the method obtains the full bytes of object.
* @param buffer Array to write data.
* @return Size of bytes that are actually read.
*/
@@ -190,7 +190,7 @@ public final class MtpDevice {
*
* @param objectHandle handle of the object to read
* @param offset Start index of reading range. It must be a non-negative value.
* @param size Size of reading range. It must be a non-negative value at most 0xffffffff.
* @param size Size of reading range. It must be a non-negative value at most Integer.MAX_VALUE.
* @param buffer Array to write data.
* @return Size of bytes that are actually read.
* @see MtpConstants#OPERATION_GET_PARTIAL_OBJECT_64
@@ -317,7 +317,7 @@ public final class MtpDevice {
* The returned {@link MtpObjectInfo} has the new object handle field filled in.
*
* @param info metadata of the entry
* @return object info of the created entry
* @return object info of the created entry or null if the operation failed.
*/
public MtpObjectInfo sendObjectInfo(MtpObjectInfo info) {
return native_send_object_info(info);

View File

@@ -16,8 +16,6 @@
package android.mtp;
import android.annotation.Nullable;
/**
* This class encapsulates information about an MTP device.
* This corresponds to the DeviceInfo Dataset described in
@@ -112,7 +110,7 @@ public class MtpDeviceInfo {
* @see MtpConstants#OPERATION_SET_OBJECT_REFERENCES
* @see MtpConstants#OPERATION_SKIP
*/
public final @Nullable int[] getOperationsSupported() {
public final int[] getOperationsSupported() {
return mOperationsSupported;
}
@@ -120,26 +118,57 @@ public class MtpDeviceInfo {
* Returns event code supported by the device.
*
* @return supported event code. Can be null if device does not provide the property.
* @see MtpConstants#EVENT_UNDEFINED
* @see MtpConstants#EVENT_CANCEL_TRANSACTION
* @see MtpConstants#EVENT_OBJECT_ADDED
* @see MtpConstants#EVENT_OBJECT_REMOVED
* @see MtpConstants#EVENT_STORE_ADDED
* @see MtpConstants#EVENT_STORE_REMOVED
* @see MtpConstants#EVENT_DEVICE_PROP_CHANGED
* @see MtpConstants#EVENT_OBJECT_INFO_CHANGED
* @see MtpConstants#EVENT_DEVICE_INFO_CHANGED
* @see MtpConstants#EVENT_REQUEST_OBJECT_TRANSFER
* @see MtpConstants#EVENT_STORE_FULL
* @see MtpConstants#EVENT_DEVICE_RESET
* @see MtpConstants#EVENT_STORAGE_INFO_CHANGED
* @see MtpConstants#EVENT_CAPTURE_COMPLETE
* @see MtpConstants#EVENT_UNREPORTED_STATUS
* @see MtpConstants#EVENT_OBJECT_PROP_CHANGED
* @see MtpConstants#EVENT_OBJECT_PROP_DESC_CHANGED
* @see MtpConstants#EVENT_OBJECT_REFERENCES_CHANGED
* @see MtpEvent#EVENT_UNDEFINED
* @see MtpEvent#EVENT_CANCEL_TRANSACTION
* @see MtpEvent#EVENT_OBJECT_ADDED
* @see MtpEvent#EVENT_OBJECT_REMOVED
* @see MtpEvent#EVENT_STORE_ADDED
* @see MtpEvent#EVENT_STORE_REMOVED
* @see MtpEvent#EVENT_DEVICE_PROP_CHANGED
* @see MtpEvent#EVENT_OBJECT_INFO_CHANGED
* @see MtpEvent#EVENT_DEVICE_INFO_CHANGED
* @see MtpEvent#EVENT_REQUEST_OBJECT_TRANSFER
* @see MtpEvent#EVENT_STORE_FULL
* @see MtpEvent#EVENT_DEVICE_RESET
* @see MtpEvent#EVENT_STORAGE_INFO_CHANGED
* @see MtpEvent#EVENT_CAPTURE_COMPLETE
* @see MtpEvent#EVENT_UNREPORTED_STATUS
* @see MtpEvent#EVENT_OBJECT_PROP_CHANGED
* @see MtpEvent#EVENT_OBJECT_PROP_DESC_CHANGED
* @see MtpEvent#EVENT_OBJECT_REFERENCES_CHANGED
*/
public final @Nullable int[] getEventsSupported() {
public final int[] getEventsSupported() {
return mEventsSupported;
}
/**
* Returns if the given operation is supported by the device or not.
* @param code Operation code.
* @return If the given operation is supported by the device or not.
*/
public boolean isOperationSupported(int code) {
return isSupported(mOperationsSupported, code);
}
/**
* Returns if the given event is supported by the device or not.
* @param code Event code.
* @return If the given event is supported by the device or not.
*/
public boolean isEventSupported(int code) {
return isSupported(mEventsSupported, code);
}
/**
* Returns if the code set contains code.
* @hide
*/
private static boolean isSupported(int[] set, int code) {
for (final int element : set) {
if (element == code) {
return true;
}
}
return false;
}
}

View File

@@ -21,13 +21,55 @@ package android.mtp;
* This corresponds to the events described in appendix G of the MTP specification.
*/
public class MtpEvent {
private int mEventCode = MtpConstants.EVENT_UNDEFINED;
/** Event code for UNDEFINED event */
public static final int EVENT_UNDEFINED = 0x4000;
/** Event code for CANCEL_TRANSACTION event */
public static final int EVENT_CANCEL_TRANSACTION = 0x4001;
/** Event code for OBJECT_ADDED event */
public static final int EVENT_OBJECT_ADDED = 0x4002;
/** Event code for OBJECT_REMOVED event */
public static final int EVENT_OBJECT_REMOVED = 0x4003;
/** Event code for STORE_ADDED event */
public static final int EVENT_STORE_ADDED = 0x4004;
/** Event code for STORE_REMOVED event */
public static final int EVENT_STORE_REMOVED = 0x4005;
/** Event code for DEVICE_PROP_CHANGED event */
public static final int EVENT_DEVICE_PROP_CHANGED = 0x4006;
/** Event code for OBJECT_INFO_CHANGED event */
public static final int EVENT_OBJECT_INFO_CHANGED = 0x4007;
/** Event code for DEVICE_INFO_CHANGED event */
public static final int EVENT_DEVICE_INFO_CHANGED = 0x4008;
/** Event code for REQUEST_OBJECT_TRANSFER event */
public static final int EVENT_REQUEST_OBJECT_TRANSFER = 0x4009;
/** Event code for STORE_FULL event */
public static final int EVENT_STORE_FULL = 0x400A;
/** Event code for DEVICE_RESET event */
public static final int EVENT_DEVICE_RESET = 0x400B;
/** Event code for STORAGE_INFO_CHANGED event */
public static final int EVENT_STORAGE_INFO_CHANGED = 0x400C;
/** Event code for CAPTURE_COMPLETE event */
public static final int EVENT_CAPTURE_COMPLETE = 0x400D;
/** Event code for UNREPORTED_STATUS event */
public static final int EVENT_UNREPORTED_STATUS = 0x400E;
/** Event code for OBJECT_PROP_CHANGED event */
public static final int EVENT_OBJECT_PROP_CHANGED = 0xC801;
/** Event code for OBJECT_PROP_DESC_CHANGED event */
public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 0xC802;
/** Event code for OBJECT_REFERENCES_CHANGED event */
public static final int EVENT_OBJECT_REFERENCES_CHANGED = 0xC803;
private int mEventCode = EVENT_UNDEFINED;
// Parameters for event. The interpretation of event parameters depends upon mEventCode.
private int mParameter1;
private int mParameter2;
private int mParameter3;
/**
* MtpEvent is instantiated by JNI.
*/
private MtpEvent() {}
/**
* Returns event code of MTP event.
* See the USB-IF MTP specification for the details of event constants.
@@ -53,26 +95,26 @@ public class MtpEvent {
/**
* Obtains objectHandle event parameter.
*
* @see MtpConstants#EVENT_OBJECT_ADDED
* @see MtpConstants#EVENT_OBJECT_REMOVED
* @see MtpConstants#EVENT_OBJECT_INFO_CHANGED
* @see MtpConstants#EVENT_REQUEST_OBJECT_TRANSFER
* @see MtpConstants#EVENT_OBJECT_PROP_CHANGED
* @see MtpConstants#EVENT_OBJECT_REFERENCES_CHANGED
* @see #EVENT_OBJECT_ADDED
* @see #EVENT_OBJECT_REMOVED
* @see #EVENT_OBJECT_INFO_CHANGED
* @see #EVENT_REQUEST_OBJECT_TRANSFER
* @see #EVENT_OBJECT_PROP_CHANGED
* @see #EVENT_OBJECT_REFERENCES_CHANGED
*/
public int getObjectHandle() {
switch (mEventCode) {
case MtpConstants.EVENT_OBJECT_ADDED:
case EVENT_OBJECT_ADDED:
return mParameter1;
case MtpConstants.EVENT_OBJECT_REMOVED:
case EVENT_OBJECT_REMOVED:
return mParameter1;
case MtpConstants.EVENT_OBJECT_INFO_CHANGED:
case EVENT_OBJECT_INFO_CHANGED:
return mParameter1;
case MtpConstants.EVENT_REQUEST_OBJECT_TRANSFER:
case EVENT_REQUEST_OBJECT_TRANSFER:
return mParameter1;
case MtpConstants.EVENT_OBJECT_PROP_CHANGED:
case EVENT_OBJECT_PROP_CHANGED:
return mParameter1;
case MtpConstants.EVENT_OBJECT_REFERENCES_CHANGED:
case EVENT_OBJECT_REFERENCES_CHANGED:
return mParameter1;
default:
throw new IllegalParameterAccess("objectHandle", mEventCode);
@@ -82,20 +124,20 @@ public class MtpEvent {
/**
* Obtains storageID event parameter.
*
* @see MtpConstants#EVENT_STORE_ADDED
* @see MtpConstants#EVENT_STORE_REMOVED
* @see MtpConstants#EVENT_STORE_FULL
* @see MtpConstants#EVENT_STORAGE_INFO_CHANGED
* @see #EVENT_STORE_ADDED
* @see #EVENT_STORE_REMOVED
* @see #EVENT_STORE_FULL
* @see #EVENT_STORAGE_INFO_CHANGED
*/
public int getStorageId() {
switch (mEventCode) {
case MtpConstants.EVENT_STORE_ADDED:
case EVENT_STORE_ADDED:
return mParameter1;
case MtpConstants.EVENT_STORE_REMOVED:
case EVENT_STORE_REMOVED:
return mParameter1;
case MtpConstants.EVENT_STORE_FULL:
case EVENT_STORE_FULL:
return mParameter1;
case MtpConstants.EVENT_STORAGE_INFO_CHANGED:
case EVENT_STORAGE_INFO_CHANGED:
return mParameter1;
default:
throw new IllegalParameterAccess("storageID", mEventCode);
@@ -105,11 +147,11 @@ public class MtpEvent {
/**
* Obtains devicePropCode event parameter.
*
* @see MtpConstants#EVENT_DEVICE_PROP_CHANGED
* @see #EVENT_DEVICE_PROP_CHANGED
*/
public int getDevicePropCode() {
switch (mEventCode) {
case MtpConstants.EVENT_DEVICE_PROP_CHANGED:
case EVENT_DEVICE_PROP_CHANGED:
return mParameter1;
default:
throw new IllegalParameterAccess("devicePropCode", mEventCode);
@@ -119,11 +161,11 @@ public class MtpEvent {
/**
* Obtains transactionID event parameter.
*
* @see MtpConstants#EVENT_CAPTURE_COMPLETE
* @see #EVENT_CAPTURE_COMPLETE
*/
public int getTransactionId() {
switch (mEventCode) {
case MtpConstants.EVENT_CAPTURE_COMPLETE:
case EVENT_CAPTURE_COMPLETE:
return mParameter1;
default:
throw new IllegalParameterAccess("transactionID", mEventCode);
@@ -133,14 +175,14 @@ public class MtpEvent {
/**
* Obtains objectPropCode event parameter.
*
* @see MtpConstants#EVENT_OBJECT_PROP_CHANGED
* @see MtpConstants#EVENT_OBJECT_PROP_DESC_CHANGED
* @see #EVENT_OBJECT_PROP_CHANGED
* @see #EVENT_OBJECT_PROP_DESC_CHANGED
*/
public int getObjectPropCode() {
switch (mEventCode) {
case MtpConstants.EVENT_OBJECT_PROP_CHANGED:
case EVENT_OBJECT_PROP_CHANGED:
return mParameter2;
case MtpConstants.EVENT_OBJECT_PROP_DESC_CHANGED:
case EVENT_OBJECT_PROP_DESC_CHANGED:
return mParameter1;
default:
throw new IllegalParameterAccess("objectPropCode", mEventCode);
@@ -150,11 +192,11 @@ public class MtpEvent {
/**
* Obtains objectFormatCode event parameter.
*
* @see MtpConstants#EVENT_OBJECT_PROP_DESC_CHANGED
* @see #EVENT_OBJECT_PROP_DESC_CHANGED
*/
public int getObjectFormatCode() {
switch (mEventCode) {
case MtpConstants.EVENT_OBJECT_PROP_DESC_CHANGED:
case EVENT_OBJECT_PROP_DESC_CHANGED:
return mParameter2;
default:
throw new IllegalParameterAccess("objectFormatCode", mEventCode);

View File

@@ -244,7 +244,8 @@ android_mtp_MtpDevice_get_device_info(JNIEnv *env, jobject thiz)
if (deviceInfo->mSerial)
env->SetObjectField(info, field_deviceInfo_serialNumber,
env->NewStringUTF(deviceInfo->mSerial));
if (deviceInfo->mOperations) {
assert(deviceInfo->mOperations);
{
const size_t size = deviceInfo->mOperations->size();
ScopedLocalRef<jintArray> operations(env, static_cast<jintArray>(env->NewIntArray(size)));
{
@@ -259,7 +260,8 @@ android_mtp_MtpDevice_get_device_info(JNIEnv *env, jobject thiz)
env->SetObjectField(info, field_deviceInfo_operationsSupported, operations.get());
}
}
if (deviceInfo->mEvents) {
assert(deviceInfo->mEvents);
{
const size_t size = deviceInfo->mEvents->size();
ScopedLocalRef<jintArray> events(env, static_cast<jintArray>(env->NewIntArray(size)));
{