Loading Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -235,6 +235,7 @@ java_library { "android.hardware.usb-V1.0-java-constants", "android.hardware.usb-V1.1-java-constants", "android.hardware.usb-V1.2-java-constants", "android.hardware.usb.gadget-V1-java", "android.hardware.usb.gadget-V1.0-java", "android.hardware.usb.gadget-V1.1-java", "android.hardware.usb.gadget-V1.2-java", Loading core/java/android/hardware/usb/UsbManager.java +27 −21 Original line number Diff line number Diff line Loading @@ -37,8 +37,8 @@ import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.hardware.usb.gadget.V1_0.GadgetFunction; import android.hardware.usb.gadget.V1_2.UsbSpeed; import android.hardware.usb.gadget.GadgetFunction; import android.hardware.usb.gadget.UsbSpeed; import android.os.Binder; import android.os.Build; import android.os.Bundle; Loading @@ -54,15 +54,12 @@ import com.android.internal.annotations.GuardedBy; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.StringJoiner; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.Executor; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.concurrent.atomic.AtomicInteger; /** * This class allows you to access the state of USB and communicate with USB devices. Loading Loading @@ -104,7 +101,7 @@ public class UsbManager { * MIDI function is enabled * </ul> * If the sticky intent has not been found, that indicates USB is disconnected, * USB is not configued, MTP function is enabled, and all the other functions are disabled. * USB is not configured, MTP function is enabled, and all the other functions are disabled. * * @hide */ Loading Loading @@ -616,6 +613,7 @@ public class UsbManager { /** * Code for the charging usb function. Passed into {@link #setCurrentFunctions(long)} * Must be equal to {@link GadgetFunction#NONE} * @hide */ @SystemApi Loading @@ -623,55 +621,63 @@ public class UsbManager { /** * Code for the mtp usb function. Passed as a mask into {@link #setCurrentFunctions(long)} * Must be equal to {@link GadgetFunction#MTP} * @hide */ @SystemApi public static final long FUNCTION_MTP = GadgetFunction.MTP; public static final long FUNCTION_MTP = 1 << 2; /** * Code for the ptp usb function. Passed as a mask into {@link #setCurrentFunctions(long)} * Must be equal to {@link GadgetFunction#PTP} * @hide */ @SystemApi public static final long FUNCTION_PTP = GadgetFunction.PTP; public static final long FUNCTION_PTP = 1 << 4; /** * Code for the rndis usb function. Passed as a mask into {@link #setCurrentFunctions(long)} * Must be equal to {@link GadgetFunction#RNDIS} * @hide */ @SystemApi public static final long FUNCTION_RNDIS = GadgetFunction.RNDIS; public static final long FUNCTION_RNDIS = 1 << 5; /** * Code for the midi usb function. Passed as a mask into {@link #setCurrentFunctions(long)} * Must be equal to {@link GadgetFunction#MIDI} * @hide */ @SystemApi public static final long FUNCTION_MIDI = GadgetFunction.MIDI; public static final long FUNCTION_MIDI = 1 << 3; /** * Code for the accessory usb function. * Must be equal to {@link GadgetFunction#ACCESSORY} * @hide */ @SystemApi public static final long FUNCTION_ACCESSORY = GadgetFunction.ACCESSORY; public static final long FUNCTION_ACCESSORY = 1 << 1; /** * Code for the audio source usb function. * Must be equal to {@link GadgetFunction#AUDIO_SOURCE} * @hide */ @SystemApi public static final long FUNCTION_AUDIO_SOURCE = GadgetFunction.AUDIO_SOURCE; public static final long FUNCTION_AUDIO_SOURCE = 1 << 6; /** * Code for the adb usb function. * Must be equal to {@link GadgetFunction#ADB} * @hide */ @SystemApi public static final long FUNCTION_ADB = GadgetFunction.ADB; public static final long FUNCTION_ADB = 1; /** * Code for the ncm source usb function. * Must be equal to {@link GadgetFunction#NCM} * @hide */ @SystemApi Loading Loading
Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -235,6 +235,7 @@ java_library { "android.hardware.usb-V1.0-java-constants", "android.hardware.usb-V1.1-java-constants", "android.hardware.usb-V1.2-java-constants", "android.hardware.usb.gadget-V1-java", "android.hardware.usb.gadget-V1.0-java", "android.hardware.usb.gadget-V1.1-java", "android.hardware.usb.gadget-V1.2-java", Loading
core/java/android/hardware/usb/UsbManager.java +27 −21 Original line number Diff line number Diff line Loading @@ -37,8 +37,8 @@ import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.hardware.usb.gadget.V1_0.GadgetFunction; import android.hardware.usb.gadget.V1_2.UsbSpeed; import android.hardware.usb.gadget.GadgetFunction; import android.hardware.usb.gadget.UsbSpeed; import android.os.Binder; import android.os.Build; import android.os.Bundle; Loading @@ -54,15 +54,12 @@ import com.android.internal.annotations.GuardedBy; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.StringJoiner; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.Executor; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.concurrent.atomic.AtomicInteger; /** * This class allows you to access the state of USB and communicate with USB devices. Loading Loading @@ -104,7 +101,7 @@ public class UsbManager { * MIDI function is enabled * </ul> * If the sticky intent has not been found, that indicates USB is disconnected, * USB is not configued, MTP function is enabled, and all the other functions are disabled. * USB is not configured, MTP function is enabled, and all the other functions are disabled. * * @hide */ Loading Loading @@ -616,6 +613,7 @@ public class UsbManager { /** * Code for the charging usb function. Passed into {@link #setCurrentFunctions(long)} * Must be equal to {@link GadgetFunction#NONE} * @hide */ @SystemApi Loading @@ -623,55 +621,63 @@ public class UsbManager { /** * Code for the mtp usb function. Passed as a mask into {@link #setCurrentFunctions(long)} * Must be equal to {@link GadgetFunction#MTP} * @hide */ @SystemApi public static final long FUNCTION_MTP = GadgetFunction.MTP; public static final long FUNCTION_MTP = 1 << 2; /** * Code for the ptp usb function. Passed as a mask into {@link #setCurrentFunctions(long)} * Must be equal to {@link GadgetFunction#PTP} * @hide */ @SystemApi public static final long FUNCTION_PTP = GadgetFunction.PTP; public static final long FUNCTION_PTP = 1 << 4; /** * Code for the rndis usb function. Passed as a mask into {@link #setCurrentFunctions(long)} * Must be equal to {@link GadgetFunction#RNDIS} * @hide */ @SystemApi public static final long FUNCTION_RNDIS = GadgetFunction.RNDIS; public static final long FUNCTION_RNDIS = 1 << 5; /** * Code for the midi usb function. Passed as a mask into {@link #setCurrentFunctions(long)} * Must be equal to {@link GadgetFunction#MIDI} * @hide */ @SystemApi public static final long FUNCTION_MIDI = GadgetFunction.MIDI; public static final long FUNCTION_MIDI = 1 << 3; /** * Code for the accessory usb function. * Must be equal to {@link GadgetFunction#ACCESSORY} * @hide */ @SystemApi public static final long FUNCTION_ACCESSORY = GadgetFunction.ACCESSORY; public static final long FUNCTION_ACCESSORY = 1 << 1; /** * Code for the audio source usb function. * Must be equal to {@link GadgetFunction#AUDIO_SOURCE} * @hide */ @SystemApi public static final long FUNCTION_AUDIO_SOURCE = GadgetFunction.AUDIO_SOURCE; public static final long FUNCTION_AUDIO_SOURCE = 1 << 6; /** * Code for the adb usb function. * Must be equal to {@link GadgetFunction#ADB} * @hide */ @SystemApi public static final long FUNCTION_ADB = GadgetFunction.ADB; public static final long FUNCTION_ADB = 1; /** * Code for the ncm source usb function. * Must be equal to {@link GadgetFunction#NCM} * @hide */ @SystemApi Loading