Loading media/java/android/mtp/MtpDeviceInfo.java +9 −7 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.mtp; import android.annotation.NonNull; /** * This class encapsulates information about an MTP device. * This corresponds to the DeviceInfo Dataset described in Loading @@ -39,7 +41,7 @@ public class MtpDeviceInfo { * * @return the manufacturer name */ public final String getManufacturer() { public final @NonNull String getManufacturer() { return mManufacturer; } Loading @@ -48,7 +50,7 @@ public class MtpDeviceInfo { * * @return the model name */ public final String getModel() { public final @NonNull String getModel() { return mModel; } Loading @@ -57,7 +59,7 @@ public class MtpDeviceInfo { * * @return the device version */ public final String getVersion() { public final @NonNull String getVersion() { return mVersion; } Loading @@ -66,7 +68,7 @@ public class MtpDeviceInfo { * * @return the serial number */ public final String getSerialNumber() { public final @NonNull String getSerialNumber() { return mSerialNumber; } Loading Loading @@ -110,7 +112,7 @@ public class MtpDeviceInfo { * @see MtpConstants#OPERATION_SET_OBJECT_REFERENCES * @see MtpConstants#OPERATION_SKIP */ public final int[] getOperationsSupported() { public final @NonNull int[] getOperationsSupported() { return mOperationsSupported; } Loading @@ -137,7 +139,7 @@ public class MtpDeviceInfo { * @see MtpEvent#EVENT_OBJECT_PROP_DESC_CHANGED * @see MtpEvent#EVENT_OBJECT_REFERENCES_CHANGED */ public final int[] getEventsSupported() { public final @NonNull int[] getEventsSupported() { return mEventsSupported; } Loading @@ -163,7 +165,7 @@ public class MtpDeviceInfo { * Returns if the code set contains code. * @hide */ private static boolean isSupported(int[] set, int code) { private static boolean isSupported(@NonNull int[] set, int code) { for (final int element : set) { if (element == code) { return true; Loading media/java/android/mtp/MtpObjectInfo.java +19 −6 Original line number Diff line number Diff line Loading @@ -16,8 +16,13 @@ package android.mtp; import android.annotation.NonNull; import android.os.Build; import com.android.internal.util.Preconditions; import dalvik.system.VMRuntime; /** * This class encapsulates information about an object on an MTP device. * This corresponds to the ObjectInfo Dataset described in Loading @@ -40,10 +45,10 @@ public final class MtpObjectInfo { private int mAssociationType; private int mAssociationDesc; private int mSequenceNumber; private String mName; private String mName = ""; private long mDateCreated; private long mDateModified; private String mKeywords; private String mKeywords = ""; // only instantiated via JNI or via a builder private MtpObjectInfo() { Loading Loading @@ -311,7 +316,7 @@ public final class MtpObjectInfo { * * @return the object's name */ public final String getName() { public final @NonNull String getName() { return mName; } Loading Loading @@ -340,7 +345,7 @@ public final class MtpObjectInfo { * * @return the object's keyword list */ public final String getKeywords() { public final @NonNull String getKeywords() { return mKeywords; } Loading Loading @@ -435,12 +440,20 @@ public final class MtpObjectInfo { return this; } public Builder setKeywords(String value) { public Builder setKeywords(@NonNull String value) { if (VMRuntime.getRuntime().getTargetSdkVersion() > Build.VERSION_CODES.N_MR1) { Preconditions.checkNotNull(value); } else if (value == null) { // Before N_MR1 we accept null value and it was regarded as an empty string in // MtpDevice#sendObjectInfo. value = ""; } mObjectInfo.mKeywords = value; return this; } public Builder setName(String value) { public Builder setName(@NonNull String value) { Preconditions.checkNotNull(value); mObjectInfo.mName = value; return this; } Loading media/java/android/mtp/MtpStorageInfo.java +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.mtp; import android.annotation.NonNull; /** * This class encapsulates information about a storage unit on an MTP device. * This corresponds to the StorageInfo Dataset described in Loading Loading @@ -68,7 +70,7 @@ public final class MtpStorageInfo { * * @return the storage unit description */ public final String getDescription() { public final @NonNull String getDescription() { return mDescription; } Loading @@ -77,7 +79,7 @@ public final class MtpStorageInfo { * * @return the storage volume identifier */ public final String getVolumeIdentifier() { public final @NonNull String getVolumeIdentifier() { return mVolumeIdentifier; } } Loading
media/java/android/mtp/MtpDeviceInfo.java +9 −7 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.mtp; import android.annotation.NonNull; /** * This class encapsulates information about an MTP device. * This corresponds to the DeviceInfo Dataset described in Loading @@ -39,7 +41,7 @@ public class MtpDeviceInfo { * * @return the manufacturer name */ public final String getManufacturer() { public final @NonNull String getManufacturer() { return mManufacturer; } Loading @@ -48,7 +50,7 @@ public class MtpDeviceInfo { * * @return the model name */ public final String getModel() { public final @NonNull String getModel() { return mModel; } Loading @@ -57,7 +59,7 @@ public class MtpDeviceInfo { * * @return the device version */ public final String getVersion() { public final @NonNull String getVersion() { return mVersion; } Loading @@ -66,7 +68,7 @@ public class MtpDeviceInfo { * * @return the serial number */ public final String getSerialNumber() { public final @NonNull String getSerialNumber() { return mSerialNumber; } Loading Loading @@ -110,7 +112,7 @@ public class MtpDeviceInfo { * @see MtpConstants#OPERATION_SET_OBJECT_REFERENCES * @see MtpConstants#OPERATION_SKIP */ public final int[] getOperationsSupported() { public final @NonNull int[] getOperationsSupported() { return mOperationsSupported; } Loading @@ -137,7 +139,7 @@ public class MtpDeviceInfo { * @see MtpEvent#EVENT_OBJECT_PROP_DESC_CHANGED * @see MtpEvent#EVENT_OBJECT_REFERENCES_CHANGED */ public final int[] getEventsSupported() { public final @NonNull int[] getEventsSupported() { return mEventsSupported; } Loading @@ -163,7 +165,7 @@ public class MtpDeviceInfo { * Returns if the code set contains code. * @hide */ private static boolean isSupported(int[] set, int code) { private static boolean isSupported(@NonNull int[] set, int code) { for (final int element : set) { if (element == code) { return true; Loading
media/java/android/mtp/MtpObjectInfo.java +19 −6 Original line number Diff line number Diff line Loading @@ -16,8 +16,13 @@ package android.mtp; import android.annotation.NonNull; import android.os.Build; import com.android.internal.util.Preconditions; import dalvik.system.VMRuntime; /** * This class encapsulates information about an object on an MTP device. * This corresponds to the ObjectInfo Dataset described in Loading @@ -40,10 +45,10 @@ public final class MtpObjectInfo { private int mAssociationType; private int mAssociationDesc; private int mSequenceNumber; private String mName; private String mName = ""; private long mDateCreated; private long mDateModified; private String mKeywords; private String mKeywords = ""; // only instantiated via JNI or via a builder private MtpObjectInfo() { Loading Loading @@ -311,7 +316,7 @@ public final class MtpObjectInfo { * * @return the object's name */ public final String getName() { public final @NonNull String getName() { return mName; } Loading Loading @@ -340,7 +345,7 @@ public final class MtpObjectInfo { * * @return the object's keyword list */ public final String getKeywords() { public final @NonNull String getKeywords() { return mKeywords; } Loading Loading @@ -435,12 +440,20 @@ public final class MtpObjectInfo { return this; } public Builder setKeywords(String value) { public Builder setKeywords(@NonNull String value) { if (VMRuntime.getRuntime().getTargetSdkVersion() > Build.VERSION_CODES.N_MR1) { Preconditions.checkNotNull(value); } else if (value == null) { // Before N_MR1 we accept null value and it was regarded as an empty string in // MtpDevice#sendObjectInfo. value = ""; } mObjectInfo.mKeywords = value; return this; } public Builder setName(String value) { public Builder setName(@NonNull String value) { Preconditions.checkNotNull(value); mObjectInfo.mName = value; return this; } Loading
media/java/android/mtp/MtpStorageInfo.java +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.mtp; import android.annotation.NonNull; /** * This class encapsulates information about a storage unit on an MTP device. * This corresponds to the StorageInfo Dataset described in Loading Loading @@ -68,7 +70,7 @@ public final class MtpStorageInfo { * * @return the storage unit description */ public final String getDescription() { public final @NonNull String getDescription() { return mDescription; } Loading @@ -77,7 +79,7 @@ public final class MtpStorageInfo { * * @return the storage volume identifier */ public final String getVolumeIdentifier() { public final @NonNull String getVolumeIdentifier() { return mVolumeIdentifier; } }