Merge "Report "SKIPPED" for unsupported tests."
diff --git a/.clang-format b/.clang-format
index 9b3f9d9..3494682 100644
--- a/.clang-format
+++ b/.clang-format
@@ -22,3 +22,4 @@
TabWidth: 4
UseTab: Never
IndentWidth: 4
+ContinuationIndentWidth: 8
diff --git a/audio/4.0/config/api/current.txt b/audio/4.0/config/api/current.txt
index f0814bf..d59cade 100644
--- a/audio/4.0/config/api/current.txt
+++ b/audio/4.0/config/api/current.txt
@@ -1,3 +1,4 @@
+// Signature format: 2.0
package audio.policy.configuration.V4_0 {
public class AttachedDevices {
@@ -5,10 +6,8 @@
method public java.util.List<java.lang.String> getItem();
}
- public final class AudioDevice extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V4_0.AudioDevice valueOf(java.lang.String);
- method public static final audio.policy.configuration.V4_0.AudioDevice[] values();
+ public enum AudioDevice {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_AMBIENT;
enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET;
enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_AUX_DIGITAL;
@@ -72,10 +71,8 @@
enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_WIRED_HEADSET;
}
- public final class AudioFormat extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V4_0.AudioFormat valueOf(java.lang.String);
- method public static final audio.policy.configuration.V4_0.AudioFormat[] values();
+ public enum AudioFormat {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC;
enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ADIF;
enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ADTS;
@@ -148,10 +145,8 @@
method public void setVersion(audio.policy.configuration.V4_0.Version);
}
- public final class AudioUsage extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V4_0.AudioUsage valueOf(java.lang.String);
- method public static final audio.policy.configuration.V4_0.AudioUsage[] values();
+ public enum AudioUsage {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V4_0.AudioUsage AUDIO_USAGE_ALARM;
enum_constant public static final audio.policy.configuration.V4_0.AudioUsage AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY;
enum_constant public static final audio.policy.configuration.V4_0.AudioUsage AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE;
@@ -167,10 +162,8 @@
enum_constant public static final audio.policy.configuration.V4_0.AudioUsage AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING;
}
- public final class DeviceCategory extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V4_0.DeviceCategory valueOf(java.lang.String);
- method public static final audio.policy.configuration.V4_0.DeviceCategory[] values();
+ public enum DeviceCategory {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V4_0.DeviceCategory DEVICE_CATEGORY_EARPIECE;
enum_constant public static final audio.policy.configuration.V4_0.DeviceCategory DEVICE_CATEGORY_EXT_MEDIA;
enum_constant public static final audio.policy.configuration.V4_0.DeviceCategory DEVICE_CATEGORY_HEADSET;
@@ -185,25 +178,23 @@
public static class DevicePorts.DevicePort {
ctor public DevicePorts.DevicePort();
- method public java.lang.String getAddress();
+ method public String getAddress();
method public audio.policy.configuration.V4_0.Gains getGains();
method public java.util.List<audio.policy.configuration.V4_0.Profile> getProfile();
method public audio.policy.configuration.V4_0.Role getRole();
- method public java.lang.String getTagName();
- method public java.lang.String getType();
+ method public String getTagName();
+ method public String getType();
method public boolean get_default();
- method public void setAddress(java.lang.String);
+ method public void setAddress(String);
method public void setGains(audio.policy.configuration.V4_0.Gains);
method public void setRole(audio.policy.configuration.V4_0.Role);
- method public void setTagName(java.lang.String);
- method public void setType(java.lang.String);
+ method public void setTagName(String);
+ method public void setType(String);
method public void set_default(boolean);
}
- public final class GainMode extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V4_0.GainMode valueOf(java.lang.String);
- method public static final audio.policy.configuration.V4_0.GainMode[] values();
+ public enum GainMode {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V4_0.GainMode AUDIO_GAIN_MODE_CHANNELS;
enum_constant public static final audio.policy.configuration.V4_0.GainMode AUDIO_GAIN_MODE_JOINT;
enum_constant public static final audio.policy.configuration.V4_0.GainMode AUDIO_GAIN_MODE_RAMP;
@@ -216,23 +207,23 @@
public static class Gains.Gain {
ctor public Gains.Gain();
- method public java.lang.String getChannel_mask();
+ method public String getChannel_mask();
method public int getDefaultValueMB();
method public int getMaxRampMs();
method public int getMaxValueMB();
method public int getMinRampMs();
method public int getMinValueMB();
method public audio.policy.configuration.V4_0.GainMode getMode();
- method public java.lang.String getName();
+ method public String getName();
method public int getStepValueMB();
- method public void setChannel_mask(java.lang.String);
+ method public void setChannel_mask(String);
method public void setDefaultValueMB(int);
method public void setMaxRampMs(int);
method public void setMaxValueMB(int);
method public void setMinRampMs(int);
method public void setMinValueMB(int);
method public void setMode(audio.policy.configuration.V4_0.GainMode);
- method public void setName(java.lang.String);
+ method public void setName(String);
method public void setStepValueMB(int);
}
@@ -242,10 +233,8 @@
method public void setSpeaker_drc_enabled(boolean);
}
- public final class HalVersion extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V4_0.HalVersion valueOf(java.lang.String);
- method public static final audio.policy.configuration.V4_0.HalVersion[] values();
+ public enum HalVersion {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V4_0.HalVersion _2_0;
enum_constant public static final audio.policy.configuration.V4_0.HalVersion _3_0;
}
@@ -257,27 +246,25 @@
public static class MixPorts.MixPort {
ctor public MixPorts.MixPort();
- method public java.lang.String getFlags();
+ method public String getFlags();
method public audio.policy.configuration.V4_0.Gains getGains();
method public long getMaxActiveCount();
method public long getMaxOpenCount();
- method public java.lang.String getName();
+ method public String getName();
method public java.util.List<audio.policy.configuration.V4_0.AudioUsage> getPreferredUsage();
method public java.util.List<audio.policy.configuration.V4_0.Profile> getProfile();
method public audio.policy.configuration.V4_0.Role getRole();
- method public void setFlags(java.lang.String);
+ method public void setFlags(String);
method public void setGains(audio.policy.configuration.V4_0.Gains);
method public void setMaxActiveCount(long);
method public void setMaxOpenCount(long);
- method public void setName(java.lang.String);
+ method public void setName(String);
method public void setPreferredUsage(java.util.List<audio.policy.configuration.V4_0.AudioUsage>);
method public void setRole(audio.policy.configuration.V4_0.Role);
}
- public final class MixType extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V4_0.MixType valueOf(java.lang.String);
- method public static final audio.policy.configuration.V4_0.MixType[] values();
+ public enum MixType {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V4_0.MixType mix;
enum_constant public static final audio.policy.configuration.V4_0.MixType mux;
}
@@ -290,44 +277,42 @@
public static class Modules.Module {
ctor public Modules.Module();
method public audio.policy.configuration.V4_0.AttachedDevices getAttachedDevices();
- method public java.lang.String getDefaultOutputDevice();
+ method public String getDefaultOutputDevice();
method public audio.policy.configuration.V4_0.DevicePorts getDevicePorts();
method public audio.policy.configuration.V4_0.HalVersion getHalVersion();
method public audio.policy.configuration.V4_0.MixPorts getMixPorts();
- method public java.lang.String getName();
+ method public String getName();
method public audio.policy.configuration.V4_0.Routes getRoutes();
method public void setAttachedDevices(audio.policy.configuration.V4_0.AttachedDevices);
- method public void setDefaultOutputDevice(java.lang.String);
+ method public void setDefaultOutputDevice(String);
method public void setDevicePorts(audio.policy.configuration.V4_0.DevicePorts);
method public void setHalVersion(audio.policy.configuration.V4_0.HalVersion);
method public void setMixPorts(audio.policy.configuration.V4_0.MixPorts);
- method public void setName(java.lang.String);
+ method public void setName(String);
method public void setRoutes(audio.policy.configuration.V4_0.Routes);
}
public class Profile {
ctor public Profile();
- method public java.lang.String getChannelMasks();
- method public java.lang.String getFormat();
- method public java.lang.String getName();
- method public java.lang.String getSamplingRates();
- method public void setChannelMasks(java.lang.String);
- method public void setFormat(java.lang.String);
- method public void setName(java.lang.String);
- method public void setSamplingRates(java.lang.String);
+ method public String getChannelMasks();
+ method public String getFormat();
+ method public String getName();
+ method public String getSamplingRates();
+ method public void setChannelMasks(String);
+ method public void setFormat(String);
+ method public void setName(String);
+ method public void setSamplingRates(String);
}
public class Reference {
ctor public Reference();
- method public java.lang.String getName();
+ method public String getName();
method public java.util.List<java.lang.String> getPoint();
- method public void setName(java.lang.String);
+ method public void setName(String);
}
- public final class Role extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V4_0.Role valueOf(java.lang.String);
- method public static final audio.policy.configuration.V4_0.Role[] values();
+ public enum Role {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V4_0.Role sink;
enum_constant public static final audio.policy.configuration.V4_0.Role source;
}
@@ -339,18 +324,16 @@
public static class Routes.Route {
ctor public Routes.Route();
- method public java.lang.String getSink();
- method public java.lang.String getSources();
+ method public String getSink();
+ method public String getSources();
method public audio.policy.configuration.V4_0.MixType getType();
- method public void setSink(java.lang.String);
- method public void setSources(java.lang.String);
+ method public void setSink(String);
+ method public void setSources(String);
method public void setType(audio.policy.configuration.V4_0.MixType);
}
- public final class Stream extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V4_0.Stream valueOf(java.lang.String);
- method public static final audio.policy.configuration.V4_0.Stream[] values();
+ public enum Stream {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V4_0.Stream AUDIO_STREAM_ACCESSIBILITY;
enum_constant public static final audio.policy.configuration.V4_0.Stream AUDIO_STREAM_ALARM;
enum_constant public static final audio.policy.configuration.V4_0.Stream AUDIO_STREAM_BLUETOOTH_SCO;
@@ -366,10 +349,8 @@
enum_constant public static final audio.policy.configuration.V4_0.Stream AUDIO_STREAM_VOICE_CALL;
}
- public final class Version extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V4_0.Version valueOf(java.lang.String);
- method public static final audio.policy.configuration.V4_0.Version[] values();
+ public enum Version {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V4_0.Version _1_0;
}
@@ -377,10 +358,10 @@
ctor public Volume();
method public audio.policy.configuration.V4_0.DeviceCategory getDeviceCategory();
method public java.util.List<java.lang.String> getPoint();
- method public java.lang.String getRef();
+ method public String getRef();
method public audio.policy.configuration.V4_0.Stream getStream();
method public void setDeviceCategory(audio.policy.configuration.V4_0.DeviceCategory);
- method public void setRef(java.lang.String);
+ method public void setRef(String);
method public void setStream(audio.policy.configuration.V4_0.Stream);
}
@@ -393,7 +374,7 @@
public class XmlParser {
ctor public XmlParser();
method public static audio.policy.configuration.V4_0.AudioPolicyConfiguration read(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException;
- method public static java.lang.String readText(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method public static String readText(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public static void skip(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
}
diff --git a/audio/4.0/config/api/removed.txt b/audio/4.0/config/api/removed.txt
index e69de29..d802177 100644
--- a/audio/4.0/config/api/removed.txt
+++ b/audio/4.0/config/api/removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/audio/5.0/IStreamIn.hal b/audio/5.0/IStreamIn.hal
index d33cfdc..b042960 100644
--- a/audio/5.0/IStreamIn.hal
+++ b/audio/5.0/IStreamIn.hal
@@ -165,4 +165,27 @@
*/
getActiveMicrophones()
generates(Result retval, vec<MicrophoneInfo> microphones);
+
+ /**
+ * Specifies the logical microphone (for processing).
+ *
+ * Optional method
+ *
+ * @param Direction constant
+ * @return retval OK if the call is successful, an error code otherwise.
+ */
+ setMicrophoneDirection(MicrophoneDirection direction)
+ generates(Result retval);
+
+ /**
+ * Specifies the zoom factor for the selected microphone (for processing).
+ *
+ * Optional method
+ *
+ * @param the desired field dimension of microphone capture. Range is from -1 (wide angle),
+ * though 0 (no zoom) to 1 (maximum zoom).
+ *
+ * @return retval OK if the call is not successful, an error code otherwise.
+ */
+ setMicrophoneFieldDimension(float zoom) generates(Result retval);
};
diff --git a/audio/5.0/config/api/current.txt b/audio/5.0/config/api/current.txt
index 4334172..17f38c1 100644
--- a/audio/5.0/config/api/current.txt
+++ b/audio/5.0/config/api/current.txt
@@ -1,3 +1,4 @@
+// Signature format: 2.0
package audio.policy.configuration.V5_0 {
public class AttachedDevices {
@@ -5,10 +6,8 @@
method public java.util.List<java.lang.String> getItem();
}
- public final class AudioDevice extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V5_0.AudioDevice valueOf(java.lang.String);
- method public static final audio.policy.configuration.V5_0.AudioDevice[] values();
+ public enum AudioDevice {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_AMBIENT;
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET;
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_AUX_DIGITAL;
@@ -21,8 +20,10 @@
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_COMMUNICATION;
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_DEFAULT;
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET;
+ enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_ECHO_REFERENCE;
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_FM_TUNER;
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_HDMI;
+ enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_HDMI_ARC;
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_IP;
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_LINE;
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_LOOPBACK;
@@ -72,10 +73,8 @@
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_WIRED_HEADSET;
}
- public final class AudioFormat extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V5_0.AudioFormat valueOf(java.lang.String);
- method public static final audio.policy.configuration.V5_0.AudioFormat[] values();
+ public enum AudioFormat {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ADIF;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ADTS;
@@ -94,6 +93,10 @@
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ERLC;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_HE_V1;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_HE_V2;
+ enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LATM;
+ enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LATM_HE_V1;
+ enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LATM_HE_V2;
+ enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LATM_LC;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LC;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LD;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LTP;
@@ -109,7 +112,9 @@
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AMR_WB_PLUS;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_APE;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_APTX;
+ enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_APTX_ADAPTIVE;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_APTX_HD;
+ enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_CELT;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_DOLBY_TRUEHD;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_DSD;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_DTS;
@@ -125,6 +130,8 @@
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_HE_AAC_V2;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_IEC61937;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_LDAC;
+ enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_LHDC;
+ enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_LHDC_LL;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_MAT_1_0;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_MAT_2_0;
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_MAT_2_1;
@@ -156,10 +163,8 @@
method public void setVersion(audio.policy.configuration.V5_0.Version);
}
- public final class AudioUsage extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V5_0.AudioUsage valueOf(java.lang.String);
- method public static final audio.policy.configuration.V5_0.AudioUsage[] values();
+ public enum AudioUsage {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V5_0.AudioUsage AUDIO_USAGE_ALARM;
enum_constant public static final audio.policy.configuration.V5_0.AudioUsage AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY;
enum_constant public static final audio.policy.configuration.V5_0.AudioUsage AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE;
@@ -175,10 +180,8 @@
enum_constant public static final audio.policy.configuration.V5_0.AudioUsage AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING;
}
- public final class DeviceCategory extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V5_0.DeviceCategory valueOf(java.lang.String);
- method public static final audio.policy.configuration.V5_0.DeviceCategory[] values();
+ public enum DeviceCategory {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V5_0.DeviceCategory DEVICE_CATEGORY_EARPIECE;
enum_constant public static final audio.policy.configuration.V5_0.DeviceCategory DEVICE_CATEGORY_EXT_MEDIA;
enum_constant public static final audio.policy.configuration.V5_0.DeviceCategory DEVICE_CATEGORY_HEADSET;
@@ -193,25 +196,25 @@
public static class DevicePorts.DevicePort {
ctor public DevicePorts.DevicePort();
- method public java.lang.String getAddress();
+ method public String getAddress();
+ method public java.util.List<audio.policy.configuration.V5_0.AudioFormat> getEncodedFormats();
method public audio.policy.configuration.V5_0.Gains getGains();
method public java.util.List<audio.policy.configuration.V5_0.Profile> getProfile();
method public audio.policy.configuration.V5_0.Role getRole();
- method public java.lang.String getTagName();
- method public java.lang.String getType();
+ method public String getTagName();
+ method public String getType();
method public boolean get_default();
- method public void setAddress(java.lang.String);
+ method public void setAddress(String);
+ method public void setEncodedFormats(java.util.List<audio.policy.configuration.V5_0.AudioFormat>);
method public void setGains(audio.policy.configuration.V5_0.Gains);
method public void setRole(audio.policy.configuration.V5_0.Role);
- method public void setTagName(java.lang.String);
- method public void setType(java.lang.String);
+ method public void setTagName(String);
+ method public void setType(String);
method public void set_default(boolean);
}
- public final class GainMode extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V5_0.GainMode valueOf(java.lang.String);
- method public static final audio.policy.configuration.V5_0.GainMode[] values();
+ public enum GainMode {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V5_0.GainMode AUDIO_GAIN_MODE_CHANNELS;
enum_constant public static final audio.policy.configuration.V5_0.GainMode AUDIO_GAIN_MODE_JOINT;
enum_constant public static final audio.policy.configuration.V5_0.GainMode AUDIO_GAIN_MODE_RAMP;
@@ -224,23 +227,23 @@
public static class Gains.Gain {
ctor public Gains.Gain();
- method public java.lang.String getChannel_mask();
+ method public String getChannel_mask();
method public int getDefaultValueMB();
method public int getMaxRampMs();
method public int getMaxValueMB();
method public int getMinRampMs();
method public int getMinValueMB();
method public audio.policy.configuration.V5_0.GainMode getMode();
- method public java.lang.String getName();
+ method public String getName();
method public int getStepValueMB();
- method public void setChannel_mask(java.lang.String);
+ method public void setChannel_mask(String);
method public void setDefaultValueMB(int);
method public void setMaxRampMs(int);
method public void setMaxValueMB(int);
method public void setMinRampMs(int);
method public void setMinValueMB(int);
method public void setMode(audio.policy.configuration.V5_0.GainMode);
- method public void setName(java.lang.String);
+ method public void setName(String);
method public void setStepValueMB(int);
}
@@ -250,10 +253,8 @@
method public void setSpeaker_drc_enabled(boolean);
}
- public final class HalVersion extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V5_0.HalVersion valueOf(java.lang.String);
- method public static final audio.policy.configuration.V5_0.HalVersion[] values();
+ public enum HalVersion {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V5_0.HalVersion _2_0;
enum_constant public static final audio.policy.configuration.V5_0.HalVersion _3_0;
}
@@ -265,27 +266,25 @@
public static class MixPorts.MixPort {
ctor public MixPorts.MixPort();
- method public java.lang.String getFlags();
+ method public String getFlags();
method public audio.policy.configuration.V5_0.Gains getGains();
method public long getMaxActiveCount();
method public long getMaxOpenCount();
- method public java.lang.String getName();
+ method public String getName();
method public java.util.List<audio.policy.configuration.V5_0.AudioUsage> getPreferredUsage();
method public java.util.List<audio.policy.configuration.V5_0.Profile> getProfile();
method public audio.policy.configuration.V5_0.Role getRole();
- method public void setFlags(java.lang.String);
+ method public void setFlags(String);
method public void setGains(audio.policy.configuration.V5_0.Gains);
method public void setMaxActiveCount(long);
method public void setMaxOpenCount(long);
- method public void setName(java.lang.String);
+ method public void setName(String);
method public void setPreferredUsage(java.util.List<audio.policy.configuration.V5_0.AudioUsage>);
method public void setRole(audio.policy.configuration.V5_0.Role);
}
- public final class MixType extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V5_0.MixType valueOf(java.lang.String);
- method public static final audio.policy.configuration.V5_0.MixType[] values();
+ public enum MixType {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V5_0.MixType mix;
enum_constant public static final audio.policy.configuration.V5_0.MixType mux;
}
@@ -298,44 +297,42 @@
public static class Modules.Module {
ctor public Modules.Module();
method public audio.policy.configuration.V5_0.AttachedDevices getAttachedDevices();
- method public java.lang.String getDefaultOutputDevice();
+ method public String getDefaultOutputDevice();
method public audio.policy.configuration.V5_0.DevicePorts getDevicePorts();
method public audio.policy.configuration.V5_0.HalVersion getHalVersion();
method public audio.policy.configuration.V5_0.MixPorts getMixPorts();
- method public java.lang.String getName();
+ method public String getName();
method public audio.policy.configuration.V5_0.Routes getRoutes();
method public void setAttachedDevices(audio.policy.configuration.V5_0.AttachedDevices);
- method public void setDefaultOutputDevice(java.lang.String);
+ method public void setDefaultOutputDevice(String);
method public void setDevicePorts(audio.policy.configuration.V5_0.DevicePorts);
method public void setHalVersion(audio.policy.configuration.V5_0.HalVersion);
method public void setMixPorts(audio.policy.configuration.V5_0.MixPorts);
- method public void setName(java.lang.String);
+ method public void setName(String);
method public void setRoutes(audio.policy.configuration.V5_0.Routes);
}
public class Profile {
ctor public Profile();
- method public java.lang.String getChannelMasks();
- method public java.lang.String getFormat();
- method public java.lang.String getName();
- method public java.lang.String getSamplingRates();
- method public void setChannelMasks(java.lang.String);
- method public void setFormat(java.lang.String);
- method public void setName(java.lang.String);
- method public void setSamplingRates(java.lang.String);
+ method public String getChannelMasks();
+ method public String getFormat();
+ method public String getName();
+ method public String getSamplingRates();
+ method public void setChannelMasks(String);
+ method public void setFormat(String);
+ method public void setName(String);
+ method public void setSamplingRates(String);
}
public class Reference {
ctor public Reference();
- method public java.lang.String getName();
+ method public String getName();
method public java.util.List<java.lang.String> getPoint();
- method public void setName(java.lang.String);
+ method public void setName(String);
}
- public final class Role extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V5_0.Role valueOf(java.lang.String);
- method public static final audio.policy.configuration.V5_0.Role[] values();
+ public enum Role {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V5_0.Role sink;
enum_constant public static final audio.policy.configuration.V5_0.Role source;
}
@@ -347,18 +344,16 @@
public static class Routes.Route {
ctor public Routes.Route();
- method public java.lang.String getSink();
- method public java.lang.String getSources();
+ method public String getSink();
+ method public String getSources();
method public audio.policy.configuration.V5_0.MixType getType();
- method public void setSink(java.lang.String);
- method public void setSources(java.lang.String);
+ method public void setSink(String);
+ method public void setSources(String);
method public void setType(audio.policy.configuration.V5_0.MixType);
}
- public final class Stream extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V5_0.Stream valueOf(java.lang.String);
- method public static final audio.policy.configuration.V5_0.Stream[] values();
+ public enum Stream {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V5_0.Stream AUDIO_STREAM_ACCESSIBILITY;
enum_constant public static final audio.policy.configuration.V5_0.Stream AUDIO_STREAM_ALARM;
enum_constant public static final audio.policy.configuration.V5_0.Stream AUDIO_STREAM_BLUETOOTH_SCO;
@@ -393,10 +388,8 @@
method public void setFormats(audio.policy.configuration.V5_0.SurroundFormats);
}
- public final class Version extends java.lang.Enum {
- method public java.lang.String getRawName();
- method public static audio.policy.configuration.V5_0.Version valueOf(java.lang.String);
- method public static final audio.policy.configuration.V5_0.Version[] values();
+ public enum Version {
+ method public String getRawName();
enum_constant public static final audio.policy.configuration.V5_0.Version _1_0;
}
@@ -404,10 +397,10 @@
ctor public Volume();
method public audio.policy.configuration.V5_0.DeviceCategory getDeviceCategory();
method public java.util.List<java.lang.String> getPoint();
- method public java.lang.String getRef();
+ method public String getRef();
method public audio.policy.configuration.V5_0.Stream getStream();
method public void setDeviceCategory(audio.policy.configuration.V5_0.DeviceCategory);
- method public void setRef(java.lang.String);
+ method public void setRef(String);
method public void setStream(audio.policy.configuration.V5_0.Stream);
}
@@ -420,7 +413,7 @@
public class XmlParser {
ctor public XmlParser();
method public static audio.policy.configuration.V5_0.AudioPolicyConfiguration read(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException;
- method public static java.lang.String readText(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method public static String readText(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public static void skip(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
}
diff --git a/audio/5.0/config/api/removed.txt b/audio/5.0/config/api/removed.txt
index e69de29..d802177 100644
--- a/audio/5.0/config/api/removed.txt
+++ b/audio/5.0/config/api/removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/audio/5.0/config/audio_policy_configuration.xsd b/audio/5.0/config/audio_policy_configuration.xsd
index b0927b2..ee3a437 100644
--- a/audio/5.0/config/audio_policy_configuration.xsd
+++ b/audio/5.0/config/audio_policy_configuration.xsd
@@ -277,6 +277,8 @@
<xs:enumeration value="AUDIO_DEVICE_IN_PROXY"/>
<xs:enumeration value="AUDIO_DEVICE_IN_USB_HEADSET"/>
<xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_BLE"/>
+ <xs:enumeration value="AUDIO_DEVICE_IN_HDMI_ARC"/>
+ <xs:enumeration value="AUDIO_DEVICE_IN_ECHO_REFERENCE"/>
<xs:enumeration value="AUDIO_DEVICE_IN_DEFAULT"/>
<xs:enumeration value="AUDIO_DEVICE_IN_STUB"/>
</xs:restriction>
@@ -364,6 +366,14 @@
<xs:enumeration value="AUDIO_FORMAT_MAT_2_1"/>
<xs:enumeration value="AUDIO_FORMAT_AAC_XHE"/>
<xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_XHE"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_LATM"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_LATM_LC"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_LATM_HE_V1"/>
+ <xs:enumeration value="AUDIO_FORMAT_AAC_LATM_HE_V2"/>
+ <xs:enumeration value="AUDIO_FORMAT_CELT"/>
+ <xs:enumeration value="AUDIO_FORMAT_APTX_ADAPTIVE"/>
+ <xs:enumeration value="AUDIO_FORMAT_LHDC"/>
+ <xs:enumeration value="AUDIO_FORMAT_LHDC_LL"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="extendableAudioFormat">
@@ -461,6 +471,8 @@
</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="encodedFormats" type="audioFormatsList" use="optional"
+ default="" />
</xs:complexType>
<xs:unique name="devicePortProfileUniqueness">
<xs:selector xpath="profile"/>
@@ -595,7 +607,7 @@
<xs:element name="formats" type="surroundFormats"/>
</xs:sequence>
</xs:complexType>
- <xs:simpleType name="surroundFormatsList">
+ <xs:simpleType name="audioFormatsList">
<xs:list itemType="audioFormat" />
</xs:simpleType>
<xs:complexType name="surroundFormats">
@@ -603,7 +615,7 @@
<xs:element name="format" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="audioFormat" use="required"/>
- <xs:attribute name="subformats" type="surroundFormatsList" />
+ <xs:attribute name="subformats" type="audioFormatsList" />
</xs:complexType>
</xs:element>
</xs:sequence>
diff --git a/audio/5.0/types.hal b/audio/5.0/types.hal
index 4932367..2c153c6 100644
--- a/audio/5.0/types.hal
+++ b/audio/5.0/types.hal
@@ -221,3 +221,29 @@
*/
AudioMicrophoneCoordinate orientation;
};
+
+/**
+ * Constants used by the HAL to determine how to select microphones and process those inputs in
+ * order to optimize for capture in the specified direction.
+ *
+ * MicrophoneDirection Constants are defined in MicrophoneDirection.java.
+ */
+@export(name="audio_microphone_direction_t", value_prefix="MIC_DIRECTION_")
+enum MicrophoneDirection : int32_t {
+ /**
+ * Don't do any directionality processing of the activated microphone(s).
+ */
+ UNSPECIFIED = 0,
+ /**
+ * Optimize capture for audio coming from the screen-side of the device.
+ */
+ FRONT = 1,
+ /**
+ * Optimize capture for audio coming from the side of the device opposite the screen.
+ */
+ BACK = 2,
+ /**
+ * Optimize capture for audio coming from an off-device microphone.
+ */
+ EXTERNAL = 3,
+};
diff --git a/audio/common/5.0/types.hal b/audio/common/5.0/types.hal
index dab7464..ffe4506 100644
--- a/audio/common/5.0/types.hal
+++ b/audio/common/5.0/types.hal
@@ -133,7 +133,18 @@
* and raw signal analysis.
*/
UNPROCESSED = 9,
-
+ /**
+ * Source for capturing audio meant to be processed in real time and played back for live
+ * performance (e.g karaoke). The capture path will minimize latency and coupling with
+ * playback path.
+ */
+ VOICE_PERFORMANCE = 10,
+ /**
+ * Source for an echo canceller to capture the reference signal to be cancelled.
+ * The echo reference signal will be captured as close as possible to the DAC in order
+ * to include all post processing applied to the playback path.
+ */
+ ECHO_REFERENCE = 1997,
FM_TUNER = 1998,
};
@@ -224,6 +235,12 @@
LDAC = 0x23000000UL,
/** Dolby Metadata-enhanced Audio Transmission */
MAT = 0x24000000UL,
+ AAC_LATM = 0x25000000UL,
+ CELT = 0x26000000UL,
+ APTX_ADAPTIVE = 0x27000000UL,
+ LHDC = 0x28000000UL,
+ LHDC_LL = 0x29000000UL,
+
/** Deprecated */
MAIN_MASK = 0xFF000000UL,
SUB_MASK = 0x00FFFFFFUL,
@@ -295,6 +312,9 @@
MAT_1_0 = (MAT | MAT_SUB_1_0),
MAT_2_0 = (MAT | MAT_SUB_2_0),
MAT_2_1 = (MAT | MAT_SUB_2_1),
+ AAC_LATM_LC = (AAC_LATM | AAC_SUB_LC),
+ AAC_LATM_HE_V1 = (AAC_LATM | AAC_SUB_HE_V1),
+ AAC_LATM_HE_V2 = (AAC_LATM | AAC_SUB_HE_V2),
};
/**
@@ -598,6 +618,7 @@
IN_PROXY = BIT_IN | 0x1000000,
IN_USB_HEADSET = BIT_IN | 0x2000000,
IN_BLUETOOTH_BLE = BIT_IN | 0x4000000,
+ IN_ECHO_REFERENCE = BIT_IN | 0x10000000,
IN_DEFAULT = BIT_IN | BIT_DEFAULT,
// Note that the 2.0 IN_ALL* have been moved to helper functions
diff --git a/audio/common/all-versions/default/service/Android.mk b/audio/common/all-versions/default/service/Android.mk
index 32110ee..58987c7 100644
--- a/audio/common/all-versions/default/service/Android.mk
+++ b/audio/common/all-versions/default/service/Android.mk
@@ -50,7 +50,8 @@
android.hardware.audio.effect@5.0 \
android.hardware.bluetooth.a2dp@1.0 \
android.hardware.soundtrigger@2.0 \
- android.hardware.soundtrigger@2.1
+ android.hardware.soundtrigger@2.1 \
+ android.hardware.soundtrigger@2.2
# Can not switch to Android.bp until AUDIOSERVER_MULTILIB
# is deprecated as build config variable are not supported
diff --git a/audio/common/all-versions/default/service/service.cpp b/audio/common/all-versions/default/service/service.cpp
index 7b5da81..15ce5e0 100644
--- a/audio/common/all-versions/default/service/service.cpp
+++ b/audio/common/all-versions/default/service/service.cpp
@@ -25,6 +25,7 @@
#include <android/hardware/bluetooth/a2dp/1.0/IBluetoothAudioOffload.h>
#include <android/hardware/soundtrigger/2.0/ISoundTriggerHw.h>
#include <android/hardware/soundtrigger/2.1/ISoundTriggerHw.h>
+#include <android/hardware/soundtrigger/2.2/ISoundTriggerHw.h>
#include <binder/ProcessState.h>
#include <cutils/properties.h>
#include <hidl/HidlTransportSupport.h>
@@ -58,9 +59,10 @@
registerPassthroughServiceImplementation<audio::effect::V2_0::IEffectsFactory>() != OK,
LOG_ALWAYS_FATAL_IF(fail, "Could not register audio effect API 2, 4 nor 5");
- fail = registerPassthroughServiceImplementation<soundtrigger::V2_1::ISoundTriggerHw>() != OK &&
+ fail = registerPassthroughServiceImplementation<soundtrigger::V2_2::ISoundTriggerHw>() != OK &&
+ registerPassthroughServiceImplementation<soundtrigger::V2_1::ISoundTriggerHw>() != OK &&
registerPassthroughServiceImplementation<soundtrigger::V2_0::ISoundTriggerHw>() != OK,
- ALOGW_IF(fail, "Could not register soundtrigger API 2.0 nor 2.1");
+ ALOGW_IF(fail, "Could not register soundtrigger API 2.0, 2.1 nor 2.2");
fail =
registerPassthroughServiceImplementation<bluetooth::a2dp::V1_0::IBluetoothAudioOffload>() !=
diff --git a/audio/core/all-versions/default/Device.cpp b/audio/core/all-versions/default/Device.cpp
index 8e0b763..bec22df 100644
--- a/audio/core/all-versions/default/Device.cpp
+++ b/audio/core/all-versions/default/Device.cpp
@@ -137,12 +137,11 @@
return Void();
}
-Return<void> Device::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
- const AudioConfig& config, AudioOutputFlagBitfield flags,
-#if MAJOR_VERSION >= 4
- const SourceMetadata& /* sourceMetadata */,
-#endif
- openOutputStream_cb _hidl_cb) {
+std::tuple<Result, sp<IStreamOut>> Device::openOutputStreamImpl(int32_t ioHandle,
+ const DeviceAddress& device,
+ const AudioConfig& config,
+ AudioOutputFlagBitfield flags,
+ AudioConfig* suggestedConfig) {
audio_config_t halConfig;
HidlUtils::audioConfigToHal(config, &halConfig);
audio_stream_out_t* halStream;
@@ -161,16 +160,13 @@
if (status == OK) {
streamOut = new StreamOut(this, halStream);
}
- AudioConfig suggestedConfig;
- HidlUtils::audioConfigFromHal(halConfig, &suggestedConfig);
- _hidl_cb(analyzeStatus("open_output_stream", status, {EINVAL} /* ignore */), streamOut,
- suggestedConfig);
- return Void();
+ HidlUtils::audioConfigFromHal(halConfig, suggestedConfig);
+ return {analyzeStatus("open_output_stream", status, {EINVAL} /*ignore*/), streamOut};
}
-Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& device,
- const AudioConfig& config, AudioInputFlagBitfield flags,
- AudioSource source, openInputStream_cb _hidl_cb) {
+std::tuple<Result, sp<IStreamIn>> Device::openInputStreamImpl(
+ int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config,
+ AudioInputFlagBitfield flags, AudioSource source, AudioConfig* suggestedConfig) {
audio_config_t halConfig;
HidlUtils::audioConfigToHal(config, &halConfig);
audio_stream_in_t* halStream;
@@ -190,14 +186,46 @@
if (status == OK) {
streamIn = new StreamIn(this, halStream);
}
+ HidlUtils::audioConfigFromHal(halConfig, suggestedConfig);
+ return {analyzeStatus("open_input_stream", status, {EINVAL} /*ignore*/), streamIn};
+}
+
+#if MAJOR_VERSION == 2
+Return<void> Device::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
+ const AudioConfig& config, AudioOutputFlagBitfield flags,
+ openOutputStream_cb _hidl_cb) {
AudioConfig suggestedConfig;
- HidlUtils::audioConfigFromHal(halConfig, &suggestedConfig);
- _hidl_cb(analyzeStatus("open_input_stream", status, {EINVAL} /* ignore */), streamIn,
- suggestedConfig);
+ auto [result, streamOut] =
+ openOutputStreamImpl(ioHandle, device, config, flags, &suggestedConfig);
+ _hidl_cb(result, streamOut, suggestedConfig);
return Void();
}
-#if MAJOR_VERSION >= 4
+Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& device,
+ const AudioConfig& config, AudioInputFlagBitfield flags,
+ AudioSource source, openInputStream_cb _hidl_cb) {
+ AudioConfig suggestedConfig;
+ auto [result, streamIn] =
+ openInputStreamImpl(ioHandle, device, config, flags, source, &suggestedConfig);
+ _hidl_cb(result, streamIn, suggestedConfig);
+ return Void();
+}
+
+#elif MAJOR_VERSION >= 4
+Return<void> Device::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
+ const AudioConfig& config, AudioOutputFlagBitfield flags,
+ const SourceMetadata& sourceMetadata,
+ openOutputStream_cb _hidl_cb) {
+ AudioConfig suggestedConfig;
+ auto [result, streamOut] =
+ openOutputStreamImpl(ioHandle, device, config, flags, &suggestedConfig);
+ if (streamOut) {
+ streamOut->updateSourceMetadata(sourceMetadata);
+ }
+ _hidl_cb(result, streamOut, suggestedConfig);
+ return Void();
+}
+
Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioInputFlagBitfield flags,
const SinkMetadata& sinkMetadata,
@@ -209,11 +237,18 @@
_hidl_cb(Result::INVALID_ARGUMENTS, nullptr, AudioConfig());
return Void();
}
- // Pick the first one as the main until the legacy API is update
+ // Pick the first one as the main.
AudioSource source = sinkMetadata.tracks[0].source;
- return openInputStream(ioHandle, device, config, flags, source, _hidl_cb);
+ AudioConfig suggestedConfig;
+ auto [result, streamIn] =
+ openInputStreamImpl(ioHandle, device, config, flags, source, &suggestedConfig);
+ if (streamIn) {
+ streamIn->updateSinkMetadata(sinkMetadata);
+ }
+ _hidl_cb(result, streamIn, suggestedConfig);
+ return Void();
}
-#endif
+#endif /* MAJOR_VERSION */
Return<bool> Device::supportsAudioPatches() {
return version() >= AUDIO_DEVICE_API_VERSION_3_0;
diff --git a/audio/core/all-versions/default/StreamIn.cpp b/audio/core/all-versions/default/StreamIn.cpp
index ac7c2cb..daba6f7 100644
--- a/audio/core/all-versions/default/StreamIn.cpp
+++ b/audio/core/all-versions/default/StreamIn.cpp
@@ -454,8 +454,19 @@
std::vector<record_track_metadata> halTracks;
halTracks.reserve(sinkMetadata.tracks.size());
for (auto& metadata : sinkMetadata.tracks) {
- halTracks.push_back(
- {.source = static_cast<audio_source_t>(metadata.source), .gain = metadata.gain});
+ record_track_metadata halTrackMetadata = {
+ .source = static_cast<audio_source_t>(metadata.source), .gain = metadata.gain};
+#if MAJOR_VERSION >= 5
+ if (metadata.destination.getDiscriminator() ==
+ RecordTrackMetadata::Destination::hidl_discriminator::device) {
+ halTrackMetadata.dest_device =
+ static_cast<audio_devices_t>(metadata.destination.device().device);
+ strncpy(halTrackMetadata.dest_device_address,
+ deviceAddressToHal(metadata.destination.device()).c_str(),
+ AUDIO_DEVICE_MAX_ADDRESS_LEN);
+ }
+#endif
+ halTracks.push_back(halTrackMetadata);
}
const sink_metadata_t halMetadata = {
.track_count = halTracks.size(),
@@ -485,6 +496,27 @@
}
#endif
+#if MAJOR_VERSION >= 5
+Return<Result> StreamIn::setMicrophoneDirection(MicrophoneDirection direction) {
+ if (mStream->set_microphone_direction == nullptr) {
+ return Result::NOT_SUPPORTED;
+ }
+ return Stream::analyzeStatus(
+ "set_microphone_direction",
+ mStream->set_microphone_direction(
+ mStream, static_cast<audio_microphone_direction_t>(direction)));
+}
+
+Return<Result> StreamIn::setMicrophoneFieldDimension(float zoom) {
+ if (mStream->set_microphone_field_dimension == nullptr) {
+ return Result::NOT_SUPPORTED;
+ }
+ return Stream::analyzeStatus("set_microphone_field_dimension",
+ mStream->set_microphone_field_dimension(mStream, zoom));
+}
+
+#endif
+
} // namespace implementation
} // namespace CPP_VERSION
} // namespace audio
diff --git a/audio/core/all-versions/default/include/core/default/Device.h b/audio/core/all-versions/default/include/core/default/Device.h
index 836259f..e64f00f 100644
--- a/audio/core/all-versions/default/include/core/default/Device.h
+++ b/audio/core/all-versions/default/include/core/default/Device.h
@@ -62,14 +62,21 @@
Return<void> getInputBufferSize(const AudioConfig& config,
getInputBufferSize_cb _hidl_cb) override;
- // V2 openInputStream is called by V4 input stream thus present in both versions
- Return<void> openInputStream(int32_t ioHandle, const DeviceAddress& device,
- const AudioConfig& config, AudioInputFlagBitfield flags,
- AudioSource source, openInputStream_cb _hidl_cb);
+ std::tuple<Result, sp<IStreamOut>> openOutputStreamImpl(int32_t ioHandle,
+ const DeviceAddress& device,
+ const AudioConfig& config,
+ AudioOutputFlagBitfield flags,
+ AudioConfig* suggestedConfig);
+ std::tuple<Result, sp<IStreamIn>> openInputStreamImpl(
+ int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config,
+ AudioInputFlagBitfield flags, AudioSource source, AudioConfig* suggestedConfig);
#if MAJOR_VERSION == 2
Return<void> openOutputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioOutputFlagBitfield flags,
openOutputStream_cb _hidl_cb) override;
+ Return<void> openInputStream(int32_t ioHandle, const DeviceAddress& device,
+ const AudioConfig& config, AudioInputFlagBitfield flags,
+ AudioSource source, openInputStream_cb _hidl_cb) override;
#elif MAJOR_VERSION >= 4
Return<void> openOutputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioOutputFlagBitfield flags,
diff --git a/audio/core/all-versions/default/include/core/default/StreamIn.h b/audio/core/all-versions/default/include/core/default/StreamIn.h
index 7a658b3..6209b8f 100644
--- a/audio/core/all-versions/default/include/core/default/StreamIn.h
+++ b/audio/core/all-versions/default/include/core/default/StreamIn.h
@@ -112,7 +112,10 @@
Return<void> updateSinkMetadata(const SinkMetadata& sinkMetadata) override;
Return<void> getActiveMicrophones(getActiveMicrophones_cb _hidl_cb) override;
#endif
-
+#if MAJOR_VERSION >= 5
+ Return<Result> setMicrophoneDirection(MicrophoneDirection direction) override;
+ Return<Result> setMicrophoneFieldDimension(float zoom) override;
+#endif
static Result getCapturePositionImpl(audio_stream_in_t* stream, uint64_t* frames,
uint64_t* time);
diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp
index b04adf7..6498289 100644
--- a/audio/core/all-versions/vts/functional/Android.bp
+++ b/audio/core/all-versions/vts/functional/Android.bp
@@ -22,6 +22,7 @@
"libaudiopolicycomponents",
"libicuuc",
"libicuuc_stubdata",
+ "libandroidicu",
"libmedia_helper",
"libxml2",
],
diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
index ec8041c..a22cc1c 100644
--- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
+++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
@@ -428,7 +428,8 @@
if (policyConfig.getStatus() != OK || policyConfig.getPrimaryModule() == nullptr) {
return true; // Could not get the information, run all tests
}
- auto getMic = [](auto& devs) { return devs.getDevice(AUDIO_DEVICE_IN_BUILTIN_MIC, {}); };
+ auto getMic = [](auto& devs) { return devs.getDevice(
+ AUDIO_DEVICE_IN_BUILTIN_MIC, {}, AUDIO_FORMAT_DEFAULT); };
auto primaryMic = getMic(policyConfig.getPrimaryModule()->getDeclaredDevices());
auto availableMic = getMic(policyConfig.getAvailableInputDevices());
diff --git a/audio/effect/2.0/xml/audio_effects_conf.xsd b/audio/effect/2.0/xml/audio_effects_conf.xsd
index df281b3..b97b847 100644
--- a/audio/effect/2.0/xml/audio_effects_conf.xsd
+++ b/audio/effect/2.0/xml/audio_effects_conf.xsd
@@ -39,6 +39,7 @@
<xs:enumeration value="voice_recognition"/>
<xs:enumeration value="voice_communication"/>
<xs:enumeration value="unprocessed"/>
+ <xs:enumeration value="voice_performance"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="streamOutputType">
diff --git a/audio/effect/5.0/xml/Android.bp b/audio/effect/5.0/xml/Android.bp
new file mode 100644
index 0000000..967135c
--- /dev/null
+++ b/audio/effect/5.0/xml/Android.bp
@@ -0,0 +1,6 @@
+
+xsd_config {
+ name: "audio_effects_conf",
+ srcs: ["audio_effects_conf.xsd"],
+ package_name: "audio.effects.V5_0",
+}
diff --git a/audio/effect/5.0/xml/api/current.txt b/audio/effect/5.0/xml/api/current.txt
new file mode 100644
index 0000000..473bb10
--- /dev/null
+++ b/audio/effect/5.0/xml/api/current.txt
@@ -0,0 +1,132 @@
+// Signature format: 2.0
+package audio.effects.V5_0 {
+
+ public class Audioeffectsconf {
+ ctor public Audioeffectsconf();
+ method public audio.effects.V5_0.EffectsType getEffects();
+ method public audio.effects.V5_0.LibrariesType getLibraries();
+ method public audio.effects.V5_0.Audioeffectsconf.Postprocess getPostprocess();
+ method public audio.effects.V5_0.Audioeffectsconf.Preprocess getPreprocess();
+ method public audio.effects.V5_0.VersionType getVersion();
+ method public void setEffects(audio.effects.V5_0.EffectsType);
+ method public void setLibraries(audio.effects.V5_0.LibrariesType);
+ method public void setPostprocess(audio.effects.V5_0.Audioeffectsconf.Postprocess);
+ method public void setPreprocess(audio.effects.V5_0.Audioeffectsconf.Preprocess);
+ method public void setVersion(audio.effects.V5_0.VersionType);
+ }
+
+ public static class Audioeffectsconf.Postprocess {
+ ctor public Audioeffectsconf.Postprocess();
+ method public java.util.List<audio.effects.V5_0.StreamPostprocessType> getStream();
+ }
+
+ public static class Audioeffectsconf.Preprocess {
+ ctor public Audioeffectsconf.Preprocess();
+ method public java.util.List<audio.effects.V5_0.StreamPreprocessType> getStream();
+ }
+
+ public class EffectImplType {
+ ctor public EffectImplType();
+ method public String getLibrary();
+ method public String getUuid();
+ method public void setLibrary(String);
+ method public void setUuid(String);
+ }
+
+ public class EffectProxyType extends audio.effects.V5_0.EffectType {
+ ctor public EffectProxyType();
+ method public audio.effects.V5_0.EffectImplType getLibhw();
+ method public audio.effects.V5_0.EffectImplType getLibsw();
+ method public void setLibhw(audio.effects.V5_0.EffectImplType);
+ method public void setLibsw(audio.effects.V5_0.EffectImplType);
+ }
+
+ public class EffectType extends audio.effects.V5_0.EffectImplType {
+ ctor public EffectType();
+ method public String getName();
+ method public void setName(String);
+ }
+
+ public class EffectsType {
+ ctor public EffectsType();
+ method public java.util.List<audio.effects.V5_0.EffectProxyType> getEffectProxy_optional();
+ method public java.util.List<audio.effects.V5_0.EffectType> getEffect_optional();
+ }
+
+ public class LibrariesType {
+ ctor public LibrariesType();
+ method public java.util.List<audio.effects.V5_0.LibrariesType.Library> getLibrary();
+ }
+
+ public static class LibrariesType.Library {
+ ctor public LibrariesType.Library();
+ method public String getName();
+ method public String getPath();
+ method public void setName(String);
+ method public void setPath(String);
+ }
+
+ public enum StreamInputType {
+ method public String getRawName();
+ enum_constant public static final audio.effects.V5_0.StreamInputType camcorder;
+ enum_constant public static final audio.effects.V5_0.StreamInputType mic;
+ enum_constant public static final audio.effects.V5_0.StreamInputType unprocessed;
+ enum_constant public static final audio.effects.V5_0.StreamInputType voice_call;
+ enum_constant public static final audio.effects.V5_0.StreamInputType voice_communication;
+ enum_constant public static final audio.effects.V5_0.StreamInputType voice_downlink;
+ enum_constant public static final audio.effects.V5_0.StreamInputType voice_performance;
+ enum_constant public static final audio.effects.V5_0.StreamInputType voice_recognition;
+ enum_constant public static final audio.effects.V5_0.StreamInputType voice_uplink;
+ }
+
+ public enum StreamOutputType {
+ method public String getRawName();
+ enum_constant public static final audio.effects.V5_0.StreamOutputType alarm;
+ enum_constant public static final audio.effects.V5_0.StreamOutputType bluetooth_sco;
+ enum_constant public static final audio.effects.V5_0.StreamOutputType dtmf;
+ enum_constant public static final audio.effects.V5_0.StreamOutputType enforced_audible;
+ enum_constant public static final audio.effects.V5_0.StreamOutputType music;
+ enum_constant public static final audio.effects.V5_0.StreamOutputType notification;
+ enum_constant public static final audio.effects.V5_0.StreamOutputType ring;
+ enum_constant public static final audio.effects.V5_0.StreamOutputType system;
+ enum_constant public static final audio.effects.V5_0.StreamOutputType tts;
+ enum_constant public static final audio.effects.V5_0.StreamOutputType voice_call;
+ }
+
+ public class StreamPostprocessType extends audio.effects.V5_0.StreamProcessingType {
+ ctor public StreamPostprocessType();
+ method public audio.effects.V5_0.StreamOutputType getType();
+ method public void setType(audio.effects.V5_0.StreamOutputType);
+ }
+
+ public class StreamPreprocessType extends audio.effects.V5_0.StreamProcessingType {
+ ctor public StreamPreprocessType();
+ method public audio.effects.V5_0.StreamInputType getType();
+ method public void setType(audio.effects.V5_0.StreamInputType);
+ }
+
+ public class StreamProcessingType {
+ ctor public StreamProcessingType();
+ method public java.util.List<audio.effects.V5_0.StreamProcessingType.Apply> getApply();
+ }
+
+ public static class StreamProcessingType.Apply {
+ ctor public StreamProcessingType.Apply();
+ method public String getEffect();
+ method public void setEffect(String);
+ }
+
+ public enum VersionType {
+ method public String getRawName();
+ enum_constant public static final audio.effects.V5_0.VersionType _2_0;
+ }
+
+ public class XmlParser {
+ ctor public XmlParser();
+ method public static audio.effects.V5_0.Audioeffectsconf read(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method public static String readText(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method public static void skip(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ }
+
+}
+
diff --git a/audio/effect/5.0/xml/api/last_current.txt b/audio/effect/5.0/xml/api/last_current.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/audio/effect/5.0/xml/api/last_current.txt
diff --git a/audio/effect/5.0/xml/api/last_removed.txt b/audio/effect/5.0/xml/api/last_removed.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/audio/effect/5.0/xml/api/last_removed.txt
diff --git a/audio/effect/5.0/xml/api/removed.txt b/audio/effect/5.0/xml/api/removed.txt
new file mode 100644
index 0000000..d802177
--- /dev/null
+++ b/audio/effect/5.0/xml/api/removed.txt
@@ -0,0 +1 @@
+// Signature format: 2.0
diff --git a/audio/effect/all-versions/vts/functional/Android.bp b/audio/effect/all-versions/vts/functional/Android.bp
index 88d49d8..de6cad9 100644
--- a/audio/effect/all-versions/vts/functional/Android.bp
+++ b/audio/effect/all-versions/vts/functional/Android.bp
@@ -28,6 +28,7 @@
"libeffectsconfig",
"libicuuc",
"libicuuc_stubdata",
+ "libandroidicu",
"libxml2",
],
header_libs: [
diff --git a/automotive/OWNERS b/automotive/OWNERS
new file mode 100644
index 0000000..4a94494
--- /dev/null
+++ b/automotive/OWNERS
@@ -0,0 +1,3 @@
+randolphs@google.com
+pirozzoj@google.com
+twasilczyk@google.com
diff --git a/automotive/vehicle/2.0/default/OWNERS b/automotive/vehicle/2.0/default/OWNERS
deleted file mode 100644
index d5d9d4c..0000000
--- a/automotive/vehicle/2.0/default/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-egranata@google.com
-pavelm@google.com
-spaik@google.com
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index a5c8eb8..7614cad 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -36,10 +36,12 @@
constexpr int DOOR_1_RIGHT = (int)VehicleAreaDoor::ROW_1_RIGHT;
constexpr int DOOR_2_LEFT = (int)VehicleAreaDoor::ROW_2_LEFT;
constexpr int DOOR_2_RIGHT = (int)VehicleAreaDoor::ROW_2_RIGHT;
+constexpr int DOOR_REAR = (int)VehicleAreaDoor::REAR;
constexpr int WINDOW_1_LEFT = (int)VehicleAreaWindow::ROW_1_LEFT;
constexpr int WINDOW_1_RIGHT = (int)VehicleAreaWindow::ROW_1_RIGHT;
constexpr int WINDOW_2_LEFT = (int)VehicleAreaWindow::ROW_2_LEFT;
constexpr int WINDOW_2_RIGHT = (int)VehicleAreaWindow::ROW_2_RIGHT;
+constexpr int WINDOW_ROOF_TOP_1 = (int)VehicleAreaWindow::ROOF_TOP_1;
constexpr int FAN_DIRECTION_FACE = (int)VehicleHvacFanDirection::FACE;
constexpr int FAN_DIRECTION_FLOOR = (int)VehicleHvacFanDirection::FLOOR;
constexpr int OBD2_LIVE_FRAME = (int)VehicleProperty::OBD2_LIVE_FRAME;
@@ -581,17 +583,18 @@
{DOOR_2_LEFT, {.int32Values = {1}}},
{DOOR_2_RIGHT, {.int32Values = {1}}}}},
- {.config = {.prop = toInt(VehicleProperty::DOOR_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT},
- VehicleAreaConfig{.areaId = DOOR_1_RIGHT},
- VehicleAreaConfig{.areaId = DOOR_2_LEFT},
- VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}},
- .initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {0}}},
- {DOOR_1_RIGHT, {.int32Values = {0}}},
- {DOOR_2_LEFT, {.int32Values = {0}}},
- {DOOR_2_RIGHT, {.int32Values = {0}}}}},
+ {.config =
+ {
+ .prop = toInt(VehicleProperty::DOOR_POS),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs =
+ {VehicleAreaConfig{.areaId = DOOR_1_LEFT, .minInt32Value = 0, .maxInt32Value = 1},
+ VehicleAreaConfig{.areaId = DOOR_1_RIGHT, .minInt32Value = 0, .maxInt32Value = 1},
+ VehicleAreaConfig{.areaId = DOOR_2_LEFT, .minInt32Value = 0, .maxInt32Value = 1},
+ VehicleAreaConfig{.areaId = DOOR_2_RIGHT, .minInt32Value = 0, .maxInt32Value = 1},
+ VehicleAreaConfig{.areaId = DOOR_REAR, .minInt32Value = 0, .maxInt32Value = 1}}},
+ .initialValue = {.int32Values = {0}}},
{.config = {.prop = toInt(VehicleProperty::WINDOW_LOCK),
.access = VehiclePropertyAccess::READ_WRITE,
@@ -601,17 +604,19 @@
.initialAreaValues = {{WINDOW_1_RIGHT | WINDOW_2_LEFT | WINDOW_2_RIGHT,
{.int32Values = {0}}}}},
- {.config = {.prop = toInt(VehicleProperty::WINDOW_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_LEFT},
- VehicleAreaConfig{.areaId = WINDOW_1_RIGHT},
- VehicleAreaConfig{.areaId = WINDOW_2_LEFT},
- VehicleAreaConfig{.areaId = WINDOW_2_RIGHT}}},
- .initialAreaValues = {{WINDOW_1_LEFT, {.int32Values = {0}}},
- {WINDOW_1_RIGHT, {.int32Values = {0}}},
- {WINDOW_2_LEFT, {.int32Values = {0}}},
- {WINDOW_2_RIGHT, {.int32Values = {0}}}}},
+ {.config =
+ {.prop = toInt(VehicleProperty::WINDOW_POS),
+ .access =
+ VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs =
+ {VehicleAreaConfig{.areaId = WINDOW_1_LEFT, .minInt32Value = 0, .maxInt32Value = 10},
+ VehicleAreaConfig{.areaId = WINDOW_1_RIGHT, .minInt32Value = 0, .maxInt32Value = 10},
+ VehicleAreaConfig{.areaId = WINDOW_2_LEFT, .minInt32Value = 0, .maxInt32Value = 10},
+ VehicleAreaConfig{.areaId = WINDOW_2_RIGHT, .minInt32Value = 0, .maxInt32Value = 10},
+ VehicleAreaConfig{
+ .areaId = WINDOW_ROOF_TOP_1, .minInt32Value = -10, .maxInt32Value = 10}}},
+ .initialValue = {.int32Values = {0}}},
{.config =
{
diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal
index 4751a76..e874146 100644
--- a/automotive/vehicle/2.0/types.hal
+++ b/automotive/vehicle/2.0/types.hal
@@ -131,6 +131,9 @@
* When a property's status field is not set to AVAILABLE:
* - IVehicle#set may return StatusCode::NOT_AVAILABLE.
* - IVehicle#get is not guaranteed to work.
+ *
+ * Properties set to values out of range must be ignored and no action taken
+ * in response to such ill formed requests.
*/
enum VehicleProperty : int32_t {
@@ -243,7 +246,7 @@
* Fuel door location
*
* @change_mode VehiclePropertyChangeMode:STATIC
- * @data_enum FuelDoorLocationType
+ * @data_enum PortLocationType
* @access VehiclePropertyAccess:READ
*/
INFO_FUEL_DOOR_LOCATION = (
@@ -267,6 +270,7 @@
/**
* Driver's seat location
+ * VHAL implementations must ignore the areaId. Use VehicleArea:GLOBAL.
*
* @change_mode VehiclePropertyChangeMode:STATIC
* @data_enum VehicleAreaSeat
diff --git a/biometrics/face/1.0/types.hal b/biometrics/face/1.0/types.hal
index a488d67..2bcd3d5 100644
--- a/biometrics/face/1.0/types.hal
+++ b/biometrics/face/1.0/types.hal
@@ -281,9 +281,52 @@
TOO_SIMILAR = 15,
/**
+ * The magnitude of the pan angle of the user’s face with respect to the sensor’s
+ * capture plane is too high.
+ *
+ * The pan angle is defined as the angle swept out by the user’s face turning
+ * their neck left and right. The pan angle would be zero if the user faced the
+ * camera directly.
+ *
+ * The user should be informed to look more directly at the camera.
+ */
+ PAN_TOO_EXTREME = 16,
+
+ /**
+ * The magnitude of the tilt angle of the user’s face with respect to the sensor’s
+ * capture plane is too high.
+ *
+ * The tilt angle is defined as the angle swept out by the user’s face looking up
+ * and down. The pan angle would be zero if the user faced the camera directly.
+ *
+ * The user should be informed to look more directly at the camera.
+ */
+ TILT_TOO_EXTREME = 17,
+
+ /**
+ * The magnitude of the roll angle of the user’s face with respect to the sensor’s
+ * capture plane is too high.
+ *
+ * The roll angle is defined as the angle swept out by the user’s face tilting their head
+ * towards their shoulders to the left and right. The pan angle would be zero if the user
+ * faced the camera directly.
+ *
+ * The user should be informed to look more directly at the camera.
+ */
+ ROLL_TOO_EXTREME = 18,
+
+ /**
+ * The user’s face has been obscured by some object.
+ *
+ * The user should be informed to remove any objects from the line of sight from
+ * the sensor to the user’s face.
+ */
+ FACE_OBSCURED = 19,
+
+ /**
* Used to enable a vendor-specific acquisition message.
*/
- VENDOR = 16
+ VENDOR = 20
};
/**
diff --git a/bluetooth/audio/2.0/Android.bp b/bluetooth/audio/2.0/Android.bp
new file mode 100644
index 0000000..5d67f75
--- /dev/null
+++ b/bluetooth/audio/2.0/Android.bp
@@ -0,0 +1,44 @@
+hidl_interface {
+ name: "android.hardware.bluetooth.audio@2.0",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "types.hal",
+ "IBluetoothAudioPort.hal",
+ "IBluetoothAudioProvider.hal",
+ "IBluetoothAudioProvidersFactory.hal",
+ ],
+ interfaces: [
+ "android.hidl.base@1.0",
+ "android.hardware.audio.common@5.0",
+ ],
+ types: [
+ "AacObjectType",
+ "AacParameters",
+ "AacVariableBitRate",
+ "AptxParameters",
+ "AudioCapabilities",
+ "AudioConfiguration",
+ "BitsPerSample",
+ "ChannelMode",
+ "CodecCapabilities",
+ "CodecConfiguration",
+ "CodecType",
+ "LdacChannelMode",
+ "LdacParameters",
+ "LdacQualityIndex",
+ "PcmParameters",
+ "SampleRate",
+ "SbcAllocMethod",
+ "SbcBlockLength",
+ "SbcChannelMode",
+ "SbcParameters",
+ "SessionType",
+ "Status",
+ "TimeSpec",
+ ],
+ gen_java: false,
+}
+
diff --git a/bluetooth/audio/2.0/IBluetoothAudioPort.hal b/bluetooth/audio/2.0/IBluetoothAudioPort.hal
new file mode 100644
index 0000000..fedc8d3
--- /dev/null
+++ b/bluetooth/audio/2.0/IBluetoothAudioPort.hal
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.bluetooth.audio@2.0;
+
+import android.hardware.audio.common@5.0::SourceMetadata;
+
+/**
+ * HAL interface from the Audio HAL to the Bluetooth stack
+ *
+ * The Audio HAL calls methods in this interface to start, suspend, and stop
+ * an audio stream. These calls return immediately and the results, if any,
+ * are sent over the IBluetoothAudioProvider interface.
+ *
+ * Moreover, the Audio HAL can also get the presentation position of the stream
+ * and provide stream metadata.
+ *
+ * Note: For HIDL APIs with a "generates" statement, the callback parameter used
+ * for return value must be invoked synchronously before the API call returns.
+ */
+interface IBluetoothAudioPort {
+ /**
+ * This indicates that the caller of this method has opened the data path
+ * and wants to start an audio stream. The caller must wait for a
+ * IBluetoothAudioProvider.streamStarted(Status) call.
+ */
+ startStream();
+
+ /**
+ * This indicates that the caller of this method wants to suspend the audio
+ * stream. The caller must wait for the Bluetooth process to call
+ * IBluetoothAudioProvider.streamSuspended(Status). The caller still keeps
+ * the data path open.
+ */
+ suspendStream();
+
+ /**
+ * This indicates that the caller of this method wants to stop the audio
+ * stream. The data path will be closed after this call. There is no
+ * callback from the IBluetoothAudioProvider interface even though the
+ * teardown is asynchronous.
+ */
+ stopStream();
+
+ /**
+ * Get the audio presentation position.
+ *
+ * @return status the command status
+ * @return remoteDeviceAudioDelayNanos the audio delay from when the remote
+ * device (e.g. headset) receives audio data to when the device plays the
+ * sound. If the delay is unknown, the value is set to zero.
+ * @return transmittedOctets the number of audio data octets that were sent
+ * to a remote device. This excludes octets that have been written to the
+ * data path but have not been sent to the remote device. The count is
+ * not reset until stopStream() is called. If the software data path is
+ * unused (e.g. A2DP Hardware Offload), the value is set to 0.
+ * @return transmittedOctetsTimeStamp the value of CLOCK_MONOTONIC
+ * corresponding to transmittedOctets. If the software data path is
+ * unused (e.g., for A2DP Hardware Offload), the value is set to zero.
+ */
+ getPresentationPosition() generates (Status status,
+ uint64_t remoteDeviceAudioDelayNanos, uint64_t transmittedOctets,
+ TimeSpec transmittedOctetsTimeStamp);
+
+ /**
+ * Called when the metadata of the stream's source has been changed.
+ *
+ * @param sourceMetadata Description of the audio that is played by the
+ * clients.
+ */
+ updateMetadata(SourceMetadata sourceMetadata);
+};
diff --git a/bluetooth/audio/2.0/IBluetoothAudioProvider.hal b/bluetooth/audio/2.0/IBluetoothAudioProvider.hal
new file mode 100644
index 0000000..2b08cc3
--- /dev/null
+++ b/bluetooth/audio/2.0/IBluetoothAudioProvider.hal
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.bluetooth.audio@2.0;
+
+import IBluetoothAudioPort;
+
+/**
+ * HAL interface from the Bluetooth stack to the Audio HAL
+ *
+ * The Bluetooth stack calls methods in this interface to start and end audio
+ * sessions and sends callback events to the Audio HAL.
+ *
+ * Note: For HIDL APIs with a "generates" statement, the callback parameter used
+ * for return value must be invoked synchronously before the API call returns.
+ */
+interface IBluetoothAudioProvider {
+
+ /**
+ * This method indicates that the Bluetooth stack is ready to stream audio.
+ * It registers an instance of IBluetoothAudioPort with and provides the
+ * current negotiated codec to the Audio HAL. After this method is called,
+ * the Audio HAL can invoke IBluetoothAudioPort.startStream().
+ *
+ * Note: endSession() must be called to unregister this IBluetoothAudioPort
+ *
+ * @param hostIf An instance of IBluetoothAudioPort for stream control
+ * @param audioConfig The audio configuration negotiated with the remote
+ * device. The PCM parameters are set if software based encoding,
+ * otherwise the correct codec configuration is used for hardware
+ * encoding.
+ *
+ * @return status One of the following
+ * SUCCESS if this IBluetoothAudioPort was successfully registered with
+ * the Audio HAL
+ * UNSUPPORTED_CODEC_CONFIGURATION if the Audio HAL cannot register this
+ * IBluetoothAudioPort with the given codec configuration
+ * FAILURE if the Audio HAL cannot register this IBluetoothAudioPort for
+ * any other reason
+ * @return dataMQ The fast message queue for audio data from this provider.
+ * Audio data will be in PCM format as specified by the
+ * audioConfig.pcmConfig parameter.
+ * Invalid if streaming is offloaded to hardware or on failure.
+ */
+ startSession(IBluetoothAudioPort hostIf, AudioConfiguration audioConfig)
+ generates (Status status, fmq_sync<uint8_t> dataMQ);
+
+ /**
+ * Callback for IBluetoothAudioPort.startStream()
+ *
+ * @param status SUCCESS or FAILURE
+ */
+ streamStarted(Status status);
+
+ /**
+ * Callback for IBluetoothAudioPort.suspendStream()
+ *
+ * @param status SUCCESS or FAILURE
+ */
+ streamSuspended(Status status);
+
+ /**
+ * Ends the current session and unregisters the IBluetoothAudioPort
+ * interface.
+ */
+ endSession();
+};
diff --git a/bluetooth/audio/2.0/IBluetoothAudioProvidersFactory.hal b/bluetooth/audio/2.0/IBluetoothAudioProvidersFactory.hal
new file mode 100644
index 0000000..1025665
--- /dev/null
+++ b/bluetooth/audio/2.0/IBluetoothAudioProvidersFactory.hal
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.bluetooth.audio@2.0;
+
+import IBluetoothAudioProvider;
+
+/**
+ * This factory allows a HAL implementation to be split into multiple
+ * independent providers.
+ *
+ * When the Bluetooth stack is ready to create an audio session, it must first
+ * obtain the IBluetoothAudioProvider for that session type by calling
+ * openProvider().
+ *
+ * Note: For HIDL APIs with a "generates" statement, the callback parameter used
+ * for return value must be invoked synchronously before the API call returns.
+ */
+interface IBluetoothAudioProvidersFactory {
+
+ /**
+ * Opens an audio provider for a session type. To close the provider, it is
+ * necessary to release references to the returned provider object.
+ *
+ * @param sessionType The session type (e.g.
+ * A2DP_SOFTWARE_ENCODING_DATAPATH).
+ *
+ * @return status One of the following
+ * SUCCESS if the Audio HAL successfully opens the provider with the
+ * given session type
+ * FAILURE if the Audio HAL cannot open the provider
+ * @return provider The provider of the specified session type
+ */
+ openProvider(SessionType sessionType)
+ generates (Status status, IBluetoothAudioProvider provider);
+
+ /**
+ * Gets a list of audio capabilities for a session type.
+ *
+ * For software encoding, the PCM capabilities are returned.
+ * For hardware encoding, the supported codecs and their capabilities are
+ * returned.
+ *
+ * @param sessionType The session type (e.g.
+ * A2DP_SOFTWARE_ENCODING_DATAPATH).
+ * @return audioCapabilities A list containing all the capabilities
+ * supported by the sesson type. The capabilities is a list of
+ * available options when configuring the codec for the session.
+ * For software encoding it is the PCM data rate.
+ * For hardware encoding it is the list of supported codecs and their
+ * capabilities.
+ * If a provider isn't supported, an empty list should be returned.
+ * Note: Only one entry should exist per codec when using hardware
+ * encoding.
+ */
+ getProviderCapabilities(SessionType sessionType)
+ generates (vec<AudioCapabilities> audioCapabilities);
+};
diff --git a/bluetooth/audio/2.0/types.hal b/bluetooth/audio/2.0/types.hal
new file mode 100644
index 0000000..909dd57
--- /dev/null
+++ b/bluetooth/audio/2.0/types.hal
@@ -0,0 +1,252 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.bluetooth.audio@2.0;
+
+/**
+ * The different audio parameter structs are used to provide a method to list
+ * all the Capabilities of a codec as well as to configure the codecs. All
+ * fields are bitfields unless specified. If used as a configuration, only one
+ * bit may be enabled. If used for Capabilities, enable all bits corresponding to
+ * supported features.
+ */
+
+/**
+ * POSIX timespec.
+ */
+struct TimeSpec {
+ uint64_t tvSec; // seconds
+ uint64_t tvNSec; // nanoseconds
+};
+
+enum Status : uint8_t {
+ SUCCESS = 0x00,
+ /** Codec configuration not supported by the audio platform */
+ UNSUPPORTED_CODEC_CONFIGURATION,
+ /** Any other failure */
+ FAILURE,
+};
+
+enum SessionType : uint8_t {
+ UNKNOWN,
+ /** A2DP legacy that AVDTP media is encoded by Bluetooth Stack */
+ A2DP_SOFTWARE_ENCODING_DATAPATH,
+ /** The encoding of AVDTP media is done by HW and there is control only */
+ A2DP_HARDWARE_OFFLOAD_DATAPATH,
+ /** Used when encoded by Bluetooth Stack and streaming to Hearing Aid */
+ HEARING_AID_SOFTWARE_ENCODING_DATAPATH,
+};
+
+enum CodecType : uint32_t {
+ UNKNOWN = 0x00,
+ SBC = 0x01,
+ AAC = 0x02,
+ APTX = 0x04,
+ APTX_HD = 0x08,
+ LDAC = 0x10,
+};
+
+enum SampleRate : uint32_t {
+ RATE_UNKNOWN = 0x00,
+ RATE_44100 = 0x01,
+ RATE_48000 = 0x02,
+ RATE_88200 = 0x04,
+ RATE_96000 = 0x08,
+ RATE_176400 = 0x10,
+ RATE_192000 = 0x20,
+ RATE_16000 = 0x40,
+ RATE_24000 = 0x80,
+};
+
+enum BitsPerSample : uint8_t {
+ BITS_UNKNOWN = 0x00,
+ BITS_16 = 0x01,
+ BITS_24 = 0x02,
+ BITS_32 = 0x04,
+};
+
+enum ChannelMode : uint8_t {
+ UNKNOWN = 0x00,
+ MONO = 0x01,
+ STEREO = 0x02,
+};
+
+enum SbcChannelMode : uint8_t {
+ /** Channel Mode: 4 bits */
+ UNKNOWN = 0x00,
+ JOINT_STEREO = 0x01,
+ STEREO = 0x02,
+ DUAL = 0x04,
+ MONO = 0x08,
+};
+
+enum SbcBlockLength : uint8_t {
+ BLOCKS_4 = 0x80,
+ BLOCKS_8 = 0x40,
+ BLOCKS_12 = 0x20,
+ BLOCKS_16 = 0x10,
+};
+
+enum SbcNumSubbands : uint8_t {
+ SUBBAND_4 = 0x08,
+ SUBBAND_8 = 0x04,
+};
+
+enum SbcAllocMethod : uint8_t {
+ /** SNR */
+ ALLOC_MD_S = 0x02,
+ /** Loudness */
+ ALLOC_MD_L = 0x01,
+};
+
+enum AacObjectType : uint8_t {
+ /** MPEG-2 Low Complexity. Support is Mandatory. */
+ MPEG2_LC = 0x80,
+ /** MPEG-4 Low Complexity. Support is Optional. */
+ MPEG4_LC = 0x40,
+ /** MPEG-4 Long Term Prediction. Support is Optional. */
+ MPEG4_LTP = 0x20,
+ /** MPEG-4 Scalable. Support is Optional. */
+ MPEG4_SCALABLE = 0x10,
+};
+
+enum AacVariableBitRate : uint8_t {
+ ENABLED = 0x80,
+ DISABLED = 0x00,
+};
+
+enum LdacChannelMode : uint8_t {
+ /** Channel Mode: 3 bits */
+ UNKNOWN = 0x00,
+ STEREO = 0x01,
+ DUAL = 0x02,
+ MONO = 0x04,
+};
+
+enum LdacQualityIndex : uint8_t {
+ // 990kbps
+ QUALITY_HIGH = 0x00,
+ // 660kbps
+ QUALITY_MID = 0x01,
+ // 330kbps
+ QUALITY_LOW = 0x02,
+ // Adaptive Bit Rate mode
+ QUALITY_ABR = 0x7F,
+};
+
+/** Used for Software Encoding audio feed parameters */
+struct PcmParameters {
+ SampleRate sampleRate;
+ ChannelMode channelMode;
+ BitsPerSample bitsPerSample;
+};
+
+/**
+ * Used for Hardware Encoding SBC codec parameters.
+ * minBitpool and maxBitpool are not bitfields.
+ */
+struct SbcParameters {
+ SampleRate sampleRate;
+ SbcChannelMode channelMode;
+ SbcBlockLength blockLength;
+ SbcNumSubbands numSubbands;
+ SbcAllocMethod allocMethod;
+ BitsPerSample bitsPerSample;
+ uint8_t minBitpool;
+ uint8_t maxBitpool;
+};
+
+/** Used for Hardware Encoding AAC codec parameters */
+struct AacParameters {
+ AacObjectType objectType;
+ SampleRate sampleRate;
+ ChannelMode channelMode;
+ AacVariableBitRate variableBitRateEnabled;
+ BitsPerSample bitsPerSample;
+};
+
+/**
+ * Used for Hardware Encoding LDAC codec parameters
+ * Only used when configuring the codec. When Capabilities are requested, this
+ * field is left empty since all qualities must be supported. Not a bitfield.
+ */
+struct LdacParameters {
+ SampleRate sampleRate;
+ LdacChannelMode channelMode;
+ LdacQualityIndex qualityIndex;
+ BitsPerSample bitsPerSample;
+};
+
+/** Used for Hardware Encoding AptX and AptX-HD codec parameters */
+struct AptxParameters {
+ SampleRate sampleRate;
+ ChannelMode channelMode;
+ BitsPerSample bitsPerSample;
+};
+
+/**
+ * Used to specify the capabilities of the codecs supported by Hardware Encoding.
+ * AptX and AptX-HD both use the AptxParameters field.
+ */
+struct CodecCapabilities {
+ CodecType codecType;
+
+ safe_union Capabilities {
+ SbcParameters sbcCapabilities;
+ AacParameters aacCapabilities;
+ LdacParameters ldacCapabilities;
+ AptxParameters aptxCapabilities;
+ } capabilities;
+};
+
+/** Used to specify the capabilities of the different session types. */
+safe_union AudioCapabilities {
+ PcmParameters pcmCapabilities;
+ CodecCapabilities codecCapabilities;
+};
+
+/**
+ * Used to configure a Hardware Encoding session.
+ * AptX and AptX-HD both use the AptxParameters field.
+ */
+struct CodecConfiguration {
+ CodecType codecType;
+ /**
+ * The encoded audio bitrate in bits / second.
+ * 0x00000000 - The audio bitrate is not specified / unused
+ * 0x00000001 - 0x00FFFFFF - Encoded audio bitrate in bits/second
+ * 0x01000000 - 0xFFFFFFFF - Reserved
+ *
+ * The HAL needs to support all legal bitrates for the selected codec.
+ */
+ uint32_t encodedAudioBitrate;
+ /** Peer MTU (in octets) */
+ uint16_t peerMtu;
+ /** Content protection by SCMS-T */
+ bool isScmstEnabled;
+ safe_union CodecSpecific {
+ SbcParameters sbcConfig;
+ AacParameters aacConfig;
+ LdacParameters ldacConfig;
+ AptxParameters aptxConfig;
+ } config;
+};
+
+/** Used to configure either a Hardware or Software Encoding session based on session type */
+safe_union AudioConfiguration {
+ PcmParameters pcmConfig;
+ CodecConfiguration codecConfig;
+};
diff --git a/camera/common/1.0/default/VendorTagDescriptor.cpp b/camera/common/1.0/default/VendorTagDescriptor.cpp
index 052bf5b..d2bee85 100644
--- a/camera/common/1.0/default/VendorTagDescriptor.cpp
+++ b/camera/common/1.0/default/VendorTagDescriptor.cpp
@@ -176,6 +176,93 @@
}
+int VendorTagDescriptorCache::getTagCount(metadata_vendor_id_t id) const {
+ int ret = 0;
+ auto desc = mVendorMap.find(id);
+ if (desc != mVendorMap.end()) {
+ ret = desc->second->getTagCount();
+ } else {
+ ALOGE("%s: Vendor descriptor id is missing!", __func__);
+ }
+
+ return ret;
+}
+
+void VendorTagDescriptorCache::getTagArray(uint32_t* tagArray, metadata_vendor_id_t id) const {
+ auto desc = mVendorMap.find(id);
+ if (desc != mVendorMap.end()) {
+ desc->second->getTagArray(tagArray);
+ } else {
+ ALOGE("%s: Vendor descriptor id is missing!", __func__);
+ }
+}
+
+const char* VendorTagDescriptorCache::getSectionName(uint32_t tag, metadata_vendor_id_t id) const {
+ const char* ret = nullptr;
+ auto desc = mVendorMap.find(id);
+ if (desc != mVendorMap.end()) {
+ ret = desc->second->getSectionName(tag);
+ } else {
+ ALOGE("%s: Vendor descriptor id is missing!", __func__);
+ }
+
+ return ret;
+}
+
+const char* VendorTagDescriptorCache::getTagName(uint32_t tag, metadata_vendor_id_t id) const {
+ const char* ret = nullptr;
+ auto desc = mVendorMap.find(id);
+ if (desc != mVendorMap.end()) {
+ ret = desc->second->getTagName(tag);
+ } else {
+ ALOGE("%s: Vendor descriptor id is missing!", __func__);
+ }
+
+ return ret;
+}
+
+int VendorTagDescriptorCache::getTagType(uint32_t tag, metadata_vendor_id_t id) const {
+ int ret = 0;
+ auto desc = mVendorMap.find(id);
+ if (desc != mVendorMap.end()) {
+ ret = desc->second->getTagType(tag);
+ } else {
+ ALOGE("%s: Vendor descriptor id is missing!", __func__);
+ }
+
+ return ret;
+}
+
+void VendorTagDescriptorCache::dump(int fd, int verbosity, int indentation) const {
+ for (const auto& desc : mVendorMap) {
+ desc.second->dump(fd, verbosity, indentation);
+ }
+}
+
+int32_t VendorTagDescriptorCache::addVendorDescriptor(
+ metadata_vendor_id_t id, sp<hardware::camera::common::V1_0::helper::VendorTagDescriptor> desc) {
+ auto entry = mVendorMap.find(id);
+ if (entry != mVendorMap.end()) {
+ ALOGE("%s: Vendor descriptor with same id already present!", __func__);
+ return BAD_VALUE;
+ }
+
+ mVendorMap.emplace(id, desc);
+ return NO_ERROR;
+}
+
+int32_t VendorTagDescriptorCache::getVendorTagDescriptor(
+ metadata_vendor_id_t id,
+ sp<hardware::camera::common::V1_0::helper::VendorTagDescriptor>* desc /*out*/) {
+ auto entry = mVendorMap.find(id);
+ if (entry == mVendorMap.end()) {
+ return NAME_NOT_FOUND;
+ }
+
+ *desc = entry->second;
+
+ return NO_ERROR;
+}
} // namespace params
} // namespace camera2
@@ -192,10 +279,17 @@
static const char* vendor_tag_descriptor_get_tag_name(const vendor_tag_ops_t* v, uint32_t tag);
static int vendor_tag_descriptor_get_tag_type(const vendor_tag_ops_t* v, uint32_t tag);
+static int vendor_tag_descriptor_cache_get_tag_count(metadata_vendor_id_t id);
+static void vendor_tag_descriptor_cache_get_all_tags(uint32_t* tagArray, metadata_vendor_id_t id);
+static const char* vendor_tag_descriptor_cache_get_section_name(uint32_t tag,
+ metadata_vendor_id_t id);
+static const char* vendor_tag_descriptor_cache_get_tag_name(uint32_t tag, metadata_vendor_id_t id);
+static int vendor_tag_descriptor_cache_get_tag_type(uint32_t tag, metadata_vendor_id_t id);
} /* extern "C" */
static Mutex sLock;
static sp<VendorTagDescriptor> sGlobalVendorTagDescriptor;
+static sp<VendorTagDescriptorCache> sGlobalVendorTagDescriptorCache;
status_t VendorTagDescriptor::createDescriptorFromOps(const vendor_tag_ops_t* vOps,
/*out*/
@@ -310,6 +404,39 @@
return sGlobalVendorTagDescriptor;
}
+status_t VendorTagDescriptorCache::setAsGlobalVendorTagCache(
+ const sp<VendorTagDescriptorCache>& cache) {
+ status_t res = OK;
+ Mutex::Autolock al(sLock);
+ sGlobalVendorTagDescriptorCache = cache;
+
+ struct vendor_tag_cache_ops* opsPtr = NULL;
+ if (cache != NULL) {
+ opsPtr = &(cache->mVendorCacheOps);
+ opsPtr->get_tag_count = vendor_tag_descriptor_cache_get_tag_count;
+ opsPtr->get_all_tags = vendor_tag_descriptor_cache_get_all_tags;
+ opsPtr->get_section_name = vendor_tag_descriptor_cache_get_section_name;
+ opsPtr->get_tag_name = vendor_tag_descriptor_cache_get_tag_name;
+ opsPtr->get_tag_type = vendor_tag_descriptor_cache_get_tag_type;
+ }
+ if ((res = set_camera_metadata_vendor_cache_ops(opsPtr)) != OK) {
+ ALOGE("%s: Could not set vendor tag cache, received error %s (%d).", __FUNCTION__,
+ strerror(-res), res);
+ }
+ return res;
+}
+
+void VendorTagDescriptorCache::clearGlobalVendorTagCache() {
+ Mutex::Autolock al(sLock);
+ set_camera_metadata_vendor_cache_ops(NULL);
+ sGlobalVendorTagDescriptorCache.clear();
+}
+
+sp<VendorTagDescriptorCache> VendorTagDescriptorCache::getGlobalVendorTagCache() {
+ Mutex::Autolock al(sLock);
+ return sGlobalVendorTagDescriptorCache;
+}
+
extern "C" {
int vendor_tag_descriptor_get_tag_count(const vendor_tag_ops_t* /*v*/) {
@@ -357,6 +484,50 @@
return sGlobalVendorTagDescriptor->getTagType(tag);
}
+int vendor_tag_descriptor_cache_get_tag_count(metadata_vendor_id_t id) {
+ Mutex::Autolock al(sLock);
+ if (sGlobalVendorTagDescriptorCache == NULL) {
+ ALOGE("%s: Vendor tag descriptor cache not initialized.", __FUNCTION__);
+ return VENDOR_TAG_COUNT_ERR;
+ }
+ return sGlobalVendorTagDescriptorCache->getTagCount(id);
+}
+
+void vendor_tag_descriptor_cache_get_all_tags(uint32_t* tagArray, metadata_vendor_id_t id) {
+ Mutex::Autolock al(sLock);
+ if (sGlobalVendorTagDescriptorCache == NULL) {
+ ALOGE("%s: Vendor tag descriptor cache not initialized.", __FUNCTION__);
+ }
+ sGlobalVendorTagDescriptorCache->getTagArray(tagArray, id);
+}
+
+const char* vendor_tag_descriptor_cache_get_section_name(uint32_t tag, metadata_vendor_id_t id) {
+ Mutex::Autolock al(sLock);
+ if (sGlobalVendorTagDescriptorCache == NULL) {
+ ALOGE("%s: Vendor tag descriptor cache not initialized.", __FUNCTION__);
+ return VENDOR_SECTION_NAME_ERR;
+ }
+ return sGlobalVendorTagDescriptorCache->getSectionName(tag, id);
+}
+
+const char* vendor_tag_descriptor_cache_get_tag_name(uint32_t tag, metadata_vendor_id_t id) {
+ Mutex::Autolock al(sLock);
+ if (sGlobalVendorTagDescriptorCache == NULL) {
+ ALOGE("%s: Vendor tag descriptor cache not initialized.", __FUNCTION__);
+ return VENDOR_TAG_NAME_ERR;
+ }
+ return sGlobalVendorTagDescriptorCache->getTagName(tag, id);
+}
+
+int vendor_tag_descriptor_cache_get_tag_type(uint32_t tag, metadata_vendor_id_t id) {
+ Mutex::Autolock al(sLock);
+ if (sGlobalVendorTagDescriptorCache == NULL) {
+ ALOGE("%s: Vendor tag descriptor cache not initialized.", __FUNCTION__);
+ return VENDOR_TAG_NAME_ERR;
+ }
+ return sGlobalVendorTagDescriptorCache->getTagType(tag, id);
+}
+
} /* extern "C" */
} // namespace helper
diff --git a/camera/common/1.0/default/include/VendorTagDescriptor.h b/camera/common/1.0/default/include/VendorTagDescriptor.h
index a040540..0f54db5 100644
--- a/camera/common/1.0/default/include/VendorTagDescriptor.h
+++ b/camera/common/1.0/default/include/VendorTagDescriptor.h
@@ -157,6 +157,81 @@
};
+} /* namespace helper */
+} /* namespace V1_0 */
+} /* namespace common */
+} /* namespace camera */
+
+namespace camera2 {
+namespace params {
+
+class VendorTagDescriptorCache {
+ public:
+ typedef android::hardware::camera::common::V1_0::helper::VendorTagDescriptor
+ VendorTagDescriptor;
+ VendorTagDescriptorCache(){};
+ int32_t addVendorDescriptor(metadata_vendor_id_t id, sp<VendorTagDescriptor> desc);
+
+ int32_t getVendorTagDescriptor(metadata_vendor_id_t id, sp<VendorTagDescriptor>* desc /*out*/);
+
+ // Returns the number of vendor tags defined.
+ int getTagCount(metadata_vendor_id_t id) const;
+
+ // Returns an array containing the id's of vendor tags defined.
+ void getTagArray(uint32_t* tagArray, metadata_vendor_id_t id) const;
+
+ // Returns the section name string for a given vendor tag id.
+ const char* getSectionName(uint32_t tag, metadata_vendor_id_t id) const;
+
+ // Returns the tag name string for a given vendor tag id.
+ const char* getTagName(uint32_t tag, metadata_vendor_id_t id) const;
+
+ // Returns the tag type for a given vendor tag id.
+ int getTagType(uint32_t tag, metadata_vendor_id_t id) const;
+
+ /**
+ * Dump the currently configured vendor tags to a file descriptor.
+ */
+ void dump(int fd, int verbosity, int indentation) const;
+
+ protected:
+ std::unordered_map<metadata_vendor_id_t, sp<VendorTagDescriptor>> mVendorMap;
+ struct vendor_tag_cache_ops mVendorCacheOps;
+};
+
+} /* namespace params */
+} /* namespace camera2 */
+
+namespace camera {
+namespace common {
+namespace V1_0 {
+namespace helper {
+
+class VendorTagDescriptorCache
+ : public ::android::hardware::camera2::params::VendorTagDescriptorCache,
+ public LightRefBase<VendorTagDescriptorCache> {
+ public:
+ /**
+ * Sets the global vendor tag descriptor cache to use for this process.
+ * Camera metadata operations that access vendor tags will use the
+ * vendor tag definitions set this way.
+ *
+ * Returns OK on success, or a negative error code.
+ */
+ static status_t setAsGlobalVendorTagCache(const sp<VendorTagDescriptorCache>& cache);
+
+ /**
+ * Returns the global vendor tag cache used by this process.
+ * This will contain NULL if no vendor tags are defined.
+ */
+ static sp<VendorTagDescriptorCache> getGlobalVendorTagCache();
+
+ /**
+ * Clears the global vendor tag cache used by this process.
+ */
+ static void clearGlobalVendorTagCache();
+};
+
} // namespace helper
} // namespace V1_0
} // namespace common
diff --git a/camera/device/3.4/default/ExternalCameraDevice.cpp b/camera/device/3.4/default/ExternalCameraDevice.cpp
index b96f574..0f23657 100644
--- a/camera/device/3.4/default/ExternalCameraDevice.cpp
+++ b/camera/device/3.4/default/ExternalCameraDevice.cpp
@@ -378,8 +378,12 @@
const uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;
UPDATE(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE, ×tampSource, 1);
- // Orientation probably isn't useful for external facing camera?
- const int32_t orientation = 0;
+ // Orientation is a bit odd for external camera, but consider it as the orientation
+ // between the external camera sensor (which is usually landscape) and the device's
+ // natural display orientation. For devices with natural landscape display (ex: tablet/TV), the
+ // orientation should be 0. For devices with natural portrait display (phone), the orientation
+ // should be 270.
+ const int32_t orientation = mCfg.orientation;
UPDATE(ANDROID_SENSOR_ORIENTATION, &orientation, 1);
// android.shading
diff --git a/camera/device/3.4/default/ExternalCameraUtils.cpp b/camera/device/3.4/default/ExternalCameraUtils.cpp
index 680c95a..0941052 100644
--- a/camera/device/3.4/default/ExternalCameraUtils.cpp
+++ b/camera/device/3.4/default/ExternalCameraUtils.cpp
@@ -160,9 +160,11 @@
namespace common {
namespace {
- const int kDefaultJpegBufSize = 5 << 20; // 5MB
- const int kDefaultNumVideoBuffer = 4;
- const int kDefaultNumStillBuffer = 2;
+ const int kDefaultJpegBufSize = 5 << 20; // 5MB
+ const int kDefaultNumVideoBuffer = 4;
+ const int kDefaultNumStillBuffer = 2;
+ const int kDefaultOrientation = 0; // suitable for natural landscape displays like tablet/TV
+ // For phone devices 270 is better
} // anonymous namespace
const char* ExternalCameraConfig::kDefaultCfgPath = "/vendor/etc/external_camera_config.xml";
@@ -276,10 +278,17 @@
minStreamSize->UnsignedAttribute("height", /*Default*/0)};
}
+ XMLElement *orientation = deviceCfg->FirstChildElement("Orientation");
+ if (orientation == nullptr) {
+ ALOGI("%s: no sensor orientation specified", __FUNCTION__);
+ } else {
+ ret.orientation = orientation->IntAttribute("degree", /*Default*/kDefaultOrientation);
+ }
+
ALOGI("%s: external camera cfg loaded: maxJpgBufSize %d,"
- " num video buffers %d, num still buffers %d",
+ " num video buffers %d, num still buffers %d, orientation %d",
__FUNCTION__, ret.maxJpegBufSize,
- ret.numVideoBuffers, ret.numStillBuffers);
+ ret.numVideoBuffers, ret.numStillBuffers, ret.orientation);
for (const auto& limit : ret.fpsLimits) {
ALOGI("%s: fpsLimitList: %dx%d@%f", __FUNCTION__,
limit.size.width, limit.size.height, limit.fpsUpperBound);
@@ -292,7 +301,8 @@
ExternalCameraConfig::ExternalCameraConfig() :
maxJpegBufSize(kDefaultJpegBufSize),
numVideoBuffers(kDefaultNumVideoBuffer),
- numStillBuffers(kDefaultNumStillBuffer) {
+ numStillBuffers(kDefaultNumStillBuffer),
+ orientation(kDefaultOrientation) {
fpsLimits.push_back({/*Size*/{ 640, 480}, /*FPS upper bound*/30.0});
fpsLimits.push_back({/*Size*/{1280, 720}, /*FPS upper bound*/7.5});
fpsLimits.push_back({/*Size*/{1920, 1080}, /*FPS upper bound*/5.0});
diff --git a/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraUtils.h b/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraUtils.h
index 5754ccb..3b1ac96 100644
--- a/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraUtils.h
+++ b/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraUtils.h
@@ -80,6 +80,9 @@
// Minimum output stream size
Size minStreamSize;
+ // The value of android.sensor.orientation
+ int32_t orientation;
+
private:
ExternalCameraConfig();
};
diff --git a/camera/device/3.4/types.hal b/camera/device/3.4/types.hal
index bf2b3fc..85b3f7d 100644
--- a/camera/device/3.4/types.hal
+++ b/camera/device/3.4/types.hal
@@ -164,6 +164,9 @@
* If non-zero, read settings from request queue instead
* (see ICameraDeviceSession.getCaptureRequestMetadataQueue).
* If zero, read settings from .settings field.
+ *
+ * The v3_2 settings metadata is read first from the FMQ, followed by
+ * the physical cameras' settings metadata starting from index 0.
*/
uint64_t fmqSettingsSize;
@@ -205,8 +208,70 @@
* structure asynchronously to the framework, using the processCaptureResult()
* callback.
*
- * Identical to @3.2::CaptureRequest, except that it contains @3.4::physCamSettings vector.
+ * Identical to @3.2::CaptureRequest, except that it contains
+ * @3.4::physCamSettings vector.
*
+ * With 3.4 CaptureRequest, there can be multiple sources of metadata settings.
+ * The @3.2::CaptureRequest v3_2 and each of the PhysicalCameraSetting in
+ * physicalCameraSettings can contain settings, and each buffer may have
+ * metadata settings from a different source.
+ *
+ * For both @3.2::CaptureRequest and PhysicalCameraSetting, the settings can be
+ * passed from framework to HAL using either hwbinder or FMQ; both of the
+ * structs have the fields fmqSettingsSize and settings to pass the metadata.
+ * When metadata settings are passed using hwbinder, fmqSettingsSize == 0 and
+ * settings field contains the metadata for the HAL to read. When metadata
+ * settings comes from FMQ, fmqSettingsSize > 0 and HAL reads metadata from FMQ.
+ * For the purposes of selecting which settings to use, it does not matter
+ * whether it comes from hwbinder or FMQ. When the below specifications say that
+ * v3_2 has settings or a PhysicalCameraSetting has settings, it could refer to
+ * either hwbinder or FMQ, whichever is specified in the struct.
+ *
+ * Below is the logic that the HAL must follow for applying the metadata
+ * settings when it receives a CaptureRequest request in
+ * processCaptureRequest_3_4. Note that HAL must be capable of storing both the
+ * request.v3_2 settings and the PhysicalCameraSetting settings for each
+ * physical device.
+ * - Case 1 - request.v3_2 has settings, request.physicalCameraSettings vector
+ * is empty:
+ * - Store the request.v3_2 settings, overwriting the previously stored
+ * request.v3_2 settings and clearing all previously stored physical device
+ * settings.
+ * - Apply the settings from the request.v3_2 to all buffers.
+ * - Case 2 - request.v3_2 has settings, request.physicalCameraSettings vector
+ * is not empty:
+ * - Store the request.v3_2 settings, overwriting the previously stored
+ * request.v3_2 settings.
+ * - Each PhysicalCameraSetting in request.physicalCameraSettings must have
+ * settings; if not, return error.
+ * - For each PhysicalCameraSetting in request.physicalCameraSettings, store
+ * the settings, overwriting the previously stored settings for this
+ * physical camera; apply these settings to the buffers belonging to the
+ * stream for this device.
+ * - If there are any stored physical camera settings which do not correspond
+ * to one of the PhysicalCameraSetting in this request, clear them.
+ * - Apply the request.v3_2 settings to all buffers belonging to streams not
+ * covered by one of the PhysicalCameraSetting in this request.
+ * - Case 3 - request.v3_2 does not have settings,
+ * request.physicalCameraSettings vector is empty:
+ * - Clear all previously stored physical device settings.
+ * - Apply the stored request.v3_2 settings to all buffers. If there is no
+ * stored request.v3_2 settings, return error.
+ * - Case 4 - request.v3_2 does not have settings,
+ * request.physicalCameraSettings vector is not empty:
+ * - If request.physicalCameraSettings does not have the same set of physical
+ * cameras as the stored physical camera settings, return error.
+ * - Each PhysicalCameraSetting in request.physicalCameraSettings must not
+ * have settings; if any do have settings, return error.
+ * - For each PhysicalCameraSetting in request.physicalCameraSettings, apply
+ * the previously stored settings for this physical camera to the buffers
+ * belonging to the stream for this device.
+ * - Apply the stored request.v3_2 settings to all buffers belonging to
+ * streams not covered by one of the PhysicalCameraSetting in this request.
+ * If there is no stored request.v3_2 settings, return error.
+ *
+ * For the first request received by the HAL, only Case 1 and Case 2 are
+ * allowed.
*/
struct CaptureRequest {
/**
@@ -238,6 +303,9 @@
* If non-zero, read metadata from result metadata queue instead
* (see ICameraDeviceSession.getCaptureResultMetadataQueue).
* If zero, read metadata from .metadata field.
+ *
+ * The v3_2 CaptureResult metadata is read first from the FMQ, followed by
+ * the physical cameras' metadata starting from index 0.
*/
uint64_t fmqMetadataSize;
@@ -251,9 +319,6 @@
/**
* If fmqMetadataSize is zero, the metadata buffer contains the metadata
* for the physical device with physicalCameraId.
- *
- * The v3_2 CaptureResult metadata is read first from the FMQ, followed by
- * the physical cameras' metadata starting from index 0.
*/
CameraMetadata metadata;
};
diff --git a/camera/device/3.5/ICameraDevice.hal b/camera/device/3.5/ICameraDevice.hal
index d9f2837..492105c 100644
--- a/camera/device/3.5/ICameraDevice.hal
+++ b/camera/device/3.5/ICameraDevice.hal
@@ -84,6 +84,9 @@
*
* The streamList must contain at least one output-capable stream, and may
* not contain more than one input-capable stream.
+ * In contrast to regular stream configuration the framework does not create
+ * or initialize any actual streams. This means that Hal must not use or
+ * consider the stream "id" value.
*
* ------------------------------------------------------------------------
*
diff --git a/camera/metadata/3.4/types.hal b/camera/metadata/3.4/types.hal
index 61a399e..28c56c8 100644
--- a/camera/metadata/3.4/types.hal
+++ b/camera/metadata/3.4/types.hal
@@ -75,6 +75,14 @@
ANDROID_DEPTH_END_3_4,
+ /** android.logicalMultiCamera.activePhysicalId [dynamic, byte, public]
+ *
+ * <p>String containing the ID of the underlying active physical camera.</p>
+ */
+ ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID = android.hardware.camera.metadata@3.3::CameraMetadataTag:ANDROID_LOGICAL_MULTI_CAMERA_END_3_3,
+
+ ANDROID_LOGICAL_MULTI_CAMERA_END_3_4,
+
};
/*
diff --git a/camera/provider/2.4/default/CameraProvider.cpp b/camera/provider/2.4/default/CameraProvider.cpp
index 488b9af..f143dd7 100644
--- a/camera/provider/2.4/default/CameraProvider.cpp
+++ b/camera/provider/2.4/default/CameraProvider.cpp
@@ -143,7 +143,6 @@
int new_status) {
CameraProvider* cp = const_cast<CameraProvider*>(
static_cast<const CameraProvider*>(callbacks));
- bool found = false;
if (cp == nullptr) {
ALOGE("%s: callback ops is null", __FUNCTION__);
@@ -155,17 +154,23 @@
snprintf(cameraId, sizeof(cameraId), "%d", camera_id);
std::string cameraIdStr(cameraId);
cp->mCameraStatusMap[cameraIdStr] = (camera_device_status_t) new_status;
- if (cp->mCallbacks != nullptr) {
- CameraDeviceStatus status = (CameraDeviceStatus) new_status;
- for (auto const& deviceNamePair : cp->mCameraDeviceNames) {
- if (cameraIdStr.compare(deviceNamePair.first) == 0) {
- cp->mCallbacks->cameraDeviceStatusChange(
- deviceNamePair.second, status);
- found = true;
- }
- }
- switch (status) {
+ if (cp->mCallbacks == nullptr) {
+ // For camera connected before mCallbacks is set, the corresponding
+ // addDeviceNames() would be called later in setCallbacks().
+ return;
+ }
+
+ bool found = false;
+ CameraDeviceStatus status = (CameraDeviceStatus)new_status;
+ for (auto const& deviceNamePair : cp->mCameraDeviceNames) {
+ if (cameraIdStr.compare(deviceNamePair.first) == 0) {
+ cp->mCallbacks->cameraDeviceStatusChange(deviceNamePair.second, status);
+ found = true;
+ }
+ }
+
+ switch (status) {
case CameraDeviceStatus::PRESENT:
case CameraDeviceStatus::ENUMERATING:
if (!found) {
@@ -176,7 +181,6 @@
if (found) {
cp->removeDeviceNames(camera_id);
}
- }
}
}
@@ -439,8 +443,22 @@
// Methods from ::android::hardware::camera::provider::V2_4::ICameraProvider follow.
Return<Status> CameraProvider::setCallback(const sp<ICameraProviderCallback>& callback) {
+ if (callback == nullptr) {
+ return Status::ILLEGAL_ARGUMENT;
+ }
+
Mutex::Autolock _l(mCbLock);
mCallbacks = callback;
+
+ // Add and report all presenting external cameras.
+ for (auto const& statusPair : mCameraStatusMap) {
+ int id = std::stoi(statusPair.first);
+ auto status = static_cast<CameraDeviceStatus>(statusPair.second);
+ if (id >= mNumberOfLegacyCameras && status != CameraDeviceStatus::NOT_PRESENT) {
+ addDeviceNames(id, status, true);
+ }
+ }
+
return Status::OK;
}
@@ -452,6 +470,11 @@
Return<void> CameraProvider::getCameraIdList(getCameraIdList_cb _hidl_cb) {
std::vector<hidl_string> deviceNameList;
for (auto const& deviceNamePair : mCameraDeviceNames) {
+ if (std::stoi(deviceNamePair.first) >= mNumberOfLegacyCameras) {
+ // External camera devices must be reported through the device status change callback,
+ // not in this list.
+ continue;
+ }
if (mCameraStatusMap[deviceNamePair.first] == CAMERA_DEVICE_STATUS_PRESENT) {
deviceNameList.push_back(deviceNamePair.second);
}
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index e376551..1556c08 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -114,6 +114,8 @@
using ::android::hardware::camera::device::V1_0::FrameCallbackFlag;
using ::android::hardware::camera::device::V1_0::HandleTimestampMessage;
using ::android::hardware::camera::metadata::V3_4::CameraMetadataEnumAndroidSensorInfoColorFilterArrangement;
+using ::android::hardware::camera::metadata::V3_4::CameraMetadataTag;
+using ::android::hardware::camera::device::V3_4::PhysicalCameraMetadata;
using ::android::hardware::MessageQueue;
using ::android::hardware::kSynchronizedReadWrite;
using ::android::hidl::allocator::V1_0::IAllocator;
@@ -587,8 +589,8 @@
};
struct DeviceCb : public V3_5::ICameraDeviceCallback {
- DeviceCb(CameraHidlTest *parent, bool checkMonochromeResult) : mParent(parent),
- mCheckMonochromeResult(checkMonochromeResult) {}
+ DeviceCb(CameraHidlTest *parent, int deviceVersion, const camera_metadata_t *staticMeta) :
+ mParent(parent), mDeviceVersion(deviceVersion), mStaticMetadata(staticMeta) {}
Return<void> processCaptureResult_3_4(
const hidl_vec<V3_4::CaptureResult>& results) override;
@@ -607,10 +609,12 @@
void waitForBuffersReturned();
private:
- bool processCaptureResultLocked(const CaptureResult& results);
+ bool processCaptureResultLocked(const CaptureResult& results,
+ hidl_vec<PhysicalCameraMetadata> physicalCameraMetadata);
CameraHidlTest *mParent; // Parent object
- bool mCheckMonochromeResult;
+ int mDeviceVersion;
+ const camera_metadata_t *mStaticMetadata;
bool hasOutstandingBuffersLocked();
/* members for requestStreamBuffers() and returnStreamBuffers()*/
@@ -715,7 +719,8 @@
StreamConfigurationMode configMode,
::android::hardware::camera::device::V3_2::StreamConfiguration *config3_2,
::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4,
- ::android::hardware::camera::device::V3_5::StreamConfiguration *config3_5);
+ ::android::hardware::camera::device::V3_5::StreamConfiguration *config3_5,
+ uint32_t jpegBufferSize = 0);
void configurePreviewStreams3_4(const std::string &name, int32_t deviceVersion,
sp<ICameraProvider> provider,
@@ -754,6 +759,8 @@
void verifyStreamCombination(sp<device::V3_5::ICameraDevice> cameraDevice3_5,
const ::android::hardware::camera::device::V3_4::StreamConfiguration &config3_4,
bool expectedStatus);
+ void verifyLogicalCameraResult(const camera_metadata_t* staticMetadata,
+ const ::android::hardware::camera::common::V1_0::helper::CameraMetadata& resultMetadata);
void verifyBuffersReturned(sp<device::V3_2::ICameraDeviceSession> session,
int deviceVerison, int32_t streamId, sp<DeviceCb> cb,
@@ -766,6 +773,8 @@
static Status getAvailableOutputStreams(camera_metadata_t *staticMeta,
std::vector<AvailableStream> &outputStreams,
const AvailableStream *threshold = nullptr);
+ static Status getJpegBufferSize(camera_metadata_t *staticMeta,
+ uint32_t* outBufSize);
static Status isConstrainedModeAvailable(camera_metadata_t *staticMeta);
static Status isLogicalMultiCamera(const camera_metadata_t *staticMeta);
static Status getPhysicalCameraIds(const camera_metadata_t *staticMeta,
@@ -1005,7 +1014,7 @@
bool notify = false;
std::unique_lock<std::mutex> l(mParent->mLock);
for (size_t i = 0 ; i < results.size(); i++) {
- notify = processCaptureResultLocked(results[i].v3_2);
+ notify = processCaptureResultLocked(results[i].v3_2, results[i].physicalCameraMetadata);
}
l.unlock();
@@ -1024,8 +1033,9 @@
bool notify = false;
std::unique_lock<std::mutex> l(mParent->mLock);
+ ::android::hardware::hidl_vec<PhysicalCameraMetadata> noPhysMetadata;
for (size_t i = 0 ; i < results.size(); i++) {
- notify = processCaptureResultLocked(results[i]);
+ notify = processCaptureResultLocked(results[i], noPhysMetadata);
}
l.unlock();
@@ -1036,7 +1046,8 @@
return Void();
}
-bool CameraHidlTest::DeviceCb::processCaptureResultLocked(const CaptureResult& results) {
+bool CameraHidlTest::DeviceCb::processCaptureResultLocked(const CaptureResult& results,
+ hidl_vec<PhysicalCameraMetadata> physicalCameraMetadata) {
bool notify = false;
uint32_t frameNumber = results.frameNumber;
@@ -1077,6 +1088,20 @@
ADD_FAILURE();
return notify;
}
+
+ std::vector<::android::hardware::camera::device::V3_2::CameraMetadata> physResultMetadata;
+ physResultMetadata.resize(physicalCameraMetadata.size());
+ for (size_t i = 0; i < physicalCameraMetadata.size(); i++) {
+ physResultMetadata[i].resize(physicalCameraMetadata[i].fmqMetadataSize);
+ if (!request->resultQueue->read(physResultMetadata[i].data(),
+ physicalCameraMetadata[i].fmqMetadataSize)) {
+ ALOGE("%s: Frame %d: Cannot read physical camera metadata from fmq,"
+ "size = %" PRIu64, __func__, frameNumber,
+ physicalCameraMetadata[i].fmqMetadataSize);
+ ADD_FAILURE();
+ return notify;
+ }
+ }
resultSize = resultMetadata.size();
} else if (results.result.size() > 0) {
resultMetadata.setToExternal(const_cast<uint8_t *>(
@@ -1134,8 +1159,20 @@
request->collectedResult.sort();
// Verify final result metadata
- if (mCheckMonochromeResult) {
- mParent->verifyMonochromeCameraResult(request->collectedResult);
+ bool isAtLeast_3_5 = mDeviceVersion >= CAMERA_DEVICE_API_VERSION_3_5;
+ if (isAtLeast_3_5) {
+ bool isMonochrome = Status::OK ==
+ CameraHidlTest::isMonochromeCamera(mStaticMetadata);
+ if (isMonochrome) {
+ mParent->verifyMonochromeCameraResult(request->collectedResult);
+ }
+
+ // Verify logical camera result metadata
+ bool isLogicalCamera =
+ Status::OK == CameraHidlTest::isLogicalMultiCamera(mStaticMetadata);
+ if (isLogicalCamera) {
+ mParent->verifyLogicalCameraResult(mStaticMetadata, request->collectedResult);
+ }
}
}
@@ -2786,6 +2823,10 @@
ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
ASSERT_NE(0u, outputStreams.size());
+ uint32_t jpegBufferSize = 0;
+ ASSERT_EQ(Status::OK, getJpegBufferSize(staticMeta, &jpegBufferSize));
+ ASSERT_NE(0u, jpegBufferSize);
+
int32_t streamId = 0;
uint32_t streamConfigCounter = 0;
for (auto& it : outputStreams) {
@@ -2804,7 +2845,7 @@
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams3_2, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4, &config3_5);
+ &config3_2, &config3_4, &config3_5, jpegBufferSize);
if (session3_5 != nullptr) {
verifyStreamCombination(cameraDevice3_5, config3_4,
/*expectedStatus*/ true);
@@ -2879,6 +2920,10 @@
ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
ASSERT_NE(0u, outputStreams.size());
+ uint32_t jpegBufferSize = 0;
+ ASSERT_EQ(Status::OK, getJpegBufferSize(staticMeta, &jpegBufferSize));
+ ASSERT_NE(0u, jpegBufferSize);
+
int32_t streamId = 0;
V3_2::Stream stream3_2 = {streamId++,
StreamType::OUTPUT,
@@ -2894,7 +2939,7 @@
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4, &config3_5);
+ &config3_2, &config3_4, &config3_5, jpegBufferSize);
if (session3_5 != nullptr) {
verifyStreamCombination(cameraDevice3_5, config3_4, /*expectedStatus*/ false);
config3_5.streamConfigCounter = streamConfigCounter++;
@@ -2934,7 +2979,7 @@
StreamRotation::ROTATION_0};
streams[0] = stream3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4, &config3_5);
+ &config3_2, &config3_4, &config3_5, jpegBufferSize);
if (session3_5 != nullptr) {
config3_5.streamConfigCounter = streamConfigCounter++;
ret = session3_5->configureStreams_3_5(config3_5, [](Status s,
@@ -2970,7 +3015,7 @@
StreamRotation::ROTATION_0};
streams[0] = stream3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4, &config3_5);
+ &config3_2, &config3_4, &config3_5, jpegBufferSize);
if (session3_5 != nullptr) {
config3_5.streamConfigCounter = streamConfigCounter++;
ret = session3_5->configureStreams_3_5(config3_5,
@@ -3005,7 +3050,7 @@
static_cast<StreamRotation>(UINT32_MAX)};
streams[0] = stream3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4, &config3_5);
+ &config3_2, &config3_4, &config3_5, jpegBufferSize);
if (session3_5 != nullptr) {
config3_5.streamConfigCounter = streamConfigCounter++;
ret = session3_5->configureStreams_3_5(config3_5,
@@ -3093,6 +3138,10 @@
}
}
+ uint32_t jpegBufferSize = 0;
+ ASSERT_EQ(Status::OK, getJpegBufferSize(staticMeta, &jpegBufferSize));
+ ASSERT_NE(0u, jpegBufferSize);
+
int32_t streamId = 0;
bool hasPrivToY8 = false, hasY8ToY8 = false, hasY8ToBlob = false;
uint32_t streamConfigCounter = 0;
@@ -3150,7 +3199,7 @@
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4, &config3_5);
+ &config3_2, &config3_4, &config3_5, jpegBufferSize);
if (session3_5 != nullptr) {
verifyStreamCombination(cameraDevice3_5, config3_4,
/*expectedStatus*/ true);
@@ -3199,7 +3248,7 @@
}
}
-// Check wehether session parameters are supported. If Hal support for them
+// Check whether session parameters are supported. If Hal support for them
// exist, then try to configure a preview stream using them.
TEST_F(CameraHidlTest, configureStreamsWithSessionParameters) {
hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
@@ -3253,6 +3302,8 @@
continue;
}
+ outputPreviewStreams.clear();
+
ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMetaBuffer, outputPreviewStreams,
&previewThreshold));
ASSERT_NE(0u, outputPreviewStreams.size());
@@ -3266,6 +3317,7 @@
GRALLOC1_CONSUMER_USAGE_HWCOMPOSER,
0,
StreamRotation::ROTATION_0};
+ previewStream.bufferSize = 0;
::android::hardware::hidl_vec<V3_4::Stream> streams = {previewStream};
::android::hardware::camera::device::V3_4::StreamConfiguration config;
::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
@@ -3344,6 +3396,10 @@
&previewThreshold));
ASSERT_NE(0u, outputPreviewStreams.size());
+ uint32_t jpegBufferSize = 0;
+ ASSERT_EQ(Status::OK, getJpegBufferSize(staticMeta, &jpegBufferSize));
+ ASSERT_NE(0u, jpegBufferSize);
+
int32_t streamId = 0;
uint32_t streamConfigCounter = 0;
for (auto& blobIter : outputBlobStreams) {
@@ -3370,7 +3426,7 @@
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4, &config3_5);
+ &config3_2, &config3_4, &config3_5, jpegBufferSize);
if (session3_5 != nullptr) {
verifyStreamCombination(cameraDevice3_5, config3_4,
/*expectedStatus*/ true);
@@ -3661,6 +3717,10 @@
&videoThreshold));
ASSERT_NE(0u, outputVideoStreams.size());
+ uint32_t jpegBufferSize = 0;
+ ASSERT_EQ(Status::OK, getJpegBufferSize(staticMeta, &jpegBufferSize));
+ ASSERT_NE(0u, jpegBufferSize);
+
int32_t streamId = 0;
uint32_t streamConfigCounter = 0;
for (auto& blobIter : outputBlobStreams) {
@@ -3686,7 +3746,7 @@
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4, &config3_5);
+ &config3_2, &config3_4, &config3_5, jpegBufferSize);
if (session3_5 != nullptr) {
verifyStreamCombination(cameraDevice3_5, config3_4,
/*expectedStatus*/ true);
@@ -4660,6 +4720,23 @@
return Status::OK;
}
+// Get max jpeg buffer size in android.jpeg.maxSize
+Status CameraHidlTest::getJpegBufferSize(camera_metadata_t *staticMeta, uint32_t* outBufSize) {
+ if (nullptr == staticMeta || nullptr == outBufSize) {
+ return Status::ILLEGAL_ARGUMENT;
+ }
+
+ camera_metadata_ro_entry entry;
+ int rc = find_camera_metadata_ro_entry(staticMeta,
+ ANDROID_JPEG_MAX_SIZE, &entry);
+ if ((0 != rc) || (1 != entry.count)) {
+ return Status::ILLEGAL_ARGUMENT;
+ }
+
+ *outBufSize = static_cast<uint32_t>(entry.data.i32[0]);
+ return Status::OK;
+}
+
// Check if the camera device has logical multi-camera capability.
Status CameraHidlTest::isLogicalMultiCamera(const camera_metadata_t *staticMeta) {
Status ret = Status::METHOD_NOT_SUPPORTED;
@@ -4946,7 +5023,8 @@
StreamConfigurationMode configMode,
::android::hardware::camera::device::V3_2::StreamConfiguration *config3_2 /*out*/,
::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4 /*out*/,
- ::android::hardware::camera::device::V3_5::StreamConfiguration *config3_5 /*out*/) {
+ ::android::hardware::camera::device::V3_5::StreamConfiguration *config3_5 /*out*/,
+ uint32_t jpegBufferSize) {
ASSERT_NE(nullptr, config3_2);
ASSERT_NE(nullptr, config3_4);
ASSERT_NE(nullptr, config3_5);
@@ -4956,6 +5034,11 @@
for (auto& stream3_2 : streams3_2) {
V3_4::Stream stream;
stream.v3_2 = stream3_2;
+ stream.bufferSize = 0;
+ if (stream3_2.format == PixelFormat::BLOB &&
+ stream3_2.dataSpace == static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF)) {
+ stream.bufferSize = jpegBufferSize;
+ }
streams3_4[idx++] = stream;
}
// Caller is responsible to fill in non-zero config3_5->streamConfigCounter after this returns
@@ -5009,7 +5092,7 @@
ASSERT_EQ(Status::OK, s);
staticMeta = clone_camera_metadata(
reinterpret_cast<const camera_metadata_t*>(metadata.data()));
- ASSERT_NE(nullptr, staticMeta);
+ ASSERT_NE(nullptr, staticMeta);
});
ASSERT_TRUE(ret.isOk());
@@ -5021,9 +5104,7 @@
*supportsPartialResults = (*partialResultCount > 1);
}
- bool checkMonochromeResultTags = Status::OK == isMonochromeCamera(staticMeta) &&
- deviceVersion >= CAMERA_DEVICE_API_VERSION_3_5;
- sp<DeviceCb> cb = new DeviceCb(this, checkMonochromeResultTags);
+ sp<DeviceCb> cb = new DeviceCb(this, deviceVersion, staticMeta);
sp<ICameraDeviceSession> session;
ret = device3_x->open(
cb,
@@ -5161,9 +5242,7 @@
*supportsPartialResults = (*partialResultCount > 1);
}
- bool checkMonochromeResultTags = Status::OK == isMonochromeCamera(staticMeta) &&
- deviceVersion >= CAMERA_DEVICE_API_VERSION_3_5;
- sp<DeviceCb> cb = new DeviceCb(this, checkMonochromeResultTags);
+ sp<DeviceCb> cb = new DeviceCb(this, deviceVersion, staticMeta);
ret = device3_x->open(
cb,
[&](auto status, const auto& newSession) {
@@ -5191,6 +5270,11 @@
outputPreviewStreams.clear();
auto rc = getAvailableOutputStreams(staticMeta,
outputPreviewStreams, previewThreshold);
+
+ uint32_t jpegBufferSize = 0;
+ ASSERT_EQ(Status::OK, getJpegBufferSize(staticMeta, &jpegBufferSize));
+ ASSERT_NE(0u, jpegBufferSize);
+
free_camera_metadata(staticMeta);
ASSERT_EQ(Status::OK, rc);
ASSERT_FALSE(outputPreviewStreams.empty());
@@ -5205,7 +5289,7 @@
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
createStreamConfiguration(streams3_2, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4, &config3_5);
+ &config3_2, &config3_4, &config3_5, jpegBufferSize);
if (session3_5 != nullptr) {
RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
ret = session3_5->constructDefaultRequestSettings(reqTemplate,
@@ -5387,6 +5471,22 @@
});
ASSERT_TRUE(ret.isOk());
}
+
+ // Make sure ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID is available in
+ // result keys.
+ if (deviceVersion >= CAMERA_DEVICE_API_VERSION_3_5) {
+ camera_metadata_ro_entry entry;
+ int retcode = find_camera_metadata_ro_entry(metadata,
+ ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, &entry);
+ if ((0 == retcode) && (entry.count > 0)) {
+ ASSERT_NE(std::find(entry.data.i32, entry.data.i32 + entry.count,
+ static_cast<int32_t>(
+ CameraMetadataTag::ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID)),
+ entry.data.i32 + entry.count);
+ } else {
+ ADD_FAILURE() << "Get camera availableResultKeys failed!";
+ }
+ }
}
void CameraHidlTest::verifyCameraCharacteristics(Status status, const CameraMetadata& chars) {
@@ -5595,6 +5695,24 @@
cb->waitForBuffersReturned();
}
+void CameraHidlTest::verifyLogicalCameraResult(const camera_metadata_t* staticMetadata,
+ const ::android::hardware::camera::common::V1_0::helper::CameraMetadata& resultMetadata) {
+ std::unordered_set<std::string> physicalIds;
+ Status rc = getPhysicalCameraIds(staticMetadata, &physicalIds);
+ ASSERT_TRUE(Status::OK == rc);
+ ASSERT_TRUE(physicalIds.size() > 1);
+
+ camera_metadata_ro_entry entry;
+ // Check mainPhysicalId
+ entry = resultMetadata.find(ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID);
+ if (entry.count > 0) {
+ std::string mainPhysicalId(reinterpret_cast<const char *>(entry.data.u8));
+ ASSERT_NE(physicalIds.find(mainPhysicalId), physicalIds.end());
+ } else {
+ ADD_FAILURE() << "Get LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID failed!";
+ }
+}
+
// Open a device session with empty callbacks and return static metadata.
void CameraHidlTest::openEmptyDeviceSession(const std::string &name, sp<ICameraProvider> provider,
sp<ICameraDeviceSession> *session /*out*/, camera_metadata_t **staticMeta /*out*/,
diff --git a/cas/1.0/default/Android.bp b/cas/1.0/default/Android.bp
index debb3e5..aa080f4 100644
--- a/cas/1.0/default/Android.bp
+++ b/cas/1.0/default/Android.bp
@@ -23,10 +23,10 @@
"libhidlmemory",
"libhidltransport",
"liblog",
+ "libstagefright_foundation",
"libutils",
],
header_libs: [
- "libstagefright_foundation_headers",
"media_plugin_headers",
],
}
diff --git a/cas/1.0/default/DescramblerImpl.cpp b/cas/1.0/default/DescramblerImpl.cpp
index 6d5e2d5..9b09751 100644
--- a/cas/1.0/default/DescramblerImpl.cpp
+++ b/cas/1.0/default/DescramblerImpl.cpp
@@ -20,6 +20,7 @@
#include <hidlmemory/mapping.h>
#include <media/cas/DescramblerAPI.h>
#include <media/hardware/CryptoAPI.h>
+#include <media/stagefright/foundation/AString.h>
#include <media/stagefright/foundation/AUtils.h>
#include <utils/Log.h>
@@ -177,6 +178,7 @@
// Casting hidl SubSample to DescramblerPlugin::SubSample, but need
// to ensure structs are actually idential
+ AString detailedError;
int32_t result = holder->descramble(
dstBuffer.type != BufferType::SHARED_MEMORY,
(DescramblerPlugin::ScramblingControl)scramblingControl,
@@ -186,10 +188,10 @@
srcOffset,
dstPtr,
dstOffset,
- NULL);
+ &detailedError);
holder.reset();
- _hidl_cb(toStatus(result >= 0 ? OK : result), result, NULL);
+ _hidl_cb(toStatus(result >= 0 ? OK : result), result, detailedError.c_str());
return Void();
}
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index d4c422d..94ffe80 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -9,7 +9,7 @@
</hal>
<hal format="hidl" optional="false">
<name>android.hardware.audio</name>
- <version>4.0</version>
+ <version>5.0</version>
<interface>
<name>IDevicesFactory</name>
<instance>default</instance>
@@ -17,7 +17,7 @@
</hal>
<hal format="hidl" optional="false">
<name>android.hardware.audio.effect</name>
- <version>4.0</version>
+ <version>5.0</version>
<interface>
<name>IEffectsFactory</name>
<instance>default</instance>
@@ -88,6 +88,14 @@
</interface>
</hal>
<hal format="hidl" optional="true">
+ <name>android.hardware.bluetooth.audio</name>
+ <version>2.0</version>
+ <interface>
+ <name>IBluetoothAudioProvidersFactory</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+ <hal format="hidl" optional="true">
<name>android.hardware.boot</name>
<version>1.0</version>
<interface>
@@ -195,6 +203,7 @@
<hal format="hidl" optional="false">
<name>android.hardware.graphics.allocator</name>
<version>2.0</version>
+ <version>3.0</version>
<interface>
<name>IAllocator</name>
<instance>default</instance>
@@ -210,7 +219,8 @@
</hal>
<hal format="hidl" optional="false">
<name>android.hardware.graphics.mapper</name>
- <version>2.0</version>
+ <version>2.0-1</version>
+ <version>3.0</version>
<interface>
<name>IMapper</name>
<instance>default</instance>
@@ -240,6 +250,14 @@
<instance>default</instance>
</interface>
</hal>
+ <hal format="hidl" optional="true">
+ <name>android.hardware.input.classifier</name>
+ <version>1.0</version>
+ <interface>
+ <name>IInputClassifier</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
<hal format="hidl" optional="false">
<name>android.hardware.keymaster</name>
<version>3.0</version>
@@ -327,7 +345,8 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.radio</name>
- <version>1.0-2</version>
+ <!-- Todo<b/123249760> Allow only 1.4 for Q-->
+ <version>1.3-4</version>
<interface>
<name>IRadio</name>
<instance>slot1</instance>
@@ -341,7 +360,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.radio.config</name>
- <version>1.0</version>
+ <version>1.2</version>
<interface>
<name>IRadioConfig</name>
<instance>default</instance>
@@ -367,6 +386,7 @@
<hal format="hidl" optional="true">
<name>android.hardware.sensors</name>
<version>1.0</version>
+ <version>2.0</version>
<interface>
<name>ISensors</name>
<instance>default</instance>
@@ -374,7 +394,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.soundtrigger</name>
- <version>2.0-1</version>
+ <version>2.0-2</version>
<interface>
<name>ISoundTriggerHw</name>
<instance>default</instance>
@@ -423,7 +443,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.usb</name>
- <version>1.0-1</version>
+ <version>1.0-2</version>
<interface>
<name>IUsb</name>
<instance>default</instance>
@@ -439,7 +459,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.vibrator</name>
- <version>1.0-2</version>
+ <version>1.0-3</version>
<interface>
<name>IVibrator</name>
<instance>default</instance>
@@ -487,7 +507,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.wifi.supplicant</name>
- <version>1.0-1</version>
+ <version>1.0-2</version>
<interface>
<name>ISupplicant</name>
<instance>default</instance>
diff --git a/configstore/1.2/Android.bp b/configstore/1.2/Android.bp
index bb4dd4a..a3976b6 100644
--- a/configstore/1.2/Android.bp
+++ b/configstore/1.2/Android.bp
@@ -7,6 +7,7 @@
enabled: true,
},
srcs: [
+ "types.hal",
"ISurfaceFlingerConfigs.hal",
],
interfaces: [
@@ -17,6 +18,10 @@
"android.hardware.graphics.common@1.2",
"android.hidl.base@1.0",
],
+ types: [
+ "CieXyz",
+ "DisplayPrimaries",
+ ],
gen_java: true,
}
diff --git a/configstore/1.2/ISurfaceFlingerConfigs.hal b/configstore/1.2/ISurfaceFlingerConfigs.hal
index e91b2c7..431b3fc 100644
--- a/configstore/1.2/ISurfaceFlingerConfigs.hal
+++ b/configstore/1.2/ISurfaceFlingerConfigs.hal
@@ -15,7 +15,7 @@
*/
package android.hardware.configstore@1.2;
-import android.hardware.graphics.common@1.1::PixelFormat;
+import android.hardware.graphics.common@1.2::PixelFormat;
import android.hardware.graphics.common@1.2::Dataspace;
import @1.1::ISurfaceFlingerConfigs;
import @1.0::OptionalBool;
@@ -69,4 +69,11 @@
getCompositionPreference()
generates (Dataspace dataspace, PixelFormat pixelFormat,
Dataspace wcgDataspace, PixelFormat wcgPixelFormat);
+
+ /**
+ * Returns the native panel primary data. The data includes red, green,
+ * blue and white. The primary format is CIE 1931 XYZ color space. If
+ * unspecified, the primaries is sRGB gamut by default.
+ */
+ getDisplayNativePrimaries() generates (DisplayPrimaries primaries);
};
diff --git a/configstore/1.2/default/SurfaceFlingerConfigs.cpp b/configstore/1.2/default/SurfaceFlingerConfigs.cpp
index c2cf374..714442b 100644
--- a/configstore/1.2/default/SurfaceFlingerConfigs.cpp
+++ b/configstore/1.2/default/SurfaceFlingerConfigs.cpp
@@ -17,6 +17,7 @@
#include "SurfaceFlingerConfigs.h"
#include <android/hardware/configstore/1.1/types.h>
+#include <android/hardware/configstore/1.2/types.h>
#include <android/hardware/graphics/common/1.1/types.h>
#include <log/log.h>
@@ -26,8 +27,8 @@
namespace V1_2 {
namespace implementation {
-using ::android::hardware::graphics::common::V1_1::PixelFormat;
using ::android::hardware::graphics::common::V1_2::Dataspace;
+using ::android::hardware::graphics::common::V1_2::PixelFormat;
// ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs implementation.
Return<void> SurfaceFlingerConfigs::vsyncEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) {
@@ -241,6 +242,85 @@
return Void();
}
+Return<void> SurfaceFlingerConfigs::getDisplayNativePrimaries(getDisplayNativePrimaries_cb _hidl_cb) {
+ DisplayPrimaries primaries;
+ // The default XYZ is sRGB gamut in CIE1931 color space
+#ifdef TARGET_DISPLAY_PRIMARY_RED_X
+ primaries.red.X = TARGET_DISPLAY_PRIMARY_RED_X;
+#else
+ primaries.red.X = 0.4123;
+#endif
+
+#ifdef TARGET_DISPLAY_PRIMARY_RED_Y
+ primaries.red.Y = TARGET_DISPLAY_PRIMARY_RED_Y;
+#else
+ primaries.red.Y = 0.2126;
+#endif
+
+#ifdef TARGET_DISPLAY_PRIMARY_RED_Z
+ primaries.red.Z = TARGET_DISPLAY_PRIMARY_RED_Z;
+#else
+ primaries.red.Z = 0.0193;
+#endif
+
+#ifdef TARGET_DISPLAY_PRIMARY_GREEN_X
+ primaries.green.X = TARGET_DISPLAY_PRIMARY_GREEN_X;
+#else
+ primaries.green.X = 0.3576;
+#endif
+
+#ifdef TARGET_DISPLAY_PRIMARY_GREEN_Y
+ primaries.green.Y = TARGET_DISPLAY_PRIMARY_GREEN_Y;
+#else
+ primaries.green.Y = 0.7152;
+#endif
+
+#ifdef TARGET_DISPLAY_PRIMARY_GREEN_Z
+ primaries.green.Z = TARGET_DISPLAY_PRIMARY_GREEN_Z;
+#else
+ primaries.green.Z = 0.1192;
+#endif
+
+#ifdef TARGET_DISPLAY_PRIMARY_BLUE_X
+ primaries.blue.X = TARGET_DISPLAY_PRIMARY_BLUE_X;
+#else
+ primaries.blue.X = 0.1805;
+#endif
+
+#ifdef TARGET_DISPLAY_PRIMARY_BLUE_Y
+ primaries.blue.Y = TARGET_DISPLAY_PRIMARY_BLUE_Y;
+#else
+ primaries.blue.Y = 0.0722;
+#endif
+
+#ifdef TARGET_DISPLAY_PRIMARY_BLUE_Z
+ primaries.blue.Z = TARGET_DISPLAY_PRIMARY_BLUE_Z;
+#else
+ primaries.blue.Z = 0.9506;
+#endif
+
+#ifdef TARGET_DISPLAY_PRIMARY_WHITE_X
+ primaries.white.X = TARGET_DISPLAY_PRIMARY_WHITE_X;
+#else
+ primaries.white.X = 0.9505;
+#endif
+
+#ifdef TARGET_DISPLAY_PRIMARY_WHITE_Y
+ primaries.white.Y = TARGET_DISPLAY_PRIMARY_WHITE_Y;
+#else
+ primaries.white.Y = 1.0000;
+#endif
+
+#ifdef TARGET_DISPLAY_PRIMARY_WHITE_Z
+ primaries.white.Z = TARGET_DISPLAY_PRIMARY_WHITE_Z;
+#else
+ primaries.white.Z = 1.0891;
+#endif
+
+ _hidl_cb(primaries);
+ return Void();
+}
+
} // namespace implementation
} // namespace V1_2
} // namespace configstore
diff --git a/configstore/1.2/default/SurfaceFlingerConfigs.h b/configstore/1.2/default/SurfaceFlingerConfigs.h
index 7dd8f6d..54a6e62 100644
--- a/configstore/1.2/default/SurfaceFlingerConfigs.h
+++ b/configstore/1.2/default/SurfaceFlingerConfigs.h
@@ -53,6 +53,7 @@
// ::android::hardware::configstore::V1_2::ISurfaceFlingerConfigs follow implementation.
Return<void> useColorManagement(useColorManagement_cb _hidl_cb) override;
Return<void> getCompositionPreference(getCompositionPreference_cb _hidl_cb) override;
+ Return<void> getDisplayNativePrimaries(getDisplayNativePrimaries_cb _hidl_cb) override;
};
} // namespace implementation
diff --git a/configstore/1.2/default/surfaceflinger.mk b/configstore/1.2/default/surfaceflinger.mk
index dab6aa5..9a67256 100644
--- a/configstore/1.2/default/surfaceflinger.mk
+++ b/configstore/1.2/default/surfaceflinger.mk
@@ -74,3 +74,51 @@
ifneq ($(SF_WCG_COMPOSITION_PIXEL_FORMAT),)
LOCAL_CFLAGS += -DWCG_COMPOSITION_PIXEL_FORMAT=$(SF_WCG_COMPOSITION_PIXEL_FORMAT)
endif
+
+ifneq ($(TARGET_DISPLAY_PRIMARY_RED_X),)
+ LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_RED_X=$(TARGET_DISPLAY_PRIMARY_RED_X)
+endif
+
+ifneq ($(TARGET_DISPLAY_PRIMARY_RED_Y),)
+ LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_RED_Y=$(TARGET_DISPLAY_PRIMARY_RED_Y)
+endif
+
+ifneq ($(TARGET_DISPLAY_PRIMARY_RED_Z),)
+ LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_RED_Z=$(TARGET_DISPLAY_PRIMARY_RED_Z)
+endif
+
+ifneq ($(TARGET_DISPLAY_PRIMARY_GREEN_X),)
+ LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_GREEN_X=$(TARGET_DISPLAY_PRIMARY_GREEN_X)
+endif
+
+ifneq ($(TARGET_DISPLAY_PRIMARY_GREEN_Y),)
+ LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_GREEN_Y=$(TARGET_DISPLAY_PRIMARY_GREEN_Y)
+endif
+
+ifneq ($(TARGET_DISPLAY_PRIMARY_GREEN_Z),)
+ LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_GREEN_Z=$(TARGET_DISPLAY_PRIMARY_GREEN_Z)
+endif
+
+ifneq ($(TARGET_DISPLAY_PRIMARY_BLUE_X),)
+ LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_BLUE_X=$(TARGET_DISPLAY_PRIMARY_BLUE_X)
+endif
+
+ifneq ($(TARGET_DISPLAY_PRIMARY_BLUE_Y),)
+ LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_BLUE_Y=$(TARGET_DISPLAY_PRIMARY_BLUE_Y)
+endif
+
+ifneq ($(TARGET_DISPLAY_PRIMARY_BLUE_Z),)
+ LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_BLUE_Z=$(TARGET_DISPLAY_PRIMARY_BLUE_Z)
+endif
+
+ifneq ($(TARGET_DISPLAY_PRIMARY_WHITE_X),)
+ LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_WHITE_X=$(TARGET_DISPLAY_PRIMARY_WHITE_X)
+endif
+
+ifneq ($(TARGET_DISPLAY_PRIMARY_WHITE_Y),)
+ LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_WHITE_Y=$(TARGET_DISPLAY_PRIMARY_WHITE_Y)
+endif
+
+ifneq ($(TARGET_DISPLAY_PRIMARY_WHITE_Z),)
+ LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_WHITE_Z=$(TARGET_DISPLAY_PRIMARY_WHITE_Z)
+endif
diff --git a/configstore/1.2/types.hal b/configstore/1.2/types.hal
new file mode 100644
index 0000000..5b2c9a6
--- /dev/null
+++ b/configstore/1.2/types.hal
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.hardware.configstore@1.2;
+
+struct CieXyz {
+ float X;
+ float Y;
+ float Z;
+};
+struct DisplayPrimaries {
+ CieXyz red;
+ CieXyz green;
+ CieXyz blue;
+ CieXyz white;
+};
diff --git a/configstore/1.2/vts/functional/VtsHalConfigstoreV1_2TargetTest.cpp b/configstore/1.2/vts/functional/VtsHalConfigstoreV1_2TargetTest.cpp
index dc5fec5..d7f4dcf 100644
--- a/configstore/1.2/vts/functional/VtsHalConfigstoreV1_2TargetTest.cpp
+++ b/configstore/1.2/vts/functional/VtsHalConfigstoreV1_2TargetTest.cpp
@@ -21,6 +21,7 @@
#include <android-base/logging.h>
#include <android/hardware/configstore/1.0/types.h>
#include <android/hardware/configstore/1.2/ISurfaceFlingerConfigs.h>
+#include <android/hardware/configstore/1.2/types.h>
#include <unistd.h>
using ::android::sp;
@@ -30,9 +31,10 @@
using ::android::hardware::configstore::V1_0::OptionalBool;
using ::android::hardware::configstore::V1_0::OptionalInt64;
using ::android::hardware::configstore::V1_0::OptionalUInt64;
+using ::android::hardware::configstore::V1_2::DisplayPrimaries;
using ::android::hardware::configstore::V1_2::ISurfaceFlingerConfigs;
-using ::android::hardware::graphics::common::V1_1::PixelFormat;
using ::android::hardware::graphics::common::V1_2::Dataspace;
+using ::android::hardware::graphics::common::V1_2::PixelFormat;
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())
@@ -125,6 +127,43 @@
}
}
+TEST_F(ConfigstoreHidlTest, TestGetDisplayNativePrimaries) {
+ DisplayPrimaries primaries;
+
+ Return<void> status = sfConfigs->getDisplayNativePrimaries(
+ [&](DisplayPrimaries tmpPrimaries) {
+ primaries.red = tmpPrimaries.red;
+ primaries.green = tmpPrimaries.green;
+ primaries.blue = tmpPrimaries.blue;
+ primaries.white = tmpPrimaries.white;
+ });
+ EXPECT_OK(status);
+
+ // Display primaries should be greater than or equal to zero.
+ // Or it returns defualt value if there is no definition.
+ // RED
+ EXPECT_GE(primaries.red.X, 0.0);
+ EXPECT_GE(primaries.red.Y, 0.0);
+ EXPECT_GE(primaries.red.Z, 0.0);
+
+ // GREEN
+ EXPECT_GE(primaries.green.X, 0.0);
+ EXPECT_GE(primaries.green.Y, 0.0);
+ EXPECT_GE(primaries.green.Z, 0.0);
+
+
+ // BLUE
+ EXPECT_GE(primaries.blue.X, 0.0);
+ EXPECT_GE(primaries.blue.Y, 0.0);
+ EXPECT_GE(primaries.blue.Z, 0.0);
+
+
+ // WHITE
+ EXPECT_GE(primaries.white.X, 0.0);
+ EXPECT_GE(primaries.white.Y, 0.0);
+ EXPECT_GE(primaries.white.Z, 0.0);
+}
+
int main(int argc, char** argv) {
::testing::AddGlobalTestEnvironment(ConfigstoreHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
diff --git a/current.txt b/current.txt
index 3f124ae..3b87306 100644
--- a/current.txt
+++ b/current.txt
@@ -388,6 +388,7 @@
2a55e224aa9bc62c0387cd85ad3c97e33f0c33a4e1489cbae86b2523e6f9df35 android.hardware.camera.device@3.2::ICameraDevice
8caf9104dc6885852c0b117d853dd93f6d4b61a0a365138295eb8bcd41b36423 android.hardware.camera.device@3.2::ICameraDeviceSession
684702a60deef03a1e8093961dc0a18c555c857ad5a77ba7340b0635ae01eb70 android.hardware.camera.device@3.4::ICameraDeviceSession
+f8a19622cb0cc890913b1ef3e32b675ffb26089a09e02fef4056ebad324d2b5d android.hardware.camera.device@3.4::types
291638a1b6d4e63283e9e722ab5049d9351717ffa2b66162124f84d1aa7c2835 android.hardware.camera.metadata@3.2::types
8a075cf3a17fe99c6d23415a3e9a65612f1fee73ee052a3a8a0ca5b8877395a4 android.hardware.camera.metadata@3.3::types
da33234403ff5d60f3473711917b9948e6484a4260b5247acdafb111193a9de2 android.hardware.configstore@1.0::ISurfaceFlingerConfigs
@@ -395,11 +396,12 @@
d702fb01dc2a0733aa820b7eb65435ee3334f75632ef880bafd2fb8803a20a58 android.hardware.gnss@1.0::IGnssMeasurementCallback
b7ecf29927055ec422ec44bf776223f07d79ad9f92ccf9becf167e62c2607e7a android.hardware.keymaster@4.0::IKeymasterDevice
574e8f1499436fb4075894dcae0b36682427956ecb114f17f1fe22d116a83c6b android.hardware.neuralnetworks@1.0::IPreparedModel
-1fb32361286b938d48a55c2539c846732afce0b99fe08590f556643125bc13d3 android.hardware.neuralnetworks@1.0::types
+417ab60fe1ef786778047e4486f3d868ebce570d91addd8fe4251515213072de android.hardware.neuralnetworks@1.0::types
e22e8135d061d0e9c4c1a70c25c19fdba10f4d3cda9795ef25b6392fc520317c android.hardware.neuralnetworks@1.1::types
1d4a5776614c08b5d794a5ec5ab04697260cbd4b3441d5935cd53ee71d19da02 android.hardware.radio@1.0::IRadioResponse
271187e261b30c01a33011aea257c07a2d2f05b72943ebee89e973e997849973 android.hardware.radio@1.0::types
1d19720d4fd38b1095f0f555a4bd92b3b12c9b1d0f560b0e9a474cd6dcc20db6 android.hardware.radio@1.2::IRadio
e78cf871f9fd1c072874e481e06e18e2681763cf2aa38c1fd777d53bab4eb69b android.hardware.sensors@1.0::types
+3d01e29e8129186f7567c4f9c8bee7480a0768e587b1be9b28adb0a6cbec6bf2 android.hardware.tv.cec@1.0::types
1722ad002317b1fae1400de709e90f442d94ef22864e05f7a12af48c32e8edc8 android.hardware.usb@1.1::types
29c8da7a13c40d488f569c812441d5754ee45bdcdb8ce6564f524b708d10a057 android.hardware.vibrator@1.1::types
diff --git a/drm/1.0/default/Android.mk b/drm/1.0/default/Android.mk
index 99773be..d66f377 100644
--- a/drm/1.0/default/Android.mk
+++ b/drm/1.0/default/Android.mk
@@ -19,39 +19,23 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
+
+include $(LOCAL_PATH)/common_default_service.mk
LOCAL_MODULE := android.hardware.drm@1.0-service
LOCAL_INIT_RC := android.hardware.drm@1.0-service.rc
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := \
- service.cpp \
+LOCAL_SRC_FILES := service.cpp
-LOCAL_SHARED_LIBRARIES := \
- android.hardware.drm@1.0 \
- android.hidl.memory@1.0 \
- libhidlbase \
- libhidltransport \
- libhardware \
- liblog \
- libutils \
- libbinder \
+include $(BUILD_EXECUTABLE)
-LOCAL_STATIC_LIBRARIES := \
- android.hardware.drm@1.0-helper \
+############# Build legacy drm lazy service ############
-LOCAL_C_INCLUDES := \
- hardware/interfaces/drm
+include $(CLEAR_VARS)
-LOCAL_HEADER_LIBRARIES := \
- media_plugin_headers
-
-# TODO(b/18948909) Some legacy DRM plugins only support 32-bit. They need to be
-# migrated to 64-bit. Once all of a device's legacy DRM plugins support 64-bit,
-# that device can turn on TARGET_ENABLE_MEDIADRM_64 to build this service as
-# 64-bit.
-ifneq ($(TARGET_ENABLE_MEDIADRM_64), true)
-LOCAL_32_BIT_ONLY := true
-endif
+include $(LOCAL_PATH)/common_default_service.mk
+LOCAL_MODULE := android.hardware.drm@1.0-service-lazy
+LOCAL_OVERRIDES_MODULES := android.hardware.drm@1.0-service
+LOCAL_INIT_RC := android.hardware.drm@1.0-service-lazy.rc
+LOCAL_SRC_FILES := serviceLazy.cpp
include $(BUILD_EXECUTABLE)
diff --git a/drm/1.0/default/android.hardware.drm@1.0-service-lazy.rc b/drm/1.0/default/android.hardware.drm@1.0-service-lazy.rc
new file mode 100644
index 0000000..4b32f7f
--- /dev/null
+++ b/drm/1.0/default/android.hardware.drm@1.0-service-lazy.rc
@@ -0,0 +1,10 @@
+service vendor.drm-hal-1-0 /vendor/bin/hw/android.hardware.drm@1.0-service-lazy
+ interface android.hardware.drm@1.0::ICryptoFactory default
+ interface android.hardware.drm@1.0::IDrmFactory default
+ oneshot
+ disabled
+ class hal
+ user media
+ group mediadrm drmrpc
+ ioprio rt 4
+ writepid /dev/cpuset/foreground/tasks
diff --git a/drm/1.0/default/android.hardware.drm@1.0-service.rc b/drm/1.0/default/android.hardware.drm@1.0-service.rc
index a3457b5..790eded 100644
--- a/drm/1.0/default/android.hardware.drm@1.0-service.rc
+++ b/drm/1.0/default/android.hardware.drm@1.0-service.rc
@@ -1,4 +1,6 @@
service vendor.drm-hal-1-0 /vendor/bin/hw/android.hardware.drm@1.0-service
+ interface android.hardware.drm@1.0::ICryptoFactory default
+ interface android.hardware.drm@1.0::IDrmFactory default
class hal
user media
group mediadrm drmrpc
diff --git a/drm/1.0/default/common_default_service.mk b/drm/1.0/default/common_default_service.mk
new file mode 100644
index 0000000..28db567
--- /dev/null
+++ b/drm/1.0/default/common_default_service.mk
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+include $(CLEAR_VARS)
+LOCAL_PROPRIETARY_MODULE := true
+LOCAL_MODULE_RELATIVE_PATH := hw
+
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.drm@1.0 \
+ android.hidl.memory@1.0 \
+ libhidlbase \
+ libhidltransport \
+ libhardware \
+ liblog \
+ libutils \
+ libbinder \
+
+LOCAL_STATIC_LIBRARIES := \
+ android.hardware.drm@1.0-helper \
+
+LOCAL_C_INCLUDES := \
+ hardware/interfaces/drm
+
+LOCAL_HEADER_LIBRARIES := \
+ media_plugin_headers
+
+# TODO(b/18948909) Some legacy DRM plugins only support 32-bit. They need to be
+# migrated to 64-bit. Once all of a device's legacy DRM plugins support 64-bit,
+# that device can turn on TARGET_ENABLE_MEDIADRM_64 to build this service as
+# 64-bit.
+ifneq ($(TARGET_ENABLE_MEDIADRM_64), true)
+LOCAL_32_BIT_ONLY := true
+endif
diff --git a/drm/1.0/default/service.cpp b/drm/1.0/default/service.cpp
index 1a44ce2..98d2c3b 100644
--- a/drm/1.0/default/service.cpp
+++ b/drm/1.0/default/service.cpp
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#define LOG_TAG "android.hardware.drm@1.0-service"
#include <1.0/default/CryptoFactory.h>
#include <1.0/default/DrmFactory.h>
@@ -31,15 +30,8 @@
using android::hardware::drm::V1_0::IDrmFactory;
int main() {
- ALOGD("android.hardware.drm@1.0-service starting...");
-
- // The DRM HAL may communicate to other vendor components via
- // /dev/vndbinder
- android::ProcessState::initWithDriver("/dev/vndbinder");
-
configureRpcThreadpool(8, true /* callerWillJoin */);
- android::status_t status =
- registerPassthroughServiceImplementation<IDrmFactory>();
+ android::status_t status = registerPassthroughServiceImplementation<IDrmFactory>();
LOG_ALWAYS_FATAL_IF(
status != android::OK,
"Error while registering drm service: %d", status);
diff --git a/drm/1.0/default/serviceLazy.cpp b/drm/1.0/default/serviceLazy.cpp
new file mode 100644
index 0000000..e5068b5
--- /dev/null
+++ b/drm/1.0/default/serviceLazy.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <1.0/default/CryptoFactory.h>
+#include <1.0/default/DrmFactory.h>
+
+#include <hidl/HidlTransportSupport.h>
+#include <hidl/LegacySupport.h>
+
+#include <binder/ProcessState.h>
+
+using android::hardware::configureRpcThreadpool;
+using android::hardware::joinRpcThreadpool;
+using android::hardware::registerLazyPassthroughServiceImplementation;
+
+using android::hardware::drm::V1_0::ICryptoFactory;
+using android::hardware::drm::V1_0::IDrmFactory;
+
+int main() {
+ configureRpcThreadpool(8, true /* callerWillJoin */);
+ android::status_t status = registerLazyPassthroughServiceImplementation<IDrmFactory>();
+ LOG_ALWAYS_FATAL_IF(status != android::OK, "Error while registering drm service: %d", status);
+ status = registerLazyPassthroughServiceImplementation<ICryptoFactory>();
+ LOG_ALWAYS_FATAL_IF(status != android::OK, "Error while registering crypto service: %d",
+ status);
+ joinRpcThreadpool();
+}
diff --git a/drm/1.2/Android.bp b/drm/1.2/Android.bp
index 66a1bd8..fa2962a 100644
--- a/drm/1.2/Android.bp
+++ b/drm/1.2/Android.bp
@@ -9,8 +9,10 @@
srcs: [
"types.hal",
"ICryptoFactory.hal",
+ "ICryptoPlugin.hal",
"IDrmFactory.hal",
"IDrmPlugin.hal",
+ "IDrmPluginListener.hal",
],
interfaces: [
"android.hardware.drm@1.0",
@@ -18,8 +20,8 @@
"android.hidl.base@1.0",
],
types: [
- "KeySetId",
"OfflineLicenseState",
+ "Status",
],
gen_java: false,
}
diff --git a/drm/1.2/ICryptoPlugin.hal b/drm/1.2/ICryptoPlugin.hal
new file mode 100644
index 0000000..0700676
--- /dev/null
+++ b/drm/1.2/ICryptoPlugin.hal
@@ -0,0 +1,84 @@
+/**
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.hardware.drm@1.2;
+
+import @1.0::DestinationBuffer;
+import @1.0::ICryptoPlugin;
+import @1.0::Mode;
+import @1.0::Pattern;
+import @1.0::SessionId;
+import @1.0::SharedBuffer;
+import @1.0::SubSample;
+
+/**
+ * ICryptoPlugin is the HAL for vendor-provided crypto plugins.
+ * It allows crypto sessions to be opened and operated on, to
+ * load crypto keys for a codec to decrypt protected video content.
+ */
+interface ICryptoPlugin extends @1.0::ICryptoPlugin {
+
+ /**
+ * Decrypt an array of subsamples from the source memory buffer to the
+ * destination memory buffer.
+ *
+ * decrypt_1_2() only differs from decrypt() in that additional status
+ * codes must be returned.
+ *
+ * @param secure a flag to indicate if a secure decoder is being used. This
+ * enables the plugin to configure buffer modes to work consistently with
+ * a secure decoder.
+ * @param the keyId for the key that is used to do the the decryption. The
+ * keyId refers to a key in the associated MediaDrm instance.
+ * @param iv the initialization vector to use
+ * @param mode the crypto mode to use
+ * @param pattern the crypto pattern to use
+ * @param subSamples a vector of subsamples indicating the number
+ * of clear and encrypted bytes to process. This allows the decrypt
+ * call to operate on a range of subsamples in a single call
+ * @param source the input buffer for the decryption
+ * @param offset the offset of the first byte of encrypted data from
+ * the base of the source buffer
+ * @param destination the output buffer for the decryption
+ * @return status the status of the call. The status must be OK or one
+ * of the following errors:
+ * ERROR_DRM_NO_LICENSE if no license keys have been loaded
+ * ERROR_DRM_LICENSE_EXPIRED if the license keys have expired
+ * ERROR_DRM_RESOURCE_BUSY if the resources required to perform
+ * the decryption are not available
+ * ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION if required output
+ * protections are not active
+ * ERROR_DRM_INSUFFICIENT_SECURITY if the security level of the
+ * device is not sufficient to meet the requirements in
+ * the license policy
+ * ERROR_DRM_FRAME_TOO_LARGE if the frame being decrypted into
+ * the secure output buffer exceeds the size of the buffer
+ * ERROR_DRM_SESSION_NOT_OPENED if the decrypt session is not
+ * opened
+ * ERROR_DRM_DECRYPT if the decrypt operation fails
+ * ERROR_DRM_INVALID_STATE if the device is in a state where it
+ * is not able to perform decryption
+ * ERROR_DRM_CANNOT_HANDLE in other failure cases.
+ *
+ * @return bytesWritten the number of bytes output from the decryption
+ * @return detailedError if the error is a vendor-specific error, the
+ * vendor's crypto HAL may provide a detailed error string to help
+ * describe the error.
+ */
+ decrypt_1_2(bool secure, uint8_t[16] keyId, uint8_t[16] iv, Mode mode,
+ Pattern pattern, vec<SubSample> subSamples,
+ SharedBuffer source, uint64_t offset, DestinationBuffer destination)
+ generates(Status status, uint32_t bytesWritten, string detailedError);
+};
diff --git a/drm/1.2/IDrmFactory.hal b/drm/1.2/IDrmFactory.hal
index c94e4bb..682889c 100644
--- a/drm/1.2/IDrmFactory.hal
+++ b/drm/1.2/IDrmFactory.hal
@@ -17,6 +17,7 @@
import @1.1::IDrmFactory;
import @1.1::IDrmPlugin;
+import @1.1::SecurityLevel;
/**
* IDrmFactory is the main entry point for interacting with a vendor's
@@ -35,4 +36,16 @@
*/
interface IDrmFactory extends @1.1::IDrmFactory {
+ /**
+ * Determine if a specific security level is supported by the device.
+ * This method only differs from @1.0 isCryptoSchemeSupported
+ * by the addition of a security level.
+ *
+ * @param uuid identifies the crypto scheme in question
+ * @param mimeType identifies the mime type in question
+ * @param securityLevel specifies the security level required
+ * @return isSupported must be true only if the scheme is supported
+ */
+ isCryptoSchemeSupported_1_2(uint8_t[16] uuid, string mimeType,
+ @1.1::SecurityLevel securityLevel) generates(bool isSupported);
};
diff --git a/drm/1.2/IDrmPlugin.hal b/drm/1.2/IDrmPlugin.hal
index 88338d6..3c21815 100644
--- a/drm/1.2/IDrmPlugin.hal
+++ b/drm/1.2/IDrmPlugin.hal
@@ -15,13 +15,19 @@
*/
package android.hardware.drm@1.2;
-import @1.1::IDrmPlugin;
+import @1.0::KeyedVector;
+import @1.0::KeyType;
+import @1.0::SessionId;
import @1.0::Status;
+import @1.1::IDrmPlugin;
+import @1.1::KeyRequestType;
+import @1.2::IDrmPluginListener;
/**
- * IDrmPlugin is used to interact with a specific drm plugin that was created by
- * IDrm::createPlugin. A drm plugin provides methods for obtaining drm keys that
- * may be used by a codec to decrypt protected video content.
+ * IDrmPlugin is used to interact with a specific drm plugin that was
+ * created by IDrm::createPlugin. A drm plugin provides methods for
+ * obtaining drm keys to be used by a codec to decrypt protected video
+ * content.
*/
interface IDrmPlugin extends @1.1::IDrmPlugin {
@@ -32,24 +38,25 @@
* request/response exchange when the key request KeyType is
* OFFLINE. Normally each app is responsible for keeping track of
* the KeySetIds it has created. In some situations however, it
- * may be necessary to request the list of stored offline license
+ * will be necessary to request the list of stored offline license
* KeySetIds. If an app loses the KeySetId for any stored licenses
* that it created, for example, it must be able to recover the
- * stored KeySetIds so those licenses can be removed when they
+ * stored KeySetIds so those licenses will be removed when they
* expire or when the app is uninstalled.
* <p>
* This method returns a list of the KeySetIds for all offline
- * licenses. The offline license KeySetId may be used to query
+ * licenses. The offline license KeySetId allows an app to query
* the status of an offline license or remove it.
*
- * @return status the status of the call. May be OK or
+ * @return status the status of the call. Must be OK or
* ERROR_DRM_INVALID_STATE if the HAL is in a state where the
* KeySetIds can't be returned.
* @return a list of offline license keySetIds. If there are no offline
* licenses, the list must be empty and OK must be returned as the
* status.
*/
- getOfflineLicenseKeySetIds() generates (Status status, vec<KeySetId> keySetIds);
+ getOfflineLicenseKeySetIds() generates (@1.0::Status status,
+ vec<KeySetId> keySetIds);
/**
* Normally offline licenses are released using a key
@@ -59,20 +66,20 @@
* removed and then adjust the count of offline licenses allocated
* to the device.
* <p>
- * In some exceptional situations it may be necessary to directly
- * remove offline licenses without notifying the server, which may
- * be performed using this method.
+ * In some exceptional situations it will be necessary to directly
+ * remove offline licenses without notifying the server, which is
+ * performed by this method.
*
* @param keySetId the id of the offline license to remove
- * @return status the status of the call. May be one of OK on
+ * @return status the status of the call. Must be one of OK on
* success, BAD_VALUE if the license is not found or
* ERROR_DRM_INVALID_STATE if the HAL is in a state where the
* KeySetIds can't be returned.
*/
- removeOfflineLicense(KeySetId keySetId) generates (Status status);
+ removeOfflineLicense(KeySetId keySetId) generates (@1.0::Status status);
/**
- * Request the state of an offline license. An offline license may
+ * Request the state of an offline license. An offline license must
* be usable or inactive. The keys in a usable offline license are
* available for decryption. When the offline license state is
* inactive, the keys have been marked for release using
@@ -81,7 +88,7 @@
* usable for decryption.
*
* @param keySetId the id of the offline license
- * @return status the status of the call. May be one of OK on
+ * @return status the status of the call. Must be one of OK on
* success, BAD_VALUE if the license is not found or
* ERROR_DRM_INVALID_STATE if the HAL is in a state where the
* offline license state can't be queried.
@@ -89,6 +96,134 @@
* If the return status is not OK then state must be set to
* UNKNOWN.
*/
- getOfflineLicenseState(KeySetId keySetId) generates (Status status,
- OfflineLicenseState state);
+ getOfflineLicenseState(KeySetId keySetId) generates (
+ @1.0::Status status, OfflineLicenseState state);
+
+ /**
+ * A key request/response exchange occurs between the app and a License
+ * Server to obtain the keys required to decrypt the content.
+ * getKeyRequest_1_2() is used to obtain an opaque key request blob that is
+ * delivered to the license server.
+ *
+ * getKeyRequest_1_2() only differs from getKeyRequest_1_1() in that
+ * additional status codes must be returned.
+ *
+ * @param scope either a sessionId or a keySetId, depending on the
+ * specified keyType. When the keyType is OFFLINE or STREAMING, scope
+ * must be set to the sessionId the keys will be provided to. When the
+ * keyType is RELEASE, scope must be set to the keySetId of the keys
+ * being released.
+ * @param initData container-specific data, its meaning is interpreted
+ * based on the mime type provided in the mimeType parameter. It could
+ * contain, for example, the content ID, key ID or other data obtained
+ * from the content metadata that is required to generate the key
+ * request. initData must be empty when keyType is RELEASE.
+ * @param mimeType identifies the mime type of the content
+ * @param keyType specifies if the keys are to be used for streaming,
+ * offline or a release
+ * @param optionalParameters included in the key request message to
+ * allow a client application to provide additional message parameters
+ * to the server.
+ * @return status the status of the call. The status must be OK or one of
+ * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is
+ * not opened, ERROR_DRM_NOT_PROVISIONED if the device requires
+ * provisioning before it is able to generate a key request,
+ * ERROR_DRM_RESOURCE_CONTENTION if client applications using the hal
+ * are temporarily exceeding the available crypto resources such that a
+ * retry of the operation is likely to succeed, ERROR_DRM_CANNOT_HANDLE
+ * if getKeyRequest is not supported at the time of the call, BAD_VALUE
+ * if any parameters are invalid or ERROR_DRM_INVALID_STATE if the HAL
+ * is in a state where a key request cannot be generated.
+ * @return request if successful, the opaque key request blob is returned
+ * @return requestType indicates type information about the returned
+ * request. The type must be one of INITIAL, RENEWAL, RELEASE, NONE or
+ * UPDATE. An INITIAL request is the first key request for a
+ * license. RENEWAL is a subsequent key request used to refresh the
+ * keys in a license. RELEASE corresponds to a keyType of RELEASE,
+ * which indicates keys are being released. NONE indicates that no
+ * request is needed because the keys are already loaded. UPDATE
+ * indicates that the keys need to be refetched after the initial
+ * license request.
+ * @return defaultUrl the URL that the request may be sent to, if
+ * provided by the drm HAL. The app can choose to override this URL.
+ */
+ getKeyRequest_1_2(vec<uint8_t> scope, vec<uint8_t> initData,
+ string mimeType, KeyType keyType, KeyedVector optionalParameters)
+ generates (Status status, vec<uint8_t> request,
+ KeyRequestType requestType, string defaultUrl);
+
+ /**
+ * A provision request/response exchange occurs between the app and a
+ * provisioning server to retrieve a device certificate. getProvisionRequest
+ * is used to obtain an opaque provisioning request blob that is delivered
+ * to the provisioning server.
+ *
+ * getProvisionRequest_1_2() only differs from getProvisionRequest_1_0() in
+ * that additional status codes must be returned.
+ *
+ * @param certificateType the type of certificate requested, e.g. "X.509"
+ * @param certificateAuthority identifies the certificate authority. A
+ * certificate authority (CA) is an entity which issues digital
+ * certificates for use by other parties. It is an example of a trusted
+ * third party.
+ * @return status the status of the call. The status must be OK or one of
+ * the following errors: ERROR_DRM_RESOURCE_CONTENTION if client
+ * applications using the hal are temporarily exceeding the available
+ * crypto resources such that a retry of the operation is likely to
+ * succeed, ERROR_DRM_CANNOT_HANDLE if the drm scheme does not require
+ * provisioning or ERROR_DRM_INVALID_STATE if the HAL is in a state
+ * where the provision request cannot be generated.
+ * @return request if successful the opaque certificate request blob
+ * is returned
+ * @return defaultUrl URL that the provisioning request may be
+ * sent to, if known by the HAL implementation. An app can choose to
+ * override this URL. If the HAL implementation does not provide a
+ * defaultUrl, the returned string must be empty.
+ */
+ getProvisionRequest_1_2(string certificateType, string certificateAuthority)
+ generates (Status status, vec<uint8_t> request, string defaultUrl);
+
+ /**
+ * Return the currently negotiated and max supported HDCP levels.
+ *
+ * This method only differs from @1.1 version by the addition of
+ * support for HDCP 2.3.
+ *
+ * The current level is based on the display(s) the device is connected to.
+ * If multiple HDCP-capable displays are simultaneously connected to
+ * separate interfaces, this method returns the lowest negotiated HDCP level
+ * of all interfaces.
+ *
+ * The maximum HDCP level is the highest level that can potentially be
+ * negotiated. It is a constant for any device, i.e. it does not depend on
+ * downstream receiving devices that could be connected. For example, if
+ * the device has HDCP 1.x keys and is capable of negotiating HDCP 1.x, but
+ * does not have HDCP 2.x keys, then the maximum HDCP capability would be
+ * reported as 1.x. If multiple HDCP-capable interfaces are present, it
+ * indicates the highest of the maximum HDCP levels of all interfaces.
+ *
+ * This method should only be used for informational purposes, not for
+ * enforcing compliance with HDCP requirements. Trusted enforcement of HDCP
+ * policies must be handled by the DRM system.
+ *
+ * @return status the status of the call. The status must be OK or
+ * ERROR_DRM_INVALID_STATE if the HAL is in a state where the HDCP
+ * level cannot be queried.
+ * @return connectedLevel the lowest HDCP level for any connected
+ * displays
+ * @return maxLevel the highest HDCP level that can be supported
+ * by the device
+ */
+ getHdcpLevels_1_2() generates (Status status, HdcpLevel connectedLevel,
+ HdcpLevel maxLevel);
+
+ /**
+ * Send a session lost state event to the listener. This event
+ * indicates that a session's state has become invalid because the
+ * device crypto hardware is incapable of retaining crypto session
+ * state across suspend and resume cycles.
+ *
+ * @param sessionId identifies the session the event originated from
+ */
+ sendSessionLostState(SessionId sessionId);
};
diff --git a/drm/1.2/IDrmPluginListener.hal b/drm/1.2/IDrmPluginListener.hal
new file mode 100644
index 0000000..a6bd6c9
--- /dev/null
+++ b/drm/1.2/IDrmPluginListener.hal
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.drm@1.2;
+
+import @1.0::IDrmPluginListener;
+import @1.0::SessionId;
+
+/**
+ * IDrmPluginListener is a listener interface for Drm events sent from an
+ * IDrmPlugin instance.
+ */
+interface IDrmPluginListener extends @1.0::IDrmPluginListener {
+ /**
+ * Some device crypto hardware is incapable of retaining crypto
+ * session state across suspend and resume cycles. A
+ * SessionLostState event must be signaled when a session has
+ * become invalid for this reason. This event must not be used to
+ * indicate a failure in the crypto system. Closing the session
+ * and opening a new one must allow the application to resume
+ * normal use of the drm hal module.
+ *
+ * @param sessionId identifies the session that has been invalidated
+ */
+ oneway sendSessionLostState(SessionId sessionId);
+};
diff --git a/drm/1.2/types.hal b/drm/1.2/types.hal
index 8770c79..28c8e67 100644
--- a/drm/1.2/types.hal
+++ b/drm/1.2/types.hal
@@ -16,6 +16,9 @@
package android.hardware.drm@1.2;
+import @1.0::Status;
+import @1.1::HdcpLevel;
+
enum OfflineLicenseState : uint32_t {
/**
* Offline license state is unknown
@@ -23,7 +26,7 @@
UNKNOWN,
/**
- * Offline license state is usable, the keys may be used for decryption.
+ * Offline license state is usable, the keys are usable for decryption.
*/
USABLE,
@@ -35,6 +38,53 @@
INACTIVE
};
+enum Status : @1.0::Status {
+ /**
+ * The drm HAL module must return ERROR_DRM_INSUFFICIENT_SECURITY
+ * from the crypto plugin decrypt method when the security level
+ * of the device is not sufficient to meet the requirements in the
+ * license policy.
+ */
+ ERROR_DRM_INSUFFICIENT_SECURITY,
+
+ /**
+ * The drm HAL module must return ERROR_FRAME_TOO_LARGE from the
+ * decrypt method when the frame being decrypted into the secure
+ * output buffer exceeds the size of the buffer.
+ */
+ ERROR_DRM_FRAME_TOO_LARGE,
+
+ /**
+ * This error must be returned from any session method when an
+ * attempt is made to use the session after the crypto hardware
+ * state has been invalidated. Some devices are not able to
+ * retain crypto session state across device suspend/resume which
+ * results in invalid session state.
+ */
+ ERROR_DRM_SESSION_LOST_STATE,
+
+ /**
+ * The drm HAL module must return this error if client
+ * applications using the hal are temporarily exceeding the
+ * capacity of available crypto resources such that a retry of
+ * the operation is likely to succeed.
+ */
+ ERROR_DRM_RESOURCE_CONTENTION,
+};
+
+/**
+ * HDCP specifications are defined by Digital Content Protection LLC (DCP).
+ * "HDCP Specification Rev. 2.3 Interface Independent Adaptation"
+ * "HDCP 2.3 on HDMI Specification"
+ */
+enum HdcpLevel : @1.1::HdcpLevel {
+ /**
+ * HDCP version 2.3 Type 1.
+ */
+ HDCP_V2_3
+};
+
+
/**
* KeySetId is an identifier that references a set of keys in an
* offline license. The keySetId is created by the HAL implementation
diff --git a/gnss/2.0/Android.bp b/gnss/2.0/Android.bp
index 200671e..9b04be0 100644
--- a/gnss/2.0/Android.bp
+++ b/gnss/2.0/Android.bp
@@ -13,11 +13,13 @@
"IAGnssRil.hal",
"IGnss.hal",
"IGnssCallback.hal",
+ "IGnssConfiguration.hal",
"IGnssMeasurement.hal",
"IGnssMeasurementCallback.hal",
],
interfaces: [
"android.hardware.gnss.measurement_corrections@1.0",
+ "android.hardware.gnss.visibility_control@1.0",
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
"android.hidl.base@1.0",
diff --git a/gnss/2.0/IGnss.hal b/gnss/2.0/IGnss.hal
index fb8b040..1f1858e 100644
--- a/gnss/2.0/IGnss.hal
+++ b/gnss/2.0/IGnss.hal
@@ -17,16 +17,26 @@
package android.hardware.gnss@2.0;
import android.hardware.gnss.measurement_corrections@1.0::IMeasurementCorrections;
+import android.hardware.gnss.visibility_control@1.0::IGnssVisibilityControl;
import @1.1::IGnss;
import IGnssCallback;
+import IGnssConfiguration;
import IGnssMeasurement;
import IAGnss;
import IAGnssRil;
-/** Represents the standard GNSS (Global Navigation Satellite System) interface. */
+/**
+ * Represents the standard GNSS (Global Navigation Satellite System) interface.
+ *
+ * Due to the introduction of new GNSS HAL package android.hardware.gnss.visibility_control@1.0
+ * the interface @1.0::IGnssNi.hal and @1.0::IGnssNiCallback.hal are deprecated in this version
+ * and are not supported by the framework. The GNSS HAL implementation of this interface
+ * must return nullptr for the following @1.0::IGnss method.
+ * getExtensionGnssNi() generates (IGnssNi gnssNiIface);
+ */
interface IGnss extends @1.1::IGnss {
- /**
+ /**
* Opens the interface and provides the callback routines to the implementation of this
* interface.
*
@@ -37,6 +47,13 @@
setCallback_2_0(IGnssCallback callback) generates (bool success);
/**
+ * This method returns the IGnssConfiguration interface.
+ *
+ * @return gnssConfigurationIface Handle to the IGnssConfiguration interface.
+ */
+ getExtensionGnssConfiguration_2_0() generates (IGnssConfiguration gnssConfigurationIface);
+
+ /**
* This method returns the IAGnss Interface.
*
* The getExtensionAGnss() must return nullptr as the @1.0::IAGnss interface is
@@ -68,6 +85,13 @@
*
* @return measurementCorrectionsIface Handle to the IMeasurementCorrections interface.
*/
- getExtensionMeasurementCorrections()
+ getExtensionMeasurementCorrections()
generates (IMeasurementCorrections measurementCorrectionsIface);
-};
+
+ /**
+ * This method returns the IGnssVisibilityControl interface.
+ *
+ * @return visibilityControlIface Handle to the IGnssVisibilityControl interface.
+ */
+ getExtensionVisibilityControl() generates (IGnssVisibilityControl visibilityControlIface);
+};
\ No newline at end of file
diff --git a/gnss/2.0/IGnssConfiguration.hal b/gnss/2.0/IGnssConfiguration.hal
new file mode 100644
index 0000000..90c376e
--- /dev/null
+++ b/gnss/2.0/IGnssConfiguration.hal
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@2.0;
+
+import @1.1::IGnssConfiguration;
+
+/**
+ * Extended interface for GNSS Configuration support.
+ *
+ * Due to the introduction of new GNSS HAL package android.hardware.gnss.visibility_control@1.0
+ * the following methods in @1.0::IGnssConfiguration are deprecated in this version and not
+ * called by the framework.
+ *
+ * setGpsLock(bitfield<GpsLock> lock) generates (bool success);
+ * setSuplEs(bool enabled) generates (bool success);
+ */
+interface IGnssConfiguration extends @1.1::IGnssConfiguration {
+ /**
+ * This method sets the emergency session extension duration. The GNSS HAL
+ * implementation must serve emergency SUPL and Control Plane network initiated
+ * location requests for this extra duration after the user initiated emergency
+ * session ends.
+ *
+ * @param emergencyExtensionSeconds Number of seconds to extend the emergency
+ * session duration post emergency call.
+ *
+ * @return success True if the GNSS HAL implementation accepts and supports the
+ * extended duration for emergency SUPL and Control Plane location requests.
+ */
+ setEsExtensionSec(uint32_t emergencyExtensionSeconds) generates (bool success);
+};
\ No newline at end of file
diff --git a/gnss/2.0/default/Android.bp b/gnss/2.0/default/Android.bp
index 9119ee4..985aa2b 100644
--- a/gnss/2.0/default/Android.bp
+++ b/gnss/2.0/default/Android.bp
@@ -21,10 +21,12 @@
vendor: true,
vintf_fragments: ["android.hardware.gnss@2.0-service.xml"],
srcs: [
+ "GnssConfiguration.cpp",
"AGnss.cpp",
"AGnssRil.cpp",
"Gnss.cpp",
"GnssMeasurement.cpp",
+ "GnssVisibilityControl.cpp",
"service.cpp"
],
shared_libs: [
@@ -34,6 +36,7 @@
"liblog",
"android.hardware.gnss@2.0",
"android.hardware.gnss.measurement_corrections@1.0",
+ "android.hardware.gnss.visibility_control@1.0",
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
],
diff --git a/gnss/2.0/default/Gnss.cpp b/gnss/2.0/default/Gnss.cpp
index bde904f..217f0f3 100644
--- a/gnss/2.0/default/Gnss.cpp
+++ b/gnss/2.0/default/Gnss.cpp
@@ -20,9 +20,12 @@
#include <log/log.h>
#include "AGnss.h"
#include "AGnssRil.h"
+#include "GnssConfiguration.h"
#include "GnssMeasurement.h"
+#include "GnssVisibilityControl.h"
using ::android::hardware::Status;
+using ::android::hardware::gnss::visibility_control::V1_0::implementation::GnssVisibilityControl;
namespace android {
namespace hardware {
@@ -92,8 +95,8 @@
}
Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
- // TODO implement
- return sp<V1_0::IGnssNi>{};
+ // The IGnssNi.hal interface is deprecated in 2.0.
+ return nullptr;
}
Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
@@ -181,6 +184,10 @@
}
// Methods from V2_0::IGnss follow.
+Return<sp<V2_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_2_0() {
+ return new GnssConfiguration{};
+}
+
Return<sp<V2_0::IAGnss>> Gnss::getExtensionAGnss_2_0() {
return new AGnss{};
}
@@ -200,6 +207,11 @@
return sp<measurement_corrections::V1_0::IMeasurementCorrections>{};
}
+Return<sp<visibility_control::V1_0::IGnssVisibilityControl>> Gnss::getExtensionVisibilityControl() {
+ ALOGD("Gnss::getExtensionVisibilityControl");
+ return new GnssVisibilityControl();
+}
+
Return<bool> Gnss::setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) {
ALOGD("Gnss::setCallback_2_0");
if (callback == nullptr) {
diff --git a/gnss/2.0/default/Gnss.h b/gnss/2.0/default/Gnss.h
index 47792cf..890b026 100644
--- a/gnss/2.0/default/Gnss.h
+++ b/gnss/2.0/default/Gnss.h
@@ -72,12 +72,15 @@
Return<bool> injectBestLocation(const V1_0::GnssLocation& location) override;
// Methods from V2_0::IGnss follow.
+ Return<sp<V2_0::IGnssConfiguration>> getExtensionGnssConfiguration_2_0() override;
Return<sp<V2_0::IAGnss>> getExtensionAGnss_2_0() override;
Return<sp<V2_0::IAGnssRil>> getExtensionAGnssRil_2_0() override;
Return<sp<V2_0::IGnssMeasurement>> getExtensionGnssMeasurement_2_0() override;
Return<bool> setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) override;
Return<sp<measurement_corrections::V1_0::IMeasurementCorrections>>
getExtensionMeasurementCorrections() override;
+ Return<sp<visibility_control::V1_0::IGnssVisibilityControl>> getExtensionVisibilityControl()
+ override;
private:
static sp<V2_0::IGnssCallback> sGnssCallback_2_0;
diff --git a/gnss/2.0/default/GnssConfiguration.cpp b/gnss/2.0/default/GnssConfiguration.cpp
new file mode 100644
index 0000000..4389dd2
--- /dev/null
+++ b/gnss/2.0/default/GnssConfiguration.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "GnssConfiguration"
+
+#include "GnssConfiguration.h"
+#include <log/log.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
+Return<bool> GnssConfiguration::setSuplEs(bool enable) {
+ ALOGD("setSuplEs enable: %d", enable);
+ // Method deprecated in 2.0 and not expected to be called by the framework.
+ return false;
+}
+
+Return<bool> GnssConfiguration::setSuplVersion(uint32_t) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> GnssConfiguration::setSuplMode(hidl_bitfield<SuplMode>) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> GnssConfiguration::setGpsLock(hidl_bitfield<GpsLock> gpsLock) {
+ ALOGD("setGpsLock gpsLock: %hhu", static_cast<GpsLock>(gpsLock));
+ // Method deprecated in 2.0 and not expected to be called by the framework.
+ return false;
+}
+
+Return<bool> GnssConfiguration::setLppProfile(hidl_bitfield<LppProfile>) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> GnssConfiguration::setGlonassPositioningProtocol(hidl_bitfield<GlonassPosProtocol>) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> GnssConfiguration::setEmergencySuplPdn(bool) {
+ // TODO implement
+ return bool{};
+}
+
+// Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
+Return<bool> GnssConfiguration::setBlacklist(
+ const hidl_vec<V1_1::IGnssConfiguration::BlacklistedSource>&) {
+ // TODO (b/122463906): Reuse 1.1 implementation.
+ return bool{};
+}
+
+// Methods from ::android::hardware::gnss::V2_0::IGnssConfiguration follow.
+Return<bool> GnssConfiguration::setEsExtensionSec(uint32_t emergencyExtensionSeconds) {
+ ALOGD("setEsExtensionSec emergencyExtensionSeconds: %d", emergencyExtensionSeconds);
+ return true;
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
\ No newline at end of file
diff --git a/gnss/2.0/default/GnssConfiguration.h b/gnss/2.0/default/GnssConfiguration.h
new file mode 100644
index 0000000..0c02ccd
--- /dev/null
+++ b/gnss/2.0/default/GnssConfiguration.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSSCONFIGURATION_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSSCONFIGURATION_H
+
+#include <android/hardware/gnss/2.0/IGnssConfiguration.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+struct GnssConfiguration : public IGnssConfiguration {
+ // Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
+ Return<bool> setSuplEs(bool enabled) override;
+ Return<bool> setSuplVersion(uint32_t version) override;
+ Return<bool> setSuplMode(hidl_bitfield<SuplMode> mode) override;
+ Return<bool> setGpsLock(hidl_bitfield<GpsLock> lock) override;
+ Return<bool> setLppProfile(hidl_bitfield<LppProfile> lppProfile) override;
+ Return<bool> setGlonassPositioningProtocol(hidl_bitfield<GlonassPosProtocol> protocol) override;
+ Return<bool> setEmergencySuplPdn(bool enable) override;
+
+ // Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
+ Return<bool> setBlacklist(
+ const hidl_vec<V1_1::IGnssConfiguration::BlacklistedSource>& blacklist) override;
+
+ // Methods from ::android::hardware::gnss::V2_0::IGnssConfiguration follow.
+ Return<bool> setEsExtensionSec(uint32_t emergencyExtensionSeconds) override;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSCONFIGURATION_H
\ No newline at end of file
diff --git a/gnss/2.0/default/GnssVisibilityControl.cpp b/gnss/2.0/default/GnssVisibilityControl.cpp
new file mode 100644
index 0000000..99b8e34
--- /dev/null
+++ b/gnss/2.0/default/GnssVisibilityControl.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "GnssVisibilityControl"
+
+#include "GnssVisibilityControl.h"
+#include <log/log.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace visibility_control {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl follow.
+Return<bool> GnssVisibilityControl::enableNfwLocationAccess(
+ const hidl_vec<hidl_string>& proxyApps) {
+ std::string os;
+ bool first = true;
+ for (const auto& proxyApp : proxyApps) {
+ if (first) {
+ first = false;
+ } else {
+ os += " ";
+ }
+
+ os += proxyApp;
+ }
+
+ ALOGD("enableNfwLocationAccess proxyApps: %s", os.c_str());
+ return true;
+}
+
+Return<bool> GnssVisibilityControl::setCallback(const sp<V1_0::IGnssVisibilityControlCallback>&) {
+ return true;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace visibility_control
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gnss/2.0/default/GnssVisibilityControl.h b/gnss/2.0/default/GnssVisibilityControl.h
new file mode 100644
index 0000000..45febff
--- /dev/null
+++ b/gnss/2.0/default/GnssVisibilityControl.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_VISIBILITY_CONTROL_V1_0_GNSSVISIBILITYCONTROL_H
+#define ANDROID_HARDWARE_GNSS_VISIBILITY_CONTROL_V1_0_GNSSVISIBILITYCONTROL_H
+
+#include <android/hardware/gnss/visibility_control/1.0/IGnssVisibilityControl.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace visibility_control {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+struct GnssVisibilityControl : public IGnssVisibilityControl {
+ // Methods from ::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl
+ // follow.
+ Return<bool> enableNfwLocationAccess(const hidl_vec<hidl_string>& proxyApps) override;
+ Return<bool> setCallback(const sp<V1_0::IGnssVisibilityControlCallback>& callback) override;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace visibility_control
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_VISIBILITY_CONTROL_V1_0_GNSSVISIBILITYCONTROL_H
\ No newline at end of file
diff --git a/gnss/2.0/vts/functional/Android.bp b/gnss/2.0/vts/functional/Android.bp
index 894716d..684b381 100644
--- a/gnss/2.0/vts/functional/Android.bp
+++ b/gnss/2.0/vts/functional/Android.bp
@@ -24,6 +24,7 @@
],
static_libs: [
"android.hardware.gnss.measurement_corrections@1.0",
+ "android.hardware.gnss.visibility_control@1.0",
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
"android.hardware.gnss@2.0",
diff --git a/gnss/2.0/vts/functional/VtsHalGnssV2_0TargetTest.cpp b/gnss/2.0/vts/functional/VtsHalGnssV2_0TargetTest.cpp
index ae36c50..a8e40ba 100644
--- a/gnss/2.0/vts/functional/VtsHalGnssV2_0TargetTest.cpp
+++ b/gnss/2.0/vts/functional/VtsHalGnssV2_0TargetTest.cpp
@@ -23,6 +23,7 @@
::testing::AddGlobalTestEnvironment(GnssHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
GnssHidlEnvironment::Instance()->init(&argc, argv);
+ // TODO (b/122463165): Expand coverage to include 1.1 and 1.0 VTS tests.
int status = RUN_ALL_TESTS();
ALOGI("Test result = %d", status);
return status;
diff --git a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
index ef232c9..552cf1b 100644
--- a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
+++ b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
@@ -19,8 +19,10 @@
#include <VtsHalHidlTargetTestBase.h>
#include <gnss_hal_test.h>
+using android::hardware::hidl_string;
using android::hardware::hidl_vec;
+using IGnssConfiguration_2_0 = android::hardware::gnss::V2_0::IGnssConfiguration;
using IAGnssRil_2_0 = android::hardware::gnss::V2_0::IAGnssRil;
using IGnssMeasurement_2_0 = android::hardware::gnss::V2_0::IGnssMeasurement;
using IGnssMeasurement_1_1 = android::hardware::gnss::V1_1::IGnssMeasurement;
@@ -29,6 +31,8 @@
using IAGnss_2_0 = android::hardware::gnss::V2_0::IAGnss;
using IAGnss_1_0 = android::hardware::gnss::V1_0::IAGnss;
using IAGnssCallback_2_0 = android::hardware::gnss::V2_0::IAGnssCallback;
+using android::hardware::gnss::V1_0::IGnssNi;
+using android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl;
/*
* SetupTeardownCreateCleanup:
@@ -60,13 +64,63 @@
}
/*
+ * TestGnssConfigurationExtension:
+ * Gets the GnssConfigurationExtension and verifies that it returns an actual extension by
+ * calling a method.
+ *
+ * The GNSS HAL 2.0 implementation must support @2.0::IGnssConfiguration interface due to
+ * the deprecation of some methods in @1.0::IGnssConfiguration interface.
+ */
+TEST_F(GnssHalTest, TestGnssConfigurationExtension) {
+ auto gnssConfiguration = gnss_hal_->getExtensionGnssConfiguration_2_0();
+ ASSERT_TRUE(gnssConfiguration.isOk());
+ sp<IGnssConfiguration_2_0> iGnssConfiguration = gnssConfiguration;
+ ASSERT_NE(iGnssConfiguration, nullptr);
+
+ auto result = iGnssConfiguration->setEsExtensionSec(180);
+ ASSERT_TRUE(result.isOk());
+ // Expected result can be true or false depending on whether HAL implementation supports
+ // detecting emergency sessions without involving the framework.
+}
+
+/*
+ * TestGnssConfiguration_setSuplEs_Deprecation:
+ * Calls setSuplEs and verifies that it returns false.
+ */
+TEST_F(GnssHalTest, TestGnssConfiguration_setSuplEs_Deprecation) {
+ auto gnssConfiguration = gnss_hal_->getExtensionGnssConfiguration_2_0();
+ ASSERT_TRUE(gnssConfiguration.isOk());
+ sp<IGnssConfiguration_2_0> iGnssConfiguration = gnssConfiguration;
+ ASSERT_NE(iGnssConfiguration, nullptr);
+
+ auto result = iGnssConfiguration->setSuplEs(false);
+ ASSERT_TRUE(result.isOk());
+ EXPECT_FALSE(result);
+}
+
+/*
+ * TestGnssConfiguration_setGpsLock_Deprecation:
+ * Calls setGpsLock and verifies that it returns false.
+ */
+TEST_F(GnssHalTest, TestGnssConfiguration_setGpsLock_Deprecation) {
+ auto gnssConfiguration = gnss_hal_->getExtensionGnssConfiguration_2_0();
+ ASSERT_TRUE(gnssConfiguration.isOk());
+ sp<IGnssConfiguration_2_0> iGnssConfiguration = gnssConfiguration;
+ ASSERT_NE(iGnssConfiguration, nullptr);
+
+ auto result = iGnssConfiguration->setGpsLock(0);
+ ASSERT_TRUE(result.isOk());
+ EXPECT_FALSE(result);
+}
+
+/*
* TestAGnssRilExtension:
* Gets the AGnssRilExtension and verifies that it returns an actual extension.
*
* The GNSS HAL 2.0 implementation must support @2.0::IAGnssRil interface due to the deprecation
* of framework network API methods needed to support the @1.0::IAGnssRil interface.
*
- * TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launced with Q or later.
+ * TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launched with Q or later
*/
TEST_F(GnssHalTest, TestAGnssRilExtension) {
auto agnssRil = gnss_hal_->getExtensionAGnssRil_2_0();
@@ -76,11 +130,11 @@
}
/*
- * TestAGnssRilUpdateNetworkState_2_0:
+ * TestAGnssRil_UpdateNetworkState_2_0:
* 1. Updates GNSS HAL that a network has connected.
* 2. Updates GNSS HAL that network has disconnected.
*/
-TEST_F(GnssHalTest, TestAGnssRilUpdateNetworkState_2_0) {
+TEST_F(GnssHalTest, TestAGnssRil_UpdateNetworkState_2_0) {
auto agnssRil = gnss_hal_->getExtensionAGnssRil_2_0();
ASSERT_TRUE(agnssRil.isOk());
sp<IAGnssRil_2_0> iAGnssRil = agnssRil;
@@ -148,7 +202,7 @@
* The GNSS HAL 2.0 implementation must support @2.0::IAGnss interface due to the deprecation
* of framework network API methods needed to support the @1.0::IAGnss interface.
*
- * TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launced with Q or later.
+ * TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launched with Q or later
*/
TEST_F(GnssHalTest, TestAGnssExtension) {
// Verify IAGnss 2.0 is supported.
@@ -167,10 +221,45 @@
* TestAGnssExtension_1_0_Deprecation:
* Gets the @1.0::IAGnss extension and verifies that it is a nullptr.
*
- * TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launced with Q or later.
+ * TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launched with Q or later
*/
TEST_F(GnssHalTest, TestAGnssExtension_1_0_Deprecation) {
// Verify IAGnss 1.0 is not supported.
auto agnss_1_0 = gnss_hal_->getExtensionAGnss();
ASSERT_TRUE(!agnss_1_0.isOk() || ((sp<IAGnss_1_0>)agnss_1_0) == nullptr);
}
+
+/*
+ * TestGnssNiExtension_Deprecation:
+ * Gets the @1.0::IGnssNi extension and verifies that it is a nullptr.
+ *
+ * TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launched with Q or later
+ */
+TEST_F(GnssHalTest, TestGnssNiExtension_Deprecation) {
+ // Verify IGnssNi 1.0 is not supported.
+ auto gnssNi = gnss_hal_->getExtensionGnssNi();
+ ASSERT_TRUE(!gnssNi.isOk() || ((sp<IGnssNi>)gnssNi) == nullptr);
+}
+
+/*
+ * TestGnssVisibilityControlExtension:
+ * Gets the GnssVisibilityControlExtension and verifies that it supports the
+ * gnss.visibility_control@1.0::IGnssVisibilityControl interface by invoking a method.
+ *
+ * The GNSS HAL 2.0 implementation must support gnss.visibility_control@1.0::IGnssVisibilityControl.
+ *
+ * TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launched with Q or later
+ */
+TEST_F(GnssHalTest, TestGnssVisibilityControlExtension) {
+ // Verify IGnssVisibilityControl is supported.
+ auto gnssVisibilityControl = gnss_hal_->getExtensionVisibilityControl();
+ ASSERT_TRUE(gnssVisibilityControl.isOk());
+ sp<IGnssVisibilityControl> iGnssVisibilityControl = gnssVisibilityControl;
+ ASSERT_NE(iGnssVisibilityControl, nullptr);
+
+ // Set non-framework proxy apps.
+ hidl_vec<hidl_string> proxyApps{"ims.example.com", "mdt.example.com"};
+ auto result = iGnssVisibilityControl->enableNfwLocationAccess(proxyApps);
+ ASSERT_TRUE(result.isOk());
+ EXPECT_TRUE(result);
+}
diff --git a/gnss/measurement_corrections/1.0/types.hal b/gnss/measurement_corrections/1.0/types.hal
index 4b48e4e..5f20734 100644
--- a/gnss/measurement_corrections/1.0/types.hal
+++ b/gnss/measurement_corrections/1.0/types.hal
@@ -47,8 +47,11 @@
*/
float carrierFrequencyHz;
- /** True if the satellite is in Line-of-Sight condition */
- bool satIsLos;
+ /**
+ * The probability that the satellite is estimated to be in Line-of-Sight condition at the given
+ * location.
+ */
+ float probSatIsLos;
/**
* Excess path length to be subtracted from pseudorange before using it in calculating location.
@@ -123,8 +126,8 @@
/** Bit mask to indicate which values are valid in a SingleSatCorrection object. */
enum GnssSingleSatCorrectionFlags : uint16_t {
- /** GnssSingleSatCorrectionFlags has valid satellite-is-line-of-sight field. */
- HAS_SAT_IS_LOS = 0x0001,
+ /** GnssSingleSatCorrectionFlags has valid satellite-is-line-of-sight-probability field. */
+ HAS_SAT_IS_LOS_PROBABILITY = 0x0001,
/** GnssSingleSatCorrectionFlags has valid Excess Path Length field. */
HAS_EXCESS_PATH_LENGTH = 0x0002,
/** GnssSingleSatCorrectionFlags has valid Excess Path Length Uncertainty field. */
diff --git a/gnss/visibility_control/1.0/Android.bp b/gnss/visibility_control/1.0/Android.bp
new file mode 100644
index 0000000..40a28c9
--- /dev/null
+++ b/gnss/visibility_control/1.0/Android.bp
@@ -0,0 +1,18 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.gnss.visibility_control@1.0",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "IGnssVisibilityControl.hal",
+ "IGnssVisibilityControlCallback.hal",
+ ],
+ interfaces: [
+ "android.hidl.base@1.0",
+ ],
+ gen_java: true,
+}
+
diff --git a/gnss/visibility_control/1.0/IGnssVisibilityControl.hal b/gnss/visibility_control/1.0/IGnssVisibilityControl.hal
new file mode 100644
index 0000000..9148127
--- /dev/null
+++ b/gnss/visibility_control/1.0/IGnssVisibilityControl.hal
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss.visibility_control@1.0;
+
+import IGnssVisibilityControlCallback;
+
+/**
+ * Represents the GNSS location reporting permissions and notification interface.
+ *
+ * This interface is used to tell the GNSS HAL implementation whether the framework user has
+ * granted permission to the GNSS HAL implementation to provide GNSS location information for
+ * non-framework (NFW), non-user initiated emergency use cases, and to notify the framework user
+ * of these GNSS location information deliveries.
+ *
+ * For user initiated emergency cases (and for the configured extended emergency session duration),
+ * the GNSS HAL implementation must serve the emergency location supporting network initiated
+ * location requests immediately irrespective of this permission settings.
+ *
+ * There is no separate need for the GNSS HAL implementation to monitor the global device location
+ * on/off setting. Permission to use GNSS for non-framework use cases is expressly controlled
+ * by the method enableNfwLocationAccess(). The framework monitors the location permission settings
+ * of the configured proxy applications(s), and device location settings, and calls the method
+ * enableNfwLocationAccess() whenever the user control proxy applications have, or do not have,
+ * location permission. The proxy applications are used to provide user visibility and control of
+ * location access by the non-framework on/off device entities they are representing.
+ *
+ * For device user visibility, the GNSS HAL implementation must call the method
+ * IGnssVisibilityControlCallback.nfwNotifyCb() whenever location request is rejected or
+ * location information is provided to non-framework entities (on or off device). This includes
+ * the network initiated location requests for user-initiated emergency use cases as well.
+ *
+ * The HAL implementations that support this interface must not report GNSS location, measurement,
+ * status, or other information that can be used to derive user location to any entity when not
+ * expressly authorized by this HAL. This includes all endpoints for location information
+ * off the device, including carriers, vendors, OEM and others directly or indirectly.
+ */
+interface IGnssVisibilityControl {
+ /**
+ * Enables/disables non-framework entity location access permission in the GNSS HAL.
+ *
+ * The framework will call this method to update GNSS HAL implementation every time the
+ * framework user, through the given proxy application(s) and/or device location settings,
+ * explicitly grants/revokes the location access permission for non-framework, non-user
+ * initiated emergency use cases.
+ *
+ * Whenever the user location information is delivered to non-framework entities, the HAL
+ * implementation must call the method IGnssVisibilityControlCallback.nfwNotifyCb() to notify
+ * the framework for user visibility.
+ *
+ * @param proxyApps Full list of package names of proxy Android applications representing
+ * the non-framework location access entities (on/off the device) for which the framework
+ * user has granted non-framework location access permission. The GNSS HAL implementation
+ * must provide location information only to non-framework entities represented by these
+ * proxy applications.
+ *
+ * The package name of the proxy Android application follows the standard Java language
+ * package naming format. For example, com.example.myapp.
+ *
+ * @return success True if the operation was successful.
+ */
+ enableNfwLocationAccess(vec<string> proxyApps) generates (bool success);
+
+ /**
+ * Registers the callback for HAL implementation to use.
+ *
+ * @param callback Handle to IGnssVisibilityControlCallback interface.
+ */
+ setCallback(IGnssVisibilityControlCallback callback) generates (bool success);
+};
\ No newline at end of file
diff --git a/gnss/visibility_control/1.0/IGnssVisibilityControlCallback.hal b/gnss/visibility_control/1.0/IGnssVisibilityControlCallback.hal
new file mode 100644
index 0000000..5a582c2
--- /dev/null
+++ b/gnss/visibility_control/1.0/IGnssVisibilityControlCallback.hal
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss.visibility_control@1.0;
+
+/**
+ * GNSS location reporting permissions and notification callback interface.
+ */
+interface IGnssVisibilityControlCallback {
+ /**
+ * Protocol stack that is requesting the non-framework location information.
+ */
+ enum NfwProtocolStack : uint8_t {
+ /** Cellular control plane requests */
+ CTRL_PLANE = 0,
+ /** All types of SUPL requests */
+ SUPL = 1,
+
+ /** All types of requests from IMS */
+ IMS = 10,
+ /** All types of requests from SIM */
+ SIM = 11,
+
+ /** Requests from other protocol stacks */
+ OTHER_PROTOCOL_STACK = 100
+ };
+
+ /*
+ * Entity that is requesting/receiving the location information.
+ */
+ enum NfwRequestor : uint8_t {
+ /** Wireless service provider */
+ CARRIER = 0,
+
+ /** Device manufacturer */
+ OEM = 10,
+ /** Modem chipset vendor */
+ MODEM_CHIPSET_VENDOR = 11,
+ /** GNSS chipset vendor */
+ GNSS_CHIPSET_VENDOR = 12,
+ /** Other chipset vendor */
+ OTHER_CHIPSET_VENDOR = 13,
+
+ /** Automobile client */
+ AUTOMOBILE_CLIENT = 20,
+
+ /** Other sources */
+ OTHER_REQUESTOR = 100
+ };
+
+ /**
+ * GNSS response type for non-framework location requests.
+ */
+ enum NfwResponseType : uint8_t {
+ /** Request rejected because framework has not given permission for this use case */
+ REJECTED = 0,
+
+ /** Request accepted but could not provide location because of a failure */
+ ACCEPTED_NO_LOCATION_PROVIDED = 1,
+
+ /** Request accepted and location provided */
+ ACCEPTED_LOCATION_PROVIDED = 2,
+ };
+
+ /**
+ * Represents a non-framework location information request/response notification.
+ */
+ struct NfwNotification {
+ /**
+ * Package name of the Android proxy application representing the non-framework
+ * entity that requested location. Set to empty string if unknown.
+ */
+ string proxyAppPackageName;
+
+ /** Protocol stack that initiated the non-framework location request. */
+ NfwProtocolStack protocolStack;
+
+ /**
+ * Name of the protocol stack if protocolStack field is set to OTHER_PROTOCOL_STACK.
+ * Otherwise, set to empty string.
+ *
+ * This field is opaque to the framework and used for logging purposes.
+ */
+ string otherProtocolStackName;
+
+ /** Source initiating/receiving the location information. */
+ NfwRequestor requestor;
+
+ /**
+ * Identity of the endpoint receiving the location information. For example, carrier
+ * name, OEM name, SUPL SLP/E-SLP FQDN, chipset vendor name, etc.
+ *
+ * This field is opaque to the framework and used for logging purposes.
+ */
+ string requestorId;
+
+ /** Indicates whether location information was provided for this request. */
+ NfwResponseType responseType;
+
+ /** Is the device in user initiated emergency session. */
+ bool inEmergencyMode;
+
+ /** Is cached location provided */
+ bool isCachedLocation;
+ };
+
+ /**
+ * Callback to report a non-framework delivered location.
+ *
+ * The GNSS HAL implementation must call this method to notify the framework whenever
+ * a non-framework location request is made to the GNSS HAL.
+ *
+ * Non-framework entities like low power sensor hubs that request location from GNSS and
+ * only pass location information through Android framework controls are exempt from this
+ * power-spending reporting. However, low power sensor hubs or other chipsets which may send
+ * the location information to anywhere other than Android framework (which provides user
+ * visibility and control), must report location information use through this API whenever
+ * location information (or events driven by that location such as "home" location detection)
+ * leaves the domain of that low power chipset.
+ *
+ * To avoid overly spamming the framework, high speed location reporting of the exact same
+ * type may be throttled to report location at a lower rate than the actual report rate, as
+ * long as the location is reported with a latency of no more than the larger of 5 seconds,
+ * or the next the Android processor awake time. For example, if an Automotive client is
+ * getting location information from the GNSS location system at 20Hz, this method may be
+ * called at 1Hz. As another example, if a low power processor is getting location from the
+ * GNSS chipset, and the Android processor is asleep, the notification to the Android HAL may
+ * be delayed until the next wake of the Android processor.
+ *
+ * @param notification Non-framework delivered location request/response description.
+ */
+ nfwNotifyCb(NfwNotification notification);
+
+ /**
+ * Tells if the device is currently in an emergency session.
+ *
+ * Emergency session is defined as the device being actively in a user initiated emergency
+ * call or in post emergency call extension time period.
+ *
+ * If the GNSS HAL implementation cannot determine if the device is in emergency session
+ * mode, it must call this method to confirm that the device is in emergency session before
+ * serving network initiated emergency SUPL and Control Plane location requests.
+ *
+ * @return success True if the framework determines that the device is in emergency session.
+ */
+ isInEmergencySession() generates (bool success);
+};
\ No newline at end of file
diff --git a/graphics/allocator/2.0/default/OWNERS b/graphics/allocator/2.0/default/OWNERS
index 3aa5fa1..273cb4c 100644
--- a/graphics/allocator/2.0/default/OWNERS
+++ b/graphics/allocator/2.0/default/OWNERS
@@ -1,4 +1,4 @@
# Graphics team
jessehall@google.com
-olv@google.com
+marissaw@google.com
stoza@google.com
diff --git a/graphics/allocator/2.0/utils/OWNERS b/graphics/allocator/2.0/utils/OWNERS
index 3aa5fa1..273cb4c 100644
--- a/graphics/allocator/2.0/utils/OWNERS
+++ b/graphics/allocator/2.0/utils/OWNERS
@@ -1,4 +1,4 @@
# Graphics team
jessehall@google.com
-olv@google.com
+marissaw@google.com
stoza@google.com
diff --git a/graphics/allocator/3.0/Android.bp b/graphics/allocator/3.0/Android.bp
new file mode 100644
index 0000000..fa3e2ce
--- /dev/null
+++ b/graphics/allocator/3.0/Android.bp
@@ -0,0 +1,21 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.graphics.allocator@3.0",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "IAllocator.hal",
+ ],
+ interfaces: [
+ "android.hardware.graphics.common@1.0",
+ "android.hardware.graphics.common@1.1",
+ "android.hardware.graphics.common@1.2",
+ "android.hardware.graphics.mapper@3.0",
+ "android.hidl.base@1.0",
+ ],
+ gen_java: false,
+}
+
diff --git a/graphics/allocator/3.0/IAllocator.hal b/graphics/allocator/3.0/IAllocator.hal
new file mode 100644
index 0000000..34b08e7
--- /dev/null
+++ b/graphics/allocator/3.0/IAllocator.hal
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.graphics.allocator@3.0;
+
+import android.hardware.graphics.mapper@3.0;
+
+interface IAllocator {
+ /**
+ * Retrieves implementation-defined debug information, which will be
+ * displayed during, for example, `dumpsys SurfaceFlinger`.
+ *
+ * @return debugInfo is a string of debug information.
+ */
+ dumpDebugInfo() generates (string debugInfo);
+
+ /**
+ * Allocates buffers with the properties specified by the descriptor.
+ *
+ * Allocations should be optimized for usage bits provided in the
+ * descriptor.
+ *
+ * @param descriptor Properties of the buffers to allocate. This must be
+ * obtained from IMapper::createDescriptor().
+ * @param count The number of buffers to allocate.
+ * @return error Error status of the call, which may be
+ * - `NONE` upon success.
+ * - `BAD_DESCRIPTOR` if the descriptor is invalid.
+ * - `NO_RESOURCES` if the allocation cannot be fulfilled at this time.
+ * - `UNSUPPORTED` if any of the properties encoded in the descriptor
+ * are not supported.
+ * @return stride The number of pixels between two consecutive rows of
+ * an allocated buffer, when the concept of consecutive rows is defined.
+ * Otherwise, it has no meaning.
+ * @return buffers Array of raw handles to the allocated buffers.
+ */
+ allocate(BufferDescriptor descriptor, uint32_t count)
+ generates (Error error,
+ uint32_t stride,
+ vec<handle> buffers);
+};
+
diff --git a/graphics/common/1.2/types.hal b/graphics/common/1.2/types.hal
index 392a12e..c9c3aeb 100644
--- a/graphics/common/1.2/types.hal
+++ b/graphics/common/1.2/types.hal
@@ -25,7 +25,8 @@
/**
* Hdr
*/
-@export(name="android_hdr_v1_2_t", value_prefix="HAL_HDR_")
+@export(name="android_hdr_v1_2_t", value_prefix="HAL_HDR_",
+ export_parent="false")
enum Hdr : @1.0::Hdr {
HDR10_PLUS = 4,
};
@@ -96,3 +97,18 @@
*/
typedef int32_t[4] Rect;
+/**
+ * Pixel formats for graphics buffers.
+ */
+@export(name="android_pixel_format_v1_2_t", value_prefix="HAL_PIXEL_FORMAT_",
+ export_parent="false")
+enum PixelFormat : @1.1::PixelFormat {
+ /**
+ * 24-bit format that has 8-bit H, S, and V components, in that order,
+ * from the lowest memory address to the highest memory address.
+ *
+ * The component values are unsigned normalized to the range [0, 1], whose
+ * interpretation is defined by the dataspace.
+ */
+ HSV_888 = 0x37,
+};
diff --git a/graphics/composer/2.1/default/Android.bp b/graphics/composer/2.1/default/Android.bp
index 2de1e3c..63accff 100644
--- a/graphics/composer/2.1/default/Android.bp
+++ b/graphics/composer/2.1/default/Android.bp
@@ -10,6 +10,7 @@
shared_libs: [
"android.hardware.graphics.composer@2.1",
"android.hardware.graphics.mapper@2.0",
+ "android.hardware.graphics.mapper@3.0",
"libbase",
"libcutils",
"libfmq",
diff --git a/graphics/composer/2.1/default/OWNERS b/graphics/composer/2.1/default/OWNERS
index 4714be2..db8fb80 100644
--- a/graphics/composer/2.1/default/OWNERS
+++ b/graphics/composer/2.1/default/OWNERS
@@ -1,5 +1,6 @@
# Graphics team
courtneygo@google.com
jessehall@google.com
-olv@google.com
+lpy@google.com
stoza@google.com
+vhau@google.com
diff --git a/graphics/composer/2.1/utils/OWNERS b/graphics/composer/2.1/utils/OWNERS
index d515a23..5acc631 100644
--- a/graphics/composer/2.1/utils/OWNERS
+++ b/graphics/composer/2.1/utils/OWNERS
@@ -1,4 +1,5 @@
courtneygo@google.com
jessehall@google.com
-olv@google.com
+lpy@google.com
stoza@google.com
+vhau@google.com
diff --git a/graphics/composer/2.1/utils/hal/Android.bp b/graphics/composer/2.1/utils/hal/Android.bp
index f24e768..7a501fc 100644
--- a/graphics/composer/2.1/utils/hal/Android.bp
+++ b/graphics/composer/2.1/utils/hal/Android.bp
@@ -20,11 +20,13 @@
shared_libs: [
"android.hardware.graphics.composer@2.1",
"android.hardware.graphics.mapper@2.0",
+ "android.hardware.graphics.mapper@3.0",
"libhardware", // TODO remove hwcomposer2.h dependency
],
export_shared_lib_headers: [
"android.hardware.graphics.composer@2.1",
"android.hardware.graphics.mapper@2.0",
+ "android.hardware.graphics.mapper@3.0",
"libhardware",
],
header_libs: [
diff --git a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h
index f249f1a..3a73f84 100644
--- a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h
+++ b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h
@@ -26,6 +26,7 @@
#include <vector>
#include <android/hardware/graphics/mapper/2.0/IMapper.h>
+#include <android/hardware/graphics/mapper/3.0/IMapper.h>
#include <log/log.h>
namespace android {
@@ -39,9 +40,16 @@
class ComposerHandleImporter {
public:
bool init() {
- mMapper = mapper::V2_0::IMapper::getService();
- ALOGE_IF(!mMapper, "failed to get mapper service");
- return mMapper != nullptr;
+ mMapper3 = mapper::V3_0::IMapper::getService();
+ if (mMapper3) {
+ return true;
+ }
+ ALOGW_IF(!mMapper3, "failed to get mapper 3.0 service");
+
+ mMapper2 = mapper::V2_0::IMapper::getService();
+ ALOGE_IF(!mMapper2, "failed to get mapper 2.0 service");
+
+ return mMapper2 != nullptr;
}
Error importBuffer(const native_handle_t* rawHandle, const native_handle_t** outBufferHandle) {
@@ -50,14 +58,28 @@
return Error::NONE;
}
- mapper::V2_0::Error error;
const native_handle_t* bufferHandle;
- mMapper->importBuffer(rawHandle, [&](const auto& tmpError, const auto& tmpBufferHandle) {
- error = tmpError;
- bufferHandle = static_cast<const native_handle_t*>(tmpBufferHandle);
- });
- if (error != mapper::V2_0::Error::NONE) {
- return Error::NO_RESOURCES;
+ if (mMapper2) {
+ mapper::V2_0::Error error;
+ mMapper2->importBuffer(
+ rawHandle, [&](const auto& tmpError, const auto& tmpBufferHandle) {
+ error = tmpError;
+ bufferHandle = static_cast<const native_handle_t*>(tmpBufferHandle);
+ });
+ if (error != mapper::V2_0::Error::NONE) {
+ return Error::NO_RESOURCES;
+ }
+ }
+ if (mMapper3) {
+ mapper::V3_0::Error error;
+ mMapper3->importBuffer(
+ rawHandle, [&](const auto& tmpError, const auto& tmpBufferHandle) {
+ error = tmpError;
+ bufferHandle = static_cast<const native_handle_t*>(tmpBufferHandle);
+ });
+ if (error != mapper::V3_0::Error::NONE) {
+ return Error::NO_RESOURCES;
+ }
}
*outBufferHandle = bufferHandle;
@@ -66,7 +88,13 @@
void freeBuffer(const native_handle_t* bufferHandle) {
if (bufferHandle) {
- mMapper->freeBuffer(static_cast<void*>(const_cast<native_handle_t*>(bufferHandle)));
+ if (mMapper2) {
+ mMapper2->freeBuffer(
+ static_cast<void*>(const_cast<native_handle_t*>(bufferHandle)));
+ } else if (mMapper3) {
+ mMapper3->freeBuffer(
+ static_cast<void*>(const_cast<native_handle_t*>(bufferHandle)));
+ }
}
}
@@ -91,7 +119,8 @@
}
private:
- sp<mapper::V2_0::IMapper> mMapper;
+ sp<mapper::V2_0::IMapper> mMapper2;
+ sp<mapper::V3_0::IMapper> mMapper3;
};
class ComposerHandleCache {
diff --git a/graphics/composer/2.1/utils/hwc2on1adapter/HWC2On1Adapter.cpp b/graphics/composer/2.1/utils/hwc2on1adapter/HWC2On1Adapter.cpp
index 366d641..3d138f7 100644
--- a/graphics/composer/2.1/utils/hwc2on1adapter/HWC2On1Adapter.cpp
+++ b/graphics/composer/2.1/utils/hwc2on1adapter/HWC2On1Adapter.cpp
@@ -1921,8 +1921,8 @@
mHwc1Id(0),
mHasUnsupportedPlaneAlpha(false) {}
-bool HWC2On1Adapter::SortLayersByZ::operator()(
- const std::shared_ptr<Layer>& lhs, const std::shared_ptr<Layer>& rhs) {
+bool HWC2On1Adapter::SortLayersByZ::operator()(const std::shared_ptr<Layer>& lhs,
+ const std::shared_ptr<Layer>& rhs) const {
return lhs->getZ() < rhs->getZ();
}
diff --git a/graphics/composer/2.1/utils/hwc2on1adapter/include/hwc2on1adapter/HWC2On1Adapter.h b/graphics/composer/2.1/utils/hwc2on1adapter/include/hwc2on1adapter/HWC2On1Adapter.h
index 3badfce..da771dc 100644
--- a/graphics/composer/2.1/utils/hwc2on1adapter/include/hwc2on1adapter/HWC2On1Adapter.h
+++ b/graphics/composer/2.1/utils/hwc2on1adapter/include/hwc2on1adapter/HWC2On1Adapter.h
@@ -130,8 +130,8 @@
class SortLayersByZ {
public:
- bool operator()(const std::shared_ptr<Layer>& lhs,
- const std::shared_ptr<Layer>& rhs);
+ bool operator()(const std::shared_ptr<Layer>& lhs,
+ const std::shared_ptr<Layer>& rhs) const;
};
// The semantics of the fences returned by the device differ between
diff --git a/graphics/composer/2.1/vts/OWNERS b/graphics/composer/2.1/vts/OWNERS
index ef69d7c..0b42d2e 100644
--- a/graphics/composer/2.1/vts/OWNERS
+++ b/graphics/composer/2.1/vts/OWNERS
@@ -1,6 +1,7 @@
# Graphics team
-olv@google.com
+lpy@google.com
+vhau@google.com
# VTS team
yim@google.com
-zhuoyao@google.com
\ No newline at end of file
+zhuoyao@google.com
diff --git a/graphics/composer/2.2/default/Android.mk b/graphics/composer/2.2/default/Android.mk
index 2f80f0c..7dedf61 100644
--- a/graphics/composer/2.2/default/Android.mk
+++ b/graphics/composer/2.2/default/Android.mk
@@ -12,6 +12,7 @@
android.hardware.graphics.composer@2.1 \
android.hardware.graphics.composer@2.2 \
android.hardware.graphics.mapper@2.0 \
+ android.hardware.graphics.mapper@3.0 \
libbase \
libbinder \
libcutils \
diff --git a/graphics/composer/2.2/default/OWNERS b/graphics/composer/2.2/default/OWNERS
index 4714be2..db8fb80 100644
--- a/graphics/composer/2.2/default/OWNERS
+++ b/graphics/composer/2.2/default/OWNERS
@@ -1,5 +1,6 @@
# Graphics team
courtneygo@google.com
jessehall@google.com
-olv@google.com
+lpy@google.com
stoza@google.com
+vhau@google.com
diff --git a/graphics/composer/2.2/utils/OWNERS b/graphics/composer/2.2/utils/OWNERS
index 1beb074..a17a50c 100644
--- a/graphics/composer/2.2/utils/OWNERS
+++ b/graphics/composer/2.2/utils/OWNERS
@@ -1,7 +1,8 @@
# Graphics team
courtneygo@google.com
-olv@google.com
+lpy@google.com
stoza@google.com
+vhau@google.com
# VTS team
yim@google.com
diff --git a/graphics/composer/2.2/vts/functional/OWNERS b/graphics/composer/2.2/vts/functional/OWNERS
index 1beb074..a17a50c 100644
--- a/graphics/composer/2.2/vts/functional/OWNERS
+++ b/graphics/composer/2.2/vts/functional/OWNERS
@@ -1,7 +1,8 @@
# Graphics team
courtneygo@google.com
-olv@google.com
+lpy@google.com
stoza@google.com
+vhau@google.com
# VTS team
yim@google.com
diff --git a/graphics/composer/2.3/IComposerClient.hal b/graphics/composer/2.3/IComposerClient.hal
index cf78dea..a3b7792 100644
--- a/graphics/composer/2.3/IComposerClient.hal
+++ b/graphics/composer/2.3/IComposerClient.hal
@@ -17,7 +17,7 @@
package android.hardware.graphics.composer@2.3;
import android.hardware.graphics.common@1.1::RenderIntent;
-import android.hardware.graphics.common@1.1::PixelFormat;
+import android.hardware.graphics.common@1.2::PixelFormat;
import android.hardware.graphics.common@1.2::ColorMode;
import android.hardware.graphics.common@1.2::Dataspace;
import android.hardware.graphics.common@1.2::Hdr;
diff --git a/graphics/composer/2.3/default/Android.bp b/graphics/composer/2.3/default/Android.bp
index ad49ec3..07afd6c 100644
--- a/graphics/composer/2.3/default/Android.bp
+++ b/graphics/composer/2.3/default/Android.bp
@@ -29,6 +29,7 @@
"android.hardware.graphics.composer@2.2",
"android.hardware.graphics.composer@2.3",
"android.hardware.graphics.mapper@2.0",
+ "android.hardware.graphics.mapper@3.0",
"libbase",
"libbinder",
"libcutils",
diff --git a/graphics/composer/2.3/default/OWNERS b/graphics/composer/2.3/default/OWNERS
index 3aa5fa1..820ebe6 100644
--- a/graphics/composer/2.3/default/OWNERS
+++ b/graphics/composer/2.3/default/OWNERS
@@ -1,4 +1,5 @@
# Graphics team
jessehall@google.com
-olv@google.com
+lpy@google.com
stoza@google.com
+vhau@google.com
diff --git a/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerClient.h b/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerClient.h
index edc203e..a272e72 100644
--- a/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerClient.h
+++ b/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerClient.h
@@ -123,7 +123,7 @@
Return<void> getDisplayedContentSamplingAttributes(
uint64_t display,
IComposerClient::getDisplayedContentSamplingAttributes_cb hidl_cb) override {
- common::V1_1::PixelFormat format;
+ PixelFormat format;
common::V1_2::Dataspace dataspace;
hidl_bitfield<IComposerClient::FormatColorComponent> componentMask;
Error error =
diff --git a/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerHal.h b/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerHal.h
index 882621f..a0812ad 100644
--- a/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerHal.h
+++ b/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerHal.h
@@ -25,11 +25,11 @@
namespace V2_3 {
namespace hal {
-using common::V1_1::PixelFormat;
using common::V1_1::RenderIntent;
using common::V1_2::ColorMode;
using common::V1_2::Dataspace;
using common::V1_2::Hdr;
+using common::V1_2::PixelFormat;
using V2_1::Display;
using V2_1::Error;
using V2_1::Layer;
diff --git a/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h b/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h
index 9fb6d4b..41e333a 100644
--- a/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h
+++ b/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h
@@ -34,11 +34,11 @@
namespace detail {
-using common::V1_1::PixelFormat;
using common::V1_1::RenderIntent;
using common::V1_2::ColorMode;
using common::V1_2::Dataspace;
using common::V1_2::Hdr;
+using common::V1_2::PixelFormat;
using V2_1::Display;
using V2_1::Error;
@@ -91,14 +91,16 @@
Error getClientTargetSupport_2_3(Display display, uint32_t width, uint32_t height,
PixelFormat format, Dataspace dataspace) override {
- return getClientTargetSupport_2_2(display, width, height, format,
+ return getClientTargetSupport_2_2(display, width, height,
+ static_cast<common::V1_1::PixelFormat>(format),
static_cast<common::V1_1::Dataspace>(dataspace));
}
Error getReadbackBufferAttributes_2_3(Display display, PixelFormat* outFormat,
Dataspace* outDataspace) override {
return getReadbackBufferAttributes(
- display, outFormat, reinterpret_cast<common::V1_1::Dataspace*>(outDataspace));
+ display, reinterpret_cast<common::V1_1::PixelFormat*>(outFormat),
+ reinterpret_cast<common::V1_1::Dataspace*>(outDataspace));
}
Error getDisplayIdentificationData(Display display, uint8_t* outPort,
diff --git a/graphics/composer/2.3/utils/vts/include/composer-vts/2.3/ComposerVts.h b/graphics/composer/2.3/utils/vts/include/composer-vts/2.3/ComposerVts.h
index 7add322..ad4ef0b 100644
--- a/graphics/composer/2.3/utils/vts/include/composer-vts/2.3/ComposerVts.h
+++ b/graphics/composer/2.3/utils/vts/include/composer-vts/2.3/ComposerVts.h
@@ -32,11 +32,11 @@
namespace V2_3 {
namespace vts {
-using common::V1_1::PixelFormat;
using common::V1_1::RenderIntent;
using common::V1_2::ColorMode;
using common::V1_2::Dataspace;
using common::V1_2::Hdr;
+using common::V1_2::PixelFormat;
using V2_1::Display;
using V2_1::Error;
using V2_3::IComposer;
diff --git a/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp b/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp
index dca7406..de74e28 100644
--- a/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp
+++ b/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp
@@ -36,10 +36,10 @@
namespace {
using common::V1_0::BufferUsage;
-using common::V1_1::PixelFormat;
using common::V1_1::RenderIntent;
using common::V1_2::ColorMode;
using common::V1_2::Dataspace;
+using common::V1_2::PixelFormat;
using mapper::V2_0::IMapper;
using mapper::V2_0::vts::Gralloc;
@@ -492,9 +492,6 @@
}
TEST_F(GraphicsComposerHidlTest, GetDisplayedContentSamplingAttributes) {
- using common::V1_1::PixelFormat;
- using common::V1_2::Dataspace;
-
int constexpr invalid = -1;
auto format = static_cast<PixelFormat>(invalid);
auto dataspace = static_cast<Dataspace>(invalid);
diff --git a/graphics/mapper/2.0/default/OWNERS b/graphics/mapper/2.0/default/OWNERS
index 3aa5fa1..273cb4c 100644
--- a/graphics/mapper/2.0/default/OWNERS
+++ b/graphics/mapper/2.0/default/OWNERS
@@ -1,4 +1,4 @@
# Graphics team
jessehall@google.com
-olv@google.com
+marissaw@google.com
stoza@google.com
diff --git a/graphics/mapper/2.0/utils/OWNERS b/graphics/mapper/2.0/utils/OWNERS
index 3aa5fa1..273cb4c 100644
--- a/graphics/mapper/2.0/utils/OWNERS
+++ b/graphics/mapper/2.0/utils/OWNERS
@@ -1,4 +1,4 @@
# Graphics team
jessehall@google.com
-olv@google.com
+marissaw@google.com
stoza@google.com
diff --git a/graphics/mapper/2.0/vts/OWNERS b/graphics/mapper/2.0/vts/OWNERS
index ef69d7c..8e86f64 100644
--- a/graphics/mapper/2.0/vts/OWNERS
+++ b/graphics/mapper/2.0/vts/OWNERS
@@ -1,6 +1,6 @@
# Graphics team
-olv@google.com
+marissaw@google.com
# VTS team
yim@google.com
-zhuoyao@google.com
\ No newline at end of file
+zhuoyao@google.com
diff --git a/graphics/mapper/2.1/default/OWNERS b/graphics/mapper/2.1/default/OWNERS
index 3aa5fa1..273cb4c 100644
--- a/graphics/mapper/2.1/default/OWNERS
+++ b/graphics/mapper/2.1/default/OWNERS
@@ -1,4 +1,4 @@
# Graphics team
jessehall@google.com
-olv@google.com
+marissaw@google.com
stoza@google.com
diff --git a/graphics/mapper/2.1/utils/OWNERS b/graphics/mapper/2.1/utils/OWNERS
index 3aa5fa1..273cb4c 100644
--- a/graphics/mapper/2.1/utils/OWNERS
+++ b/graphics/mapper/2.1/utils/OWNERS
@@ -1,4 +1,4 @@
# Graphics team
jessehall@google.com
-olv@google.com
+marissaw@google.com
stoza@google.com
diff --git a/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc1Hal.h b/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc1Hal.h
index 08d604e..c9836e5 100644
--- a/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc1Hal.h
+++ b/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc1Hal.h
@@ -28,7 +28,7 @@
using V2_0::BufferDescriptor;
using V2_0::Error;
-using android::hardware::graphics::common::V1_0::BufferUsage;
+using android::hardware::graphics::common::V1_1::BufferUsage;
namespace detail {
@@ -72,6 +72,8 @@
Error createDescriptor_2_1(const IMapper::BufferDescriptorInfo& descriptorInfo,
BufferDescriptor* outDescriptor) override {
+ if (gralloc1UsageUnsupported(descriptorInfo.usage))
+ return Error::BAD_DESCRIPTOR;
return createDescriptor(
V2_0::IMapper::BufferDescriptorInfo{
descriptorInfo.width, descriptorInfo.height, descriptorInfo.layerCount,
@@ -163,6 +165,16 @@
return consumerUsage;
}
+ static bool gralloc1UsageUnsupported(uint64_t usage) {
+ // Certain newer public usage bits should not be used with gralloc1.
+ // We use a blacklist instead of a whitelist here in order to avoid
+ // breaking private usage flags.
+ constexpr uint64_t unsupportedMask = BufferUsage::GPU_CUBE_MAP |
+ BufferUsage::GPU_MIPMAP_COMPLETE;
+
+ return usage & unsupportedMask;
+ }
+
private:
using BaseType2_0 = V2_0::passthrough::detail::Gralloc1HalImpl<Hal>;
using BaseType2_0::createDescriptor;
diff --git a/graphics/mapper/2.1/vts/OWNERS b/graphics/mapper/2.1/vts/OWNERS
index ef69d7c..8e86f64 100644
--- a/graphics/mapper/2.1/vts/OWNERS
+++ b/graphics/mapper/2.1/vts/OWNERS
@@ -1,6 +1,6 @@
# Graphics team
-olv@google.com
+marissaw@google.com
# VTS team
yim@google.com
-zhuoyao@google.com
\ No newline at end of file
+zhuoyao@google.com
diff --git a/graphics/mapper/3.0/Android.bp b/graphics/mapper/3.0/Android.bp
new file mode 100644
index 0000000..b2f0aa6
--- /dev/null
+++ b/graphics/mapper/3.0/Android.bp
@@ -0,0 +1,26 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.graphics.mapper@3.0",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ support_system_process: true,
+ },
+ srcs: [
+ "types.hal",
+ "IMapper.hal",
+ ],
+ interfaces: [
+ "android.hardware.graphics.common@1.0",
+ "android.hardware.graphics.common@1.1",
+ "android.hardware.graphics.common@1.2",
+ "android.hidl.base@1.0",
+ ],
+ types: [
+ "Error",
+ "YCbCrLayout",
+ ],
+ gen_java: false,
+}
+
diff --git a/graphics/mapper/3.0/IMapper.hal b/graphics/mapper/3.0/IMapper.hal
new file mode 100644
index 0000000..a0e4d7a
--- /dev/null
+++ b/graphics/mapper/3.0/IMapper.hal
@@ -0,0 +1,304 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.graphics.mapper@3.0;
+
+import android.hardware.graphics.common@1.1::BufferUsage;
+import android.hardware.graphics.common@1.1::PixelFormat;
+import android.hardware.graphics.common@1.2::Rect;
+
+interface IMapper {
+ struct BufferDescriptorInfo {
+ /**
+ * The width specifies how many columns of pixels must be in the
+ * allocated buffer, but does not necessarily represent the offset in
+ * columns between the same column in adjacent rows. The rows may be
+ * padded.
+ */
+ uint32_t width;
+
+ /**
+ * The height specifies how many rows of pixels must be in the
+ * allocated buffer.
+ */
+ uint32_t height;
+
+ /**
+ * The number of image layers that must be in the allocated buffer.
+ */
+ uint32_t layerCount;
+
+ /** Buffer pixel format. */
+ PixelFormat format;
+
+ /**
+ * Buffer usage mask; valid flags can be found in the definition of
+ * BufferUsage.
+ */
+ bitfield<BufferUsage> usage;
+ };
+
+ struct Rect {
+ int32_t left;
+ int32_t top;
+ int32_t width;
+ int32_t height;
+ };
+
+ /**
+ * Creates a buffer descriptor. The descriptor can be used with IAllocator
+ * to allocate buffers.
+ *
+ * Since the buffer descriptor fully describes a buffer, any device
+ * dependent or device independent checks must be performed here whenever
+ * possible. Specifically, when layered buffers are not supported, this
+ * function must return `UNSUPPORTED` if `description.layers` is great than
+ * 1.
+ *
+ * @param description Attributes of the descriptor.
+ * @return error Error status of the call, which may be
+ * - `NONE` upon success.
+ * - `BAD_VALUE` if any of the specified attributes are invalid or
+ * inconsistent.
+ * - `NO_RESOURCES` if the creation cannot be fullfilled due to
+ * unavailability of resources.
+ * - `UNSUPPORTED` when any of the specified attributes are not
+ * supported.
+ * @return descriptor Newly created buffer descriptor.
+ */
+ createDescriptor(BufferDescriptorInfo description)
+ generates (Error error,
+ BufferDescriptor descriptor);
+
+ /**
+ * Imports a raw buffer handle to create an imported buffer handle for use
+ * with the rest of the mapper or with other in-process libraries.
+ *
+ * A buffer handle is considered raw when it is cloned (e.g., with
+ * `native_handle_clone()`) from another buffer handle locally, or when it
+ * is received from another HAL server/client or another process. A raw
+ * buffer handle must not be used to access the underlying graphic
+ * buffer. It must be imported to create an imported handle first.
+ *
+ * This function must at least validate the raw handle before creating the
+ * imported handle. It must also support importing the same raw handle
+ * multiple times to create multiple imported handles. The imported handle
+ * must be considered valid everywhere in the process, including in
+ * another instance of the mapper.
+ *
+ * Because of passthrough HALs, a raw buffer handle received from a HAL
+ * may actually have been imported in the process. importBuffer() must treat
+ * such a handle as if it is raw and must not return `BAD_BUFFER`. The
+ * returned handle is independent from the input handle as usual, and
+ * freeBuffer() must be called on it when it is no longer needed.
+ *
+ * @param rawHandle Raw buffer handle to import.
+ * @return error Error status of the call, which may be
+ * - `NONE` upon success.
+ * - `BAD_BUFFER` if the raw handle is invalid.
+ * - `NO_RESOURCES` if the raw handle cannot be imported due to
+ * unavailability of resources.
+ * @return buffer Imported buffer handle that has the type
+ * `buffer_handle_t` which is a handle type.
+ */
+ importBuffer(handle rawHandle) generates (Error error, pointer buffer);
+
+ /**
+ * Frees a buffer handle. Buffer handles returned by importBuffer() must be
+ * freed with this function when no longer needed.
+ *
+ * This function must free up all resources allocated by importBuffer() for
+ * the imported handle. For example, if the imported handle was created
+ * with `native_handle_create()`, this function must call
+ * `native_handle_close()` and `native_handle_delete()`.
+ *
+ * @param buffer Imported buffer handle.
+ * @return error Error status of the call, which may be
+ * - `NONE` upon success.
+ * - `BAD_BUFFER` if the buffer is invalid.
+ */
+ freeBuffer(pointer buffer) generates (Error error);
+
+ /**
+ * Validates that the buffer can be safely accessed by a caller who assumes
+ * the specified @p description and @p stride. This must at least validate
+ * that the buffer size is large enough. Validating the buffer against
+ * individual buffer attributes is optional.
+ *
+ * @param buffer Buffer to validate against.
+ * @param description Attributes of the buffer.
+ * @param stride Stride returned by IAllocator::allocate().
+ * @return error Error status of the call, which may be
+ * - `NONE` upon success.
+ * - `BAD_BUFFER` if the buffer is invalid.
+ * - `BAD_VALUE` if the buffer cannot be safely accessed.
+ */
+ validateBufferSize(pointer buffer,
+ BufferDescriptorInfo description,
+ uint32_t stride)
+ generates (Error error);
+
+ /**
+ * Calculates the transport size of a buffer. An imported buffer handle is a
+ * raw buffer handle with the process-local runtime data appended. This
+ * function, for example, allows a caller to omit the process-local runtime
+ * data at the tail when serializing the imported buffer handle.
+ *
+ * Note that a client might or might not omit the process-local runtime data
+ * when sending an imported buffer handle. The mapper must support both
+ * cases on the receiving end.
+ *
+ * @param buffer Buffer to get the transport size from.
+ * @return error Error status of the call, which may be
+ * - `NONE` upon success.
+ * - `BAD_BUFFER` if the buffer is invalid.
+ * @return numFds The number of file descriptors needed for transport.
+ * @return numInts The number of integers needed for transport.
+ */
+ getTransportSize(pointer buffer)
+ generates (Error error,
+ uint32_t numFds,
+ uint32_t numInts);
+
+ /**
+ * Locks the given buffer for the specified CPU usage.
+ *
+ * Locking the same buffer simultaneously from multiple threads is
+ * permitted, but if any of the threads attempt to lock the buffer for
+ * writing, the behavior is undefined, except that it must not cause
+ * process termination or block the client indefinitely. Leaving the
+ * buffer content in an indeterminate state or returning an error are both
+ * acceptable.
+ *
+ * 1D buffers (width = size in bytes, height = 1, pixel_format = BLOB) must
+ * "lock in place". The buffers must be directly accessible via mapping.
+ *
+ * The client must not modify the content of the buffer outside of
+ * @p accessRegion, and the device need not guarantee that content outside
+ * of @p accessRegion is valid for reading. The result of reading or writing
+ * outside of @p accessRegion is undefined, except that it must not cause
+ * process termination.
+ *
+ * On success, @p data must be filled with a pointer to the locked buffer
+ * memory. This address will represent the top-left corner of the entire
+ * buffer, even if @p accessRegion does not begin at the top-left corner.
+ *
+ * On success, bytesPerPixel must contain the number of bytes per pixel in
+ * the buffer. If the bytesPerPixel is unknown or variable, a value of -1
+ * should be returned. bytesPerStride must contain the bytes per stride of
+ * the buffer. If the bytesPerStride is unknown or variable, a value of -1
+ * should be returned.
+ *
+ * @param buffer Buffer to lock.
+ * @param cpuUsage CPU usage flags to request. See +ndk
+ * libnativewindow#AHardwareBuffer_UsageFlags for possible values.
+ * @param accessRegion Portion of the buffer that the client intends to
+ * access.
+ * @param acquireFence Handle containing a file descriptor referring to a
+ * sync fence object, which will be signaled when it is safe for the
+ * mapper to lock the buffer. @p acquireFence may be an empty fence if
+ * it is already safe to lock.
+ * @return error Error status of the call, which may be
+ * - `NONE` upon success.
+ * - `BAD_BUFFER` if the buffer is invalid or is incompatible with this
+ * function.
+ * - `BAD_VALUE` if @p cpuUsage is 0, contains non-CPU usage flags, or
+ * is incompatible with the buffer.
+ * - `NO_RESOURCES` if the buffer cannot be locked at this time. Note
+ * that locking may succeed at a later time.
+ * @return data CPU-accessible pointer to the buffer data.
+ * @return bytesPerPixel the number of bytes per pixel in the buffer
+ * @return bytesPerStride the number of bytes per stride of the buffer
+ */
+ lock(pointer buffer,
+ uint64_t cpuUsage,
+ Rect accessRegion,
+ handle acquireFence)
+ generates (Error error,
+ pointer data,
+ int32_t bytesPerPixel,
+ int32_t bytesPerStride);
+
+ /**
+ * Locks a YCbCr buffer for the specified CPU usage.
+ *
+ * This is largely the same as lock(), except that instead of returning a
+ * pointer directly to the buffer data, it returns a `YCbCrLayout` struct
+ * describing how to access the data planes.
+ *
+ * This function must work on buffers with
+ * `AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_*` if supported by the device, as well
+ * as with any other formats requested by multimedia codecs when they are
+ * configured with a flexible-YUV-compatible color format.
+ *
+ * @param buffer Buffer to lock.
+ * @param cpuUsage CPU usage flags to request. See +ndk
+ * libnativewindow#AHardwareBuffer_UsageFlags for possible values.
+ * @param accessRegion Portion of the buffer that the client intends to
+ * access.
+ * @param acquireFence Handle containing a file descriptor referring to a
+ * sync fence object, which will be signaled when it is safe for the
+ * mapper to lock the buffer. @p acquireFence may be empty if it is
+ * already safe to lock.
+ * @return error Error status of the call, which may be
+ * - `NONE` upon success.
+ * - `BAD_BUFFER` if the buffer is invalid or is incompatible with this
+ * function.
+ * - `BAD_VALUE` if @p cpuUsage is 0, contains non-CPU usage flags, or
+ * is incompatible with the buffer.
+ * - `NO_RESOURCES` if the buffer cannot be locked at this time. Note
+ * that locking may succeed at a later time.
+ * @return layout Data layout of the locked buffer.
+ */
+ lockYCbCr(pointer buffer,
+ uint64_t cpuUsage,
+ Rect accessRegion,
+ handle acquireFence)
+ generates (Error error,
+ YCbCrLayout layout);
+
+ /**
+ * Unlocks a buffer to indicate all CPU accesses to the buffer have
+ * completed.
+ *
+ * @param buffer Buffer to unlock.
+ * @return error Error status of the call, which may be
+ * - `NONE` upon success.
+ * - `BAD_BUFFER` if the buffer is invalid or not locked.
+ * @return releaseFence Handle containing a file descriptor referring to a
+ * sync fence object. The sync fence object will be signaled when the
+ * mapper has completed any pending work. @p releaseFence may be an
+ * empty fence.
+ */
+ unlock(pointer buffer) generates (Error error, handle releaseFence);
+
+ /**
+ * Test whether the given BufferDescriptorInfo is allocatable.
+ *
+ * If this function returns true, it means that a buffer with the given
+ * description can be allocated on this implementation, unless resource
+ * exhaustion occurs. If this function returns false, it means that the
+ * allocation of the given description will never succeed.
+ *
+ * @param description the description of the buffer
+ * @return supported whether the description is supported
+ */
+ isSupported(BufferDescriptorInfo description)
+ generates (Error error,
+ bool supported);
+
+};
+
diff --git a/graphics/mapper/3.0/types.hal b/graphics/mapper/3.0/types.hal
new file mode 100644
index 0000000..f94abd3
--- /dev/null
+++ b/graphics/mapper/3.0/types.hal
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.graphics.mapper@3.0;
+
+/**
+ * Error values that may be returned by a method of IAllocator or IMapper.
+ */
+enum Error : int32_t {
+ /**
+ * No error.
+ */
+ NONE = 0,
+ /**
+ * Invalid BufferDescriptor.
+ */
+ BAD_DESCRIPTOR = 1,
+ /**
+ * Invalid buffer handle.
+ */
+ BAD_BUFFER = 2,
+ /**
+ * Invalid HardwareBufferDescription.
+ */
+ BAD_VALUE = 3,
+ /**
+ * Resource unavailable.
+ */
+ NO_RESOURCES = 5,
+ /**
+ * Permanent failure.
+ */
+ UNSUPPORTED = 7,
+};
+
+/**
+ * A buffer descriptor is an implementation-defined opaque data returned by
+ * createDescriptor(). It describes the properties of a buffer and is consumed
+ * by the allocator.
+ */
+typedef vec<uint32_t> BufferDescriptor;
+
+/**
+ * Structure for describing YCbCr formats for consumption by applications.
+ * This is used with PixelFormat::YCBCR_*_888.
+ *
+ * Buffer chroma subsampling is defined in the format.
+ * e.g. PixelFormat::YCBCR_420_888 has subsampling 4:2:0.
+ *
+ * Buffers must have a 8 bit depth.
+ *
+ * y, cb, and cr point to the first byte of their respective planes.
+ *
+ * Stride describes the distance in bytes from the first value of one row of
+ * the image to the first value of the next row. It includes the width of the
+ * image plus padding.
+ * yStride is the stride of the luma plane.
+ * cStride is the stride of the chroma planes.
+ *
+ * chromaStep is the distance in bytes from one chroma pixel value to the
+ * next. This is 2 bytes for semiplanar (because chroma values are interleaved
+ * and each chroma value is one byte) and 1 for planar.
+ */
+struct YCbCrLayout {
+ pointer y;
+ pointer cb;
+ pointer cr;
+ uint32_t yStride;
+ uint32_t cStride;
+ uint32_t chromaStep;
+};
diff --git a/graphics/mapper/3.0/utils/OWNERS b/graphics/mapper/3.0/utils/OWNERS
new file mode 100644
index 0000000..96f6d51
--- /dev/null
+++ b/graphics/mapper/3.0/utils/OWNERS
@@ -0,0 +1,3 @@
+# Graphics team
+marissaw@google.com
+stoza@google.com
diff --git a/graphics/mapper/3.0/utils/vts/Android.bp b/graphics/mapper/3.0/utils/vts/Android.bp
new file mode 100644
index 0000000..c3d480a
--- /dev/null
+++ b/graphics/mapper/3.0/utils/vts/Android.bp
@@ -0,0 +1,34 @@
+//
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "android.hardware.graphics.mapper@3.0-vts",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: ["MapperVts.cpp"],
+ cflags: [
+ "-O0",
+ "-g",
+ ],
+ static_libs: [
+ "android.hardware.graphics.allocator@3.0",
+ "android.hardware.graphics.mapper@3.0",
+ ],
+ export_static_lib_headers: [
+ "android.hardware.graphics.allocator@3.0",
+ "android.hardware.graphics.mapper@3.0",
+ ],
+ export_include_dirs: ["include"],
+}
diff --git a/graphics/mapper/3.0/utils/vts/MapperVts.cpp b/graphics/mapper/3.0/utils/vts/MapperVts.cpp
new file mode 100644
index 0000000..f2b7594
--- /dev/null
+++ b/graphics/mapper/3.0/utils/vts/MapperVts.cpp
@@ -0,0 +1,288 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <mapper-vts/3.0/MapperVts.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+namespace android {
+namespace hardware {
+namespace graphics {
+namespace mapper {
+namespace V3_0 {
+namespace vts {
+
+Gralloc::Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName) {
+ init(allocatorServiceName, mapperServiceName);
+}
+
+void Gralloc::init(const std::string& allocatorServiceName, const std::string& mapperServiceName) {
+ mAllocator = ::testing::VtsHalHidlTargetTestBase::getService<IAllocator>(allocatorServiceName);
+ ASSERT_NE(nullptr, mAllocator.get()) << "failed to get allocator service";
+
+ mMapper = ::testing::VtsHalHidlTargetTestBase::getService<IMapper>(mapperServiceName);
+ ASSERT_NE(nullptr, mMapper.get()) << "failed to get mapper service";
+ ASSERT_FALSE(mMapper->isRemote()) << "mapper is not in passthrough mode";
+}
+
+Gralloc::~Gralloc() {
+ for (auto bufferHandle : mClonedBuffers) {
+ auto buffer = const_cast<native_handle_t*>(bufferHandle);
+ native_handle_close(buffer);
+ native_handle_delete(buffer);
+ }
+ mClonedBuffers.clear();
+
+ for (auto bufferHandle : mImportedBuffers) {
+ auto buffer = const_cast<native_handle_t*>(bufferHandle);
+ EXPECT_EQ(Error::NONE, mMapper->freeBuffer(buffer)) << "failed to free buffer " << buffer;
+ }
+ mImportedBuffers.clear();
+}
+
+sp<IAllocator> Gralloc::getAllocator() const {
+ return mAllocator;
+}
+
+std::string Gralloc::dumpDebugInfo() {
+ std::string debugInfo;
+ mAllocator->dumpDebugInfo([&](const auto& tmpDebugInfo) { debugInfo = tmpDebugInfo.c_str(); });
+
+ return debugInfo;
+}
+
+const native_handle_t* Gralloc::cloneBuffer(const hidl_handle& rawHandle) {
+ const native_handle_t* bufferHandle = native_handle_clone(rawHandle.getNativeHandle());
+ EXPECT_NE(nullptr, bufferHandle);
+
+ if (bufferHandle) {
+ mClonedBuffers.insert(bufferHandle);
+ }
+
+ return bufferHandle;
+}
+
+std::vector<const native_handle_t*> Gralloc::allocate(const BufferDescriptor& descriptor,
+ uint32_t count, bool import,
+ uint32_t* outStride) {
+ std::vector<const native_handle_t*> bufferHandles;
+ bufferHandles.reserve(count);
+ mAllocator->allocate(
+ descriptor, count,
+ [&](const auto& tmpError, const auto& tmpStride, const auto& tmpBuffers) {
+ ASSERT_EQ(Error::NONE, tmpError) << "failed to allocate buffers";
+ ASSERT_EQ(count, tmpBuffers.size()) << "invalid buffer array";
+
+ for (uint32_t i = 0; i < count; i++) {
+ if (import) {
+ ASSERT_NO_FATAL_FAILURE(bufferHandles.push_back(importBuffer(tmpBuffers[i])));
+ } else {
+ ASSERT_NO_FATAL_FAILURE(bufferHandles.push_back(cloneBuffer(tmpBuffers[i])));
+ }
+ }
+
+ if (outStride) {
+ *outStride = tmpStride;
+ }
+ });
+
+ if (::testing::Test::HasFatalFailure()) {
+ bufferHandles.clear();
+ }
+
+ return bufferHandles;
+}
+
+const native_handle_t* Gralloc::allocate(const IMapper::BufferDescriptorInfo& descriptorInfo,
+ bool import, uint32_t* outStride) {
+ BufferDescriptor descriptor = createDescriptor(descriptorInfo);
+ if (::testing::Test::HasFatalFailure()) {
+ return nullptr;
+ }
+
+ auto buffers = allocate(descriptor, 1, import, outStride);
+ if (::testing::Test::HasFatalFailure()) {
+ return nullptr;
+ }
+
+ return buffers[0];
+}
+
+sp<IMapper> Gralloc::getMapper() const {
+ return mMapper;
+}
+
+BufferDescriptor Gralloc::createDescriptor(const IMapper::BufferDescriptorInfo& descriptorInfo) {
+ BufferDescriptor descriptor;
+ mMapper->createDescriptor(descriptorInfo, [&](const auto& tmpError, const auto& tmpDescriptor) {
+ ASSERT_EQ(Error::NONE, tmpError) << "failed to create descriptor";
+ descriptor = tmpDescriptor;
+ });
+
+ return descriptor;
+}
+
+const native_handle_t* Gralloc::importBuffer(const hidl_handle& rawHandle) {
+ const native_handle_t* bufferHandle = nullptr;
+ mMapper->importBuffer(rawHandle, [&](const auto& tmpError, const auto& tmpBuffer) {
+ ASSERT_EQ(Error::NONE, tmpError)
+ << "failed to import buffer %p" << rawHandle.getNativeHandle();
+ bufferHandle = static_cast<const native_handle_t*>(tmpBuffer);
+ });
+
+ if (bufferHandle) {
+ mImportedBuffers.insert(bufferHandle);
+ }
+
+ return bufferHandle;
+}
+
+void Gralloc::freeBuffer(const native_handle_t* bufferHandle) {
+ auto buffer = const_cast<native_handle_t*>(bufferHandle);
+
+ if (mImportedBuffers.erase(bufferHandle)) {
+ Error error = mMapper->freeBuffer(buffer);
+ ASSERT_EQ(Error::NONE, error) << "failed to free buffer " << buffer;
+ } else {
+ mClonedBuffers.erase(bufferHandle);
+ native_handle_close(buffer);
+ native_handle_delete(buffer);
+ }
+}
+
+void* Gralloc::lock(const native_handle_t* bufferHandle, uint64_t cpuUsage,
+ const IMapper::Rect& accessRegion, int acquireFence, int32_t* outBytesPerPixel,
+ int32_t* outBytesPerStride) {
+ auto buffer = const_cast<native_handle_t*>(bufferHandle);
+
+ NATIVE_HANDLE_DECLARE_STORAGE(acquireFenceStorage, 1, 0);
+ hidl_handle acquireFenceHandle;
+ if (acquireFence >= 0) {
+ auto h = native_handle_init(acquireFenceStorage, 1, 0);
+ h->data[0] = acquireFence;
+ acquireFenceHandle = h;
+ }
+
+ *outBytesPerPixel = -1;
+ *outBytesPerStride = -1;
+
+ void* data = nullptr;
+ mMapper->lock(buffer, cpuUsage, accessRegion, acquireFenceHandle,
+ [&](const auto& tmpError, const auto& tmpData, int32_t tmpBytesPerPixel,
+ int32_t tmpBytesPerStride) {
+ ASSERT_EQ(Error::NONE, tmpError) << "failed to lock buffer " << buffer;
+ data = tmpData;
+ *outBytesPerPixel = tmpBytesPerPixel;
+ *outBytesPerStride = tmpBytesPerStride;
+ });
+
+ if (acquireFence >= 0) {
+ close(acquireFence);
+ }
+
+ return data;
+}
+
+YCbCrLayout Gralloc::lockYCbCr(const native_handle_t* bufferHandle, uint64_t cpuUsage,
+ const IMapper::Rect& accessRegion, int acquireFence) {
+ auto buffer = const_cast<native_handle_t*>(bufferHandle);
+
+ NATIVE_HANDLE_DECLARE_STORAGE(acquireFenceStorage, 1, 0);
+ hidl_handle acquireFenceHandle;
+ if (acquireFence >= 0) {
+ auto h = native_handle_init(acquireFenceStorage, 1, 0);
+ h->data[0] = acquireFence;
+ acquireFenceHandle = h;
+ }
+
+ YCbCrLayout layout = {};
+ mMapper->lockYCbCr(buffer, cpuUsage, accessRegion, acquireFenceHandle,
+ [&](const auto& tmpError, const auto& tmpLayout) {
+ ASSERT_EQ(Error::NONE, tmpError)
+ << "failed to lockYCbCr buffer " << buffer;
+ layout = tmpLayout;
+ });
+
+ if (acquireFence >= 0) {
+ close(acquireFence);
+ }
+
+ return layout;
+}
+
+int Gralloc::unlock(const native_handle_t* bufferHandle) {
+ auto buffer = const_cast<native_handle_t*>(bufferHandle);
+
+ int releaseFence = -1;
+ mMapper->unlock(buffer, [&](const auto& tmpError, const auto& tmpReleaseFence) {
+ ASSERT_EQ(Error::NONE, tmpError) << "failed to unlock buffer " << buffer;
+
+ auto fenceHandle = tmpReleaseFence.getNativeHandle();
+ if (fenceHandle) {
+ ASSERT_EQ(0, fenceHandle->numInts) << "invalid fence handle " << fenceHandle;
+ if (fenceHandle->numFds == 1) {
+ releaseFence = dup(fenceHandle->data[0]);
+ ASSERT_LT(0, releaseFence) << "failed to dup fence fd";
+ } else {
+ ASSERT_EQ(0, fenceHandle->numFds) << " invalid fence handle " << fenceHandle;
+ }
+ }
+ });
+
+ return releaseFence;
+}
+
+bool Gralloc::validateBufferSize(const native_handle_t* bufferHandle,
+ const IMapper::BufferDescriptorInfo& descriptorInfo,
+ uint32_t stride) {
+ auto buffer = const_cast<native_handle_t*>(bufferHandle);
+
+ Error error = mMapper->validateBufferSize(buffer, descriptorInfo, stride);
+ return error == Error::NONE;
+}
+
+void Gralloc::getTransportSize(const native_handle_t* bufferHandle, uint32_t* outNumFds,
+ uint32_t* outNumInts) {
+ auto buffer = const_cast<native_handle_t*>(bufferHandle);
+
+ *outNumFds = 0;
+ *outNumInts = 0;
+ mMapper->getTransportSize(
+ buffer, [&](const auto& tmpError, const auto& tmpNumFds, const auto& tmpNumInts) {
+ ASSERT_EQ(Error::NONE, tmpError) << "failed to get transport size";
+ ASSERT_GE(bufferHandle->numFds, int(tmpNumFds)) << "invalid numFds " << tmpNumFds;
+ ASSERT_GE(bufferHandle->numInts, int(tmpNumInts)) << "invalid numInts " << tmpNumInts;
+
+ *outNumFds = tmpNumFds;
+ *outNumInts = tmpNumInts;
+ });
+}
+
+bool Gralloc::isSupported(const IMapper::BufferDescriptorInfo& descriptorInfo) {
+ bool supported = false;
+ mMapper->isSupported(descriptorInfo, [&](const auto& tmpError, const auto& tmpSupported) {
+ ASSERT_EQ(Error::NONE, tmpError) << "failed to check is supported";
+ supported = tmpSupported;
+ });
+ return supported;
+}
+
+} // namespace vts
+} // namespace V3_0
+} // namespace mapper
+} // namespace graphics
+} // namespace hardware
+} // namespace android
diff --git a/graphics/mapper/3.0/utils/vts/include/mapper-vts/3.0/MapperVts.h b/graphics/mapper/3.0/utils/vts/include/mapper-vts/3.0/MapperVts.h
new file mode 100644
index 0000000..ba79ca4
--- /dev/null
+++ b/graphics/mapper/3.0/utils/vts/include/mapper-vts/3.0/MapperVts.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <string>
+#include <unordered_set>
+#include <vector>
+
+#include <android/hardware/graphics/allocator/3.0/IAllocator.h>
+#include <android/hardware/graphics/mapper/3.0/IMapper.h>
+#include <utils/StrongPointer.h>
+
+namespace android {
+namespace hardware {
+namespace graphics {
+namespace mapper {
+namespace V3_0 {
+namespace vts {
+
+using android::hardware::graphics::allocator::V3_0::IAllocator;
+
+// A wrapper to IAllocator and IMapper.
+class Gralloc {
+ public:
+ Gralloc(const std::string& allocatorServiceName = "default",
+ const std::string& mapperServiceName = "default");
+ ~Gralloc();
+
+ // IAllocator methods
+
+ sp<IAllocator> getAllocator() const;
+
+ std::string dumpDebugInfo();
+
+ // When import is false, this simply calls IAllocator::allocate. When import
+ // is true, the returned buffers are also imported into the mapper.
+ //
+ // Either case, the returned buffers must be freed with freeBuffer.
+ std::vector<const native_handle_t*> allocate(const BufferDescriptor& descriptor, uint32_t count,
+ bool import = true, uint32_t* outStride = nullptr);
+ const native_handle_t* allocate(const IMapper::BufferDescriptorInfo& descriptorInfo,
+ bool import = true, uint32_t* outStride = nullptr);
+
+ // IMapper methods
+
+ sp<IMapper> getMapper() const;
+
+ BufferDescriptor createDescriptor(const IMapper::BufferDescriptorInfo& descriptorInfo);
+
+ const native_handle_t* importBuffer(const hidl_handle& rawHandle);
+ void freeBuffer(const native_handle_t* bufferHandle);
+
+ // We use fd instead of hidl_handle in these functions to pass fences
+ // in and out of the mapper. The ownership of the fd is always transferred
+ // with each of these functions.
+ void* lock(const native_handle_t* bufferHandle, uint64_t cpuUsage,
+ const IMapper::Rect& accessRegion, int acquireFence, int32_t* outBytesPerPixel,
+ int32_t* outBytesPerStride);
+ YCbCrLayout lockYCbCr(const native_handle_t* bufferHandle, uint64_t cpuUsage,
+ const IMapper::Rect& accessRegion, int acquireFence);
+ int unlock(const native_handle_t* bufferHandle);
+
+ bool validateBufferSize(const native_handle_t* bufferHandle,
+ const IMapper::BufferDescriptorInfo& descriptorInfo, uint32_t stride);
+ void getTransportSize(const native_handle_t* bufferHandle, uint32_t* outNumFds,
+ uint32_t* outNumInts);
+
+ bool isSupported(const IMapper::BufferDescriptorInfo& descriptorInfo);
+
+ private:
+ void init(const std::string& allocatorServiceName, const std::string& mapperServiceName);
+ const native_handle_t* cloneBuffer(const hidl_handle& rawHandle);
+
+ sp<IAllocator> mAllocator;
+ sp<IMapper> mMapper;
+
+ // Keep track of all cloned and imported handles. When a test fails with
+ // ASSERT_*, the destructor will free the handles for the test.
+ std::unordered_set<const native_handle_t*> mClonedBuffers;
+ std::unordered_set<const native_handle_t*> mImportedBuffers;
+};
+
+} // namespace vts
+} // namespace V3_0
+} // namespace mapper
+} // namespace graphics
+} // namespace hardware
+} // namespace android
diff --git a/graphics/mapper/3.0/vts/OWNERS b/graphics/mapper/3.0/vts/OWNERS
new file mode 100644
index 0000000..96f6d51
--- /dev/null
+++ b/graphics/mapper/3.0/vts/OWNERS
@@ -0,0 +1,3 @@
+# Graphics team
+marissaw@google.com
+stoza@google.com
diff --git a/graphics/mapper/3.0/vts/functional/Android.bp b/graphics/mapper/3.0/vts/functional/Android.bp
new file mode 100644
index 0000000..77075a5
--- /dev/null
+++ b/graphics/mapper/3.0/vts/functional/Android.bp
@@ -0,0 +1,30 @@
+//
+// Copyright 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+ name: "VtsHalGraphicsMapperV3_0TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: ["VtsHalGraphicsMapperV3_0TargetTest.cpp"],
+ static_libs: [
+ "android.hardware.graphics.allocator@3.0",
+ "android.hardware.graphics.common@1.0",
+ "android.hardware.graphics.common@1.1",
+ "android.hardware.graphics.common@1.2",
+ "android.hardware.graphics.mapper@3.0",
+ "android.hardware.graphics.mapper@3.0-vts",
+ ],
+ test_suites: ["general-tests"],
+}
diff --git a/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp b/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp
new file mode 100644
index 0000000..cfae635
--- /dev/null
+++ b/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp
@@ -0,0 +1,493 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "VtsHalGraphicsMapperV3_0TargetTest"
+
+#include <chrono>
+#include <thread>
+#include <vector>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <android-base/logging.h>
+#include <mapper-vts/3.0/MapperVts.h>
+
+namespace android {
+namespace hardware {
+namespace graphics {
+namespace mapper {
+namespace V3_0 {
+namespace vts {
+namespace {
+
+using android::hardware::graphics::common::V1_0::BufferUsage;
+using android::hardware::graphics::common::V1_1::PixelFormat;
+
+// Test environment for graphics.mapper.
+class GraphicsMapperHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static GraphicsMapperHidlEnvironment* Instance() {
+ static GraphicsMapperHidlEnvironment* instance = new GraphicsMapperHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override {
+ registerTestService<IAllocator>();
+ registerTestService<IMapper>();
+ }
+};
+
+class GraphicsMapperHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ protected:
+ void SetUp() override {
+ ASSERT_NO_FATAL_FAILURE(
+ mGralloc = std::make_unique<Gralloc>(
+ GraphicsMapperHidlEnvironment::Instance()->getServiceName<IAllocator>(),
+ GraphicsMapperHidlEnvironment::Instance()->getServiceName<IMapper>()));
+
+ mDummyDescriptorInfo.width = 64;
+ mDummyDescriptorInfo.height = 64;
+ mDummyDescriptorInfo.layerCount = 1;
+ mDummyDescriptorInfo.format = PixelFormat::RGBA_8888;
+ mDummyDescriptorInfo.usage =
+ static_cast<uint64_t>(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN);
+ }
+
+ void TearDown() override {}
+
+ std::unique_ptr<Gralloc> mGralloc;
+ IMapper::BufferDescriptorInfo mDummyDescriptorInfo{};
+};
+
+/**
+ * Test IAllocator::dumpDebugInfo by calling it.
+ */
+TEST_F(GraphicsMapperHidlTest, AllocatorDumpDebugInfo) {
+ mGralloc->dumpDebugInfo();
+}
+
+/**
+ * Test IAllocator::allocate with valid buffer descriptors.
+ */
+TEST_F(GraphicsMapperHidlTest, AllocatorAllocate) {
+ BufferDescriptor descriptor;
+ ASSERT_NO_FATAL_FAILURE(descriptor = mGralloc->createDescriptor(mDummyDescriptorInfo));
+
+ for (uint32_t count = 0; count < 5; count++) {
+ std::vector<const native_handle_t*> bufferHandles;
+ uint32_t stride;
+ ASSERT_NO_FATAL_FAILURE(bufferHandles =
+ mGralloc->allocate(descriptor, count, false, &stride));
+
+ if (count >= 1) {
+ EXPECT_LE(mDummyDescriptorInfo.width, stride) << "invalid buffer stride";
+ }
+
+ for (auto bufferHandle : bufferHandles) {
+ mGralloc->freeBuffer(bufferHandle);
+ }
+ }
+}
+
+/**
+ * Test IAllocator::allocate with invalid buffer descriptors.
+ */
+TEST_F(GraphicsMapperHidlTest, AllocatorAllocateNegative) {
+ // this assumes any valid descriptor is non-empty
+ BufferDescriptor descriptor;
+ mGralloc->getAllocator()->allocate(descriptor, 1,
+ [&](const auto& tmpError, const auto&, const auto&) {
+ EXPECT_EQ(Error::BAD_DESCRIPTOR, tmpError);
+ });
+}
+
+/**
+ * Test IAllocator::allocate does not leak.
+ */
+TEST_F(GraphicsMapperHidlTest, AllocatorAllocateNoLeak) {
+ auto info = mDummyDescriptorInfo;
+ info.width = 1024;
+ info.height = 1024;
+
+ for (int i = 0; i < 2048; i++) {
+ auto bufferHandle = mGralloc->allocate(info, false);
+ mGralloc->freeBuffer(bufferHandle);
+ }
+}
+
+/**
+ * Test that IAllocator::allocate is thread-safe.
+ */
+TEST_F(GraphicsMapperHidlTest, AllocatorAllocateThreaded) {
+ BufferDescriptor descriptor;
+ ASSERT_NO_FATAL_FAILURE(descriptor = mGralloc->createDescriptor(mDummyDescriptorInfo));
+
+ std::atomic<bool> timeUp(false);
+ std::atomic<uint64_t> allocationCount(0);
+ auto threadLoop = [&]() {
+ while (!timeUp) {
+ mGralloc->getAllocator()->allocate(
+ descriptor, 1, [&](const auto&, const auto&, const auto&) { allocationCount++; });
+ }
+ };
+
+ std::vector<std::thread> threads;
+ for (int i = 0; i < 8; i++) {
+ threads.push_back(std::thread(threadLoop));
+ }
+
+ std::this_thread::sleep_for(std::chrono::seconds(3));
+ timeUp = true;
+ LOG(VERBOSE) << "Made " << allocationCount << " threaded allocations";
+
+ for (auto& thread : threads) {
+ thread.join();
+ }
+}
+
+/**
+ * Test IMapper::createDescriptor with valid descriptor info.
+ */
+TEST_F(GraphicsMapperHidlTest, CreateDescriptorBasic) {
+ ASSERT_NO_FATAL_FAILURE(mGralloc->createDescriptor(mDummyDescriptorInfo));
+}
+
+/**
+ * Test IMapper::createDescriptor with invalid descriptor info.
+ */
+TEST_F(GraphicsMapperHidlTest, CreateDescriptorNegative) {
+ auto info = mDummyDescriptorInfo;
+ info.width = 0;
+ mGralloc->getMapper()->createDescriptor(info, [&](const auto& tmpError, const auto&) {
+ EXPECT_EQ(Error::BAD_VALUE, tmpError) << "createDescriptor did not fail with BAD_VALUE";
+ });
+}
+
+/**
+ * Test IMapper::importBuffer and IMapper::freeBuffer with allocated buffers.
+ */
+TEST_F(GraphicsMapperHidlTest, ImportFreeBufferBasic) {
+ const native_handle_t* bufferHandle;
+ ASSERT_NO_FATAL_FAILURE(bufferHandle = mGralloc->allocate(mDummyDescriptorInfo, true));
+ ASSERT_NO_FATAL_FAILURE(mGralloc->freeBuffer(bufferHandle));
+}
+
+/**
+ * Test IMapper::importBuffer and IMapper::freeBuffer with cloned buffers.
+ */
+TEST_F(GraphicsMapperHidlTest, ImportFreeBufferClone) {
+ const native_handle_t* clonedBufferHandle;
+ ASSERT_NO_FATAL_FAILURE(clonedBufferHandle = mGralloc->allocate(mDummyDescriptorInfo, false));
+
+ // A cloned handle is a raw handle. Check that we can import it multiple
+ // times.
+ const native_handle_t* importedBufferHandles[2];
+ ASSERT_NO_FATAL_FAILURE(importedBufferHandles[0] = mGralloc->importBuffer(clonedBufferHandle));
+ ASSERT_NO_FATAL_FAILURE(importedBufferHandles[1] = mGralloc->importBuffer(clonedBufferHandle));
+ ASSERT_NO_FATAL_FAILURE(mGralloc->freeBuffer(importedBufferHandles[0]));
+ ASSERT_NO_FATAL_FAILURE(mGralloc->freeBuffer(importedBufferHandles[1]));
+
+ ASSERT_NO_FATAL_FAILURE(mGralloc->freeBuffer(clonedBufferHandle));
+}
+
+/**
+ * Test IMapper::importBuffer and IMapper::freeBuffer cross mapper instances.
+ */
+TEST_F(GraphicsMapperHidlTest, ImportFreeBufferSingleton) {
+ const native_handle_t* rawHandle;
+ ASSERT_NO_FATAL_FAILURE(rawHandle = mGralloc->allocate(mDummyDescriptorInfo, false));
+
+ native_handle_t* importedHandle = nullptr;
+ mGralloc->getMapper()->importBuffer(rawHandle, [&](const auto& tmpError, const auto& buffer) {
+ ASSERT_EQ(Error::NONE, tmpError);
+ importedHandle = static_cast<native_handle_t*>(buffer);
+ });
+
+ // free the imported handle with another mapper
+ std::unique_ptr<Gralloc> anotherGralloc;
+ ASSERT_NO_FATAL_FAILURE(
+ anotherGralloc = std::make_unique<Gralloc>(
+ GraphicsMapperHidlEnvironment::Instance()->getServiceName<IAllocator>(),
+ GraphicsMapperHidlEnvironment::Instance()->getServiceName<IMapper>()));
+ Error error = mGralloc->getMapper()->freeBuffer(importedHandle);
+ ASSERT_EQ(Error::NONE, error);
+
+ ASSERT_NO_FATAL_FAILURE(mGralloc->freeBuffer(rawHandle));
+}
+
+/**
+ * Test IMapper::importBuffer and IMapper::freeBuffer do not leak.
+ */
+TEST_F(GraphicsMapperHidlTest, ImportFreeBufferNoLeak) {
+ auto info = mDummyDescriptorInfo;
+ info.width = 1024;
+ info.height = 1024;
+
+ for (int i = 0; i < 2048; i++) {
+ auto bufferHandle = mGralloc->allocate(info, true);
+ mGralloc->freeBuffer(bufferHandle);
+ }
+}
+
+/**
+ * Test IMapper::importBuffer with invalid buffers.
+ */
+TEST_F(GraphicsMapperHidlTest, ImportBufferNegative) {
+ native_handle_t* invalidHandle = nullptr;
+ mGralloc->getMapper()->importBuffer(invalidHandle, [&](const auto& tmpError, const auto&) {
+ EXPECT_EQ(Error::BAD_BUFFER, tmpError)
+ << "importBuffer with nullptr did not fail with BAD_BUFFER";
+ });
+
+ invalidHandle = native_handle_create(0, 0);
+ mGralloc->getMapper()->importBuffer(invalidHandle, [&](const auto& tmpError, const auto&) {
+ EXPECT_EQ(Error::BAD_BUFFER, tmpError)
+ << "importBuffer with invalid handle did not fail with BAD_BUFFER";
+ });
+ native_handle_delete(invalidHandle);
+}
+
+/**
+ * Test IMapper::freeBuffer with invalid buffers.
+ */
+TEST_F(GraphicsMapperHidlTest, FreeBufferNegative) {
+ native_handle_t* invalidHandle = nullptr;
+ Error error = mGralloc->getMapper()->freeBuffer(invalidHandle);
+ EXPECT_EQ(Error::BAD_BUFFER, error) << "freeBuffer with nullptr did not fail with BAD_BUFFER";
+
+ invalidHandle = native_handle_create(0, 0);
+ error = mGralloc->getMapper()->freeBuffer(invalidHandle);
+ EXPECT_EQ(Error::BAD_BUFFER, error)
+ << "freeBuffer with invalid handle did not fail with BAD_BUFFER";
+ native_handle_delete(invalidHandle);
+
+ const native_handle_t* clonedBufferHandle;
+ ASSERT_NO_FATAL_FAILURE(clonedBufferHandle = mGralloc->allocate(mDummyDescriptorInfo, false));
+ error = mGralloc->getMapper()->freeBuffer(invalidHandle);
+ EXPECT_EQ(Error::BAD_BUFFER, error)
+ << "freeBuffer with un-imported handle did not fail with BAD_BUFFER";
+
+ mGralloc->freeBuffer(clonedBufferHandle);
+}
+
+/**
+ * Test IMapper::lock and IMapper::unlock.
+ */
+TEST_F(GraphicsMapperHidlTest, LockUnlockBasic) {
+ const auto& info = mDummyDescriptorInfo;
+
+ const native_handle_t* bufferHandle;
+ uint32_t stride;
+ ASSERT_NO_FATAL_FAILURE(bufferHandle = mGralloc->allocate(info, true, &stride));
+
+ // lock buffer for writing
+ const IMapper::Rect region{0, 0, static_cast<int32_t>(info.width),
+ static_cast<int32_t>(info.height)};
+ int fence = -1;
+ uint8_t* data;
+ int32_t bytesPerPixel = -1;
+ int32_t bytesPerStride = -1;
+ ASSERT_NO_FATAL_FAILURE(
+ data = static_cast<uint8_t*>(mGralloc->lock(bufferHandle, info.usage, region, fence,
+ &bytesPerPixel, &bytesPerStride)));
+
+ // Valid return values are -1 for unsupported or the number bytes for supported which is >=0
+ EXPECT_GT(bytesPerPixel, -1);
+ EXPECT_GT(bytesPerStride, -1);
+
+ // RGBA_8888
+ size_t strideInBytes = stride * 4;
+ size_t writeInBytes = info.width * 4;
+
+ for (uint32_t y = 0; y < info.height; y++) {
+ memset(data, y, writeInBytes);
+ data += strideInBytes;
+ }
+
+ ASSERT_NO_FATAL_FAILURE(fence = mGralloc->unlock(bufferHandle));
+
+ bytesPerPixel = -1;
+ bytesPerStride = -1;
+
+ // lock again for reading
+ ASSERT_NO_FATAL_FAILURE(
+ data = static_cast<uint8_t*>(mGralloc->lock(bufferHandle, info.usage, region, fence,
+ &bytesPerPixel, &bytesPerStride)));
+ for (uint32_t y = 0; y < info.height; y++) {
+ for (size_t i = 0; i < writeInBytes; i++) {
+ EXPECT_EQ(static_cast<uint8_t>(y), data[i]);
+ }
+ data += strideInBytes;
+ }
+
+ EXPECT_GT(bytesPerPixel, -1);
+ EXPECT_GT(bytesPerStride, -1);
+
+ ASSERT_NO_FATAL_FAILURE(fence = mGralloc->unlock(bufferHandle));
+ if (fence >= 0) {
+ close(fence);
+ }
+}
+
+/**
+ * Test IMapper::lockYCbCr. This locks a YV12 buffer, and makes sure we can
+ * write to and read from it.
+ */
+TEST_F(GraphicsMapperHidlTest, LockYCbCrBasic) {
+ auto info = mDummyDescriptorInfo;
+ info.format = PixelFormat::YV12;
+
+ const native_handle_t* bufferHandle;
+ uint32_t stride;
+ ASSERT_NO_FATAL_FAILURE(bufferHandle = mGralloc->allocate(info, true, &stride));
+
+ // lock buffer for writing
+ const IMapper::Rect region{0, 0, static_cast<int32_t>(info.width),
+ static_cast<int32_t>(info.height)};
+ int fence = -1;
+ YCbCrLayout layout;
+ ASSERT_NO_FATAL_FAILURE(layout = mGralloc->lockYCbCr(bufferHandle, info.usage, region, fence));
+
+ auto yData = static_cast<uint8_t*>(layout.y);
+ auto cbData = static_cast<uint8_t*>(layout.cb);
+ auto crData = static_cast<uint8_t*>(layout.cr);
+ for (uint32_t y = 0; y < info.height; y++) {
+ for (uint32_t x = 0; x < info.width; x++) {
+ auto val = static_cast<uint8_t>(info.height * y + x);
+
+ yData[layout.yStride * y + x] = val;
+ if (y % 2 == 0 && x % 2 == 0) {
+ cbData[layout.cStride * y / 2 + x / 2] = val;
+ crData[layout.cStride * y / 2 + x / 2] = val;
+ }
+ }
+ }
+
+ ASSERT_NO_FATAL_FAILURE(fence = mGralloc->unlock(bufferHandle));
+
+ // lock again for reading
+ ASSERT_NO_FATAL_FAILURE(layout = mGralloc->lockYCbCr(bufferHandle, info.usage, region, fence));
+
+ yData = static_cast<uint8_t*>(layout.y);
+ cbData = static_cast<uint8_t*>(layout.cb);
+ crData = static_cast<uint8_t*>(layout.cr);
+ for (uint32_t y = 0; y < info.height; y++) {
+ for (uint32_t x = 0; x < info.width; x++) {
+ auto val = static_cast<uint8_t>(info.height * y + x);
+
+ EXPECT_EQ(val, yData[layout.yStride * y + x]);
+ if (y % 2 == 0 && x % 2 == 0) {
+ EXPECT_EQ(val, cbData[layout.cStride * y / 2 + x / 2]);
+ EXPECT_EQ(val, crData[layout.cStride * y / 2 + x / 2]);
+ }
+ }
+ }
+
+ ASSERT_NO_FATAL_FAILURE(fence = mGralloc->unlock(bufferHandle));
+ if (fence >= 0) {
+ close(fence);
+ }
+}
+
+/**
+ * Test IMapper::unlock with invalid buffers.
+ */
+TEST_F(GraphicsMapperHidlTest, UnlockNegative) {
+ native_handle_t* invalidHandle = nullptr;
+ mGralloc->getMapper()->unlock(invalidHandle, [&](const auto& tmpError, const auto&) {
+ EXPECT_EQ(Error::BAD_BUFFER, tmpError)
+ << "unlock with nullptr did not fail with BAD_BUFFER";
+ });
+
+ invalidHandle = native_handle_create(0, 0);
+ mGralloc->getMapper()->unlock(invalidHandle, [&](const auto& tmpError, const auto&) {
+ EXPECT_EQ(Error::BAD_BUFFER, tmpError)
+ << "unlock with invalid handle did not fail with BAD_BUFFER";
+ });
+ native_handle_delete(invalidHandle);
+
+ ASSERT_NO_FATAL_FAILURE(invalidHandle = const_cast<native_handle_t*>(
+ mGralloc->allocate(mDummyDescriptorInfo, false)));
+ mGralloc->getMapper()->unlock(invalidHandle, [&](const auto& tmpError, const auto&) {
+ EXPECT_EQ(Error::BAD_BUFFER, tmpError)
+ << "unlock with un-imported handle did not fail with BAD_BUFFER";
+ });
+ mGralloc->freeBuffer(invalidHandle);
+
+// disabled as it fails on many existing drivers
+#if 0
+ ASSERT_NO_FATAL_FAILURE(invalidHandle = const_cast<native_handle_t*>(
+ mGralloc->allocate(mDummyDescriptorInfo, true)));
+ mGralloc->getMapper()->unlock(
+ invalidHandle, [&](const auto& tmpError, const auto&) {
+ EXPECT_EQ(Error::BAD_BUFFER, tmpError)
+ << "unlock with unlocked handle did not fail with BAD_BUFFER";
+ });
+ mGralloc->freeBuffer(invalidHandle);
+#endif
+}
+
+/**
+ * Test IMapper::isSupported with required format RGBA_8888
+ */
+TEST_F(GraphicsMapperHidlTest, IsSupportedRGBA8888) {
+ const auto& info = mDummyDescriptorInfo;
+ bool supported = false;
+
+ ASSERT_NO_FATAL_FAILURE(supported = mGralloc->isSupported(info));
+ ASSERT_TRUE(supported);
+}
+
+/**
+ * Test IMapper::isSupported with required format YV12
+ */
+TEST_F(GraphicsMapperHidlTest, IsSupportedYV12) {
+ auto info = mDummyDescriptorInfo;
+ info.format = PixelFormat::YV12;
+ bool supported = false;
+
+ ASSERT_NO_FATAL_FAILURE(supported = mGralloc->isSupported(info));
+ ASSERT_TRUE(supported);
+}
+
+/**
+ * Test IMapper::isSupported with optional format Y16
+ */
+TEST_F(GraphicsMapperHidlTest, IsSupportedY16) {
+ auto info = mDummyDescriptorInfo;
+ info.format = PixelFormat::Y16;
+ bool supported = false;
+
+ ASSERT_NO_FATAL_FAILURE(supported = mGralloc->isSupported(info));
+}
+
+} // namespace
+} // namespace vts
+} // namespace V3_0
+} // namespace mapper
+} // namespace graphics
+} // namespace hardware
+} // namespace android
+
+int main(int argc, char** argv) {
+ using android::hardware::graphics::mapper::V3_0::vts::GraphicsMapperHidlEnvironment;
+ ::testing::AddGlobalTestEnvironment(GraphicsMapperHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ GraphicsMapperHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
+}
diff --git a/health/1.0/default/android.hardware.health@1.0-service.rc b/health/1.0/default/android.hardware.health@1.0-service.rc
index d74a07e..405784f 100644
--- a/health/1.0/default/android.hardware.health@1.0-service.rc
+++ b/health/1.0/default/android.hardware.health@1.0-service.rc
@@ -2,3 +2,4 @@
class hal
user system
group system
+ capabilities WAKE_ALARM
diff --git a/health/2.0/README.md b/health/2.0/README.md
index bdfb5a3..58ea9e3 100644
--- a/health/2.0/README.md
+++ b/health/2.0/README.md
@@ -67,6 +67,7 @@
class hal
user system
group system
+ capabilities WAKE_ALARM
file /dev/kmsg w
```
diff --git a/health/storage/1.0/default/android.hardware.health.storage@1.0-service.rc b/health/storage/1.0/default/android.hardware.health.storage@1.0-service.rc
index c6a1425..d5e1a29 100644
--- a/health/storage/1.0/default/android.hardware.health.storage@1.0-service.rc
+++ b/health/storage/1.0/default/android.hardware.health.storage@1.0-service.rc
@@ -1,5 +1,7 @@
service vendor.health-storage-hal-1-0 /vendor/bin/hw/android.hardware.health.storage@1.0-service
interface android.hardware.health.storage@1.0::IStorage default
+ oneshot
+ disabled
class hal
user system
group system
diff --git a/health/storage/1.0/default/service.cpp b/health/storage/1.0/default/service.cpp
index a945033..f4296f1 100644
--- a/health/storage/1.0/default/service.cpp
+++ b/health/storage/1.0/default/service.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <hidl/HidlLazyUtils.h>
#include <hidl/HidlTransportSupport.h>
#include "Storage.h"
@@ -23,6 +24,7 @@
using android::UNKNOWN_ERROR;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
+using android::hardware::LazyServiceRegistrar;
using android::hardware::health::storage::V1_0::IStorage;
using android::hardware::health::storage::V1_0::implementation::Storage;
@@ -30,7 +32,8 @@
configureRpcThreadpool(1, true);
sp<IStorage> service = new Storage();
- status_t result = service->registerAsService();
+ LazyServiceRegistrar registrar;
+ status_t result = registrar.registerService(service);
if (result != OK) {
return result;
diff --git a/input/classifier/1.0/Android.bp b/input/classifier/1.0/Android.bp
new file mode 100644
index 0000000..c3c6fc6
--- /dev/null
+++ b/input/classifier/1.0/Android.bp
@@ -0,0 +1,35 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.input.classifier@1.0",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "types.hal",
+ "IInputClassifier.hal",
+ ],
+ interfaces: [
+ "android.hidl.base@1.0",
+ ],
+ types: [
+ "Action",
+ "Axis",
+ "Button",
+ "Classification",
+ "EdgeFlag",
+ "Flag",
+ "Meta",
+ "MotionEvent",
+ "PointerCoords",
+ "PointerProperties",
+ "PolicyFlag",
+ "Source",
+ "SourceClass",
+ "ToolType",
+ "VideoFrame",
+ ],
+ gen_java: true,
+}
+
diff --git a/input/classifier/1.0/IInputClassifier.hal b/input/classifier/1.0/IInputClassifier.hal
new file mode 100644
index 0000000..edc1138
--- /dev/null
+++ b/input/classifier/1.0/IInputClassifier.hal
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.input.classifier@1.0;
+
+interface IInputClassifier {
+
+ /**
+ * Returns the classification for the current sequence of input events.
+ */
+ classify(MotionEvent event) generates (Classification classification);
+
+};
diff --git a/input/classifier/1.0/default/Android.bp b/input/classifier/1.0/default/Android.bp
new file mode 100644
index 0000000..ddd883c
--- /dev/null
+++ b/input/classifier/1.0/default/Android.bp
@@ -0,0 +1,23 @@
+cc_binary {
+ name: "android.hardware.input.classifier@1.0-service-example",
+ init_rc: ["android.hardware.input.classifier@1.0-service-example.rc"],
+ relative_install_path: "hw",
+ vendor: true,
+ vintf_fragments: ["manifest_input.classifier.xml"],
+ srcs: [
+ "InputClassifier.cpp",
+ "service.cpp",
+ ],
+ shared_libs: [
+ "android.hardware.input.classifier@1.0",
+ "libhidlbase",
+ "libhidltransport",
+ "liblog",
+ "libutils",
+ ],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wextra",
+ ],
+}
diff --git a/input/classifier/1.0/default/InputClassifier.cpp b/input/classifier/1.0/default/InputClassifier.cpp
new file mode 100644
index 0000000..c463361
--- /dev/null
+++ b/input/classifier/1.0/default/InputClassifier.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "InputClassifierHAL"
+
+#include "InputClassifier.h"
+#include <inttypes.h>
+#include <log/log.h>
+#include <utils/Timers.h>
+
+using namespace android::hardware::input::classifier::V1_0;
+
+namespace android {
+namespace hardware {
+namespace input {
+namespace classifier {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::input::classifier::V1_0::IInputClassifier follow.
+Return<Classification> InputClassifier::classify(const MotionEvent& event) {
+ /**
+ * In this example implementation, we will see how many "pixels" inside the video frame
+ * exceed the value of 250. If more than 6 such pixels are present, then treat the event
+ * as a "DEEP_PRESS".
+ */
+ if (event.frames.size() == 0) {
+ return Classification::NONE;
+ }
+ ALOGI("Frame(O) timestamp = %" PRIu64 ", received %zu frame(s)", event.frames[0].timestamp,
+ event.frames.size());
+ for (const VideoFrame& frame : event.frames) {
+ size_t count = 0;
+ for (size_t i = 0; i < frame.data.size(); i++) {
+ if (frame.data[i] > 250) {
+ count++;
+ }
+ }
+ if (count > 6) {
+ return Classification::DEEP_PRESS;
+ }
+ }
+
+ return Classification::NONE;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace classifier
+} // namespace input
+} // namespace hardware
+} // namespace android
diff --git a/input/classifier/1.0/default/InputClassifier.h b/input/classifier/1.0/default/InputClassifier.h
new file mode 100644
index 0000000..0858ecb
--- /dev/null
+++ b/input/classifier/1.0/default/InputClassifier.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_INPUT_CLASSIFIER_V1_0_INPUTCLASSIFIER_H
+#define ANDROID_HARDWARE_INPUT_CLASSIFIER_V1_0_INPUTCLASSIFIER_H
+
+#include <android/hardware/input/classifier/1.0/IInputClassifier.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace input {
+namespace classifier {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::Return;
+
+struct InputClassifier : public IInputClassifier {
+ // Methods from ::android::hardware::input::classifier::V1_0::IInputClassifier follow.
+ Return<Classification> classify(
+ const ::android::hardware::input::classifier::V1_0::MotionEvent& event) override;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace classifier
+} // namespace input
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_INPUT_CLASSIFIER_V1_0_INPUTCLASSIFIER_H
diff --git a/input/classifier/1.0/default/android.hardware.input.classifier@1.0-service-example.rc b/input/classifier/1.0/default/android.hardware.input.classifier@1.0-service-example.rc
new file mode 100644
index 0000000..f799bf4
--- /dev/null
+++ b/input/classifier/1.0/default/android.hardware.input.classifier@1.0-service-example.rc
@@ -0,0 +1,9 @@
+service vendor.input.classifier-1-0 /vendor/bin/hw/android.hardware.input.classifier@1.0-service-example
+ # Must be specified if "disabled" is set. This HAL will only start if requested via getService
+ interface android.hardware.input.classifier@1.0::IInputClassifier default
+ class hal
+ user nobody
+ # will not be restarted if it exits until it is requested to be restarted
+ oneshot
+ # will only be started when requested
+ disabled
diff --git a/input/classifier/1.0/default/manifest_input.classifier.xml b/input/classifier/1.0/default/manifest_input.classifier.xml
new file mode 100644
index 0000000..8634169
--- /dev/null
+++ b/input/classifier/1.0/default/manifest_input.classifier.xml
@@ -0,0 +1,11 @@
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>android.hardware.input.classifier</name>
+ <transport>hwbinder</transport>
+ <version>1.0</version>
+ <interface>
+ <name>IInputClassifier</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+</manifest>
diff --git a/input/classifier/1.0/default/service.cpp b/input/classifier/1.0/default/service.cpp
new file mode 100644
index 0000000..6ef2118
--- /dev/null
+++ b/input/classifier/1.0/default/service.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "android.hardware.input.classifier@1.0"
+
+#include <inttypes.h>
+
+#include <hidl/HidlTransportSupport.h>
+#include <log/log.h>
+
+#include "InputClassifier.h"
+#include "android/hardware/input/classifier/1.0/IInputClassifier.h"
+
+using android::sp;
+using android::status_t;
+using android::hardware::configureRpcThreadpool;
+using android::hardware::joinRpcThreadpool;
+using android::hardware::input::classifier::V1_0::IInputClassifier;
+using android::hardware::input::classifier::V1_0::implementation::InputClassifier;
+
+int main() {
+ sp<IInputClassifier> classifier = new InputClassifier();
+
+ configureRpcThreadpool(1, true);
+ const status_t status = classifier->registerAsService();
+
+ if (status != android::OK) {
+ ALOGE("Could not register InputClassifier HAL!");
+ return EXIT_FAILURE; // or handle error
+ }
+
+ joinRpcThreadpool();
+ LOG_ALWAYS_FATAL("Under normal operation, joinRpcThreadpool should never return");
+ return EXIT_FAILURE;
+}
diff --git a/input/classifier/1.0/types.hal b/input/classifier/1.0/types.hal
new file mode 100644
index 0000000..244ecd9
--- /dev/null
+++ b/input/classifier/1.0/types.hal
@@ -0,0 +1,829 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.input.classifier@1.0;
+
+
+/**
+ * Constants that identify each individual axis of a motion event.
+ */
+enum Axis : uint64_t {
+ /**
+ * Axis constant: X axis of a motion event.
+ *
+ * - For a touch screen, reports the absolute X screen position of the center of
+ * the touch contact area. The units are display pixels.
+ * - For a touch pad, reports the absolute X surface position of the center of the touch
+ * contact area. The units are device-dependent.
+ * - For a mouse, reports the absolute X screen position of the mouse pointer.
+ * The units are display pixels.
+ * - For a trackball, reports the relative horizontal displacement of the trackball.
+ * The value is normalized to a range from -1.0 (left) to 1.0 (right).
+ * - For a joystick, reports the absolute X position of the joystick.
+ * The value is normalized to a range from -1.0 (left) to 1.0 (right).
+ */
+ X = 0,
+ /**
+ * Axis constant: Y axis of a motion event.
+ *
+ * - For a touch screen, reports the absolute Y screen position of the center of
+ * the touch contact area. The units are display pixels.
+ * - For a touch pad, reports the absolute Y surface position of the center of the touch
+ * contact area. The units are device-dependent.
+ * - For a mouse, reports the absolute Y screen position of the mouse pointer.
+ * The units are display pixels.
+ * - For a trackball, reports the relative vertical displacement of the trackball.
+ * The value is normalized to a range from -1.0 (up) to 1.0 (down).
+ * - For a joystick, reports the absolute Y position of the joystick.
+ * The value is normalized to a range from -1.0 (up or far) to 1.0 (down or near).
+ */
+ Y = 1,
+ /**
+ * Axis constant: Pressure axis of a motion event.
+ *
+ * - For a touch screen or touch pad, reports the approximate pressure applied to the surface
+ * by a finger or other tool. The value is normalized to a range from
+ * 0 (no pressure at all) to 1 (normal pressure), although values higher than 1
+ * may be generated depending on the calibration of the input device.
+ * - For a trackball, the value is set to 1 if the trackball button is pressed
+ * or 0 otherwise.
+ * - For a mouse, the value is set to 1 if the primary mouse button is pressed
+ * or 0 otherwise.
+ */
+ PRESSURE = 2,
+ /**
+ * Axis constant: Size axis of a motion event.
+ *
+ * - For a touch screen or touch pad, reports the approximate size of the contact area in
+ * relation to the maximum detectable size for the device. The value is normalized
+ * to a range from 0 (smallest detectable size) to 1 (largest detectable size),
+ * although it is not a linear scale. This value is of limited use.
+ * To obtain calibrated size information, see
+ * {@link TOUCH_MAJOR} or {@link TOOL_MAJOR}.
+ */
+ SIZE = 3,
+ /**
+ * Axis constant: TouchMajor axis of a motion event.
+ *
+ * - For a touch screen, reports the length of the major axis of an ellipse that
+ * represents the touch area at the point of contact.
+ * The units are display pixels.
+ * - For a touch pad, reports the length of the major axis of an ellipse that
+ * represents the touch area at the point of contact.
+ * The units are device-dependent.
+ */
+ TOUCH_MAJOR = 4,
+ /**
+ * Axis constant: TouchMinor axis of a motion event.
+ *
+ * - For a touch screen, reports the length of the minor axis of an ellipse that
+ * represents the touch area at the point of contact.
+ * The units are display pixels.
+ * - For a touch pad, reports the length of the minor axis of an ellipse that
+ * represents the touch area at the point of contact.
+ * The units are device-dependent.
+ *
+ * When the touch is circular, the major and minor axis lengths will be equal to one another.
+ */
+ TOUCH_MINOR = 5,
+ /**
+ * Axis constant: ToolMajor axis of a motion event.
+ *
+ * - For a touch screen, reports the length of the major axis of an ellipse that
+ * represents the size of the approaching finger or tool used to make contact.
+ * - For a touch pad, reports the length of the major axis of an ellipse that
+ * represents the size of the approaching finger or tool used to make contact.
+ * The units are device-dependent.
+ *
+ * When the touch is circular, the major and minor axis lengths will be equal to one another.
+ *
+ * The tool size may be larger than the touch size since the tool may not be fully
+ * in contact with the touch sensor.
+ */
+ TOOL_MAJOR = 6,
+ /**
+ * Axis constant: ToolMinor axis of a motion event.
+ *
+ * - For a touch screen, reports the length of the minor axis of an ellipse that
+ * represents the size of the approaching finger or tool used to make contact.
+ * - For a touch pad, reports the length of the minor axis of an ellipse that
+ * represents the size of the approaching finger or tool used to make contact.
+ * The units are device-dependent.
+ *
+ * When the touch is circular, the major and minor axis lengths will be equal to one another.
+ *
+ * The tool size may be larger than the touch size since the tool may not be fully
+ * in contact with the touch sensor.
+ */
+ TOOL_MINOR = 7,
+ /**
+ * Axis constant: Orientation axis of a motion event.
+ *
+ * - For a touch screen or touch pad, reports the orientation of the finger
+ * or tool in radians relative to the vertical plane of the device.
+ * An angle of 0 radians indicates that the major axis of contact is oriented
+ * upwards, is perfectly circular or is of unknown orientation. A positive angle
+ * indicates that the major axis of contact is oriented to the right. A negative angle
+ * indicates that the major axis of contact is oriented to the left.
+ * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
+ * (finger pointing fully right).
+ * - For a stylus, the orientation indicates the direction in which the stylus
+ * is pointing in relation to the vertical axis of the current orientation of the screen.
+ * The range is from -PI radians to PI radians, where 0 is pointing up,
+ * -PI/2 radians is pointing left, -PI or PI radians is pointing down, and PI/2 radians
+ * is pointing right. See also {@link TILT}.
+ */
+ ORIENTATION = 8,
+ /**
+ * Axis constant: Vertical Scroll axis of a motion event.
+ *
+ * - For a mouse, reports the relative movement of the vertical scroll wheel.
+ * The value is normalized to a range from -1.0 (down) to 1.0 (up).
+ *
+ * The framework may use this axis to scroll views vertically.
+ */
+ VSCROLL = 9,
+ /**
+ * Axis constant: Horizontal Scroll axis of a motion event.
+ *
+ * - For a mouse, reports the relative movement of the horizontal scroll wheel.
+ * The value is normalized to a range from -1.0 (left) to 1.0 (right).
+ *
+ * The framework may use this axis to scroll views horizontally.
+ */
+ HSCROLL = 10,
+ /**
+ * Axis constant: Z axis of a motion event.
+ *
+ * - For a joystick, reports the absolute Z position of the joystick.
+ * The value is normalized to a range from -1.0 (high) to 1.0 (low).
+ * <em>On game pads with two analog joysticks, this axis is often reinterpreted
+ * to report the absolute X position of the second joystick instead.</em>
+ */
+ Z = 11,
+ /**
+ * Axis constant: X Rotation axis of a motion event.
+ *
+ * - For a joystick, reports the absolute rotation angle about the X axis.
+ * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
+ */
+ RX = 12,
+ /**
+ * Axis constant: Y Rotation axis of a motion event.
+ *
+ * - For a joystick, reports the absolute rotation angle about the Y axis.
+ * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
+ */
+ RY = 13,
+ /**
+ * Axis constant: Z Rotation axis of a motion event.
+ *
+ * - For a joystick, reports the absolute rotation angle about the Z axis.
+ * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
+ * On game pads with two analog joysticks, this axis is often reinterpreted
+ * to report the absolute Y position of the second joystick instead.
+ */
+ RZ = 14,
+ /**
+ * Axis constant: Hat X axis of a motion event.
+ *
+ * - For a joystick, reports the absolute X position of the directional hat control.
+ * The value is normalized to a range from -1.0 (left) to 1.0 (right).
+ */
+ HAT_X = 15,
+ /**
+ * Axis constant: Hat Y axis of a motion event.
+ *
+ * - For a joystick, reports the absolute Y position of the directional hat control.
+ * The value is normalized to a range from -1.0 (up) to 1.0 (down).
+ */
+ HAT_Y = 16,
+ /**
+ * Axis constant: Left Trigger axis of a motion event.
+ *
+ * - For a joystick, reports the absolute position of the left trigger control.
+ * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
+ */
+ LTRIGGER = 17,
+ /**
+ * Axis constant: Right Trigger axis of a motion event.
+ *
+ * - For a joystick, reports the absolute position of the right trigger control.
+ * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
+ */
+ RTRIGGER = 18,
+ /**
+ * Axis constant: Throttle axis of a motion event.
+ *
+ * - For a joystick, reports the absolute position of the throttle control.
+ * The value is normalized to a range from 0.0 (fully open) to 1.0 (fully closed).
+ */
+ THROTTLE = 19,
+ /**
+ * Axis constant: Rudder axis of a motion event.
+ *
+ * - For a joystick, reports the absolute position of the rudder control.
+ * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right).
+ */
+ RUDDER = 20,
+ /**
+ * Axis constant: Wheel axis of a motion event.
+ *
+ * - For a joystick, reports the absolute position of the steering wheel control.
+ * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right).
+ */
+ WHEEL = 21,
+ /**
+ * Axis constant: Gas axis of a motion event.
+ *
+ * - For a joystick, reports the absolute position of the gas (accelerator) control.
+ * The value is normalized to a range from 0.0 (no acceleration)
+ * to 1.0 (maximum acceleration).
+ */
+ GAS = 22,
+ /**
+ * Axis constant: Brake axis of a motion event.
+ *
+ * - For a joystick, reports the absolute position of the brake control.
+ * The value is normalized to a range from 0.0 (no braking) to 1.0 (maximum braking).
+ */
+ BRAKE = 23,
+ /**
+ * Axis constant: Distance axis of a motion event.
+ *
+ * - For a stylus, reports the distance of the stylus from the screen.
+ * A value of 0.0 indicates direct contact and larger values indicate increasing
+ * distance from the surface.
+ */
+ DISTANCE = 24,
+ /**
+ * Axis constant: Tilt axis of a motion event.
+ *
+ * - For a stylus, reports the tilt angle of the stylus in radians where
+ * 0 radians indicates that the stylus is being held perpendicular to the
+ * surface, and PI/2 radians indicates that the stylus is being held flat
+ * against the surface.
+ */
+ TILT = 25,
+ /**
+ * Axis constant: Generic scroll axis of a motion event.
+ *
+ * - This is used for scroll axis motion events that can't be classified as strictly
+ * vertical or horizontal. The movement of a rotating scroller is an example of this.
+ */
+ SCROLL = 26,
+ /**
+ * Axis constant: The movement of x position of a motion event.
+ *
+ * - For a mouse, reports a difference of x position between the previous position.
+ * This is useful when pointer is captured, in that case the mouse pointer doesn't
+ * change the location but this axis reports the difference which allows the app
+ * to see how the mouse is moved.
+ */
+ RELATIVE_X = 27,
+ /**
+ * Axis constant: The movement of y position of a motion event.
+ *
+ * Same as {@link RELATIVE_X}, but for y position.
+ */
+ RELATIVE_Y = 28,
+ /**
+ * Axis constant: Generic 1 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_1 = 32,
+ /**
+ * Axis constant: Generic 2 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_2 = 33,
+ /**
+ * Axis constant: Generic 3 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_3 = 34,
+ /**
+ * Axis constant: Generic 4 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_4 = 35,
+ /**
+ * Axis constant: Generic 5 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_5 = 36,
+ /**
+ * Axis constant: Generic 6 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_6 = 37,
+ /**
+ * Axis constant: Generic 7 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_7 = 38,
+ /**
+ * Axis constant: Generic 8 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_8 = 39,
+ /**
+ * Axis constant: Generic 9 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_9 = 40,
+ /**
+ * Axis constant: Generic 10 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_10 = 41,
+ /**
+ * Axis constant: Generic 11 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_11 = 42,
+ /**
+ * Axis constant: Generic 12 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_12 = 43,
+ /**
+ * Axis constant: Generic 13 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_13 = 44,
+ /**
+ * Axis constant: Generic 14 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_14 = 45,
+ /**
+ * Axis constant: Generic 15 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_15 = 46,
+ /**
+ * Axis constant: Generic 16 axis of a motion event.
+ * The interpretation of a generic axis is device-specific.
+ */
+ GENERIC_16 = 47,
+};
+
+/**
+ * Tool type of a pointer
+ */
+enum ToolType: uint8_t {
+ UNKNOWN = 0,
+ FINGER = 1,
+ STYLUS = 2,
+ MOUSE = 3,
+ ERASER = 4,
+};
+
+/**
+ * Properties of a particular pointer. Analogous to Android's PointerProperties.
+ */
+struct PointerProperties {
+ /**
+ * A number identifying a specific pointer. When a pointer is lifted,
+ * this value may be reused by another new pointer, even during the
+ * same gesture. For example, if there are two pointers touching the screen
+ * at the same time, they might have pointer ID's of 0 and 1. If the
+ * pointer with id = 0 is lifted, while the pointer with id = 1 remains, and
+ * a new pointer is placed on the screen, then the new pointer may receive
+ * an id of 0. While a pointer is active, it is guaranteed to keep the same
+ * id.
+ */
+ int32_t id;
+ /**
+ * Type of tool used to make contact, such as a finger or stylus, if known.
+ */
+ ToolType toolType;
+};
+
+/**
+ * Pointer coordinate data. Analogous to Android's PointerCoords.
+ */
+struct PointerCoords {
+ /**
+ * Bitfield of axes that are present in this structure.
+ */
+ bitfield<Axis> bits;
+ /**
+ * The values corresponding to each non-zero axis. This vector only
+ * contains non-zero entries. If an axis that is not currently specified
+ * in "bits" is requested, a zero value is returned.
+ * There are only as many values stored here
+ * as there are non-zero bits in the "bits" field.
+ * The values are position-packed. So the first non-zero axis will be
+ * at position 0, the next non-zero axis will be at position 1, and so on.
+ */
+ vec<float> values;
+};
+
+enum SourceClass: uint8_t {
+ NONE = 1 << 0,
+ BUTTON = 1 << 1,
+ POINTER = 1 << 2,
+ NAVIGATION = 1 << 3,
+ POSITION = 1 << 4,
+ JOYSTICK = 1 << 5,
+};
+
+/**
+ * Input sources
+ */
+enum Source: uint32_t {
+ UNKNOWN = 0,
+ KEYBOARD = (1 << 8) | SourceClass:BUTTON,
+ DPAD = (1 << 9) | SourceClass:BUTTON,
+ GAMEPAD = (1 << 10) | SourceClass:BUTTON,
+ TOUCHSCREEN = (1 << 12) | SourceClass:POINTER,
+ MOUSE = (1 << 13) | SourceClass:POINTER,
+ STYLUS = (1 << 14) | SourceClass:POINTER,
+ BLUETOOTH_STYLUS = (1 << 15) | STYLUS,
+ TRACKBALL = (1 << 16) | SourceClass:NAVIGATION,
+ MOUSE_RELATIVE = (1 << 17) | SourceClass:NAVIGATION,
+ TOUCHPAD = (1 << 20) | SourceClass:POSITION,
+ TOUCH_NAVIGATION = (1 << 21) | SourceClass:NONE,
+ ROTARY_ENCODER = (1 << 22) | SourceClass:NONE,
+ JOYSTICK = (1 << 24) | SourceClass:JOYSTICK,
+ ANY = 0xFFFFFF00,
+};
+
+/** Motion event actions */
+enum Action: int32_t {
+ /** A pressed gesture has started, the motion contains the initial starting location. */
+ DOWN = 0,
+ /**
+ * A pressed gesture has finished, the motion contains the final release location
+ * as well as any intermediate points since the last down or move event.
+ */
+ UP = 1,
+ /**
+ * A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and
+ * AMOTION_EVENT_ACTION_UP). The motion contains the most recent point.
+ */
+ MOVE = 2,
+ /**
+ * The current gesture has been aborted.
+ * You will not receive any more points in it. You must treat this as
+ * an up event, but not perform any action that you normally would.
+ */
+ CANCEL = 3,
+ /**
+ * A movement has happened outside of the normal bounds of the UI element.
+ * This does not provide a full gesture, but only the initial location of the movement/touch.
+ */
+ OUTSIDE = 4,
+ /**
+ * A non-primary pointer has gone down.
+ */
+ POINTER_DOWN = 5,
+ /**
+ * A non-primary pointer has gone up.
+ */
+ POINTER_UP = 6,
+ /**
+ * A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE).
+ * The motion contains the most recent point, as well as any intermediate points since
+ * the last hover move event.
+ */
+ HOVER_MOVE = 7,
+ /**
+ * The motion event contains relative vertical and/or horizontal scroll offsets.
+ * Use getAxisValue to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL
+ * and AMOTION_EVENT_AXIS_HSCROLL.
+ * The pointer may or may not be down when this event is dispatched.
+ * The framework will always deliver this action to the window under the pointer, which
+ * may not be the window currently touched.
+ */
+ SCROLL = 8,
+ /**
+ * The pointer is not down but has entered the boundaries of a window or view.
+ */
+ HOVER_ENTER = 9,
+ /**
+ * The pointer is not down but has exited the boundaries of a window or view.
+ */
+ HOVER_EXIT = 10,
+ /**
+ * One or more buttons have been pressed.
+ */
+ BUTTON_PRESS = 11,
+ /**
+ * One or more buttons have been released.
+ */
+ BUTTON_RELEASE = 12,
+};
+
+/** Edge flags */
+enum EdgeFlag : int32_t {
+ /** No edges are intersected */
+ NONE = 0,
+ /** Motion intersected top edge of the screen */
+ TOP = 1 << 0,
+ /** Motion intersected bottom edge of the screen */
+ BOTTOM = 1 << 1,
+ /** Motion intersected left edge of the screen */
+ LEFT = 1 << 2,
+ /** Motion intersected right edge of the screen */
+ RIGHT = 1 << 3,
+};
+
+/** Policy flags */
+enum PolicyFlag : uint32_t {
+ // The following flags originate in RawEvents
+
+ /** Event should wake the device */
+ WAKE = 1 << 0,
+ /** Key is virtual, and should generate haptic feedback */
+ VIRTUAL = 1 << 1,
+ /** Key is the special function modifier */
+ FUNCTION = 1 << 2,
+ /**
+ * Key represents a special gesture that has been detected
+ * by the touch firmware or driver.
+ */
+ GESTURE = 1 << 3,
+
+ // The following flags may be generated here in the InputClassifier HAL
+ // or in later InputListener stages
+
+ /** Event was injected */
+ INJECTED = 1 << 24,
+ /**
+ * Event comes from a trusted source, such as a directly attached input
+ * device or an application with system-wide event injection permission.
+ */
+ TRUSTED = 1 << 25,
+ /** Event has passed through an input filter. */
+ FILTERED = 1 << 26,
+ /** Disable automatic key repeating behaviour. */
+ DISABLE_KEY_REPEAT = 1 << 27,
+
+ // The following flags are set by the input reader policy as it intercepts each event
+
+ /** Device was in an interactive state when the event was intercepted */
+ INTERACTIVE = 1 << 29,
+ /** Event should be dispatched to applications */
+ PASS_TO_USER = 1 << 30,
+};
+
+/**
+ * Buttons that are associated with motion events.
+ */
+enum Button : int32_t {
+ NONE = 0,
+ PRIMARY = 1 << 0,
+ SECONDARY = 1 << 1,
+ TERTIARY = 1 << 2,
+ BACK = 1 << 3,
+ FORWARD = 1 << 4,
+ STYLUS_PRIMARY = 1 << 5,
+ STYLUS_SECONDARY = 1 << 6,
+};
+
+/**
+ * Meta key / modifier state
+ */
+enum Meta : int32_t {
+ NONE = 0,
+
+ /** One of the ALT meta keys is pressed. */
+ ALT_ON = 1 << 1, // 0x02
+
+ /** The left ALT meta key is pressed. */
+ ALT_LEFT_ON = 1 << 4, // 0x10
+
+ /** The right ALT meta key is pressed. */
+ ALT_RIGHT_ON = 1 << 5, // 0x20
+
+ /** One of the SHIFT meta keys is pressed. */
+ SHIFT_ON = 1 << 0, // 0x01
+
+ /** The left SHIFT meta key is pressed. */
+ SHIFT_LEFT_ON = 1 << 6, // 0x40
+
+ /** The right SHIFT meta key is pressed. */
+ SHIFT_RIGHT_ON = 1 << 7, // 0x80
+
+ /** The SYM meta key is pressed. */
+ SYM_ON = 1 << 2, // 0x04
+
+ /** The FUNCTION meta key is pressed. */
+ FUNCTION_ON = 1 << 3, // 0x08
+
+ /** One of the CTRL meta keys is pressed. */
+ CTRL_ON = 1 << 12, // 0x1000
+
+ /** The left CTRL meta key is pressed. */
+ CTRL_LEFT_ON = 1 << 13, // 0x2000
+
+ /** The right CTRL meta key is pressed. */
+ CTRL_RIGHT_ON = 1 << 14, // 0x4000
+
+ /** One of the META meta keys is pressed. */
+ META_ON = 1 << 16, // 0x10000
+
+ /** The left META meta key is pressed. */
+ META_LEFT_ON = 1 << 17, // 0x20000
+
+ /** The right META meta key is pressed. */
+ META_RIGHT_ON = 1 << 18, //0x40000
+
+ /** The CAPS LOCK meta key is on. */
+ CAPS_LOCK_ON = 1 << 20, // 0x100000
+
+ /** The NUM LOCK meta key is on. */
+ NUM_LOCK_ON = 1 << 21, // 0x200000
+
+ /** The SCROLL LOCK meta key is on. */
+ SCROLL_LOCK_ON = 1 << 22, // 0x400000
+};
+
+/**
+ * Motion event flags
+ */
+enum Flag : int32_t {
+ /**
+ * Indicates that the window that received this motion event is partly
+ * or wholly obscured by another visible window above it. This flag is set to true
+ * even if the event did not directly pass through the obscured area.
+ * A security sensitive application can check this flag to identify situations in which
+ * a malicious application may have covered up part of its content for the purpose
+ * of misleading the user or hijacking touches. An appropriate response might be
+ * to drop the suspect touches or to take additional precautions to confirm the user's
+ * actual intent.
+ */
+ WINDOW_IS_OBSCURED = 1 << 0,
+ /**
+ * This flag indicates that the event has been generated by a gesture generator. It
+ * could be used, for example, to determine whether touch slop should be applied.
+ */
+ IS_GENERATED_GESTURE = 1 << 3, // 0x8
+ /**
+ * Motion event is inconsistent with previously sent motion events.
+ */
+ TAINTED = 1 << 31, // 0x80000000
+};
+
+/**
+ * Touch heatmap.
+ *
+ * The array is a 2-D row-major matrix with dimensions (height, width).
+ * The heatmap data does not rotate when device orientation changes.
+ *
+ * Example:
+ *
+ * If the data in the array is:
+ * data[i] = i for i in 0 .. 59,
+ * then it can be represented as follows:
+ *
+ * <-- width -- >
+ * 0 1 2 3 4 5 ^
+ * 6 7 8 9 10 11 |
+ * 12 12 14 15 16 17 |
+ * 18 ... 23 | height
+ * 24 ... 29 |
+ * 30 ... 35 |
+ * 36 ... 41 |
+ * 42 ... 47 |
+ * 48 ... 53 |
+ * 54 ... 59 v
+ *
+ * Looking at the device in standard portrait orientation,
+ * the element "0" is the top left of the screen,
+ * "5" is at the top right, and "59" is the bottom right.
+ * Here width=6, and height=10.
+ */
+struct VideoFrame {
+ /**
+ * Video frame data.
+ * Size of the data is width * height.
+ */
+ vec<int16_t> data;
+ uint32_t width;
+ uint32_t height;
+ /**
+ * Time at which the frame was collected, in nanoseconds.
+ * Measured with the same clock that is used to populate MotionEvent times.
+ */
+ uint64_t timestamp;
+};
+
+/**
+ * Analogous to Android's native MotionEvent / NotifyMotionArgs.
+ * Stores the basic information about pointer movements.
+ */
+struct MotionEvent {
+ // InputEvent fields
+ /**
+ * The id of the device which produced this event.
+ */
+ int32_t deviceId;
+ /**
+ * The source type of this event.
+ */
+ Source source;
+ /**
+ * The display id associated with this event.
+ */
+ int32_t displayId;
+
+ // NotifyMotionArgs fields
+ /**
+ * Time when the initial touch down occurred, in nanoseconds.
+ */
+ int64_t downTime;
+ /**
+ * Time when this event occurred, in nanoseconds.
+ */
+ int64_t eventTime;
+ /**
+ * The kind of action being performed.
+ */
+ Action action;
+ /**
+ * For ACTION_POINTER_DOWN or ACTION_POINTER_UP, this contains the associated pointer index.
+ * The index may be used to get information about the pointer that has gone down or up.
+ */
+ uint8_t actionIndex;
+ /**
+ * The button that has been modified during a press or release action.
+ */
+ Button actionButton;
+ /**
+ * The motion event flags.
+ */
+ bitfield<Flag> flags;
+ /**
+ * The motion event policy flags.
+ */
+ bitfield<PolicyFlag> policyFlags;
+ /**
+ * The edges, if any, that were touched by this motion event.
+ */
+ bitfield<EdgeFlag> edgeFlags;
+ /**
+ * The state of any meta / modifier keys that were in effect when the event was generated.
+ */
+ bitfield<Meta> metaState;
+ /**
+ * The state of buttons that are pressed.
+ */
+ bitfield<Button> buttonState;
+ /**
+ * The precision of the X coordinate being reported.
+ */
+ float xPrecision;
+ /**
+ * The precision of the Y coordinate being reported.
+ */
+ float yPrecision;
+ /**
+ * The properties of each pointer present in this motion event.
+ */
+ vec<PointerProperties> pointerProperties;
+ /**
+ * The coordinates of each pointer.
+ */
+ vec<PointerCoords> pointerCoords;
+
+ // Additional fields from NotifyMotionArgs
+ /**
+ * Device time at which the event occurred, in microseconds.
+ * Will wrap after a little over an hour.
+ */
+ uint32_t deviceTimestamp;
+ /**
+ * The video frames, if any, associated with the current or previous motion events.
+ */
+ vec<VideoFrame> frames;
+};
+
+
+enum Classification : uint8_t {
+ NONE = 0,
+ /**
+ * Too early to classify the gesture, need more events.
+ */
+ AMBIGUOUS_GESTURE = 1,
+ /**
+ * User is force-pressing the screen.
+ */
+ DEEP_PRESS = 2,
+};
diff --git a/keymaster/3.0/vts/functional/keymaster_tags.h b/keymaster/3.0/vts/functional/keymaster_tags.h
index f241ef1..8544bf7 100644
--- a/keymaster/3.0/vts/functional/keymaster_tags.h
+++ b/keymaster/3.0/vts/functional/keymaster_tags.h
@@ -274,7 +274,10 @@
*/
template <typename ValueT> class NullOr {
template <typename T> struct reference_initializer {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wnull-dereference"
static T&& init() { return *static_cast<std::remove_reference_t<T>*>(nullptr); }
+#pragma GCC diagnostic pop
};
template <typename T> struct pointer_initializer {
static T init() { return nullptr; }
diff --git a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h
index 61c444c..97dab68 100644
--- a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h
+++ b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h
@@ -282,7 +282,10 @@
class NullOr {
template <typename T>
struct reference_initializer {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wnull-dereference"
static T&& init() { return *static_cast<std::remove_reference_t<T>*>(nullptr); }
+#pragma GCC diagnostic pop
};
template <typename T>
struct pointer_initializer {
diff --git a/light/2.0/default/Android.bp b/light/2.0/default/Android.bp
index 8b5f780..72cc873 100644
--- a/light/2.0/default/Android.bp
+++ b/light/2.0/default/Android.bp
@@ -31,13 +31,11 @@
}
-cc_binary {
- name: "android.hardware.light@2.0-service",
+cc_defaults {
+ name: "light_service_defaults",
relative_install_path: "hw",
defaults: ["hidl_defaults"],
vendor: true,
- init_rc: ["android.hardware.light@2.0-service.rc"],
- srcs: ["service.cpp"],
shared_libs: [
"liblog",
@@ -49,5 +47,19 @@
"libhidltransport",
"android.hardware.light@2.0",
],
+}
-}
\ No newline at end of file
+cc_binary {
+ name: "android.hardware.light@2.0-service",
+ defaults: ["light_service_defaults"],
+ init_rc: ["android.hardware.light@2.0-service.rc"],
+ srcs: ["service.cpp"],
+}
+
+cc_binary {
+ name: "android.hardware.light@2.0-service-lazy",
+ overrides: ["android.hardware.light@2.0-service"],
+ defaults: ["light_service_defaults"],
+ init_rc: ["android.hardware.light@2.0-service-lazy.rc"],
+ srcs: ["serviceLazy.cpp"],
+}
diff --git a/light/2.0/default/android.hardware.light@2.0-service-lazy.rc b/light/2.0/default/android.hardware.light@2.0-service-lazy.rc
new file mode 100644
index 0000000..8a3a59c
--- /dev/null
+++ b/light/2.0/default/android.hardware.light@2.0-service-lazy.rc
@@ -0,0 +1,9 @@
+service vendor.light-hal-2-0 /vendor/bin/hw/android.hardware.light@2.0-service-lazy
+ interface android.hardware.light@2.0::ILight default
+ oneshot
+ disabled
+ class hal
+ user system
+ group system
+ # shutting off lights while powering-off
+ shutdown critical
diff --git a/light/2.0/default/service.cpp b/light/2.0/default/service.cpp
index 70ae565..20f0578 100644
--- a/light/2.0/default/service.cpp
+++ b/light/2.0/default/service.cpp
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-#define LOG_TAG "android.hardware.light@2.0-service"
-
#include <android/hardware/light/2.0/ILight.h>
#include <hidl/LegacySupport.h>
diff --git a/light/2.0/default/serviceLazy.cpp b/light/2.0/default/serviceLazy.cpp
new file mode 100644
index 0000000..5324f46
--- /dev/null
+++ b/light/2.0/default/serviceLazy.cpp
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android/hardware/light/2.0/ILight.h>
+#include <hidl/LegacySupport.h>
+
+using android::hardware::defaultLazyPassthroughServiceImplementation;
+using android::hardware::light::V2_0::ILight;
+
+int main() {
+ return defaultLazyPassthroughServiceImplementation<ILight>();
+}
diff --git a/neuralnetworks/1.0/types.hal b/neuralnetworks/1.0/types.hal
index 0880b2f..89af35a 100644
--- a/neuralnetworks/1.0/types.hal
+++ b/neuralnetworks/1.0/types.hal
@@ -55,10 +55,20 @@
*/
TENSOR_QUANT8_ASYMM = 5,
- /** OEM specific scalar value. */
+ /**
+ * DEPRECATED. Since NNAPI 1.2, extensions are the preferred alternative to
+ * OEM operation and data types.
+ *
+ * OEM specific scalar value.
+ */
OEM = 10000,
- /** A tensor of OEM specific values. */
+ /**
+ * DEPRECATED. Since NNAPI 1.2, extensions are the preferred alternative to
+ * OEM operation and data types.
+ *
+ * A tensor of OEM specific values.
+ */
TENSOR_OEM_BYTE = 10001,
};
@@ -1448,7 +1458,8 @@
TANH = 28,
/**
- * OEM specific operation.
+ * DEPRECATED. Since NNAPI 1.2, extensions are the preferred alternative to
+ * OEM operation and data types.
*
* This operation is OEM specific. It should only be used for OEM
* applications.
diff --git a/neuralnetworks/1.0/vts/functional/Android.bp b/neuralnetworks/1.0/vts/functional/Android.bp
index dd6f934..52d6328 100644
--- a/neuralnetworks/1.0/vts/functional/Android.bp
+++ b/neuralnetworks/1.0/vts/functional/Android.bp
@@ -22,6 +22,10 @@
],
defaults: ["VtsHalTargetTestDefaults"],
export_include_dirs: ["."],
+ shared_libs: [
+ "libfmq",
+ "libnativewindow",
+ ],
static_libs: [
"android.hardware.neuralnetworks@1.0",
"android.hardware.neuralnetworks@1.1",
@@ -47,6 +51,10 @@
"ValidateRequest.cpp",
"VtsHalNeuralnetworks.cpp",
],
+ shared_libs: [
+ "libfmq",
+ "libnativewindow",
+ ],
static_libs: [
"android.hardware.neuralnetworks@1.0",
"android.hardware.neuralnetworks@1.1",
diff --git a/neuralnetworks/1.0/vts/functional/Callbacks.cpp b/neuralnetworks/1.0/vts/functional/Callbacks.cpp
index a1c5a1a..c30702c 100644
--- a/neuralnetworks/1.0/vts/functional/Callbacks.cpp
+++ b/neuralnetworks/1.0/vts/functional/Callbacks.cpp
@@ -135,12 +135,18 @@
Return<void> ExecutionCallback::notify(ErrorStatus errorStatus) {
mErrorStatus = errorStatus;
+ mOutputShapes = {};
+ mTiming = {.timeOnDevice = UINT64_MAX, .timeInDriver = UINT64_MAX};
CallbackBase::notify();
return Void();
}
-Return<void> ExecutionCallback::notify_1_2(ErrorStatus errorStatus) {
+Return<void> ExecutionCallback::notify_1_2(ErrorStatus errorStatus,
+ const hidl_vec<OutputShape>& outputShapes,
+ const Timing& timing) {
mErrorStatus = errorStatus;
+ mOutputShapes = outputShapes;
+ mTiming = timing;
CallbackBase::notify();
return Void();
}
@@ -150,6 +156,16 @@
return mErrorStatus;
}
+const std::vector<OutputShape>& ExecutionCallback::getOutputShapes() {
+ wait();
+ return mOutputShapes;
+}
+
+Timing ExecutionCallback::getTiming() {
+ wait();
+ return mTiming;
+}
+
} // namespace implementation
} // namespace V1_2
} // namespace neuralnetworks
diff --git a/neuralnetworks/1.0/vts/functional/Callbacks.h b/neuralnetworks/1.0/vts/functional/Callbacks.h
index e89980d..4707d0a 100644
--- a/neuralnetworks/1.0/vts/functional/Callbacks.h
+++ b/neuralnetworks/1.0/vts/functional/Callbacks.h
@@ -275,8 +275,9 @@
* Either IExecutionCallback::notify or IExecutionCallback::notify_1_2 must
* be called exactly once on a given ExecutionCallback object.
*
- * @param status Error status returned from asynchronously preparing the
- * model; will be:
+ * @param status Error status returned from launching the asynchronous task
+ * (if the launch fails) or from the asynchronous task itself
+ * (if the launch succeeds). Must be:
* - NONE if the asynchronous execution was successful
* - DEVICE_UNAVAILABLE if driver is offline or busy
* - GENERAL_FAILURE if there is an unspecified error
@@ -285,27 +286,100 @@
* - INVALID_ARGUMENT if the input request is invalid
*/
Return<void> notify(ErrorStatus status) override;
- Return<void> notify_1_2(ErrorStatus status) override;
+
+ /**
+ * Similar to IExecutionCallback::notify, but for V1_2::IPreparedModel to
+ * also notify output shapes along with error status.
+ *
+ * @param status Error status returned from launching the asynchronous task
+ * (if the launch fails) or from the asynchronous task itself
+ * (if the launch succeeds). Must be:
+ * - NONE if the asynchronous execution was successful
+ * - DEVICE_UNAVAILABLE if driver is offline or busy
+ * - GENERAL_FAILURE if the asynchronous task resulted in an
+ * unspecified error
+ * - OUTPUT_INSUFFICIENT_SIZE if at least one output
+ * operand buffer is not large enough to store the
+ * corresponding output
+ * - INVALID_ARGUMENT if one of the input arguments to
+ * prepareModel is invalid
+ * @param outputShapes A list of shape information of model output operands.
+ * The index into "outputShapes" corresponds to the index
+ * of the output operand in the Request outputs vector.
+ * outputShapes must be empty unless the status is either
+ * NONE or OUTPUT_INSUFFICIENT_SIZE.
+ * @return Timing Duration of execution. Unless MeasureTiming::YES was passed when
+ * launching the execution and status is NONE, all times must
+ * be reported as UINT64_MAX. A driver may choose to report
+ * any time as UINT64_MAX, indicating that particular measurement is
+ * not available.
+ */
+ Return<void> notify_1_2(ErrorStatus status, const hidl_vec<OutputShape>& outputShapes,
+ const Timing& timing) override;
+
+ // An overload of the latest notify interface to hide the version from ExecutionBuilder.
+ Return<void> notify(ErrorStatus status, const hidl_vec<OutputShape>& outputShapes,
+ const Timing& timing) {
+ return notify_1_2(status, outputShapes, timing);
+ }
/**
* Retrieves the error status returned from the asynchronous task launched
- * by IPreparedModel::execute. If IPreparedModel::execute has not finished
+ * by either IPreparedModel::execute or IPreparedModel::execute_1_2. If
+ * IPreparedModel::execute or IPreparedModel::execute_1_2 has not finished
* asynchronously executing, this call will block until the asynchronous task
* notifies the object.
*
- * @return status Error status returned from asynchronously preparing the
- * model; will be:
+ * @return status Error status returned from launching the asynchronous task
+ * (if the launch fails) or from the asynchronous task itself
+ * (if the launch succeeds). Must be:
* - NONE if the asynchronous execution was successful
* - DEVICE_UNAVAILABLE if driver is offline or busy
- * - GENERAL_FAILURE if there is an unspecified error
- * - OUTPUT_INSUFFICIENT_SIZE if provided output buffer is
- * not large enough to store the resultant values
- * - INVALID_ARGUMENT if the input request is invalid
+ * - GENERAL_FAILURE if the asynchronous task resulted in an
+ * unspecified error
+ * - OUTPUT_INSUFFICIENT_SIZE if at least one output
+ * operand buffer is not large enough to store the
+ * corresponding output
+ * - INVALID_ARGUMENT if one of the input arguments to
+ * prepareModel is invalid
*/
ErrorStatus getStatus();
- private:
- ErrorStatus mErrorStatus;
+ /**
+ * Retrieves the output shapes returned from the asynchronous task launched
+ * by IPreparedModel::execute_1_2. If IPreparedModel::execute_1_2 has not finished
+ * asynchronously executing, this call will block until the asynchronous task
+ * notifies the object.
+ *
+ * If the asynchronous task was launched by IPreparedModel::execute, an empty vector
+ * will be returned.
+ *
+ * @return outputShapes A list of shape information of model output operands.
+ * The index into "outputShapes" corresponds to the index
+ * of the output operand in the Request outputs vector.
+ * outputShapes must be empty unless the status is either
+ * NONE or OUTPUT_INSUFFICIENT_SIZE.
+ */
+ const std::vector<OutputShape>& getOutputShapes();
+
+ /**
+ * Retrieves the duration of execution ofthe asynchronous task launched
+ * by IPreparedModel::execute_1_2. If IPreparedModel::execute_1_2 has not finished
+ * asynchronously executing, this call will block until the asynchronous task
+ * notifies the object.
+ *
+ * If the asynchronous task was launched by IPreparedModel::execute, every time
+ * must be UINT64_MAX.
+ *
+ * @return timing Duration of the execution. Every time must be UINT64_MAX unless
+ * the status is NONE.
+ */
+ Timing getTiming();
+
+ private:
+ ErrorStatus mErrorStatus = ErrorStatus::GENERAL_FAILURE;
+ std::vector<OutputShape> mOutputShapes = {};
+ Timing mTiming = {};
};
diff --git a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
index af0a03f..b7a6f3f 100644
--- a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
+++ b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
@@ -15,6 +15,7 @@
*/
#include "Callbacks.h"
+#include "ExecutionBurstController.h"
#include "TestHarness.h"
#include "Utils.h"
@@ -45,20 +46,16 @@
using ::test_helper::compare;
using ::test_helper::expectMultinomialDistributionWithinTolerance;
using ::test_helper::filter;
-using ::test_helper::Float32Operands;
using ::test_helper::for_all;
using ::test_helper::for_each;
-using ::test_helper::Int32Operands;
using ::test_helper::MixedTyped;
using ::test_helper::MixedTypedExample;
-using ::test_helper::MixedTypedIndex;
-using ::test_helper::Quant8Operands;
using ::test_helper::resize_accordingly;
template <typename T>
-void copy_back_(MixedTyped* dst, const std::vector<RequestArgument>& ra, char* src) {
- MixedTyped& test = *dst;
- for_each<T>(test, [&ra, src](int index, std::vector<T>& m) {
+void copy_back_(std::map<int, std::vector<T>>* dst, const std::vector<RequestArgument>& ra,
+ char* src) {
+ for_each<T>(*dst, [&ra, src](int index, std::vector<T>& m) {
ASSERT_EQ(m.size(), ra[index].location.length / sizeof(T));
char* begin = src + ra[index].location.offset;
memcpy(m.data(), begin, ra[index].location.length);
@@ -66,45 +63,70 @@
}
void copy_back(MixedTyped* dst, const std::vector<RequestArgument>& ra, char* src) {
- copy_back_<float>(dst, ra, src);
- copy_back_<int32_t>(dst, ra, src);
- copy_back_<uint8_t>(dst, ra, src);
- copy_back_<int16_t>(dst, ra, src);
- copy_back_<_Float16>(dst, ra, src);
- copy_back_<bool8>(dst, ra, src);
- copy_back_<int8_t>(dst, ra, src);
- static_assert(7 == std::tuple_size<MixedTyped>::value,
+ copy_back_(&dst->float32Operands, ra, src);
+ copy_back_(&dst->int32Operands, ra, src);
+ copy_back_(&dst->quant8AsymmOperands, ra, src);
+ copy_back_(&dst->quant16SymmOperands, ra, src);
+ copy_back_(&dst->float16Operands, ra, src);
+ copy_back_(&dst->bool8Operands, ra, src);
+ copy_back_(&dst->quant8ChannelOperands, ra, src);
+ copy_back_(&dst->quant16AsymmOperands, ra, src);
+ static_assert(8 == MixedTyped::kNumTypes,
"Number of types in MixedTyped changed, but copy_back function wasn't updated");
}
// Top level driver for models and examples generated by test_generator.py
// Test driver for those generated from ml/nn/runtime/test/spec
static Return<ErrorStatus> ExecutePreparedModel(sp<V1_0::IPreparedModel>& preparedModel,
- const Request& request,
+ const Request& request, MeasureTiming,
sp<ExecutionCallback>& callback) {
return preparedModel->execute(request, callback);
}
static Return<ErrorStatus> ExecutePreparedModel(sp<V1_2::IPreparedModel>& preparedModel,
- const Request& request,
+ const Request& request, MeasureTiming measure,
sp<ExecutionCallback>& callback) {
- return preparedModel->execute_1_2(request, callback);
+ return preparedModel->execute_1_2(request, measure, callback);
}
-static Return<ErrorStatus> ExecutePreparedModel(sp<V1_0::IPreparedModel>&, const Request&) {
+static Return<ErrorStatus> ExecutePreparedModel(sp<V1_0::IPreparedModel>&, const Request&,
+ MeasureTiming, hidl_vec<OutputShape>*, Timing*) {
ADD_FAILURE() << "asking for synchronous execution at V1_0";
return ErrorStatus::GENERAL_FAILURE;
}
static Return<ErrorStatus> ExecutePreparedModel(sp<V1_2::IPreparedModel>& preparedModel,
- const Request& request) {
- return preparedModel->executeSynchronously(request);
+ const Request& request, MeasureTiming measure,
+ hidl_vec<OutputShape>* outputShapes,
+ Timing* timing) {
+ ErrorStatus result;
+ Return<void> ret = preparedModel->executeSynchronously(
+ request, measure,
+ [&result, outputShapes, timing](ErrorStatus error, const hidl_vec<OutputShape>& shapes,
+ const Timing& time) {
+ result = error;
+ *outputShapes = shapes;
+ *timing = time;
+ });
+ if (!ret.isOk()) {
+ return ErrorStatus::GENERAL_FAILURE;
+ }
+ return result;
}
-enum class Synchronously { NO, YES };
+static std::unique_ptr<::android::nn::ExecutionBurstController> CreateBurst(
+ const sp<V1_0::IPreparedModel>&) {
+ ADD_FAILURE() << "asking for burst execution at V1_0";
+ return nullptr;
+}
+static std::unique_ptr<::android::nn::ExecutionBurstController> CreateBurst(
+ const sp<V1_2::IPreparedModel>& preparedModel) {
+ return ::android::nn::createExecutionBurstController(preparedModel, /*blocking=*/true);
+}
+enum class Executor { ASYNC, SYNC, BURST };
const float kDefaultAtol = 1e-5f;
const float kDefaultRtol = 1e-5f;
template <typename T_IPreparedModel>
void EvaluatePreparedModel(sp<T_IPreparedModel>& preparedModel, std::function<bool(int)> is_ignored,
const std::vector<MixedTypedExample>& examples,
- bool hasRelaxedFloat32Model = false, float fpAtol = kDefaultAtol,
- float fpRtol = kDefaultRtol, Synchronously sync = Synchronously::NO) {
+ bool hasRelaxedFloat32Model, float fpAtol, float fpRtol,
+ Executor executor, MeasureTiming measure, bool testDynamicOutputShape) {
const uint32_t INPUT = 0;
const uint32_t OUTPUT = 1;
@@ -114,7 +136,7 @@
const MixedTyped& inputs = example.operands.first;
const MixedTyped& golden = example.operands.second;
- const bool hasFloat16Inputs = !std::get<MixedTypedIndex<_Float16>::index>(inputs).empty();
+ const bool hasFloat16Inputs = !inputs.float16Operands.empty();
if (hasRelaxedFloat32Model || hasFloat16Inputs) {
// TODO: Adjust the error limit based on testing.
// If in relaxed mode, set the absolute tolerance to be 5ULP of FP16.
@@ -197,30 +219,89 @@
inputMemory->commit();
outputMemory->commit();
- if (sync == Synchronously::NO) {
- SCOPED_TRACE("asynchronous");
+ const Request request = {.inputs = inputs_info, .outputs = outputs_info, .pools = pools};
- // launch execution
- sp<ExecutionCallback> executionCallback = new ExecutionCallback();
- ASSERT_NE(nullptr, executionCallback.get());
- Return<ErrorStatus> executionLaunchStatus = ExecutePreparedModel(
- preparedModel, {.inputs = inputs_info, .outputs = outputs_info, .pools = pools},
- executionCallback);
- ASSERT_TRUE(executionLaunchStatus.isOk());
- EXPECT_EQ(ErrorStatus::NONE, static_cast<ErrorStatus>(executionLaunchStatus));
+ ErrorStatus executionStatus;
+ hidl_vec<OutputShape> outputShapes;
+ Timing timing;
+ switch (executor) {
+ case Executor::ASYNC: {
+ SCOPED_TRACE("asynchronous");
- // retrieve execution status
- executionCallback->wait();
- ErrorStatus executionReturnStatus = executionCallback->getStatus();
- EXPECT_EQ(ErrorStatus::NONE, executionReturnStatus);
+ // launch execution
+ sp<ExecutionCallback> executionCallback = new ExecutionCallback();
+ ASSERT_NE(nullptr, executionCallback.get());
+ Return<ErrorStatus> executionLaunchStatus =
+ ExecutePreparedModel(preparedModel, request, measure, executionCallback);
+ ASSERT_TRUE(executionLaunchStatus.isOk());
+ EXPECT_EQ(ErrorStatus::NONE, static_cast<ErrorStatus>(executionLaunchStatus));
+
+ // retrieve execution status
+ executionCallback->wait();
+ executionStatus = executionCallback->getStatus();
+ outputShapes = executionCallback->getOutputShapes();
+ timing = executionCallback->getTiming();
+
+ break;
+ }
+ case Executor::SYNC: {
+ SCOPED_TRACE("synchronous");
+
+ // execute
+ Return<ErrorStatus> executionReturnStatus = ExecutePreparedModel(
+ preparedModel, request, measure, &outputShapes, &timing);
+ ASSERT_TRUE(executionReturnStatus.isOk());
+ executionStatus = static_cast<ErrorStatus>(executionReturnStatus);
+
+ break;
+ }
+ case Executor::BURST: {
+ SCOPED_TRACE("burst");
+
+ // create burst
+ const std::unique_ptr<::android::nn::ExecutionBurstController> controller =
+ CreateBurst(preparedModel);
+ ASSERT_NE(nullptr, controller.get());
+
+ // create memory keys
+ std::vector<intptr_t> keys(request.pools.size());
+ for (size_t i = 0; i < keys.size(); ++i) {
+ keys[i] = reinterpret_cast<intptr_t>(&request.pools[i]);
+ }
+
+ // execute burst
+ std::tie(executionStatus, outputShapes, timing) =
+ controller->compute(request, measure, keys);
+
+ break;
+ }
+ }
+
+ if (testDynamicOutputShape && executionStatus != ErrorStatus::NONE) {
+ LOG(INFO) << "NN VTS: Early termination of test because vendor service cannot "
+ "execute model that it does not support.";
+ std::cout << "[ ] Early termination of test because vendor service cannot "
+ "execute model that it does not support."
+ << std::endl;
+ return;
+ }
+ ASSERT_EQ(ErrorStatus::NONE, executionStatus);
+ if (measure == MeasureTiming::NO) {
+ EXPECT_EQ(UINT64_MAX, timing.timeOnDevice);
+ EXPECT_EQ(UINT64_MAX, timing.timeInDriver);
} else {
- SCOPED_TRACE("synchronous");
+ if (timing.timeOnDevice != UINT64_MAX && timing.timeInDriver != UINT64_MAX) {
+ EXPECT_LE(timing.timeOnDevice, timing.timeInDriver);
+ }
+ }
- // execute
- Return<ErrorStatus> executionStatus = ExecutePreparedModel(
- preparedModel, {.inputs = inputs_info, .outputs = outputs_info, .pools = pools});
- ASSERT_TRUE(executionStatus.isOk());
- EXPECT_EQ(ErrorStatus::NONE, static_cast<ErrorStatus>(executionStatus));
+ // Go through all outputs, overwrite output dimensions with returned output shapes
+ if (testDynamicOutputShape) {
+ ASSERT_NE(outputShapes.size(), 0);
+ for_each<uint32_t>(test.operandDimensions,
+ [&outputShapes](int idx, std::vector<uint32_t>& dim) {
+ dim = outputShapes[idx].dimensions;
+ });
}
// validate results
@@ -242,9 +323,10 @@
template <typename T_IPreparedModel>
void EvaluatePreparedModel(sp<T_IPreparedModel>& preparedModel, std::function<bool(int)> is_ignored,
const std::vector<MixedTypedExample>& examples,
- bool hasRelaxedFloat32Model, Synchronously sync) {
+ bool hasRelaxedFloat32Model, Executor executor, MeasureTiming measure,
+ bool testDynamicOutputShape) {
EvaluatePreparedModel(preparedModel, is_ignored, examples, hasRelaxedFloat32Model, kDefaultAtol,
- kDefaultRtol, sync);
+ kDefaultRtol, executor, measure, testDynamicOutputShape);
}
static void getPreparedModel(sp<PreparedModelCallback> callback,
@@ -300,7 +382,8 @@
float fpAtol = 1e-5f, fpRtol = 5.0f * 1.1920928955078125e-7f;
EvaluatePreparedModel(preparedModel, is_ignored, examples,
- /*hasRelaxedFloat32Model=*/false, fpAtol, fpRtol);
+ /*hasRelaxedFloat32Model=*/false, fpAtol, fpRtol, Executor::ASYNC,
+ MeasureTiming::NO, /*testDynamicOutputShape=*/false);
}
void Execute(const sp<V1_1::IDevice>& device, std::function<V1_1::Model(void)> create_model,
@@ -346,12 +429,14 @@
ASSERT_NE(nullptr, preparedModel.get());
EvaluatePreparedModel(preparedModel, is_ignored, examples,
- model.relaxComputationFloat32toFloat16);
+ model.relaxComputationFloat32toFloat16, 1e-5f, 1e-5f, Executor::ASYNC,
+ MeasureTiming::NO, /*testDynamicOutputShape=*/false);
}
// TODO: Reduce code duplication.
void Execute(const sp<V1_2::IDevice>& device, std::function<V1_2::Model(void)> create_model,
- std::function<bool(int)> is_ignored, const std::vector<MixedTypedExample>& examples) {
+ std::function<bool(int)> is_ignored, const std::vector<MixedTypedExample>& examples,
+ bool testDynamicOutputShape) {
V1_2::Model model = create_model();
// see if service can handle model
@@ -393,9 +478,23 @@
ASSERT_NE(nullptr, preparedModel.get());
EvaluatePreparedModel(preparedModel, is_ignored, examples,
- model.relaxComputationFloat32toFloat16, Synchronously::NO);
+ model.relaxComputationFloat32toFloat16, Executor::ASYNC,
+ MeasureTiming::NO, testDynamicOutputShape);
EvaluatePreparedModel(preparedModel, is_ignored, examples,
- model.relaxComputationFloat32toFloat16, Synchronously::YES);
+ model.relaxComputationFloat32toFloat16, Executor::SYNC, MeasureTiming::NO,
+ testDynamicOutputShape);
+ EvaluatePreparedModel(preparedModel, is_ignored, examples,
+ model.relaxComputationFloat32toFloat16, Executor::BURST,
+ MeasureTiming::NO, testDynamicOutputShape);
+ EvaluatePreparedModel(preparedModel, is_ignored, examples,
+ model.relaxComputationFloat32toFloat16, Executor::ASYNC,
+ MeasureTiming::YES, testDynamicOutputShape);
+ EvaluatePreparedModel(preparedModel, is_ignored, examples,
+ model.relaxComputationFloat32toFloat16, Executor::SYNC,
+ MeasureTiming::YES, testDynamicOutputShape);
+ EvaluatePreparedModel(preparedModel, is_ignored, examples,
+ model.relaxComputationFloat32toFloat16, Executor::BURST,
+ MeasureTiming::YES, testDynamicOutputShape);
}
} // namespace generated_tests
diff --git a/neuralnetworks/1.2/Android.bp b/neuralnetworks/1.2/Android.bp
index 7d13104..9057b94 100644
--- a/neuralnetworks/1.2/Android.bp
+++ b/neuralnetworks/1.2/Android.bp
@@ -8,6 +8,8 @@
},
srcs: [
"types.hal",
+ "IBurstCallback.hal",
+ "IBurstContext.hal",
"IDevice.hal",
"IExecutionCallback.hal",
"IPreparedModel.hal",
@@ -20,6 +22,9 @@
"android.hidl.safe_union@1.0",
],
types: [
+ "DeviceType",
+ "FmqRequestDatum",
+ "FmqResultDatum",
"Model",
"Operand",
"OperandType",
@@ -27,6 +32,8 @@
"Operation",
"OperationType",
"OperationTypeRange",
+ "OutputShape",
+ "SymmPerChannelQuantParams",
],
gen_java: false,
}
diff --git a/neuralnetworks/1.2/IBurstCallback.hal b/neuralnetworks/1.2/IBurstCallback.hal
new file mode 100644
index 0000000..3f82e31
--- /dev/null
+++ b/neuralnetworks/1.2/IBurstCallback.hal
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.neuralnetworks@1.2;
+
+import @1.0::ErrorStatus;
+
+/**
+ * Callback object used by a service to retreive memory objects based on unique
+ * identifiers ("slots").
+ */
+interface IBurstCallback {
+ /**
+ * Get the memory regions that correspond to slot ids. The slot ids are are
+ * unique to the burst object.
+ *
+ * @param slots Values uniquely identifying memory regions within a Burst.
+ * @return status Indicates whether the memories were successfully returned;
+ * must be:
+ * - NONE if the memory region was successfully retrieved
+ * - GENERAL_FAILURE if there is an unspecified error
+ * - INVALID_ARGUMENT if a slot number is invalid
+ * @return buffers Memory buffers corresponding to the slot numbers. If an
+ * error occurs, an empty vector must be returned for
+ * buffers, otherwise slots.size() == buffers.size().
+ */
+ getMemories(vec<int32_t> slots) generates (ErrorStatus status, vec<memory> buffers);
+};
diff --git a/neuralnetworks/1.2/IBurstContext.hal b/neuralnetworks/1.2/IBurstContext.hal
new file mode 100644
index 0000000..60bf53b
--- /dev/null
+++ b/neuralnetworks/1.2/IBurstContext.hal
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.neuralnetworks@1.2;
+
+/**
+ * Context object to manage the resources of a burst.
+ */
+interface IBurstContext {
+ /**
+ * freeMemory is used by the client to signal to the service that a memory
+ * buffer corresponding to a slot number is no longer needed by the client.
+ *
+ * The slot ids are unique to the burst object.
+ *
+ * @param slot Value uniquely identifying a memory region.
+ */
+ freeMemory(int32_t slot);
+};
diff --git a/neuralnetworks/1.2/IDevice.hal b/neuralnetworks/1.2/IDevice.hal
index 6a77961..de249b0 100644
--- a/neuralnetworks/1.2/IDevice.hal
+++ b/neuralnetworks/1.2/IDevice.hal
@@ -56,6 +56,26 @@
getVersionString() generates (ErrorStatus status, string version);
/**
+ * Get the type of a given device.
+ *
+ * The device type can be used to help application developers to distribute
+ * Machine Learning workloads and other workloads such as graphical rendering.
+ * E.g., for an app which renders AR scenes based on real time object detection
+ * results, the developer could choose an ACCELERATOR type device for ML
+ * workloads, and reserve GPU for graphical rendering.
+ *
+ * @param status Error status returned from querying the device type. Must be:
+ * - NONE if the query was successful
+ * - DEVICE_UNAVAILABLE if driver is offline or busy
+ * - GENERAL_FAILURE if the query resulted in an
+ * unspecified error
+ * @param type The DeviceType of the device. Please note, this is not a
+ * bitfield of DeviceTypes. Each device must only be of a
+ * single DeviceType.
+ */
+ getType() generates (ErrorStatus status, DeviceType type);
+
+ /**
* Gets the supported operations in a model.
*
* getSupportedOperations indicates which operations of a model are fully
@@ -78,6 +98,25 @@
generates (ErrorStatus status, vec<bool> supportedOperations);
/**
+ * Gets whether the driver supports compilation caching.
+ *
+ * isCachingSupported indicates whether the driver supports compilation caching.
+ * Even if so, the driver may still choose not to cache certain compiled models.
+ *
+ * If the device reports the caching is not supported, the user may avoid calling
+ * IDevice::prepareModelFromCache and IPreparedModel::saveToCache.
+ *
+ * @return status Error status of the call, must be:
+ * - NONE if successful
+ * - DEVICE_UNAVAILABLE if driver is offline or busy
+ * - GENERAL_FAILURE if there is an unspecified error
+ * @return supported A boolean indicating whether the driver supports compilation
+ * caching. Even on returning true, the driver may still choose
+ * not to cache certain compiled models.
+ */
+ isCachingSupported() generates (ErrorStatus status, bool supported);
+
+ /**
* Creates a prepared model for execution.
*
* prepareModel is used to make any necessary transformations or alternative
@@ -133,4 +172,84 @@
prepareModel_1_2(Model model, ExecutionPreference preference,
IPreparedModelCallback callback)
generates (ErrorStatus status);
+
+ /**
+ * Creates a prepared model from cache files for execution.
+ *
+ * prepareModelFromCache is used to retrieve a prepared model directly from
+ * cache files to avoid slow model compilation time. There are exactly two
+ * cache file descriptors provided to the driver: modelCache and dataCache.
+ *
+ * The dataCache is for caching constant data, possibly including preprocessed
+ * and transformed tensor buffers. Any modification to the dataCache should
+ * have no worse effect than generating bad output values at execution time.
+ *
+ * The modelCache is for caching security-sensitive data such as compiled
+ * executable machine code in the device's native binary format. A modification
+ * to the modelCache may affect the driver's execution behavior, and a malicious
+ * client could make use of this to execute beyond the granted permission. Thus,
+ * the driver must always check whether the modelCache is corrupted before preparing
+ * the model from cache.
+ *
+ * The two file descriptors may be closed by the client once the asynchronous
+ * preparation has finished. The driver has to copy all the data it needs.
+ *
+ * The model is prepared asynchronously with respect to the caller. The
+ * prepareModelFromCache function must verify the inputs to the
+ * prepareModelFromCache function are correct, and that the security-sensitive
+ * cache has not been modified since it was last written by the driver.
+ * If there is an error, or if compilation caching is not supported, or if the
+ * security-sensitive cache has been modified, prepareModelFromCache must
+ * immediately invoke the callback with the appropriate ErrorStatus value and
+ * nullptr for the IPreparedModel, then return with the same ErrorStatus. If
+ * the inputs to the prepareModelFromCache function are valid, the security-sensitive
+ * cache is not modified, and there is no error, prepareModelFromCache must launch an
+ * asynchronous task to prepare the model in the background, and immediately return
+ * from prepareModelFromCache with ErrorStatus::NONE. If the asynchronous task
+ * fails to launch, prepareModelFromCache must immediately invoke the callback
+ * with ErrorStatus::GENERAL_FAILURE and nullptr for the IPreparedModel, then
+ * return with ErrorStatus::GENERAL_FAILURE.
+ *
+ * When the asynchronous task has finished preparing the model, it must
+ * immediately invoke the callback function provided as an input to
+ * prepareModelFromCache. If the model was prepared successfully, the
+ * callback object must be invoked with an error status of ErrorStatus::NONE
+ * and the produced IPreparedModel object. If an error occurred preparing
+ * the model, the callback object must be invoked with the appropriate
+ * ErrorStatus value and nullptr for the IPreparedModel.
+ *
+ * The only information that may be unknown to the model at this stage is
+ * the shape of the tensors, which may only be known at execution time. As
+ * such, some driver services may return partially prepared models, where
+ * the prepared model may only be finished when it is paired with a set of
+ * inputs to the model. Note that the same prepared model object may be
+ * used with different shapes of inputs on different (possibly concurrent)
+ * executions.
+ *
+ * @param modelCache A handle holding exactly one cache file descriptor for the
+ * security-sensitive cache.
+ * @param dataCache A handle holding exactly one cache file descriptor for the
+ * constants' cache.
+ * @param token A caching token of length Constant::BYTE_SIZE_OF_CACHE_TOKEN
+ * identifying the prepared model. It is the same token provided when saving
+ * the cache files with IPreparedModel::saveToCache. Tokens should be chosen
+ * to have a low rate of collision for a particular application. The driver
+ * cannot detect a collision; a collision will result in a failed execution
+ * or in a successful execution that produces incorrect output values.
+ * @param callback A callback object used to return the error status of
+ * preparing the model for execution and the prepared model if
+ * successful, nullptr otherwise. The callback object's notify function
+ * must be called exactly once, even if the model could not be prepared.
+ * @return status Error status of launching a task which prepares the model
+ * in the background; must be:
+ * - NONE if preparation task is successfully launched
+ * - DEVICE_UNAVAILABLE if driver is offline or busy
+ * - GENERAL_FAILURE if caching is not supported or if there is an
+ * unspecified error
+ * - INVALID_ARGUMENT if one of the input arguments is invalid
+ */
+ prepareModelFromCache(handle modelCache, handle dataCache,
+ uint8_t[Constant:BYTE_SIZE_OF_CACHE_TOKEN] token,
+ IPreparedModelCallback callback)
+ generates (ErrorStatus status);
};
diff --git a/neuralnetworks/1.2/IExecutionCallback.hal b/neuralnetworks/1.2/IExecutionCallback.hal
index 667e0d6..7f6c9ee 100644
--- a/neuralnetworks/1.2/IExecutionCallback.hal
+++ b/neuralnetworks/1.2/IExecutionCallback.hal
@@ -39,10 +39,21 @@
* - DEVICE_UNAVAILABLE if driver is offline or busy
* - GENERAL_FAILURE if the asynchronous task resulted in an
* unspecified error
- * - OUTPUT_INSUFFICIENT_SIZE if provided output buffer is
- * not large enough to store the resultant values
+ * - OUTPUT_INSUFFICIENT_SIZE if at least one output
+ * operand buffer is not large enough to store the
+ * corresponding output
* - INVALID_ARGUMENT if one of the input arguments to
* prepareModel is invalid
+ * @param outputShapes A list of shape information of model output operands.
+ * The index into "outputShapes" corresponds with to index
+ * of the output operand in the Request outputs vector.
+ * outputShapes must be empty unless the status is either
+ * NONE or OUTPUT_INSUFFICIENT_SIZE.
+ * @return Timing Duration of execution. Unless MeasureTiming::YES was passed when
+ * launching the execution and status is NONE, all times must
+ * be reported as UINT64_MAX. A driver may choose to report
+ * any time as UINT64_MAX, indicating that particular measurement is
+ * not available.
*/
- oneway notify_1_2(ErrorStatus status);
+ oneway notify_1_2(ErrorStatus status, vec<OutputShape> outputShapes, Timing timing);
};
diff --git a/neuralnetworks/1.2/IPreparedModel.hal b/neuralnetworks/1.2/IPreparedModel.hal
index 4e91c67..757d5f1 100644
--- a/neuralnetworks/1.2/IPreparedModel.hal
+++ b/neuralnetworks/1.2/IPreparedModel.hal
@@ -19,6 +19,8 @@
import @1.0::ErrorStatus;
import @1.0::IPreparedModel;
import @1.0::Request;
+import IBurstCallback;
+import IBurstContext;
import IExecutionCallback;
/**
@@ -57,6 +59,10 @@
*
* @param request The input and output information on which the prepared
* model is to be executed.
+ * @param measure Specifies whether or not to measure duration of the execution.
+ * The duration runs from the time the driver sees the call
+ * to the execute_1_2 function to the time the driver invokes
+ * the callback.
* @param callback A callback object used to return the error status of
* the execution. The callback object's notify function must
* be called exactly once, even if the execution was
@@ -70,7 +76,7 @@
* - INVALID_ARGUMENT if one of the input arguments is
* invalid
*/
- execute_1_2(Request request, IExecutionCallback callback)
+ execute_1_2(Request request, MeasureTiming measure, IExecutionCallback callback)
generates (ErrorStatus status);
/**
@@ -96,15 +102,117 @@
*
* @param request The input and output information on which the prepared
* model is to be executed.
+ * @param measure Specifies whether or not to measure duration of the execution.
+ * The duration runs from the time the driver sees the call
+ * to the executeSynchronously function to the time the driver
+ * returns from the function.
* @return status Error status of the execution, must be:
* - NONE if execution is performed successfully
* - DEVICE_UNAVAILABLE if driver is offline or busy
* - GENERAL_FAILURE if there is an unspecified error
- * - OUTPUT_INSUFFICIENT_SIZE if provided output buffer is
- * not large enough to store the resultant values
+ * - OUTPUT_INSUFFICIENT_SIZE if at least one output
+ * operand buffer is not large enough to store the
+ * corresponding output
* - INVALID_ARGUMENT if one of the input arguments is
* invalid
+ * @return outputShapes A list of shape information of model output operands.
+ * The index into "outputShapes" corresponds to the index
+ * of the output operand in the Request outputs vector.
+ * outputShapes must be empty unless the status is either
+ * NONE or OUTPUT_INSUFFICIENT_SIZE.
+ * @return Timing Duration of execution. Unless measure is YES and status is
+ * NONE, all times must be reported as UINT64_MAX. A driver may
+ * choose to report any time as UINT64_MAX, indicating that
+ * measurement is not available.
*/
- executeSynchronously(Request request)
+ executeSynchronously(Request request, MeasureTiming measure)
+ generates (ErrorStatus status, vec<OutputShape> outputShapes, Timing timing);
+
+ /**
+ * Configure a Burst object used to execute multiple inferences on a
+ * prepared model in rapid succession.
+ *
+ * @param callback A callback object used to retrieve memory resources
+ * corresponding to a unique identifiers ("slots").
+ * @param requestChannel Used by the client to send a serialized Request to
+ * the Burst for execution. requestChannel must not be
+ * used to pass a second Request object until a result
+ * has been received from resultChannel.
+ * @param resultChannel Used by the service to return the results of an
+ * execution to the client: the status of the execution
+ * and OutputShape of all output tensors. resultChannel
+ * must be used to return the results if a Request was
+ * sent through the requestChannel.
+ * @return status Error status of configuring the execution burst, must be:
+ * - NONE if the burst is successfully configured
+ * - DEVICE_UNAVAILABLE if driver is offline or busy
+ * - GENERAL_FAILURE if there is an unspecified error
+ * - INVALID_ARGUMENT if one of the input arguments is
+ * invalid
+ * @return context Object containing all resources (such as cached
+ * hidl_memory) related to a Burst if successful, otherwise
+ * nullptr.
+ */
+ configureExecutionBurst(IBurstCallback callback,
+ fmq_sync<FmqRequestDatum> requestChannel,
+ fmq_sync<FmqResultDatum> resultChannel)
+ generates (ErrorStatus status, IBurstContext context);
+
+ /*
+ * Saves the prepared model to cache files.
+ *
+ * saveToCache is used to save a prepared model to cache files for faster
+ * model compilation time when the same model preparation is requested in
+ * the future. There are exactly two cache file descriptors provided to the
+ * driver: modelCache and dataCache.
+ *
+ * The dataCache is for caching constant data, possibly including preprocessed
+ * and transformed tensor buffers. Any modification to the dataCache should
+ * have no worse effect than generating bad output values at execution time.
+ *
+ * The modelCache is for caching security-sensitive data such as compiled
+ * executable machine code in the device's native binary format. A modification
+ * to the modelCache may affect the driver's execution behavior, and a malicious
+ * client could make use of this to execute beyond the granted permission. Thus,
+ * the driver must always check whether the modelCache is corrupted before preparing
+ * the model from cache.
+ *
+ * The two file descriptors must point to two zero-length files with offset
+ * positioned at the beginning of the file. The file descriptors may be closed
+ * by the client once the method has returned.
+ *
+ * If the driver decides not to save the prepared model without looking at the
+ * input arguments to the saveToCache function, saveToCache must return with
+ * ErrorStatus::GENERAL_FAILURE. Otherwise, the saveToCache function must verify
+ * the input arguments to the saveToCache function are valid, and return with
+ * ErrorStatus::INVALID_ARGUMENT if not. If the inputs are valid but the driver
+ * could not save the prepared model, saveToCache must return with the appropriate
+ * ErrorStatus. Otherwise, it must write the cache files and return
+ * ErrorStatus::NONE. Unless saveToCache returns ErrorStatus::NONE, the contents
+ * of the cache files are undefined.
+ *
+ * @param modelCache A handle holding exactly one cache file descriptor for the
+ * security-sensitive cache.
+ * @param dataCache A handle holding exactly one cache file descriptor for the
+ * constants' cache.
+ * @param token A caching token of length Constant::BYTE_SIZE_OF_CACHE_TOKEN
+ * identifying the prepared model. The same token will be provided
+ * when retrieving the prepared model from cache files with
+ * IDevice::prepareModelFromCache. Tokens should be chosen to have
+ * a low rate of collision for a particular application. The driver
+ * cannot detect a collision; a collision will result in a failed
+ * execution or in a successful execution that produces incorrect
+ * output values.
+ * @return status Error status of saveToCache, must be:
+ * - NONE if saveToCache is performed successfully
+ * - DEVICE_UNAVAILABLE if driver is offline or busy
+ * - GENERAL_FAILURE if the driver could not save the
+ * prepared model or if there is an unspecified error
+ * - INVALID_ARGUMENT if one of the input arguments is invalid,
+ * unless the driver decides not to save the prepared model
+ * without looking at the input arguments
+ */
+ saveToCache(handle modelCache, handle dataCache,
+ uint8_t[Constant:BYTE_SIZE_OF_CACHE_TOKEN] token)
generates (ErrorStatus status);
};
diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal
index 40c07e7..0abe56d 100644
--- a/neuralnetworks/1.2/types.hal
+++ b/neuralnetworks/1.2/types.hal
@@ -17,6 +17,7 @@
package android.hardware.neuralnetworks@1.2;
import @1.0::DataLocation;
+import @1.0::ErrorStatus;
import @1.0::OperandLifeTime;
import @1.0::OperandType;
import @1.0::PerformanceInfo;
@@ -24,6 +25,13 @@
import android.hidl.safe_union@1.0::Monostate;
+enum Constant : uint32_t {
+ /**
+ * The byte size of the cache token.
+ */
+ BYTE_SIZE_OF_CACHE_TOKEN = 32,
+};
+
enum OperandType : @1.0::OperandType {
/**
* An 8 bit boolean scalar value.
@@ -76,6 +84,18 @@
* where C is an index in the Channel dimension.
*/
TENSOR_QUANT8_SYMM_PER_CHANNEL = 11,
+ /**
+ * A tensor of 16 bit unsigned integers that represent real numbers.
+ *
+ * Attached to this tensor are two numbers that can be used to convert the
+ * 16 bit integer to the real value and vice versa. These two numbers are:
+ * - scale: a 32 bit floating point value greater than zero.
+ * - zeroPoint: a 32 bit integer, in range [0, 65535].
+ *
+ * The formula is:
+ * real_value = (integer_value - zeroPoint) * scale.
+ */
+ TENSOR_QUANT16_ASYMM = 12,
/* ADDING A NEW FUNDAMENTAL TYPE REQUIRES UPDATING THE VALUE OF
* OperandTypeRange::OPERAND_FUNDAMENTAL_MAX.
*/
@@ -89,7 +109,7 @@
*/
enum OperandTypeRange : uint32_t {
OPERAND_FUNDAMENTAL_MIN = 0,
- OPERAND_FUNDAMENTAL_MAX = 11,
+ OPERAND_FUNDAMENTAL_MAX = 12,
OPERAND_OEM_MIN = 10000,
OPERAND_OEM_MAX = 10001,
};
@@ -101,17 +121,17 @@
*/
enum OperationType : @1.1::OperationType {
// TODO(b/116445845): Sync docs when all ops are implemented.
- ARGMAX = 38,
- ARGMIN = 39,
- PAD_V2 = 40,
+ ABS = 38,
+ ARGMAX = 39,
+ ARGMIN = 40,
AXIS_ALIGNED_BBOX_TRANSFORM = 41,
BIDIRECTIONAL_SEQUENCE_LSTM = 42,
BIDIRECTIONAL_SEQUENCE_RNN = 43,
BOX_WITH_NMS_LIMIT = 44,
CAST = 45,
CHANNEL_SHUFFLE = 46,
- DETECTION_OUTPUT = 47,
- EMBEDDING_LOOKUP_SPARSE = 48,
+ DETECTION_POSTPROCESSING = 47,
+ EQUAL = 48,
EXP = 49,
EXPAND_DIMS = 50,
GATHER = 51,
@@ -120,47 +140,43 @@
GREATER_EQUAL = 54,
GROUPED_CONV_2D = 55,
HEATMAP_MAX_KEYPOINT = 56,
- LESS = 57,
- LESS_EQUAL = 58,
- LOG = 59,
- LOGICAL_AND = 60,
- LOGICAL_NOT = 61,
- LOGICAL_OR = 62,
- LOG_SOFTMAX = 63,
- MAXIMUM = 64,
- MINIMUM = 65,
- NEG = 66,
- POW = 67,
- PRELU = 68,
- PRIOR_BOX = 69,
- QUANTIZE = 70,
- QUANTIZED_16BIT_LSTM = 71,
- RANDOM_MULTINOMIAL = 72,
- REDUCE_PROD = 73,
- ROI_ALIGN = 74,
- RSQRT = 75,
- SELECT = 76,
- SIN = 77,
- SLICE = 78,
- SPARSE_TO_DENSE = 79,
- SPLIT = 80,
- SQRT = 81,
- TILE = 82,
- TOPK_V2 = 83,
- TRANSPOSE_CONV_2D = 84,
- UNIDIRECTIONAL_SEQUENCE_LSTM = 85,
- UNIDIRECTIONAL_SEQUENCE_RNN = 86,
- ROTATED_BBOX_TRANSFORM = 87,
- ABS = 88,
- ROI_POOLING = 89,
- EQUAL = 90,
- NOT_EQUAL = 91,
- REDUCE_SUM = 92,
- REDUCE_MAX = 93,
- REDUCE_MIN = 94,
- REDUCE_ANY = 95,
- REDUCE_ALL = 96,
- INSTANCE_NORMALIZATION = 97,
+ INSTANCE_NORMALIZATION = 57,
+ LESS = 58,
+ LESS_EQUAL = 59,
+ LOG = 60,
+ LOGICAL_AND = 61,
+ LOGICAL_NOT = 62,
+ LOGICAL_OR = 63,
+ LOG_SOFTMAX = 64,
+ MAXIMUM = 65,
+ MINIMUM = 66,
+ NEG = 67,
+ NOT_EQUAL = 68,
+ PAD_V2 = 69,
+ POW = 70,
+ PRELU = 71,
+ QUANTIZE = 72,
+ QUANTIZED_16BIT_LSTM = 73,
+ RANDOM_MULTINOMIAL = 74,
+ REDUCE_ALL = 75,
+ REDUCE_ANY = 76,
+ REDUCE_MAX = 77,
+ REDUCE_MIN = 78,
+ REDUCE_PROD = 79,
+ REDUCE_SUM = 80,
+ ROI_ALIGN = 81,
+ ROI_POOLING = 82,
+ RSQRT = 83,
+ SELECT = 84,
+ SIN = 85,
+ SLICE = 86,
+ SPLIT = 87,
+ SQRT = 88,
+ TILE = 89,
+ TOPK_V2 = 90,
+ TRANSPOSE_CONV_2D = 91,
+ UNIDIRECTIONAL_SEQUENCE_LSTM = 92,
+ UNIDIRECTIONAL_SEQUENCE_RNN = 93,
/* ADDING A NEW FUNDAMENTAL OPERATION REQUIRES UPDATING THE VALUE OF
* OperationTypeRange::OPERATION_FUNDAMENTAL_MAX.
*/
@@ -174,12 +190,32 @@
*/
enum OperationTypeRange : uint32_t {
OPERATION_FUNDAMENTAL_MIN = 0,
- OPERATION_FUNDAMENTAL_MAX = 97,
+ OPERATION_FUNDAMENTAL_MAX = 93,
OPERATION_OEM_MIN = 10000,
OPERATION_OEM_MAX = 10000,
};
/**
+ * Device types.
+ *
+ * The type of NNAPI device.
+ */
+enum DeviceType : int32_t {
+ // Leaving 0 unused as it means unknown type in NDK NNAPI. There is no
+ // HAL equivalent of unknown type and a 1.2 HAL implementation must belong
+ // to one of the categories below.
+ /** The device does not fall into any category below. */
+ OTHER = 1,
+ /** The device runs NNAPI models on single or multi-core CPU. */
+ CPU = 2,
+ /** The device can run NNAPI models and also accelerate graphics APIs such
+ * as OpenGL ES and Vulkan. */
+ GPU = 3,
+ /** Dedicated accelerator for Machine Learning workloads. */
+ ACCELERATOR = 4,
+};
+
+/**
* Describes one operation of the model's graph.
*/
struct Operation {
@@ -234,9 +270,6 @@
*
* For a scalar operand, dimensions.size() must be 0.
*
- * For a tensor operand, dimensions.size() must be at least 1;
- * however, any of the dimensions may be unspecified.
- *
* A tensor operand with all dimensions specified has "fully
* specified" dimensions. Whenever possible (i.e., whenever the
* dimensions are known at model construction time), a tensor
@@ -255,17 +288,20 @@
* . The operand has lifetime CONSTANT_COPY or
* CONSTANT_REFERENCE.
*
- * . The operand has lifetime MODEL_INPUT or MODEL_OUTPUT. Fully
+ * . The operand has lifetime MODEL_INPUT. Fully
* specified dimensions must either be present in the
* Operand or they must be provided in the corresponding
* RequestArgument.
- * EXCEPTION: If the input or output is optional and omitted
+ * EXCEPTION: If the input is optional and omitted
* (by setting the hasNoValue field of the corresponding
* RequestArgument to true) then it need not have fully
* specified dimensions.
*
* A tensor operand with some number of unspecified dimensions is
* represented by setting each unspecified dimension to 0.
+ *
+ * A tensor operand with unspecified rank is represented by providing
+ * an empty dimensions vector.
*/
vec<uint32_t> dimensions;
@@ -397,3 +433,255 @@
*/
bool relaxComputationFloat32toFloat16;
};
+
+/**
+ * Describes the shape information of an output operand after execution.
+ */
+struct OutputShape {
+ /**
+ * Dimensions of the operand.
+ */
+ vec<uint32_t> dimensions;
+
+ /**
+ * Whether the provided buffer size is sufficient for the output.
+ */
+ bool isSufficient;
+};
+
+/**
+ * Specifies whether or not to measure timing information during execution.
+ */
+enum MeasureTiming : int32_t {
+ NO = 0,
+ YES = 1,
+};
+
+/**
+
+ * Timing information measured during execution. Each time is a duration from
+ * the beginning of some task to the end of that task, including time when that
+ * task is not active (for example, preempted by some other task, or
+ * waiting for some resource to become available).
+ *
+ * Times are measured in microseconds.
+ * When a time is not available, it must be reported as UINT64_MAX.
+ */
+struct Timing {
+ /** Execution time on device (not driver, which runs on host processor). */
+ uint64_t timeOnDevice;
+ /** Execution time in driver (including time on device). */
+ uint64_t timeInDriver;
+};
+
+/**
+ * FmqRequestDatum is a single element of a serialized representation of an
+ * execution request (a {@link @1.0::Request} object and a {@link MeasureTiming}
+ * value) which is sent across FastMessageQueue.
+ *
+ * The serialized representation for a particular execution is referred to later
+ * in these descriptions as a 'packet'.
+ *
+ * FastMessageQueue can only pass HIDL-defined types that do not involve nested
+ * buffers, handles, or interfaces.
+ *
+ * The request is serialized as follows:
+ * 1) 'packetInformation'
+ * 2) For each input operand:
+ * 2.1) 'inputOperandInformation'
+ * 2.2) For each dimension element of the operand:
+ * 2.2.1) 'inputOperandDimensionValue'
+ * 3) For each output operand:
+ * 3.1) 'outputOperandInformation'
+ * 3.2) For each dimension element of the operand:
+ * 3.2.1) 'outputOperandDimensionValue'
+ * 4) For each pool:
+ * 4.1) 'poolIdentifier'
+ * 5) 'measureTiming'
+ */
+safe_union FmqRequestDatum {
+ /**
+ * Type to describe the high-level layout of the packet.
+ */
+ struct PacketInformation {
+ /**
+ * How many elements the packet contains, including the
+ * "packetInformation" datum.
+ */
+ uint32_t packetSize;
+
+ /**
+ * Number of input operands.
+ */
+ uint32_t numberOfInputOperands;
+
+ /**
+ * Number of output operands.
+ */
+ uint32_t numberOfOutputOperands;
+
+ /**
+ * Number of pool identifiers.
+ */
+ uint32_t numberOfPools;
+ };
+
+ /**
+ * Type representing the information for each operand.
+ */
+ struct OperandInformation {
+ /**
+ * If true, the argument does not have a value. This can be used for
+ * operations that take optional arguments. If true, the fields of
+ * 'location' are set to 0, 'numberOfDimensions' is set to 0, and the
+ * dimensions information is omitted from the serialization.
+ */
+ bool hasNoValue;
+
+ /**
+ * The location within one of the memory pools passed in the Request.
+ */
+ DataLocation location;
+
+ /**
+ * Number of subsequent elements that belong to the dimensions vector.
+ */
+ uint32_t numberOfDimensions;
+ };
+
+ /**
+ * packetInformation is the first element of the packet and describes the
+ * remainder of the packet.
+ */
+ PacketInformation packetInformation;
+
+ /**
+ * Information for each input operand.
+ */
+ OperandInformation inputOperandInformation;
+
+ /**
+ * Element of the dimensions vector.
+ */
+ uint32_t inputOperandDimensionValue;
+
+ /**
+ * Information for each output operand.
+ */
+ OperandInformation outputOperandInformation;
+
+ /**
+ * Element of the dimensions vector.
+ */
+ uint32_t outputOperandDimensionValue;
+
+ /**
+ * Unique identifier for a pool.
+ *
+ * A {@link @1.0::Request} passes across one or more pools of shared memory
+ * for the inputs and outputs of an execution. However, these memory pools
+ * are not able to be sent across FastMessageQueue directly. Instead, the
+ * producing side of the FMQ represents each different pool with a unique
+ * identifier, and sends this identifier across the FMQ. Whenever the
+ * consuming side of the FMQ needs the memory corresponding to this unique
+ * identifier, it can pass the identifier to
+ * {@link IBurstCallback::getMemories} to retreive the memory. Although this
+ * HIDL Binder call is expensive compared to communication across FMQ, it is
+ * only needed in the cases when the consumer does not recognize the unique
+ * identifier.
+ */
+ int32_t poolIdentifier;
+
+ /**
+ * Specifies whether or not to measure duration of the execution. The
+ * duration runs from the time the driver dequeues the request from a
+ * FastMessageQueue to the time the driver enqueues results to a
+ * FastMessageQueue.
+ */
+ MeasureTiming measureTiming;
+};
+
+/**
+ * FmqResultDatum is a single element of a serialized representation of the
+ * values returned from an execution ({@link @1.0::ErrorStatus},
+ * vec<{@link OutputShape}>, and {@link Timing}) which is returned via
+ * FastMessageQueue.
+ *
+ * The serialized representation for a particular execution is referred to later
+ * in these descriptions as a 'packet'.
+ *
+ * FastMessageQueue can only pass HIDL-defined types that do not involve nested
+ * buffers, handles, or interfaces.
+ *
+ * The execution return values ({@link @1.0::ErrorStatus} and
+ * vec<{@link OutputShape}>) are serialized as follows:
+ * 1) 'packetInformation'
+ * 2) For each returned operand:
+ * 2.1) 'operandInformation'
+ * 2.2) For each dimension element of the operand:
+ * 2.2.1) 'operandDimensionValue'
+ * 3) 'executionTiming'
+ */
+safe_union FmqResultDatum {
+ /**
+ * Type to describe the high-level layout of the packet.
+ */
+ struct PacketInformation {
+ /**
+ * How many elements the packet contains, including the
+ * "packetInformation" datum.
+ */
+ uint32_t packetSize;
+
+ /**
+ * Status of the execution.
+ */
+ ErrorStatus errorStatus;
+
+ /**
+ * Number of returned operands.
+ */
+ uint32_t numberOfOperands;
+ };
+
+ /**
+ * Type representing the information for each operand.
+ */
+ struct OperandInformation {
+ /**
+ * Indicates whether the operand's output buffer is large enough to
+ * store the operand's result data.
+ */
+ bool isSufficient;
+
+ /**
+ * Number of subsequent elements that belong to the dimensions vector.
+ */
+ uint32_t numberOfDimensions;
+ };
+
+ /**
+ * packetInformation is the first element of the packet and describes the
+ * remainder of the packet. It additionally includes the status of the
+ * execution.
+ */
+ PacketInformation packetInformation;
+
+ /**
+ * Information for each returned operand.
+ */
+ OperandInformation operandInformation;
+
+ /**
+ * Element of the dimensions vector.
+ */
+ uint32_t operandDimensionValue;
+
+ /**
+ * Duration of execution. Unless measurement was requested and execution
+ * succeeds, all times must be reported as UINT64_MAX. A driver may choose
+ * to report any time as UINT64_MAX, indicating that measurement is not
+ * available.
+ */
+ Timing executionTiming;
+};
diff --git a/neuralnetworks/1.2/vts/functional/Android.bp b/neuralnetworks/1.2/vts/functional/Android.bp
index 5b119ee..0cb9e16 100644
--- a/neuralnetworks/1.2/vts/functional/Android.bp
+++ b/neuralnetworks/1.2/vts/functional/Android.bp
@@ -21,6 +21,9 @@
srcs: [
"GeneratedTestsV1_0.cpp",
],
+ cflags: [
+ "-DNN_TEST_DYNAMIC_OUTPUT_SHAPE"
+ ],
test_suites: ["general-tests"],
}
@@ -31,6 +34,9 @@
srcs: [
"GeneratedTestsV1_1.cpp",
],
+ cflags: [
+ "-DNN_TEST_DYNAMIC_OUTPUT_SHAPE"
+ ],
test_suites: ["general-tests"],
}
@@ -42,5 +48,8 @@
"BasicTests.cpp",
"GeneratedTests.cpp",
],
+ cflags: [
+ "-DNN_TEST_DYNAMIC_OUTPUT_SHAPE"
+ ],
test_suites: ["general-tests"],
}
diff --git a/neuralnetworks/1.2/vts/functional/BasicTests.cpp b/neuralnetworks/1.2/vts/functional/BasicTests.cpp
index eb3ebd3..8c3ad15 100644
--- a/neuralnetworks/1.2/vts/functional/BasicTests.cpp
+++ b/neuralnetworks/1.2/vts/functional/BasicTests.cpp
@@ -45,6 +45,16 @@
});
EXPECT_TRUE(ret.isOk());
}
+
+// device type test
+TEST_F(NeuralnetworksHidlTest, GetDeviceTypeTest) {
+ Return<void> ret = device->getType([](ErrorStatus status, DeviceType type) {
+ EXPECT_EQ(ErrorStatus::NONE, status);
+ EXPECT_TRUE(type == DeviceType::OTHER || type == DeviceType::CPU ||
+ type == DeviceType::GPU || type == DeviceType::ACCELERATOR);
+ });
+ EXPECT_TRUE(ret.isOk());
+}
} // namespace functional
} // namespace vts
} // namespace V1_2
diff --git a/neuralnetworks/1.2/vts/functional/GeneratedTests.cpp b/neuralnetworks/1.2/vts/functional/GeneratedTests.cpp
index 9bff09c..4bc891f 100644
--- a/neuralnetworks/1.2/vts/functional/GeneratedTests.cpp
+++ b/neuralnetworks/1.2/vts/functional/GeneratedTests.cpp
@@ -33,7 +33,8 @@
namespace generated_tests {
using ::test_helper::MixedTypedExample;
extern void Execute(const sp<V1_2::IDevice>&, std::function<V1_2::Model(void)>,
- std::function<bool(int)>, const std::vector<MixedTypedExample>&);
+ std::function<bool(int)>, const std::vector<MixedTypedExample>&,
+ bool testDynamicOutputShape = false);
} // namespace generated_tests
namespace V1_2 {
diff --git a/neuralnetworks/1.2/vts/functional/GeneratedTestsV1_0.cpp b/neuralnetworks/1.2/vts/functional/GeneratedTestsV1_0.cpp
index 56a61d4..956926a 100644
--- a/neuralnetworks/1.2/vts/functional/GeneratedTestsV1_0.cpp
+++ b/neuralnetworks/1.2/vts/functional/GeneratedTestsV1_0.cpp
@@ -33,7 +33,8 @@
namespace generated_tests {
using ::test_helper::MixedTypedExample;
extern void Execute(const sp<V1_2::IDevice>&, std::function<V1_2::Model(void)>,
- std::function<bool(int)>, const std::vector<MixedTypedExample>&);
+ std::function<bool(int)>, const std::vector<MixedTypedExample>&,
+ bool testDynamicOutputShape = false);
} // namespace generated_tests
namespace V1_2 {
diff --git a/neuralnetworks/1.2/vts/functional/GeneratedTestsV1_1.cpp b/neuralnetworks/1.2/vts/functional/GeneratedTestsV1_1.cpp
index 1c781ec..425690f 100644
--- a/neuralnetworks/1.2/vts/functional/GeneratedTestsV1_1.cpp
+++ b/neuralnetworks/1.2/vts/functional/GeneratedTestsV1_1.cpp
@@ -33,7 +33,8 @@
namespace generated_tests {
using ::test_helper::MixedTypedExample;
extern void Execute(const sp<V1_2::IDevice>&, std::function<V1_2::Model(void)>,
- std::function<bool(int)>, const std::vector<MixedTypedExample>&);
+ std::function<bool(int)>, const std::vector<MixedTypedExample>&,
+ bool testDynamicOutputShape = false);
} // namespace generated_tests
namespace V1_2 {
diff --git a/neuralnetworks/1.2/vts/functional/ValidateModel.cpp b/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
index b1a0e53..f3e528e 100644
--- a/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
+++ b/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
@@ -161,6 +161,7 @@
case OperandType::TENSOR_FLOAT32:
case OperandType::TENSOR_INT32:
case OperandType::TENSOR_QUANT8_ASYMM:
+ case OperandType::TENSOR_QUANT16_ASYMM:
case OperandType::TENSOR_QUANT16_SYMM:
case OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL:
return 0;
@@ -172,6 +173,9 @@
static void mutateOperandRankTest(const sp<IDevice>& device, const Model& model) {
for (size_t operand = 0; operand < model.operands.size(); ++operand) {
const uint32_t invalidRank = getInvalidRank(model.operands[operand].type);
+ if (invalidRank == 0) {
+ continue;
+ }
const std::string message = "mutateOperandRankTest: operand " + std::to_string(operand) +
" has rank of " + std::to_string(invalidRank);
validate(device, message, model, [operand, invalidRank](Model* model) {
@@ -196,6 +200,7 @@
case OperandType::TENSOR_INT32:
return -1.0f;
case OperandType::TENSOR_QUANT8_ASYMM:
+ case OperandType::TENSOR_QUANT16_ASYMM:
case OperandType::TENSOR_QUANT16_SYMM:
return 0.0f;
default:
@@ -230,6 +235,8 @@
return {1};
case OperandType::TENSOR_QUANT8_ASYMM:
return {-1, 256};
+ case OperandType::TENSOR_QUANT16_ASYMM:
+ return {-1, 65536};
case OperandType::TENSOR_QUANT16_SYMM:
return {-32769, -1, 1, 32768};
default:
@@ -285,6 +292,7 @@
newOperand.zeroPoint = 0;
break;
case OperandType::TENSOR_QUANT8_ASYMM:
+ case OperandType::TENSOR_QUANT16_ASYMM:
case OperandType::TENSOR_QUANT16_SYMM:
newOperand.dimensions =
operand->dimensions.size() > 0 ? operand->dimensions : hidl_vec<uint32_t>({1});
@@ -328,6 +336,8 @@
// - RANDOM_MULTINOMIAL's argument can be either TENSOR_FLOAT16 or TENSOR_FLOAT32.
// - CONV_2D filter type (arg 1) can be QUANT8_ASYMM or QUANT8_SYMM_PER_CHANNEL
// - DEPTHWISE_CONV_2D filter type (arg 1) can be QUANT8_ASYMM or QUANT8_SYMM_PER_CHANNEL
+ // - GROUPED_CONV_2D filter type (arg 1) can be QUANT8_ASYMM or QUANT8_SYMM_PER_CHANNEL
+ // - TRANSPOSE_CONV_2D filter type (arg 1) can be QUANT8_ASYMM or QUANT8_SYMM_PER_CHANNEL
switch (operation.type) {
case OperationType::LSH_PROJECTION: {
if (operand == operation.inputs[1]) {
@@ -347,6 +357,8 @@
return true;
}
} break;
+ case OperationType::TRANSPOSE_CONV_2D:
+ case OperationType::GROUPED_CONV_2D:
case OperationType::DEPTHWISE_CONV_2D:
case OperationType::CONV_2D: {
if (operand == 1 && (type == OperandType::TENSOR_QUANT8_ASYMM ||
diff --git a/neuralnetworks/1.2/vts/functional/ValidateRequest.cpp b/neuralnetworks/1.2/vts/functional/ValidateRequest.cpp
index d80fbcf..d411da4 100644
--- a/neuralnetworks/1.2/vts/functional/ValidateRequest.cpp
+++ b/neuralnetworks/1.2/vts/functional/ValidateRequest.cpp
@@ -19,6 +19,7 @@
#include "VtsHalNeuralnetworks.h"
#include "Callbacks.h"
+#include "ExecutionBurstController.h"
#include "TestHarness.h"
#include "Utils.h"
@@ -42,6 +43,10 @@
///////////////////////// UTILITY FUNCTIONS /////////////////////////
+static bool badTiming(Timing timing) {
+ return timing.timeOnDevice == UINT64_MAX && timing.timeInDriver == UINT64_MAX;
+}
+
static void createPreparedModel(const sp<IDevice>& device, const Model& model,
sp<IPreparedModel>* preparedModel) {
ASSERT_NE(nullptr, preparedModel);
@@ -98,27 +103,86 @@
Request request, const std::function<void(Request*)>& mutation) {
mutation(&request);
+ // We'd like to test both with timing requested and without timing
+ // requested. Rather than running each test both ways, we'll decide whether
+ // to request timing by hashing the message. We do not use std::hash because
+ // it is not guaranteed stable across executions.
+ char hash = 0;
+ for (auto c : message) {
+ hash ^= c;
+ };
+ MeasureTiming measure = (hash & 1) ? MeasureTiming::YES : MeasureTiming::NO;
+
+ // asynchronous
{
SCOPED_TRACE(message + " [execute_1_2]");
sp<ExecutionCallback> executionCallback = new ExecutionCallback();
ASSERT_NE(nullptr, executionCallback.get());
Return<ErrorStatus> executeLaunchStatus =
- preparedModel->execute_1_2(request, executionCallback);
+ preparedModel->execute_1_2(request, measure, executionCallback);
ASSERT_TRUE(executeLaunchStatus.isOk());
ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, static_cast<ErrorStatus>(executeLaunchStatus));
executionCallback->wait();
ErrorStatus executionReturnStatus = executionCallback->getStatus();
+ const auto& outputShapes = executionCallback->getOutputShapes();
+ Timing timing = executionCallback->getTiming();
ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, executionReturnStatus);
+ ASSERT_EQ(outputShapes.size(), 0);
+ ASSERT_TRUE(badTiming(timing));
}
+ // synchronous
{
SCOPED_TRACE(message + " [executeSynchronously]");
- Return<ErrorStatus> executeStatus = preparedModel->executeSynchronously(request);
+ Return<void> executeStatus = preparedModel->executeSynchronously(
+ request, measure,
+ [](ErrorStatus error, const hidl_vec<OutputShape>& outputShapes,
+ const Timing& timing) {
+ ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, error);
+ EXPECT_EQ(outputShapes.size(), 0);
+ EXPECT_TRUE(badTiming(timing));
+ });
ASSERT_TRUE(executeStatus.isOk());
- ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, static_cast<ErrorStatus>(executeStatus));
+ }
+
+ // burst
+ {
+ SCOPED_TRACE(message + " [burst]");
+
+ // create burst
+ std::unique_ptr<::android::nn::ExecutionBurstController> burst =
+ ::android::nn::createExecutionBurstController(preparedModel, /*blocking=*/true);
+ ASSERT_NE(nullptr, burst.get());
+
+ // create memory keys
+ std::vector<intptr_t> keys(request.pools.size());
+ for (size_t i = 0; i < keys.size(); ++i) {
+ keys[i] = reinterpret_cast<intptr_t>(&request.pools[i]);
+ }
+
+ // execute and verify
+ ErrorStatus error;
+ std::vector<OutputShape> outputShapes;
+ Timing timing;
+ std::tie(error, outputShapes, timing) = burst->compute(request, measure, keys);
+ EXPECT_EQ(ErrorStatus::INVALID_ARGUMENT, error);
+ EXPECT_EQ(outputShapes.size(), 0);
+ EXPECT_TRUE(badTiming(timing));
+
+ // additional burst testing
+ if (request.pools.size() > 0) {
+ // valid free
+ burst->freeMemory(keys.front());
+
+ // negative test: invalid free of unknown (blank) memory
+ burst->freeMemory(intptr_t{});
+
+ // negative test: double free of memory
+ burst->freeMemory(keys.front());
+ }
}
}
diff --git a/neuralnetworks/1.2/vts/functional/VtsHalNeuralnetworks.h b/neuralnetworks/1.2/vts/functional/VtsHalNeuralnetworks.h
index dedab8d..c0c21bd 100644
--- a/neuralnetworks/1.2/vts/functional/VtsHalNeuralnetworks.h
+++ b/neuralnetworks/1.2/vts/functional/VtsHalNeuralnetworks.h
@@ -79,6 +79,9 @@
// Tag for the generated tests
class GeneratedTest : public NeuralnetworksHidlTest {};
+// Tag for the dynamic output shape tests
+class DynamicOutputShapeTest : public NeuralnetworksHidlTest {};
+
// Utility function to get PreparedModel from callback and downcast to V1_2.
sp<IPreparedModel> getPreparedModel_1_2(
const sp<V1_2::implementation::PreparedModelCallback>& callback);
diff --git a/power/stats/1.0/default/Android.bp b/power/stats/1.0/default/Android.bp
index 04270c1..b57466d 100644
--- a/power/stats/1.0/default/Android.bp
+++ b/power/stats/1.0/default/Android.bp
@@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
-cc_library_shared {
+cc_binary {
name: "android.hardware.power.stats@1.0-service",
relative_install_path: "hw",
init_rc: ["android.hardware.power.stats@1.0-service.rc"],
diff --git a/power/stats/1.0/default/OWNERS b/power/stats/1.0/default/OWNERS
new file mode 100644
index 0000000..2d95a97
--- /dev/null
+++ b/power/stats/1.0/default/OWNERS
@@ -0,0 +1,3 @@
+krossmo@google.com
+bsschwar@google.com
+tstrudel@google.com
diff --git a/power/stats/1.0/default/PowerStats.cpp b/power/stats/1.0/default/PowerStats.cpp
index 810c575..350aa62 100644
--- a/power/stats/1.0/default/PowerStats.cpp
+++ b/power/stats/1.0/default/PowerStats.cpp
@@ -287,25 +287,218 @@
return Void();
}
+uint32_t PowerStats::addPowerEntity(const std::string& name, PowerEntityType type) {
+ uint32_t id = mPowerEntityInfos.size();
+ mPowerEntityInfos.push_back({id, name, type});
+ return id;
+}
+
+void PowerStats::addStateResidencyDataProvider(std::shared_ptr<IStateResidencyDataProvider> p) {
+ std::vector<PowerEntityStateSpace> stateSpaces = p->getStateSpaces();
+ for (auto stateSpace : stateSpaces) {
+ mPowerEntityStateSpaces.emplace(stateSpace.powerEntityId, stateSpace);
+ mStateResidencyDataProviders.emplace(stateSpace.powerEntityId, p);
+ }
+}
+
Return<void> PowerStats::getPowerEntityInfo(getPowerEntityInfo_cb _hidl_cb) {
- hidl_vec<PowerEntityInfo> eInfo;
- _hidl_cb(eInfo, Status::NOT_SUPPORTED);
+ // If not configured, return NOT_SUPPORTED
+ if (mPowerEntityInfos.empty()) {
+ _hidl_cb({}, Status::NOT_SUPPORTED);
+ return Void();
+ }
+
+ _hidl_cb(mPowerEntityInfos, Status::SUCCESS);
return Void();
}
Return<void> PowerStats::getPowerEntityStateInfo(const hidl_vec<uint32_t>& powerEntityIds,
getPowerEntityStateInfo_cb _hidl_cb) {
- (void)powerEntityIds;
- hidl_vec<PowerEntityStateSpace> powerEntityStateSpaces;
- _hidl_cb(powerEntityStateSpaces, Status::NOT_SUPPORTED);
+ // If not configured, return NOT_SUPPORTED
+ if (mPowerEntityStateSpaces.empty()) {
+ _hidl_cb({}, Status::NOT_SUPPORTED);
+ return Void();
+ }
+
+ std::vector<PowerEntityStateSpace> stateSpaces;
+
+ // If powerEntityIds is empty then return state space info for all entities
+ if (powerEntityIds.size() == 0) {
+ stateSpaces.reserve(mPowerEntityStateSpaces.size());
+ for (auto i : mPowerEntityStateSpaces) {
+ stateSpaces.emplace_back(i.second);
+ }
+ _hidl_cb(stateSpaces, Status::SUCCESS);
+ return Void();
+ }
+
+ // Return state space information only for valid ids
+ auto ret = Status::SUCCESS;
+ stateSpaces.reserve(powerEntityIds.size());
+ for (const uint32_t id : powerEntityIds) {
+ auto stateSpace = mPowerEntityStateSpaces.find(id);
+ if (stateSpace != mPowerEntityStateSpaces.end()) {
+ stateSpaces.emplace_back(stateSpace->second);
+ } else {
+ ret = Status::INVALID_INPUT;
+ }
+ }
+
+ _hidl_cb(stateSpaces, ret);
return Void();
}
Return<void> PowerStats::getPowerEntityStateResidencyData(
- const hidl_vec<uint32_t>& powerEntityIds, getPowerEntityStateResidencyData_cb _hidl_cb) {
- (void)powerEntityIds;
+ const hidl_vec<uint32_t>& powerEntityIds, getPowerEntityStateResidencyData_cb _hidl_cb) {
+ // If not configured, return NOT_SUPPORTED
+ if (mStateResidencyDataProviders.empty() || mPowerEntityStateSpaces.empty()) {
+ _hidl_cb({}, Status::NOT_SUPPORTED);
+ return Void();
+ }
+
+ // If powerEntityIds is empty then return data for all supported entities
+ if (powerEntityIds.size() == 0) {
+ std::vector<uint32_t> ids;
+ for (auto stateSpace : mPowerEntityStateSpaces) {
+ ids.emplace_back(stateSpace.first);
+ }
+ return getPowerEntityStateResidencyData(ids, _hidl_cb);
+ }
+
+ std::unordered_map<uint32_t, PowerEntityStateResidencyResult> stateResidencies;
+ std::vector<PowerEntityStateResidencyResult> results;
+ results.reserve(powerEntityIds.size());
+
+ // return results for only the given powerEntityIds
+ bool invalidInput = false;
+ bool filesystemError = false;
+ for (auto id : powerEntityIds) {
+ auto dataProvider = mStateResidencyDataProviders.find(id);
+ // skip if the given powerEntityId does not have an associated StateResidencyDataProvider
+ if (dataProvider == mStateResidencyDataProviders.end()) {
+ invalidInput = true;
+ continue;
+ }
+
+ // get the results if we have not already done so.
+ if (stateResidencies.find(id) == stateResidencies.end()) {
+ if (!dataProvider->second->getResults(stateResidencies)) {
+ filesystemError = true;
+ }
+ }
+
+ // append results
+ auto stateResidency = stateResidencies.find(id);
+ if (stateResidency != stateResidencies.end()) {
+ results.emplace_back(stateResidency->second);
+ }
+ }
+
+ auto ret = Status::SUCCESS;
+ if (filesystemError) {
+ ret = Status::FILESYSTEM_ERROR;
+ } else if (invalidInput) {
+ ret = Status::INVALID_INPUT;
+ }
+
+ _hidl_cb(results, ret);
+ return Void();
+}
+
+bool DumpResidencyDataToFd(const hidl_vec<PowerEntityInfo>& infos,
+ const hidl_vec<PowerEntityStateSpace>& stateSpaces,
+ const hidl_vec<PowerEntityStateResidencyResult>& results, int fd) {
+ // construct lookup table of powerEntityId to name
+ std::unordered_map<uint32_t, std::string> entityNames;
+ for (auto info : infos) {
+ entityNames.emplace(info.powerEntityId, info.powerEntityName);
+ }
+
+ // construct lookup table of powerEntityId, powerEntityStateId to state name
+ std::unordered_map<uint32_t, std::unordered_map<uint32_t, std::string>> stateNames;
+ for (auto stateSpace : stateSpaces) {
+ stateNames.emplace(stateSpace.powerEntityId, std::unordered_map<uint32_t, std::string>());
+ for (auto state : stateSpace.states) {
+ stateNames.at(stateSpace.powerEntityId)
+ .emplace(state.powerEntityStateId, state.powerEntityStateName);
+ }
+ }
+
+ std::ostringstream dumpStats;
+ dumpStats << "\n========== PowerStats HAL 1.0 state residencies ==========\n";
+
+ const char* headerFormat = " %14s %14s %16s %15s %16s\n";
+ const char* dataFormat =
+ " %14s %14s %13" PRIu64 " ms %15" PRIu64 " %13" PRIu64 " ms\n";
+ dumpStats << android::base::StringPrintf(headerFormat, "Entity", "State", "Total time",
+ "Total entries", "Last entry timestamp");
+
+ for (auto result : results) {
+ for (auto stateResidency : result.stateResidencyData) {
+ dumpStats << android::base::StringPrintf(
+ dataFormat, entityNames.at(result.powerEntityId).c_str(),
+ stateNames.at(result.powerEntityId)
+ .at(stateResidency.powerEntityStateId)
+ .c_str(),
+ stateResidency.totalTimeInStateMs, stateResidency.totalStateEntryCount,
+ stateResidency.lastEntryTimestampMs);
+ }
+ }
+
+ dumpStats << "========== End of PowerStats HAL 1.0 state residencies ==========\n";
+
+ return android::base::WriteStringToFd(dumpStats.str(), fd);
+}
+
+Return<void> PowerStats::debug(const hidl_handle& handle, const hidl_vec<hidl_string>&) {
+ if (handle == nullptr || handle->numFds < 1) {
+ return Void();
+ }
+
+ int fd = handle->data[0];
+ Status status;
+ hidl_vec<PowerEntityInfo> infos;
+
+ // Get power entity information
+ getPowerEntityInfo([&status, &infos](auto rInfos, auto rStatus) {
+ status = rStatus;
+ infos = rInfos;
+ });
+ if (status != Status::SUCCESS) {
+ LOG(ERROR) << "Error getting power entity info";
+ return Void();
+ }
+
+ // Get power entity state information
+ hidl_vec<PowerEntityStateSpace> stateSpaces;
+ getPowerEntityStateInfo({}, [&status, &stateSpaces](auto rStateSpaces, auto rStatus) {
+ status = rStatus;
+ stateSpaces = rStateSpaces;
+ });
+ if (status != Status::SUCCESS) {
+ LOG(ERROR) << "Error getting state info";
+ return Void();
+ }
+
+ // Get power entity state residency data
hidl_vec<PowerEntityStateResidencyResult> results;
- _hidl_cb(results, Status::NOT_SUPPORTED);
+ getPowerEntityStateResidencyData({}, [&status, &results](auto rResults, auto rStatus) {
+ status = rStatus;
+ results = rResults;
+ });
+
+ // This implementation of getPowerEntityStateResidencyData supports the
+ // return of partial results if status == FILESYSTEM_ERROR.
+ if (status != Status::SUCCESS) {
+ LOG(ERROR) << "Error getting residency data -- Some results missing";
+ }
+
+ if (!DumpResidencyDataToFd(infos, stateSpaces, results, fd)) {
+ PLOG(ERROR) << "Failed to dump residency data to fd";
+ }
+
+ fsync(fd);
+
return Void();
}
diff --git a/power/stats/1.0/default/PowerStats.h b/power/stats/1.0/default/PowerStats.h
index fb2c6a8..d67fb35 100644
--- a/power/stats/1.0/default/PowerStats.h
+++ b/power/stats/1.0/default/PowerStats.h
@@ -21,6 +21,7 @@
#include <fmq/MessageQueue.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
+#include <unordered_map>
namespace android {
namespace hardware {
@@ -60,8 +61,19 @@
std::unique_ptr<MessageQueueSync> fmqSynchronized;
};
+class IStateResidencyDataProvider {
+ public:
+ virtual ~IStateResidencyDataProvider() = default;
+ virtual bool getResults(
+ std::unordered_map<uint32_t, PowerEntityStateResidencyResult>& results) = 0;
+ virtual std::vector<PowerEntityStateSpace> getStateSpaces() = 0;
+};
+
struct PowerStats : public IPowerStats {
+ public:
PowerStats();
+ uint32_t addPowerEntity(const std::string& name, PowerEntityType type);
+ void addStateResidencyDataProvider(std::shared_ptr<IStateResidencyDataProvider> p);
// Methods from ::android::hardware::power::stats::V1_0::IPowerStats follow.
Return<void> getRailInfo(getRailInfo_cb _hidl_cb) override;
Return<void> getEnergyData(const hidl_vec<uint32_t>& railIndices,
@@ -75,12 +87,19 @@
const hidl_vec<uint32_t>& powerEntityIds,
getPowerEntityStateResidencyData_cb _hidl_cb) override;
+ // Methods from ::android::hidl::base::V1_0::IBase follow.
+ Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& args) override;
+
private:
OnDeviceMmt mPm;
void findIioPowerMonitorNodes();
size_t parsePowerRails();
int parseIioEnergyNode(std::string devName);
Status parseIioEnergyNodes();
+ std::vector<PowerEntityInfo> mPowerEntityInfos;
+ std::unordered_map<uint32_t, PowerEntityStateSpace> mPowerEntityStateSpaces;
+ std::unordered_map<uint32_t, std::shared_ptr<IStateResidencyDataProvider>>
+ mStateResidencyDataProviders;
};
} // namespace implementation
diff --git a/power/stats/1.0/default/service.cpp b/power/stats/1.0/default/service.cpp
index 80649f5..a516536 100644
--- a/power/stats/1.0/default/service.cpp
+++ b/power/stats/1.0/default/service.cpp
@@ -31,17 +31,69 @@
// Generated HIDL files
using android::hardware::power::stats::V1_0::IPowerStats;
+using android::hardware::power::stats::V1_0::PowerEntityStateResidencyResult;
+using android::hardware::power::stats::V1_0::PowerEntityStateSpace;
+using android::hardware::power::stats::V1_0::PowerEntityType;
+using android::hardware::power::stats::V1_0::implementation::IStateResidencyDataProvider;
using android::hardware::power::stats::V1_0::implementation::PowerStats;
+class DefaultStateResidencyDataProvider : public IStateResidencyDataProvider {
+ public:
+ DefaultStateResidencyDataProvider(uint32_t id)
+ : mPowerEntityId(id), mActiveStateId(0), mSleepStateId(1) {}
+ ~DefaultStateResidencyDataProvider() = default;
+
+ bool getResults(std::unordered_map<uint32_t, PowerEntityStateResidencyResult>& results) {
+ PowerEntityStateResidencyResult result = { .powerEntityId = mPowerEntityId };
+ result.stateResidencyData.resize(2);
+
+ // Using fake numbers here for display only. A real implementation would
+ // use actual tracked stats.
+ result.stateResidencyData[0] = {
+ .powerEntityStateId = mActiveStateId,
+ .totalTimeInStateMs = 1,
+ .totalStateEntryCount = 2,
+ .lastEntryTimestampMs = 3
+ };
+ result.stateResidencyData[1] = {
+ .powerEntityStateId = mSleepStateId,
+ .totalTimeInStateMs = 4,
+ .totalStateEntryCount = 5,
+ .lastEntryTimestampMs = 6,
+ };
+ results.emplace(mPowerEntityId, result);
+ return true;
+ }
+
+ std::vector<PowerEntityStateSpace> getStateSpaces() {
+ return {{
+ .powerEntityId = mPowerEntityId,
+ .states = {
+ {.powerEntityStateId = mActiveStateId, .powerEntityStateName = "Active"},
+ {.powerEntityStateId = mSleepStateId, .powerEntityStateName = "Sleep"}
+ }
+ }};
+ }
+
+ private:
+ const uint32_t mPowerEntityId;
+ const uint32_t mActiveStateId;
+ const uint32_t mSleepStateId;
+};
+
int main(int /* argc */, char** /* argv */) {
ALOGI("power.stats service 1.0 is starting.");
- android::sp<IPowerStats> service = new PowerStats();
+ PowerStats* service = new PowerStats();
if (service == nullptr) {
ALOGE("Can not create an instance of power.stats HAL Iface, exiting.");
return 1;
}
+ uint32_t defaultId = service->addPowerEntity("DefaultEntity", PowerEntityType::SUBSYSTEM);
+ auto defaultSdp = std::make_shared<DefaultStateResidencyDataProvider>(defaultId);
+ service->addStateResidencyDataProvider(std::move(defaultSdp));
+
configureRpcThreadpool(1, true /*callerWillJoin*/);
status_t status = service->registerAsService();
diff --git a/prebuilt_hashes/dump_hals_for_release.py b/prebuilt_hashes/dump_hals_for_release.py
index fee12ab..e9ed4c2 100755
--- a/prebuilt_hashes/dump_hals_for_release.py
+++ b/prebuilt_hashes/dump_hals_for_release.py
@@ -32,7 +32,7 @@
class Constants:
CURRENT = 'current'
- HAL_PATH_PATTERN = r'/((?:[a-zA-Z_]+/)*)(\d+\.\d+)/([a-zA-Z_]+).hal'
+ HAL_PATH_PATTERN = r'/((?:[a-zA-Z_][a-zA-Z0-9_]*/)*)(\d+\.\d+)/([a-zA-Z_][a-zA-Z0-9_]*).hal'
CURRENT_TXT_PATTERN = r'(?:.*/)?([0-9]+|current).txt'
def trim_trailing_comments(line):
diff --git a/radio/1.3/IRadio.hal b/radio/1.3/IRadio.hal
index 2d64381..cc5b860 100644
--- a/radio/1.3/IRadio.hal
+++ b/radio/1.3/IRadio.hal
@@ -60,4 +60,15 @@
* Response function is IRadioResponse.enableModemResponse()
*/
oneway enableModem(int32_t serial, bool on);
-};
+
+ /**
+ * Request status of logical modem associated with the given serial number. It returns
+ * isEnabled=true if the logical modem is in low power mode without any activity, while
+ * the SIM card remains visible.
+ *
+ * @param serial Serial number of request.
+ *
+ * Response function is IRadioResponse.getModemStackStatusResponse()
+ */
+ oneway getModemStackStatus(int32_t serial);
+};
\ No newline at end of file
diff --git a/radio/1.3/IRadioResponse.hal b/radio/1.3/IRadioResponse.hal
index abdf2ee..c3bbe65 100644
--- a/radio/1.3/IRadioResponse.hal
+++ b/radio/1.3/IRadioResponse.hal
@@ -43,7 +43,17 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
- * RadioError:INTERNAL_ERR
+ * RadioError:MODEM_ERR
*/
oneway enableModemResponse(RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:MODEM_ERR
+ */
+ oneway getModemStackStatusResponse(RadioResponseInfo info, bool isEnabled);
};
diff --git a/radio/1.3/types.hal b/radio/1.3/types.hal
new file mode 100644
index 0000000..aa16cc7
--- /dev/null
+++ b/radio/1.3/types.hal
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio@1.3;
+
+import @1.0::RadioResponseType;
+import @1.0::RadioError;
+
+struct RadioResponseInfoModem {
+ RadioResponseType type; // Response type
+ int32_t serial; // Serial number of the request
+ RadioError error; // Response error
+ bool isEnabled; // whether modem is enabled or not
+};
\ No newline at end of file
diff --git a/radio/1.3/vts/OWNERS b/radio/1.3/vts/OWNERS
new file mode 100644
index 0000000..d642064
--- /dev/null
+++ b/radio/1.3/vts/OWNERS
@@ -0,0 +1,10 @@
+# Telephony team
+amitmahajan@google.com
+sanketpadawe@google.com
+shuoq@google.com
+sasindran@google.com
+nazaninb@google.com
+
+# VTS team
+yuexima@google.com
+yim@google.com
diff --git a/radio/1.3/vts/functional/Android.bp b/radio/1.3/vts/functional/Android.bp
new file mode 100644
index 0000000..67aff6e
--- /dev/null
+++ b/radio/1.3/vts/functional/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+ name: "VtsHalRadioV1_3TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: [
+ "radio_hidl_hal_api.cpp",
+ "radio_hidl_hal_test.cpp",
+ "radio_response.cpp",
+ "radio_indication.cpp",
+ "VtsHalRadioV1_3TargetTest.cpp",
+ ],
+ static_libs: [
+ "RadioVtsTestUtilBase",
+ "android.hardware.radio@1.3",
+ "android.hardware.radio@1.2",
+ "android.hardware.radio@1.1",
+ "android.hardware.radio@1.0",
+ ],
+ header_libs: ["radio.util.header@1.0"],
+ test_suites: ["general-tests"],
+}
diff --git a/radio/1.3/vts/functional/VtsHalRadioV1_3TargetTest.cpp b/radio/1.3/vts/functional/VtsHalRadioV1_3TargetTest.cpp
new file mode 100644
index 0000000..7d2623e
--- /dev/null
+++ b/radio/1.3/vts/functional/VtsHalRadioV1_3TargetTest.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <radio_hidl_hal_utils_v1_3.h>
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(RadioHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ RadioHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
+}
diff --git a/radio/1.3/vts/functional/radio_hidl_hal_api.cpp b/radio/1.3/vts/functional/radio_hidl_hal_api.cpp
new file mode 100644
index 0000000..6208c67
--- /dev/null
+++ b/radio/1.3/vts/functional/radio_hidl_hal_api.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <radio_hidl_hal_utils_v1_3.h>
+#include <vector>
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+
+/*
+ * Test IRadio.enableMddem() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_3, enableModem) {
+ serial = GetRandomSerialNumber();
+
+ bool responseToggle = radioRsp_v1_3->enableModemResponseToggle;
+ Return<void> res = radio_v1_3->enableModem(serial, true);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_3->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_3->rspInfo.serial);
+ ALOGI("getModemStackStatus, rspInfo.error = %s\n",
+ toString(radioRsp_v1_3->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_3->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR}));
+
+ // checking if getModemStackStatus returns true, as modem was enabled above
+ if (RadioError::NONE == radioRsp_v1_3->rspInfo.error) {
+ // wait until modem enabling is finished
+ while (responseToggle == radioRsp_v1_3->enableModemResponseToggle) {
+ sleep(1);
+ }
+ Return<void> resEnabled = radio_v1_3->getModemStackStatus(serial);
+ ASSERT_OK(resEnabled);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_3->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_3->rspInfo.serial);
+ ALOGI("getModemStackStatus, rspInfo.error = %s\n",
+ toString(radioRsp_v1_3->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_3->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR}));
+ // verify that enableModem did set isEnabled correctly
+ EXPECT_EQ(true, radioRsp_v1_3->isModemEnabled);
+ }
+}
+
+/*
+ * Test IRadio.getModemStackStatus() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_3, getModemStackStatus) {
+ serial = GetRandomSerialNumber();
+
+ Return<void> res = radio_v1_3->getModemStackStatus(serial);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_3->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_3->rspInfo.serial);
+ ALOGI("getModemStackStatus, rspInfo.error = %s\n",
+ toString(radioRsp_v1_3->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_3->rspInfo.error,
+ {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR}));
+}
diff --git a/radio/1.3/vts/functional/radio_hidl_hal_test.cpp b/radio/1.3/vts/functional/radio_hidl_hal_test.cpp
new file mode 100644
index 0000000..a876b1a
--- /dev/null
+++ b/radio/1.3/vts/functional/radio_hidl_hal_test.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <radio_hidl_hal_utils_v1_3.h>
+
+void RadioHidlTest_v1_3::SetUp() {
+ radio_v1_3 = ::testing::VtsHalHidlTargetTestBase::getService<
+ ::android::hardware::radio::V1_3::IRadio>(
+ RadioHidlEnvironment::Instance()
+ ->getServiceName<::android::hardware::radio::V1_3::IRadio>(
+ hidl_string(RADIO_SERVICE_NAME)));
+ if (radio_v1_3 == NULL) {
+ sleep(60);
+ radio_v1_3 = ::testing::VtsHalHidlTargetTestBase::getService<
+ ::android::hardware::radio::V1_3::IRadio>(
+ RadioHidlEnvironment::Instance()
+ ->getServiceName<::android::hardware::radio::V1_3::IRadio>(
+ hidl_string(RADIO_SERVICE_NAME)));
+ }
+ ASSERT_NE(nullptr, radio_v1_3.get());
+
+ radioRsp_v1_3 = new (std::nothrow) RadioResponse_v1_3(*this);
+ ASSERT_NE(nullptr, radioRsp_v1_3.get());
+
+ count_ = 0;
+
+ radioInd_v1_3 = new (std::nothrow) RadioIndication_v1_3(*this);
+ ASSERT_NE(nullptr, radioInd_v1_3.get());
+
+ radio_v1_3->setResponseFunctions(radioRsp_v1_3, radioInd_v1_3);
+
+ updateSimCardStatus();
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_3->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_3->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_3->rspInfo.error);
+
+ /* Enforce Vts Testing with Sim Status Present only. */
+ EXPECT_EQ(CardState::PRESENT, cardStatus.base.cardState);
+}
+
+/*
+ * Notify that the response message is received.
+ */
+void RadioHidlTest_v1_3::notify(int receivedSerial) {
+ std::unique_lock<std::mutex> lock(mtx_);
+ if (serial == receivedSerial) {
+ count_++;
+ cv_.notify_one();
+ }
+}
+
+/*
+ * Wait till the response message is notified or till TIMEOUT_PERIOD.
+ */
+std::cv_status RadioHidlTest_v1_3::wait() {
+ std::unique_lock<std::mutex> lock(mtx_);
+
+ std::cv_status status = std::cv_status::no_timeout;
+ auto now = std::chrono::system_clock::now();
+ while (count_ == 0) {
+ status = cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
+ if (status == std::cv_status::timeout) {
+ return status;
+ }
+ }
+ count_--;
+ return status;
+}
+
+void RadioHidlTest_v1_3::updateSimCardStatus() {
+ serial = GetRandomSerialNumber();
+ radio_v1_3->getIccCardStatus(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+}
\ No newline at end of file
diff --git a/radio/1.3/vts/functional/radio_hidl_hal_utils_v1_3.h b/radio/1.3/vts/functional/radio_hidl_hal_utils_v1_3.h
new file mode 100644
index 0000000..1d03a99
--- /dev/null
+++ b/radio/1.3/vts/functional/radio_hidl_hal_utils_v1_3.h
@@ -0,0 +1,658 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android-base/logging.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+
+#include <android/hardware/radio/1.2/types.h>
+#include <android/hardware/radio/1.3/IRadio.h>
+#include <android/hardware/radio/1.3/IRadioIndication.h>
+#include <android/hardware/radio/1.3/IRadioResponse.h>
+
+#include "vts_test_util.h"
+
+using namespace ::android::hardware::radio::V1_3;
+using namespace ::android::hardware::radio::V1_2;
+using namespace ::android::hardware::radio::V1_1;
+using namespace ::android::hardware::radio::V1_0;
+
+using ::android::sp;
+using ::android::hardware::hidl_bitfield;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+#define TIMEOUT_PERIOD 75
+#define RADIO_SERVICE_NAME "slot1"
+
+class RadioHidlTest_v1_3;
+extern ::android::hardware::radio::V1_2::CardStatus cardStatus;
+
+/* Callback class for radio response v1_3*/
+class RadioResponse_v1_3 : public ::android::hardware::radio::V1_3::IRadioResponse {
+ protected:
+ RadioHidlTest_v1_3& parent_v1_3;
+
+ public:
+ RadioResponseInfo rspInfo;
+ // Modem
+ bool isModemEnabled;
+ bool enableModemResponseToggle = false;
+
+ // Data
+ ::android::hardware::radio::V1_2::DataRegStateResult dataRegResp;
+
+ RadioResponse_v1_3(RadioHidlTest_v1_3& parent_v1_3);
+ virtual ~RadioResponse_v1_3() = default;
+
+ Return<void> getIccCardStatusResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::CardStatus& cardStatus);
+
+ Return<void> supplyIccPinForAppResponse(const RadioResponseInfo& info,
+ int32_t remainingRetries);
+
+ Return<void> supplyIccPukForAppResponse(const RadioResponseInfo& info,
+ int32_t remainingRetries);
+
+ Return<void> supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
+ int32_t remainingRetries);
+
+ Return<void> supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
+ int32_t remainingRetries);
+
+ Return<void> changeIccPinForAppResponse(const RadioResponseInfo& info,
+ int32_t remainingRetries);
+
+ Return<void> changeIccPin2ForAppResponse(const RadioResponseInfo& info,
+ int32_t remainingRetries);
+
+ Return<void> supplyNetworkDepersonalizationResponse(const RadioResponseInfo& info,
+ int32_t remainingRetries);
+
+ Return<void> getCurrentCallsResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::Call>& calls);
+
+ Return<void> dialResponse(const RadioResponseInfo& info);
+
+ Return<void> getIMSIForAppResponse(const RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& imsi);
+
+ Return<void> hangupConnectionResponse(const RadioResponseInfo& info);
+
+ Return<void> hangupWaitingOrBackgroundResponse(const RadioResponseInfo& info);
+
+ Return<void> hangupForegroundResumeBackgroundResponse(const RadioResponseInfo& info);
+
+ Return<void> switchWaitingOrHoldingAndActiveResponse(const RadioResponseInfo& info);
+
+ Return<void> conferenceResponse(const RadioResponseInfo& info);
+
+ Return<void> rejectCallResponse(const RadioResponseInfo& info);
+
+ Return<void> getLastCallFailCauseResponse(const RadioResponseInfo& info,
+ const LastCallFailCauseInfo& failCauseInfo);
+
+ Return<void> getSignalStrengthResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::SignalStrength& sigStrength);
+
+ Return<void> getVoiceRegistrationStateResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::VoiceRegStateResult& voiceRegResponse);
+
+ Return<void> getDataRegistrationStateResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_0::DataRegStateResult& dataRegResponse);
+
+ Return<void> getOperatorResponse(const RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& longName,
+ const ::android::hardware::hidl_string& shortName,
+ const ::android::hardware::hidl_string& numeric);
+
+ Return<void> setRadioPowerResponse(const RadioResponseInfo& info);
+
+ Return<void> sendDtmfResponse(const RadioResponseInfo& info);
+
+ Return<void> sendSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+
+ Return<void> sendSMSExpectMoreResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+
+ Return<void> setupDataCallResponse(const RadioResponseInfo& info,
+ const SetupDataCallResult& dcResponse);
+
+ Return<void> iccIOForAppResponse(const RadioResponseInfo& info, const IccIoResult& iccIo);
+
+ Return<void> sendUssdResponse(const RadioResponseInfo& info);
+
+ Return<void> cancelPendingUssdResponse(const RadioResponseInfo& info);
+
+ Return<void> getClirResponse(const RadioResponseInfo& info, int32_t n, int32_t m);
+
+ Return<void> setClirResponse(const RadioResponseInfo& info);
+
+ Return<void> getCallForwardStatusResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<CallForwardInfo>& call_forwardInfos);
+
+ Return<void> setCallForwardResponse(const RadioResponseInfo& info);
+
+ Return<void> getCallWaitingResponse(const RadioResponseInfo& info, bool enable,
+ int32_t serviceClass);
+
+ Return<void> setCallWaitingResponse(const RadioResponseInfo& info);
+
+ Return<void> acknowledgeLastIncomingGsmSmsResponse(const RadioResponseInfo& info);
+
+ Return<void> acceptCallResponse(const RadioResponseInfo& info);
+
+ Return<void> deactivateDataCallResponse(const RadioResponseInfo& info);
+
+ Return<void> getFacilityLockForAppResponse(const RadioResponseInfo& info, int32_t response);
+
+ Return<void> setFacilityLockForAppResponse(const RadioResponseInfo& info, int32_t retry);
+
+ Return<void> setBarringPasswordResponse(const RadioResponseInfo& info);
+
+ Return<void> getNetworkSelectionModeResponse(const RadioResponseInfo& info, bool manual);
+
+ Return<void> setNetworkSelectionModeAutomaticResponse(const RadioResponseInfo& info);
+
+ Return<void> setNetworkSelectionModeManualResponse(const RadioResponseInfo& info);
+
+ Return<void> getAvailableNetworksResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<OperatorInfo>& networkInfos);
+
+ Return<void> startDtmfResponse(const RadioResponseInfo& info);
+
+ Return<void> stopDtmfResponse(const RadioResponseInfo& info);
+
+ Return<void> getBasebandVersionResponse(const RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& version);
+
+ Return<void> separateConnectionResponse(const RadioResponseInfo& info);
+
+ Return<void> setMuteResponse(const RadioResponseInfo& info);
+
+ Return<void> getMuteResponse(const RadioResponseInfo& info, bool enable);
+
+ Return<void> getClipResponse(const RadioResponseInfo& info, ClipStatus status);
+
+ Return<void> getDataCallListResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<SetupDataCallResult>& dcResponse);
+
+ Return<void> sendOemRilRequestRawResponse(const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<uint8_t>& data);
+
+ Return<void> sendOemRilRequestStringsResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data);
+
+ Return<void> setSuppServiceNotificationsResponse(const RadioResponseInfo& info);
+
+ Return<void> writeSmsToSimResponse(const RadioResponseInfo& info, int32_t index);
+
+ Return<void> deleteSmsOnSimResponse(const RadioResponseInfo& info);
+
+ Return<void> setBandModeResponse(const RadioResponseInfo& info);
+
+ Return<void> getAvailableBandModesResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<RadioBandMode>& bandModes);
+
+ Return<void> sendEnvelopeResponse(const RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& commandResponse);
+
+ Return<void> sendTerminalResponseToSimResponse(const RadioResponseInfo& info);
+
+ Return<void> handleStkCallSetupRequestFromSimResponse(const RadioResponseInfo& info);
+
+ Return<void> explicitCallTransferResponse(const RadioResponseInfo& info);
+
+ Return<void> setPreferredNetworkTypeResponse(const RadioResponseInfo& info);
+
+ Return<void> getPreferredNetworkTypeResponse(const RadioResponseInfo& info,
+ PreferredNetworkType nwType);
+
+ Return<void> getNeighboringCidsResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<NeighboringCell>& cells);
+
+ Return<void> setLocationUpdatesResponse(const RadioResponseInfo& info);
+
+ Return<void> setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info);
+
+ Return<void> setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info);
+
+ Return<void> getCdmaRoamingPreferenceResponse(const RadioResponseInfo& info,
+ CdmaRoamingType type);
+
+ Return<void> setTTYModeResponse(const RadioResponseInfo& info);
+
+ Return<void> getTTYModeResponse(const RadioResponseInfo& info, TtyMode mode);
+
+ Return<void> setPreferredVoicePrivacyResponse(const RadioResponseInfo& info);
+
+ Return<void> getPreferredVoicePrivacyResponse(const RadioResponseInfo& info, bool enable);
+
+ Return<void> sendCDMAFeatureCodeResponse(const RadioResponseInfo& info);
+
+ Return<void> sendBurstDtmfResponse(const RadioResponseInfo& info);
+
+ Return<void> sendCdmaSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+
+ Return<void> acknowledgeLastIncomingCdmaSmsResponse(const RadioResponseInfo& info);
+
+ Return<void> getGsmBroadcastConfigResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& configs);
+
+ Return<void> setGsmBroadcastConfigResponse(const RadioResponseInfo& info);
+
+ Return<void> setGsmBroadcastActivationResponse(const RadioResponseInfo& info);
+
+ Return<void> getCdmaBroadcastConfigResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& configs);
+
+ Return<void> setCdmaBroadcastConfigResponse(const RadioResponseInfo& info);
+
+ Return<void> setCdmaBroadcastActivationResponse(const RadioResponseInfo& info);
+
+ Return<void> getCDMASubscriptionResponse(const RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& mdn,
+ const ::android::hardware::hidl_string& hSid,
+ const ::android::hardware::hidl_string& hNid,
+ const ::android::hardware::hidl_string& min,
+ const ::android::hardware::hidl_string& prl);
+
+ Return<void> writeSmsToRuimResponse(const RadioResponseInfo& info, uint32_t index);
+
+ Return<void> deleteSmsOnRuimResponse(const RadioResponseInfo& info);
+
+ Return<void> getDeviceIdentityResponse(const RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& imei,
+ const ::android::hardware::hidl_string& imeisv,
+ const ::android::hardware::hidl_string& esn,
+ const ::android::hardware::hidl_string& meid);
+
+ Return<void> exitEmergencyCallbackModeResponse(const RadioResponseInfo& info);
+
+ Return<void> getSmscAddressResponse(const RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& smsc);
+
+ Return<void> setSmscAddressResponse(const RadioResponseInfo& info);
+
+ Return<void> reportSmsMemoryStatusResponse(const RadioResponseInfo& info);
+
+ Return<void> reportStkServiceIsRunningResponse(const RadioResponseInfo& info);
+
+ Return<void> getCdmaSubscriptionSourceResponse(const RadioResponseInfo& info,
+ CdmaSubscriptionSource source);
+
+ Return<void> requestIsimAuthenticationResponse(
+ const RadioResponseInfo& info, const ::android::hardware::hidl_string& response);
+
+ Return<void> acknowledgeIncomingGsmSmsWithPduResponse(const RadioResponseInfo& info);
+
+ Return<void> sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
+ const IccIoResult& iccIo);
+
+ Return<void> getVoiceRadioTechnologyResponse(const RadioResponseInfo& info,
+ RadioTechnology rat);
+
+ Return<void> getCellInfoListResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::CellInfo>&
+ cellInfo);
+
+ Return<void> setCellInfoListRateResponse(const RadioResponseInfo& info);
+
+ Return<void> setInitialAttachApnResponse(const RadioResponseInfo& info);
+
+ Return<void> getImsRegistrationStateResponse(const RadioResponseInfo& info, bool isRegistered,
+ RadioTechnologyFamily ratFamily);
+
+ Return<void> sendImsSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+
+ Return<void> iccTransmitApduBasicChannelResponse(const RadioResponseInfo& info,
+ const IccIoResult& result);
+
+ Return<void> iccOpenLogicalChannelResponse(
+ const RadioResponseInfo& info, int32_t channelId,
+ const ::android::hardware::hidl_vec<int8_t>& selectResponse);
+
+ Return<void> iccCloseLogicalChannelResponse(const RadioResponseInfo& info);
+
+ Return<void> iccTransmitApduLogicalChannelResponse(const RadioResponseInfo& info,
+ const IccIoResult& result);
+
+ Return<void> nvReadItemResponse(const RadioResponseInfo& info,
+ const ::android::hardware::hidl_string& result);
+
+ Return<void> nvWriteItemResponse(const RadioResponseInfo& info);
+
+ Return<void> nvWriteCdmaPrlResponse(const RadioResponseInfo& info);
+
+ Return<void> nvResetConfigResponse(const RadioResponseInfo& info);
+
+ Return<void> setUiccSubscriptionResponse(const RadioResponseInfo& info);
+
+ Return<void> setDataAllowedResponse(const RadioResponseInfo& info);
+
+ Return<void> getHardwareConfigResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<HardwareConfig>& config);
+
+ Return<void> requestIccSimAuthenticationResponse(const RadioResponseInfo& info,
+ const IccIoResult& result);
+
+ Return<void> setDataProfileResponse(const RadioResponseInfo& info);
+
+ Return<void> requestShutdownResponse(const RadioResponseInfo& info);
+
+ Return<void> getRadioCapabilityResponse(const RadioResponseInfo& info,
+ const RadioCapability& rc);
+
+ Return<void> setRadioCapabilityResponse(const RadioResponseInfo& info,
+ const RadioCapability& rc);
+
+ Return<void> startLceServiceResponse(const RadioResponseInfo& info,
+ const LceStatusInfo& statusInfo);
+
+ Return<void> stopLceServiceResponse(const RadioResponseInfo& info,
+ const LceStatusInfo& statusInfo);
+
+ Return<void> pullLceDataResponse(const RadioResponseInfo& info, const LceDataInfo& lceInfo);
+
+ Return<void> getModemActivityInfoResponse(const RadioResponseInfo& info,
+ const ActivityStatsInfo& activityInfo);
+
+ Return<void> setAllowedCarriersResponse(const RadioResponseInfo& info, int32_t numAllowed);
+
+ Return<void> getAllowedCarriersResponse(const RadioResponseInfo& info, bool allAllowed,
+ const CarrierRestrictions& carriers);
+
+ Return<void> sendDeviceStateResponse(const RadioResponseInfo& info);
+
+ Return<void> setIndicationFilterResponse(const RadioResponseInfo& info);
+
+ Return<void> setSimCardPowerResponse(const RadioResponseInfo& info);
+
+ Return<void> acknowledgeRequest(int32_t serial);
+
+ /* 1.1 Api */
+ Return<void> setCarrierInfoForImsiEncryptionResponse(const RadioResponseInfo& info);
+
+ Return<void> setSimCardPowerResponse_1_1(const RadioResponseInfo& info);
+
+ Return<void> startNetworkScanResponse(const RadioResponseInfo& info);
+
+ Return<void> stopNetworkScanResponse(const RadioResponseInfo& info);
+
+ Return<void> startKeepaliveResponse(const RadioResponseInfo& info,
+ const KeepaliveStatus& status);
+
+ Return<void> stopKeepaliveResponse(const RadioResponseInfo& info);
+
+ /* 1.2 Api */
+ Return<void> setSignalStrengthReportingCriteriaResponse(const RadioResponseInfo& info);
+
+ Return<void> setLinkCapacityReportingCriteriaResponse(const RadioResponseInfo& info);
+
+ Return<void> getIccCardStatusResponse_1_2(
+ const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_2::CardStatus& card_status);
+
+ Return<void> getCurrentCallsResponse_1_2(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::Call>& calls);
+
+ Return<void> getSignalStrengthResponse_1_2(
+ const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_2::SignalStrength& sig_strength);
+
+ Return<void> getCellInfoListResponse_1_2(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::CellInfo>&
+ cellInfo);
+
+ Return<void> getVoiceRegistrationStateResponse_1_2(
+ const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_2::VoiceRegStateResult& voiceRegResponse);
+
+ Return<void> getDataRegistrationStateResponse_1_2(
+ const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_2::DataRegStateResult& dataRegResponse);
+
+ /* 1.3 Api */
+ Return<void> setSystemSelectionChannelsResponse(const RadioResponseInfo& info);
+
+ Return<void> enableModemResponse(const RadioResponseInfo& info);
+
+ Return<void> getModemStackStatusResponse(const RadioResponseInfo& info, const bool enabled);
+};
+
+/* Callback class for radio indication */
+class RadioIndication_v1_3 : public ::android::hardware::radio::V1_3::IRadioIndication {
+ protected:
+ RadioHidlTest_v1_3& parent_v1_3;
+
+ public:
+ RadioIndication_v1_3(RadioHidlTest_v1_3& parent_v1_3);
+ virtual ~RadioIndication_v1_3() = default;
+
+ /* 1.2 Api */
+ Return<void> networkScanResult_1_2(
+ RadioIndicationType type,
+ const ::android::hardware::radio::V1_2::NetworkScanResult& result);
+
+ Return<void> cellInfoList_1_2(
+ RadioIndicationType type,
+ const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::CellInfo>&
+ records);
+
+ Return<void> currentLinkCapacityEstimate(
+ RadioIndicationType type,
+ const ::android::hardware::radio::V1_2::LinkCapacityEstimate& lce);
+
+ Return<void> currentPhysicalChannelConfigs(
+ RadioIndicationType type,
+ const ::android::hardware::hidl_vec<
+ ::android::hardware::radio::V1_2::PhysicalChannelConfig>& configs);
+
+ Return<void> currentSignalStrength_1_2(
+ RadioIndicationType type,
+ const ::android::hardware::radio::V1_2::SignalStrength& signalStrength);
+
+ /* 1.1 Api */
+ Return<void> carrierInfoForImsiEncryption(RadioIndicationType info);
+
+ Return<void> networkScanResult(
+ RadioIndicationType type,
+ const ::android::hardware::radio::V1_1::NetworkScanResult& result);
+
+ Return<void> keepaliveStatus(RadioIndicationType type, const KeepaliveStatus& status);
+
+ /* 1.0 Api */
+ Return<void> radioStateChanged(RadioIndicationType type, RadioState radioState);
+
+ Return<void> callStateChanged(RadioIndicationType type);
+
+ Return<void> networkStateChanged(RadioIndicationType type);
+
+ Return<void> newSms(RadioIndicationType type,
+ const ::android::hardware::hidl_vec<uint8_t>& pdu);
+
+ Return<void> newSmsStatusReport(RadioIndicationType type,
+ const ::android::hardware::hidl_vec<uint8_t>& pdu);
+
+ Return<void> newSmsOnSim(RadioIndicationType type, int32_t recordNumber);
+
+ Return<void> onUssd(RadioIndicationType type, UssdModeType modeType,
+ const ::android::hardware::hidl_string& msg);
+
+ Return<void> nitzTimeReceived(RadioIndicationType type,
+ const ::android::hardware::hidl_string& nitzTime,
+ uint64_t receivedTime);
+
+ Return<void> currentSignalStrength(
+ RadioIndicationType type,
+ const ::android::hardware::radio::V1_0::SignalStrength& signalStrength);
+
+ Return<void> dataCallListChanged(
+ RadioIndicationType type,
+ const ::android::hardware::hidl_vec<SetupDataCallResult>& dcList);
+
+ Return<void> suppSvcNotify(RadioIndicationType type, const SuppSvcNotification& suppSvc);
+
+ Return<void> stkSessionEnd(RadioIndicationType type);
+
+ Return<void> stkProactiveCommand(RadioIndicationType type,
+ const ::android::hardware::hidl_string& cmd);
+
+ Return<void> stkEventNotify(RadioIndicationType type,
+ const ::android::hardware::hidl_string& cmd);
+
+ Return<void> stkCallSetup(RadioIndicationType type, int64_t timeout);
+
+ Return<void> simSmsStorageFull(RadioIndicationType type);
+
+ Return<void> simRefresh(RadioIndicationType type, const SimRefreshResult& refreshResult);
+
+ Return<void> callRing(RadioIndicationType type, bool isGsm, const CdmaSignalInfoRecord& record);
+
+ Return<void> simStatusChanged(RadioIndicationType type);
+
+ Return<void> cdmaNewSms(RadioIndicationType type, const CdmaSmsMessage& msg);
+
+ Return<void> newBroadcastSms(RadioIndicationType type,
+ const ::android::hardware::hidl_vec<uint8_t>& data);
+
+ Return<void> cdmaRuimSmsStorageFull(RadioIndicationType type);
+
+ Return<void> restrictedStateChanged(RadioIndicationType type, PhoneRestrictedState state);
+
+ Return<void> enterEmergencyCallbackMode(RadioIndicationType type);
+
+ Return<void> cdmaCallWaiting(RadioIndicationType type,
+ const CdmaCallWaiting& callWaitingRecord);
+
+ Return<void> cdmaOtaProvisionStatus(RadioIndicationType type, CdmaOtaProvisionStatus status);
+
+ Return<void> cdmaInfoRec(RadioIndicationType type, const CdmaInformationRecords& records);
+
+ Return<void> indicateRingbackTone(RadioIndicationType type, bool start);
+
+ Return<void> resendIncallMute(RadioIndicationType type);
+
+ Return<void> cdmaSubscriptionSourceChanged(RadioIndicationType type,
+ CdmaSubscriptionSource cdmaSource);
+
+ Return<void> cdmaPrlChanged(RadioIndicationType type, int32_t version);
+
+ Return<void> exitEmergencyCallbackMode(RadioIndicationType type);
+
+ Return<void> rilConnected(RadioIndicationType type);
+
+ Return<void> voiceRadioTechChanged(RadioIndicationType type, RadioTechnology rat);
+
+ Return<void> cellInfoList(
+ RadioIndicationType type,
+ const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::CellInfo>&
+ records);
+
+ Return<void> imsNetworkStateChanged(RadioIndicationType type);
+
+ Return<void> subscriptionStatusChanged(RadioIndicationType type, bool activate);
+
+ Return<void> srvccStateNotify(RadioIndicationType type, SrvccState state);
+
+ Return<void> hardwareConfigChanged(
+ RadioIndicationType type, const ::android::hardware::hidl_vec<HardwareConfig>& configs);
+
+ Return<void> radioCapabilityIndication(RadioIndicationType type, const RadioCapability& rc);
+
+ Return<void> onSupplementaryServiceIndication(RadioIndicationType type,
+ const StkCcUnsolSsResult& ss);
+
+ Return<void> stkCallControlAlphaNotify(RadioIndicationType type,
+ const ::android::hardware::hidl_string& alpha);
+
+ Return<void> lceData(RadioIndicationType type, const LceDataInfo& lce);
+
+ Return<void> pcoData(RadioIndicationType type, const PcoDataInfo& pco);
+
+ Return<void> modemReset(RadioIndicationType type,
+ const ::android::hardware::hidl_string& reason);
+};
+
+// Test environment for Radio HIDL HAL.
+class RadioHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static RadioHidlEnvironment* Instance() {
+ static RadioHidlEnvironment* instance = new RadioHidlEnvironment;
+ return instance;
+ }
+ virtual void registerTestServices() override {
+ registerTestService<::android::hardware::radio::V1_3::IRadio>();
+ }
+
+ private:
+ RadioHidlEnvironment() {}
+};
+
+// The main test class for Radio HIDL.
+class RadioHidlTest_v1_3 : public ::testing::VtsHalHidlTargetTestBase {
+ protected:
+ std::mutex mtx_;
+ std::condition_variable cv_;
+ int count_;
+
+ /* Serial number for radio request */
+ int serial;
+
+ /* Update Sim Card Status */
+ void updateSimCardStatus();
+
+ public:
+ virtual void SetUp() override;
+
+ /* Used as a mechanism to inform the test about data/event callback */
+ void notify(int receivedSerial);
+
+ /* Test code calls this function to wait for response */
+ std::cv_status wait();
+
+ /* radio service handle */
+ sp<::android::hardware::radio::V1_3::IRadio> radio_v1_3;
+
+ /* radio response handle */
+ sp<RadioResponse_v1_3> radioRsp_v1_3;
+
+ /* radio indication handle */
+ sp<RadioIndication_v1_3> radioInd_v1_3;
+};
\ No newline at end of file
diff --git a/radio/1.3/vts/functional/radio_indication.cpp b/radio/1.3/vts/functional/radio_indication.cpp
new file mode 100644
index 0000000..034825e
--- /dev/null
+++ b/radio/1.3/vts/functional/radio_indication.cpp
@@ -0,0 +1,288 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <radio_hidl_hal_utils_v1_3.h>
+
+RadioIndication_v1_3::RadioIndication_v1_3(RadioHidlTest_v1_3& parent) : parent_v1_3(parent) {}
+
+/* 1.2 Apis */
+Return<void> RadioIndication_v1_3::networkScanResult_1_2(
+ RadioIndicationType /*type*/,
+ const ::android::hardware::radio::V1_2::NetworkScanResult& /*result*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::cellInfoList_1_2(
+ RadioIndicationType /*type*/,
+ const ::android::hardware::hidl_vec<
+ ::android::hardware::radio::V1_2::CellInfo>& /*records*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::currentLinkCapacityEstimate(
+ RadioIndicationType /*type*/,
+ const ::android::hardware::radio::V1_2::LinkCapacityEstimate& /*lce*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::currentPhysicalChannelConfigs(
+ RadioIndicationType /*type*/,
+ const ::android::hardware::hidl_vec<
+ ::android::hardware::radio::V1_2::PhysicalChannelConfig>& /*configs*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::currentSignalStrength_1_2(
+ RadioIndicationType /*type*/,
+ const ::android::hardware::radio::V1_2::SignalStrength& /*signalStrength*/) {
+ return Void();
+}
+
+/* 1.1 Apis */
+Return<void> RadioIndication_v1_3::carrierInfoForImsiEncryption(RadioIndicationType /*info*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::networkScanResult(
+ RadioIndicationType /*type*/,
+ const ::android::hardware::radio::V1_1::NetworkScanResult& /*result*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::keepaliveStatus(RadioIndicationType /*type*/,
+ const KeepaliveStatus& /*status*/) {
+ return Void();
+}
+
+/* 1.0 Apis */
+Return<void> RadioIndication_v1_3::radioStateChanged(RadioIndicationType /*type*/,
+ RadioState /*radioState*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::callStateChanged(RadioIndicationType /*type*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::networkStateChanged(RadioIndicationType /*type*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::newSms(RadioIndicationType /*type*/,
+ const ::android::hardware::hidl_vec<uint8_t>& /*pdu*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::newSmsStatusReport(
+ RadioIndicationType /*type*/, const ::android::hardware::hidl_vec<uint8_t>& /*pdu*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::newSmsOnSim(RadioIndicationType /*type*/,
+ int32_t /*recordNumber*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::onUssd(RadioIndicationType /*type*/, UssdModeType /*modeType*/,
+ const ::android::hardware::hidl_string& /*msg*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::nitzTimeReceived(
+ RadioIndicationType /*type*/, const ::android::hardware::hidl_string& /*nitzTime*/,
+ uint64_t /*receivedTime*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::currentSignalStrength(
+ RadioIndicationType /*type*/,
+ const ::android::hardware::radio::V1_0::SignalStrength& /*signalStrength*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::dataCallListChanged(
+ RadioIndicationType /*type*/,
+ const ::android::hardware::hidl_vec<SetupDataCallResult>& /*dcList*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::suppSvcNotify(RadioIndicationType /*type*/,
+ const SuppSvcNotification& /*suppSvc*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::stkSessionEnd(RadioIndicationType /*type*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::stkProactiveCommand(
+ RadioIndicationType /*type*/, const ::android::hardware::hidl_string& /*cmd*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::stkEventNotify(RadioIndicationType /*type*/,
+ const ::android::hardware::hidl_string& /*cmd*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::stkCallSetup(RadioIndicationType /*type*/, int64_t /*timeout*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::simSmsStorageFull(RadioIndicationType /*type*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::simRefresh(RadioIndicationType /*type*/,
+ const SimRefreshResult& /*refreshResult*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::callRing(RadioIndicationType /*type*/, bool /*isGsm*/,
+ const CdmaSignalInfoRecord& /*record*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::simStatusChanged(RadioIndicationType /*type*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::cdmaNewSms(RadioIndicationType /*type*/,
+ const CdmaSmsMessage& /*msg*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::newBroadcastSms(
+ RadioIndicationType /*type*/, const ::android::hardware::hidl_vec<uint8_t>& /*data*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::cdmaRuimSmsStorageFull(RadioIndicationType /*type*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::restrictedStateChanged(RadioIndicationType /*type*/,
+ PhoneRestrictedState /*state*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::enterEmergencyCallbackMode(RadioIndicationType /*type*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::cdmaCallWaiting(RadioIndicationType /*type*/,
+ const CdmaCallWaiting& /*callWaitingRecord*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::cdmaOtaProvisionStatus(RadioIndicationType /*type*/,
+ CdmaOtaProvisionStatus /*status*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::cdmaInfoRec(RadioIndicationType /*type*/,
+ const CdmaInformationRecords& /*records*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::indicateRingbackTone(RadioIndicationType /*type*/,
+ bool /*start*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::resendIncallMute(RadioIndicationType /*type*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::cdmaSubscriptionSourceChanged(
+ RadioIndicationType /*type*/, CdmaSubscriptionSource /*cdmaSource*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::cdmaPrlChanged(RadioIndicationType /*type*/,
+ int32_t /*version*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::exitEmergencyCallbackMode(RadioIndicationType /*type*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::rilConnected(RadioIndicationType /*type*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::voiceRadioTechChanged(RadioIndicationType /*type*/,
+ RadioTechnology /*rat*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::cellInfoList(
+ RadioIndicationType /*type*/,
+ const ::android::hardware::hidl_vec<
+ ::android::hardware::radio::V1_0::CellInfo>& /*records*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::imsNetworkStateChanged(RadioIndicationType /*type*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::subscriptionStatusChanged(RadioIndicationType /*type*/,
+ bool /*activate*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::srvccStateNotify(RadioIndicationType /*type*/,
+ SrvccState /*state*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::hardwareConfigChanged(
+ RadioIndicationType /*type*/,
+ const ::android::hardware::hidl_vec<HardwareConfig>& /*configs*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::radioCapabilityIndication(RadioIndicationType /*type*/,
+ const RadioCapability& /*rc*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::onSupplementaryServiceIndication(
+ RadioIndicationType /*type*/, const StkCcUnsolSsResult& /*ss*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::stkCallControlAlphaNotify(
+ RadioIndicationType /*type*/, const ::android::hardware::hidl_string& /*alpha*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::lceData(RadioIndicationType /*type*/,
+ const LceDataInfo& /*lce*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::pcoData(RadioIndicationType /*type*/,
+ const PcoDataInfo& /*pco*/) {
+ return Void();
+}
+
+Return<void> RadioIndication_v1_3::modemReset(RadioIndicationType /*type*/,
+ const ::android::hardware::hidl_string& /*reason*/) {
+ return Void();
+}
\ No newline at end of file
diff --git a/radio/1.3/vts/functional/radio_response.cpp b/radio/1.3/vts/functional/radio_response.cpp
new file mode 100644
index 0000000..900794e
--- /dev/null
+++ b/radio/1.3/vts/functional/radio_response.cpp
@@ -0,0 +1,786 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <radio_hidl_hal_utils_v1_3.h>
+
+::android::hardware::radio::V1_2::CardStatus cardStatus;
+
+RadioResponse_v1_3::RadioResponse_v1_3(RadioHidlTest_v1_3& parent) : parent_v1_3(parent) {}
+
+/* 1.0 Apis */
+Return<void> RadioResponse_v1_3::getIccCardStatusResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::CardStatus& /*card_status*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::supplyIccPinForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::supplyIccPukForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::supplyIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::supplyIccPuk2ForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::changeIccPinForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::changeIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*remainingRetries*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::supplyNetworkDepersonalizationResponse(
+ const RadioResponseInfo& /*info*/, int32_t /*remainingRetries*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getCurrentCallsResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::Call>& /*calls*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::dialResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getIMSIForAppResponse(
+ const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*imsi*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::hangupConnectionResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::hangupWaitingOrBackgroundResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::hangupForegroundResumeBackgroundResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::switchWaitingOrHoldingAndActiveResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::conferenceResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::rejectCallResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getLastCallFailCauseResponse(
+ const RadioResponseInfo& /*info*/, const LastCallFailCauseInfo& /*failCauseInfo*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getSignalStrengthResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::SignalStrength& /*sig_strength*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getVoiceRegistrationStateResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::VoiceRegStateResult& /*voiceRegResponse*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getDataRegistrationStateResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::radio::V1_0::DataRegStateResult& /*dataRegResponse*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getOperatorResponse(
+ const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*longName*/,
+ const ::android::hardware::hidl_string& /*shortName*/,
+ const ::android::hardware::hidl_string& /*numeric*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setRadioPowerResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendDtmfResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendSmsResponse(const RadioResponseInfo& /*info*/,
+ const SendSmsResult& /*sms*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendSMSExpectMoreResponse(const RadioResponseInfo& /*info*/,
+ const SendSmsResult& /*sms*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setupDataCallResponse(const RadioResponseInfo& info,
+ const SetupDataCallResult& /*dcResponse*/) {
+ rspInfo = info;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::iccIOForAppResponse(const RadioResponseInfo& /*info*/,
+ const IccIoResult& /*iccIo*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendUssdResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::cancelPendingUssdResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getClirResponse(const RadioResponseInfo& /*info*/, int32_t /*n*/,
+ int32_t /*m*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setClirResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getCallForwardStatusResponse(
+ const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_vec<CallForwardInfo>&
+ /*callForwardInfos*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setCallForwardResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getCallWaitingResponse(const RadioResponseInfo& /*info*/,
+ bool /*enable*/, int32_t /*serviceClass*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setCallWaitingResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::acknowledgeLastIncomingGsmSmsResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::acceptCallResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::deactivateDataCallResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getFacilityLockForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*response*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setFacilityLockForAppResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*retry*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setBarringPasswordResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getNetworkSelectionModeResponse(const RadioResponseInfo& /*info*/,
+ bool /*manual*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setNetworkSelectionModeAutomaticResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setNetworkSelectionModeManualResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getAvailableNetworksResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_vec<OperatorInfo>& /*networkInfos*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::startDtmfResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::stopDtmfResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getBasebandVersionResponse(
+ const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*version*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::separateConnectionResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setMuteResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getMuteResponse(const RadioResponseInfo& /*info*/,
+ bool /*enable*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getClipResponse(const RadioResponseInfo& /*info*/,
+ ClipStatus /*status*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getDataCallListResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_vec<SetupDataCallResult>& /*dcResponse*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendOemRilRequestRawResponse(
+ const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_vec<uint8_t>& /*data*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendOemRilRequestStringsResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& /*data*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setSuppServiceNotificationsResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::writeSmsToSimResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*index*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::deleteSmsOnSimResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setBandModeResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getAvailableBandModesResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<RadioBandMode>& /* bandModes */) {
+ rspInfo = info;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendEnvelopeResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_string& /*commandResponse*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendTerminalResponseToSimResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::handleStkCallSetupRequestFromSimResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::explicitCallTransferResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setPreferredNetworkTypeResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getPreferredNetworkTypeResponse(const RadioResponseInfo& /*info*/,
+ PreferredNetworkType /*nw_type*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getNeighboringCidsResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_vec<NeighboringCell>& /*cells*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setLocationUpdatesResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setCdmaSubscriptionSourceResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setCdmaRoamingPreferenceResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getCdmaRoamingPreferenceResponse(const RadioResponseInfo& /*info*/,
+ CdmaRoamingType /*type*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setTTYModeResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getTTYModeResponse(const RadioResponseInfo& /*info*/,
+ TtyMode /*mode*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setPreferredVoicePrivacyResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getPreferredVoicePrivacyResponse(const RadioResponseInfo& /*info*/,
+ bool /*enable*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendCDMAFeatureCodeResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendBurstDtmfResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendCdmaSmsResponse(const RadioResponseInfo& /*info*/,
+ const SendSmsResult& /*sms*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::acknowledgeLastIncomingCdmaSmsResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getGsmBroadcastConfigResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& /*configs*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setGsmBroadcastConfigResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setGsmBroadcastActivationResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getCdmaBroadcastConfigResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& /*configs*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setCdmaBroadcastConfigResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setCdmaBroadcastActivationResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getCDMASubscriptionResponse(
+ const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*mdn*/,
+ const ::android::hardware::hidl_string& /*hSid*/,
+ const ::android::hardware::hidl_string& /*hNid*/,
+ const ::android::hardware::hidl_string& /*min*/,
+ const ::android::hardware::hidl_string& /*prl*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::writeSmsToRuimResponse(const RadioResponseInfo& /*info*/,
+ uint32_t /*index*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::deleteSmsOnRuimResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getDeviceIdentityResponse(
+ const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*imei*/,
+ const ::android::hardware::hidl_string& /*imeisv*/,
+ const ::android::hardware::hidl_string& /*esn*/,
+ const ::android::hardware::hidl_string& /*meid*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::exitEmergencyCallbackModeResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getSmscAddressResponse(
+ const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*smsc*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setSmscAddressResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::reportSmsMemoryStatusResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::reportStkServiceIsRunningResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getCdmaSubscriptionSourceResponse(
+ const RadioResponseInfo& /*info*/, CdmaSubscriptionSource /*source*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::requestIsimAuthenticationResponse(
+ const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*response*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::acknowledgeIncomingGsmSmsWithPduResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendEnvelopeWithStatusResponse(const RadioResponseInfo& /*info*/,
+ const IccIoResult& /*iccIo*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getVoiceRadioTechnologyResponse(const RadioResponseInfo& /*info*/,
+ RadioTechnology /*rat*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getCellInfoListResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_vec<
+ ::android::hardware::radio::V1_0::CellInfo>& /*cellInfo*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setCellInfoListRateResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setInitialAttachApnResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getImsRegistrationStateResponse(
+ const RadioResponseInfo& /*info*/, bool /*isRegistered*/,
+ RadioTechnologyFamily /*ratFamily*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendImsSmsResponse(const RadioResponseInfo& /*info*/,
+ const SendSmsResult& /*sms*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::iccTransmitApduBasicChannelResponse(
+ const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::iccOpenLogicalChannelResponse(
+ const RadioResponseInfo& /*info*/, int32_t /*channelId*/,
+ const ::android::hardware::hidl_vec<int8_t>& /*selectResponse*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::iccCloseLogicalChannelResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::iccTransmitApduLogicalChannelResponse(
+ const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::nvReadItemResponse(
+ const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*result*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::nvWriteItemResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::nvWriteCdmaPrlResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::nvResetConfigResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setUiccSubscriptionResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setDataAllowedResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getHardwareConfigResponse(
+ const RadioResponseInfo& /*info*/,
+ const ::android::hardware::hidl_vec<HardwareConfig>& /*config*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::requestIccSimAuthenticationResponse(
+ const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setDataProfileResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::requestShutdownResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getRadioCapabilityResponse(const RadioResponseInfo& /*info*/,
+ const RadioCapability& /*rc*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setRadioCapabilityResponse(const RadioResponseInfo& /*info*/,
+ const RadioCapability& /*rc*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::startLceServiceResponse(const RadioResponseInfo& /*info*/,
+ const LceStatusInfo& /*statusInfo*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::stopLceServiceResponse(const RadioResponseInfo& /*info*/,
+ const LceStatusInfo& /*statusInfo*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::pullLceDataResponse(const RadioResponseInfo& /*info*/,
+ const LceDataInfo& /*lceInfo*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getModemActivityInfoResponse(
+ const RadioResponseInfo& /*info*/, const ActivityStatsInfo& /*activityInfo*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setAllowedCarriersResponse(const RadioResponseInfo& /*info*/,
+ int32_t /*numAllowed*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getAllowedCarriersResponse(
+ const RadioResponseInfo& /*info*/, bool /*allAllowed*/,
+ const CarrierRestrictions& /*carriers*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::sendDeviceStateResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setIndicationFilterResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setSimCardPowerResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::acknowledgeRequest(int32_t /*serial*/) {
+ return Void();
+}
+
+/* 1.1 Apis */
+Return<void> RadioResponse_v1_3::setCarrierInfoForImsiEncryptionResponse(
+ const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setSimCardPowerResponse_1_1(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::startNetworkScanResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::stopNetworkScanResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::startKeepaliveResponse(const RadioResponseInfo& /*info*/,
+ const KeepaliveStatus& /*status*/) {
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::stopKeepaliveResponse(const RadioResponseInfo& /*info*/) {
+ return Void();
+}
+
+/* 1.2 Apis */
+Return<void> RadioResponse_v1_3::setSignalStrengthReportingCriteriaResponse(
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::setLinkCapacityReportingCriteriaResponse(
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getIccCardStatusResponse_1_2(
+ const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_2::CardStatus& card_status) {
+ rspInfo = info;
+ cardStatus = card_status;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getCurrentCallsResponse_1_2(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::Call>& /*calls*/) {
+ rspInfo = info;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getSignalStrengthResponse_1_2(
+ const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_2::SignalStrength& /*sig_strength*/) {
+ rspInfo = info;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getCellInfoListResponse_1_2(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<
+ ::android::hardware::radio::V1_2::CellInfo>& /*cellInfo*/) {
+ rspInfo = info;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getVoiceRegistrationStateResponse_1_2(
+ const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_2::VoiceRegStateResult& /*voiceRegResponse*/) {
+ rspInfo = info;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getDataRegistrationStateResponse_1_2(
+ const RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_2::DataRegStateResult& dataRegResponse) {
+ rspInfo = info;
+ dataRegResp = dataRegResponse;
+ parent_v1_3.notify(info.serial);
+ return Void();
+}
+
+/* 1.3 Api */
+Return<void> RadioResponse_v1_3::setSystemSelectionChannelsResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::enableModemResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ enableModemResponseToggle = !enableModemResponseToggle;
+ return Void();
+}
+
+Return<void> RadioResponse_v1_3::getModemStackStatusResponse(const RadioResponseInfo& info,
+ const bool enabled) {
+ rspInfo = info;
+ isModemEnabled = enabled;
+ return Void();
+}
diff --git a/radio/1.4/Android.bp b/radio/1.4/Android.bp
index ad114f3..9fd0374 100644
--- a/radio/1.4/Android.bp
+++ b/radio/1.4/Android.bp
@@ -23,6 +23,7 @@
types: [
"AccessNetwork",
"CardStatus",
+ "CarrierRestrictionsWithPriority",
"CellConfigLte",
"CellInfo",
"CellInfoLte",
@@ -30,20 +31,22 @@
"DataConnActiveStatus",
"DataProfileInfo",
"DataRegStateResult",
+ "EmergencyCallRouting",
"EmergencyNumber",
"EmergencyNumberSource",
"EmergencyServiceCategory",
"FrequencyRange",
"LteVopsInfo",
"NetworkScanResult",
+ "NrIndicators",
"PdpProtocolType",
"PhysicalChannelConfig",
"RadioAccessFamily",
"RadioCapability",
"RadioFrequencyInfo",
"RadioTechnology",
- "NrIndicators",
"SetupDataCallResult",
+ "SimLockMultiSimPolicy",
],
gen_java: true,
}
diff --git a/radio/1.4/IRadio.hal b/radio/1.4/IRadio.hal
index 8438777..21c5097 100644
--- a/radio/1.4/IRadio.hal
+++ b/radio/1.4/IRadio.hal
@@ -18,11 +18,15 @@
import @1.0::Dial;
import @1.2::DataRequestReason;
+import @1.2::NetworkScanRequest;
import @1.3::IRadio;
import @1.4::AccessNetwork;
+import @1.4::CarrierRestrictionsWithPriority;
import @1.4::DataProfileInfo;
+import @1.4::EmergencyCallRouting;
import @1.4::EmergencyServiceCategory;
import @1.4::RadioAccessFamily;
+import @1.4::SimLockMultiSimPolicy;
/**
* This interface is used by telephony and telecom to talk to cellular radio.
@@ -101,33 +105,66 @@
oneway setDataProfile_1_4(int32_t serial, vec<DataProfileInfo> profiles);
/**
- * Initiate emergency voice call, with zero or more emergency service category(s).
+ * Initiate emergency voice call, with zero or more emergency service category(s), zero or
+ * more emergency Uniform Resource Names (URN), and routing information for handling the call.
+ * Android uses this request to make its emergency call instead of using @1.0::IRadio.dial
+ * if the 'address' in the 'dialInfo' field is identified as an emergency number by Android.
*
- * Note this API is the same as IRadio.dial except using the
- * @1.4::EmergencyServiceCategory as the input param.
+ * In multi-sim scenario, if the emergency number is from a specific subscription, this radio
+ * request is sent through the IRadio service that serves the subscription, no matter of the
+ * PUK/PIN state of the subscription and the service state of the radio.
*
- * If the number in the 'dialInfo' field is identified as an emergency number in Android,
- * Android use this request for its emergency call instead of @1.0::IRadio.dial. The
- * implementation decides how to handle the call (e.g. emergency routing or normal
- * routing).
+ * Some countries or carriers require some emergency numbers that must be handled with normal
+ * call routing or emergency routing. If the 'routing' field is specified as
+ * @1.4::EmergencyNumberRouting#NORMAL, the implementation must use normal call routing to
+ * handle the call; if it is specified as @1.4::EmergencyNumberRouting#EMERGENCY, the
+ * implementation must use emergency routing to handle the call; if it is
+ * @1.4::EmergencyNumberRouting#UNKNOWN, Android does not know how to handle the call.
*
* If the dialed emergency number does not have a specified emergency service category, the
- * 'categories' field is set to @1.4::EmergencyServiceCategory#UNSPECIFIED; iff either the
- * 'categories' field is set to @1.4::EmergencyServiceCategory#UNSPECIFIED or the underlying
- * technology used to request emergency services does not support the emergency service
- * category, the interpretation of the categories is defined by implementation.
+ * 'categories' field is set to @1.4::EmergencyServiceCategory#UNSPECIFIED; if the dialed
+ * emergency number does not have specified emergency Uniform Resource Names, the 'urns' field
+ * is set to an empty list. If the underlying technology used to request emergency services
+ * does not support the emergency service category or emergency uniform resource names, the
+ * field 'categories' or 'urns' may be ignored.
*
- * Reference: 3gpp TS 22.101, Section 10 - Emergency Calls
+ * 'fromEmergencyDialer' indicates if this request originated from emergency dialer/shortcut,
+ * which means an explicit intent from the user to dial an emergency number. The modem must
+ * treat this as an actual emergency dial and not try to disambiguate.
+ *
+ * If 'isTesting' is true, this request is for testing purpose, and must not be sent to a real
+ * emergency service; otherwise it's for a real emergency call request.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls;
+ * 3gpp 23.167, Section 6 - Functional description;
+ * 3gpp 24.503, Section 5.1.6.8.1 - General;
+ * RFC 5031
*
* @param serial Serial number of request.
* @param dialInfo the same @1.0::Dial information used by @1.0::IRadio.dial.
* @param categories bitfield<@1.4::EmergencyServiceCategory> the Emergency Service Category(s)
* of the call.
+ * @param urns the emergency Uniform Resource Names (URN)
+ * @param routing @1.4::EmergencyCallRouting the emergency call routing information.
+ * @param fromEmergencyDialer Flag indicating if this request originated from emergency dialer.
+ * @param isTesting Flag indicating if this request is for testing purpose.
*
* Response function is IRadioResponse.emergencyDialResponse()
*/
oneway emergencyDial(int32_t serial, Dial dialInfo,
- bitfield<EmergencyServiceCategory> categories);
+ bitfield<EmergencyServiceCategory> categories, vec<string> urns,
+ EmergencyCallRouting routing, bool fromEmergencyDialer, bool isTesting);
+
+ /**
+ * Starts a network scan
+ *
+ * @param serial Serial number of request.
+ * @param request Defines the radio networks/bands/channels which need to be scanned.
+ *
+ * Same API as @1.2::IRadio.startNetworkScan_1_2, except using the
+ * @1.4::IRadioResponse.startNetworkScanResponse_1_4 as the response.
+ */
+ oneway startNetworkScan_1_4(int32_t serial, NetworkScanRequest request);
/**
* Query the preferred network type bitmap.
@@ -148,4 +185,34 @@
*/
oneway setPreferredNetworkTypeBitmap(
int32_t serial, bitfield<RadioAccessFamily> networkTypeBitmap);
+
+ /**
+ * Set carrier restrictions. Expected modem behavior:
+ * If never receives this command:
+ * - Must allow all carriers
+ * Receives this command:
+ * - Only allow carriers specified in carriers. The restriction persists across power cycles
+ * and FDR. If a present SIM is allowed, modem must not reload the SIM. If a present SIM is
+ * *not* allowed, modem must detach from the registered network and only keep emergency
+ * service, and notify Android SIM refresh reset with new SIM state being
+ * CardState:RESTRICTED. Emergency service must be enabled.
+ *
+ * @param serial Serial number of request.
+ * @param carriers CarrierRestrictionsWithPriority consisting allowed and excluded carriers
+ * as defined in types.hal
+ * @param multiSimPolicy Policy to be used for devices with multiple SIMs.
+ *
+ * Response callback is IRadioResponse.setAllowedCarriersResponse()
+ */
+ oneway setAllowedCarriers_1_4(int32_t serial, CarrierRestrictionsWithPriority carriers,
+ SimLockMultiSimPolicy multiSimPolicy);
+
+ /**
+ * Get carrier restrictions.
+ *
+ * @param serial Serial number of request.
+ *
+ * Response callback is IRadioResponse.getAllowedCarriersResponse_1_3()
+ */
+ oneway getAllowedCarriers_1_4(int32_t serial);
};
diff --git a/radio/1.4/IRadioIndication.hal b/radio/1.4/IRadioIndication.hal
index 626b494..58b7b70 100644
--- a/radio/1.4/IRadioIndication.hal
+++ b/radio/1.4/IRadioIndication.hal
@@ -27,22 +27,24 @@
* Report the current list of emergency numbers
*
* Each emergency number (@1.4::EmergencyNumber) in the emergency number list contains a
- * dialing number, zero or more service category(s), mobile country code, and source(s) that
- * indicate where it comes from.
+ * dialing number, zero or more service category(s), zero or more emergency uniform resource
+ * names, mobile country code, mobile network code, and source(s) that indicate where it comes
+ * from.
*
- * Radio must report all the valid emergency numbers with known mobile country code and
- * emergency service categories from all available sources including network signaling, sim,
- * modem/oem configuration, and default configuration (112 and 911 must be always available;
- * additionally, 000, 08, 110, 999, 118 and 119 must be available when sim is not present).
- * Radio shall not report emergency numbers that are invalid in the current locale. The
- * reported emergency number list must not have duplicate @1.4::EmergencyNumber entries. Please
- * refer the documentation of @1.4::EmergencyNumber to construct each emergency number to
- * report.
+ * Radio must report all the valid emergency numbers with known mobile country code, mobile
+ * network code, emergency service categories, and emergency uniform resource names from all
+ * available sources including network signaling, sim, modem/oem configuration, and default
+ * configuration (112 and 911 must be always available; additionally, 000, 08, 110, 999, 118
+ * and 119 must be available when sim is not present). Radio shall not report emergency numbers
+ * that are invalid in the current locale. The reported emergency number list must not have
+ * duplicate @1.4::EmergencyNumber entries. Please refer the documentation of
+ * @1.4::EmergencyNumber to construct each emergency number to report.
*
* Radio must report the complete list of emergency numbers whenever the emergency numbers in
* the list are changed or whenever the client and the radio server are connected.
*
- * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls;
+ * 3gpp 24.008, Section 9.2.13.4 - Emergency Number List
*
* @param type Type of radio indication
* @param emergencyNumberList Current list of emergency numbers known to radio.
diff --git a/radio/1.4/IRadioResponse.hal b/radio/1.4/IRadioResponse.hal
index df40969..6b8977d 100644
--- a/radio/1.4/IRadioResponse.hal
+++ b/radio/1.4/IRadioResponse.hal
@@ -18,6 +18,13 @@
import @1.0::RadioResponseInfo;
import @1.3::IRadioResponse;
+import @1.4::CardStatus;
+import @1.4::CarrierRestrictionsWithPriority;
+import @1.4::CellInfo;
+import @1.4::DataRegStateResult;
+import @1.4::RadioAccessFamily;
+import @1.4::SetupDataCallResult;
+import @1.4::SimLockMultiSimPolicy;
/**
* Interface declaring response functions to solicited radio requests.
@@ -33,7 +40,6 @@
* RadioError:DIAL_MODIFIED_TO_SS
* RadioError:DIAL_MODIFIED_TO_DIAL
* RadioError:INVALID_ARGUMENTS
- * RadioError:NO_MEMORY
* RadioError:NO_RESOURCES
* RadioError:INTERNAL_ERR
* RadioError:FDN_CHECK_FAILURE
@@ -44,12 +50,27 @@
* RadioError:DEVICE_IN_USE
* RadioError:ABORTED
* RadioError:INVALID_MODEM_STATE
- * RadioError:CANCELLED
*/
oneway emergencyDialResponse(RadioResponseInfo info);
/**
* @param info Response info struct containing response type, serial no. and error
+ *
+ * Same API as @1.1::IRadioResponse.startNetworkScanResponse, except disallowing error codes
+ * OPERATION_NOT_ALLOWED and REQUEST_NOT_SUPPORTED.
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:DEVICE_IN_USE
+ * RadioError:INTERNAL_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INVALID_ARGUMENTS
+ */
+ oneway startNetworkScanResponse_1_4(RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
* @param cellInfo List of current cell information known to radio
*
* Valid errors returned:
@@ -81,9 +102,7 @@
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:INTERNAL_ERR
- * RadioError:NO_MEMORY
* RadioError:NO_RESOURCES
- * RadioError:CANCELLED
* RadioError:REQUEST_NOT_SUPPORTED
*/
oneway getIccCardStatusResponse_1_4(RadioResponseInfo info, CardStatus cardStatus);
@@ -95,14 +114,11 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
- * RadioError:NO_MEMORY
* RadioError:INTERNAL_ERR
- * RadioError:SYSTEM_ERR
* RadioError:INVALID_ARGUMENTS
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:NO_RESOURCES
- * RadioError:CANCELLED
*/
oneway getPreferredNetworkTypeBitmapResponse(RadioResponseInfo info,
bitfield<RadioAccessFamily> networkTypeBitmap);
@@ -117,14 +133,11 @@
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:OPERATION_NOT_ALLOWED
* RadioError:MODE_NOT_SUPPORTED
- * RadioError:NO_MEMORY
* RadioError:INTERNAL_ERR
- * RadioError:SYSTEM_ERR
* RadioError:INVALID_ARGUMENTS
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:NO_RESOURCES
- * RadioError:CANCELLED
*/
oneway setPreferredNetworkTypeBitmapResponse(RadioResponseInfo info);
@@ -136,9 +149,7 @@
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:INTERNAL_ERR
- * RadioError:NO_MEMORY
* RadioError:NO_RESOURCES
- * RadioError:CANCELLED
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:SIM_ABSENT
*/
@@ -158,10 +169,35 @@
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_ARGUMENTS
* RadioError:INTERNAL_ERR
- * RadioError:NO_MEMORY
* RadioError:NO_RESOURCES
- * RadioError:CANCELLED
* RadioError:SIM_ABSENT
*/
oneway setupDataCallResponse_1_4(RadioResponseInfo info, SetupDataCallResult dcResponse);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ */
+ oneway setAllowedCarriersResponse_1_4(RadioResponseInfo info);
+
+ /**
+ * Expected modem behavior:
+ * Return list of allowed carriers, and if all carriers are allowed.
+ *
+ * @param info Response info struct containing response type, serial no. and error
+ * @param carriers Carrier restriction information.
+ * @param multiSimPolicy Policy used for devices with multiple SIM cards.
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:REQUEST_NOT_SUPPORTED
+ */
+ oneway getAllowedCarriersResponse_1_4(RadioResponseInfo info,
+ CarrierRestrictionsWithPriority carriers, SimLockMultiSimPolicy multiSimPolicy);
};
diff --git a/radio/1.4/types.hal b/radio/1.4/types.hal
index d0eb0ac..6fa7ebd 100644
--- a/radio/1.4/types.hal
+++ b/radio/1.4/types.hal
@@ -18,6 +18,7 @@
import @1.0::ApnAuthType;
import @1.0::ApnTypes;
+import @1.0::Carrier;
import @1.0::CellInfoType;
import @1.0::DataCallFailCause;
import @1.0::DataProfileId;
@@ -39,6 +40,7 @@
import @1.2::CellInfoWcdma;
import @1.2::CardStatus;
import @1.2::CellIdentity;
+import @1.2::CellConnectionStatus;
import @1.2::DataRegStateResult;
import @1.2::PhysicalChannelConfig;
@@ -52,20 +54,27 @@
};
/**
- * Emergency number contains information of number, one or more service category(s), mobile country
- * code (mcc), and source(s) that indicate where it comes from.
+ * Emergency number contains information of number, one or more service category(s), zero or more
+ * emergency uniform resource names, mobile country code (mcc), mobile network country (mnc) and
+ * source(s) that indicate where it comes from.
*
- * If the source of the emergency number is associated with country, field ‘mcc’ must be provided;
- * otherwise the field ‘mcc’ must be an empty string.
+ * If the emergency number is associated with country, field ‘mcc’ must be provided, otherwise
+ * field ‘mcc’ must be an empty string. If the emergency number is associated with network
+ * operator, field ‘mcc’ and 'mnc' must be provided, otherwise field ‘mnc’ must be an empty
+ * string. If the emergency number is specified with emergency service category(s), field
+ * 'categories' must be provided, otherwise field 'categories' must be
+ * @1.4::EmergencyServiceCategories::UNSPECIFIED. If the emergency number is specified with
+ * emergency uniform resource names (URN), field 'urns' must be provided, otherwise field 'urns'
+ * must be an empty list.
*
- * If the source of the emergency number is associated with network operator, field ‘mcc’ and
- * 'mnc' must be provided; otherwise the field ‘mnc’ must be an empty string.
+ * A unique EmergencyNumber has a unique combination of ‘number’, ‘mcc’, 'mnc', 'categories' and
+ * 'urns' fields. Multiple @1.4::EmergencyNumberSource should be merged into one 'sources' field
+ * via bitwise-OR combination for the same EmergencyNumber.
*
- * A unique EmergencyNumber has a unique combination of ‘number’, ‘mcc’, 'mnc' and 'categories'
- * fields. Multiple @1.4::EmergencyNumberSource should be merged into the bitfield for the same
- * EmergencyNumber.
- *
- * Reference: 3GPP TS 22.101 version 9.1.0 Release 9
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls;
+ * 3gpp 23.167, Section 6 - Functional description;
+ * 3gpp 24.503, Section 5.1.6.8.1 - General;
+ * RFC 5031
*/
struct EmergencyNumber{
/**
@@ -87,6 +96,10 @@
*/
bitfield<EmergencyServiceCategory> categories;
/**
+ * The list of emergency Uniform Resource Names (URN).
+ */
+ vec<string> urns;
+ /**
* The bitfield of @1.4::EmergencyNumberSource(s). See @1.4::EmergencyNumberSource for the
* value of each bit.
*/
@@ -155,6 +168,25 @@
DEFAULT = 1 << 3,
};
+/**
+ * Indicates how the implementation should handle the emergency call if it is required by Android.
+ */
+enum EmergencyCallRouting : int32_t {
+ /**
+ * Indicates Android does not require how to handle the corresponding emergency call; it is
+ * decided by implementation.
+ */
+ UNKNOWN = 0,
+ /**
+ * Indicates the implementation must handle the call through emergency routing.
+ */
+ EMERGENCY = 1,
+ /**
+ * Indicates the implementation must handle the call through normal call routing.
+ */
+ NORMAL = 2,
+};
+
enum RadioTechnology : @1.0::RadioTechnology {
/** 5G NR. */
NR = 20,
@@ -198,7 +230,7 @@
* Network has already initiated the activation, modification, or deactivation of bearer
* resources that was requested by the UE.
*/
- COLLISION_WITH_NW_INIT_REQ = 0x38,
+ COLLISION_WITH_NETWORK_INITIATED_REQUEST = 0x38,
/**
* Network supports IPv4v6 PDP type only. Non-IP type is not allowed. In LTE mode of operation,
* this is a PDN throttling cause code, meaning the UE may throttle further requests to the
@@ -212,7 +244,7 @@
*/
ONLY_NON_IP_ALLOWED = 0x3A,
/**
- * QCI indicated in the UE request cannot be supported.
+ * QCI (QoS Class Identifier) indicated in the UE request cannot be supported.
*/
UNSUPPORTED_QCI_VALUE = 0x3B,
/**
@@ -226,7 +258,7 @@
/**
* Not receiving either a PCSCF or a DNS address, one of them being mandatory.
*/
- INVALID_PCSCF_DNS_ADDR = 0x7C,
+ INVALID_PCSCF_OR_DNS_ADDRESS = 0x7C,
/**
* Emergency call bring up on a different ePDG.
*/
@@ -234,128 +266,136 @@
/**
* UE performs a detach or disconnect PDN action based on TE requirements.
*/
- UE_INIT_DETACH_OR_DISCONNECT = 0x80,
+ UE_INITIATED_DETACH_OR_DISCONNECT = 0x80,
/**
- * Reason unspecified for foreign agent rejected MIP registration.
+ * Reason unspecified for foreign agent rejected MIP (Mobile IP) registration.
*/
MIP_FA_REASON_UNSPECIFIED = 0x7D0,
/**
- * Foreign agent administratively prohibited MIP registration.
+ * Foreign agent administratively prohibited MIP (Mobile IP) registration.
*/
MIP_FA_ADMIN_PROHIBITED = 0x7D1,
/**
- * Foreign agent rejected MIP registration because of insufficient resources.
+ * Foreign agent rejected MIP (Mobile IP) registration because of insufficient resources.
*/
MIP_FA_INSUFFICIENT_RESOURCES = 0x7D2,
/**
- * Foreign agent rejected MIP registration because of MN-AAA authenticator was wrong.
+ * Foreign agent rejected MIP (Mobile IP) registration because of MN-AAA authenticator was
+ * wrong.
*/
- MIP_FA_MOBILE_NODE_AUTH_FAILURE = 0x7D3,
+ MIP_FA_MOBILE_NODE_AUTHENTICATION_FAILURE = 0x7D3,
/**
- * Foreign agent rejected MIP registration because of home agent authentication failure.
+ * Foreign agent rejected MIP (Mobile IP) registration because of home agent authentication
+ * failure.
*/
- MIP_FA_HA_AUTH_FAILURE = 0x7D4,
+ MIP_FA_HOME_AGENT_AUTHENTICATION_FAILURE = 0x7D4,
/**
- * Foreign agent rejected MIP registration because of requested lifetime was too long.
+ * Foreign agent rejected MIP (Mobile IP) registration because of requested lifetime was too
+ * long.
*/
- MIP_FA_REQ_LIFETIME_TOO_LONG = 0x7D5,
+ MIP_FA_REQUESTED_LIFETIME_TOO_LONG = 0x7D5,
/**
- * Foreign agent rejected MIP registration because of malformed request.
+ * Foreign agent rejected MIP (Mobile IP) registration because of malformed request.
*/
MIP_FA_MALFORMED_REQUEST = 0x7D6,
/**
- * Foreign agent rejected MIP registration because of malformed reply.
+ * Foreign agent rejected MIP (Mobile IP) registration because of malformed reply.
*/
MIP_FA_MALFORMED_REPLY = 0x7D7,
/**
- * Foreign agent rejected MIP registration because of requested encapsulation was unavailable.
+ * Foreign agent rejected MIP (Mobile IP) registration because of requested encapsulation was
+ * unavailable.
*/
MIP_FA_ENCAPSULATION_UNAVAILABLE = 0x7D8,
/**
- * Foreign agent rejected MIP registration of VJ Header Compression was unavailable.
+ * Foreign agent rejected MIP (Mobile IP) registration of VJ Header Compression was unavailable.
*/
- MIP_FA_VJHC_UNAVAILABLE = 0x7D9,
+ MIP_FA_VJ_HEADER_COMPRESSION_UNAVAILABLE = 0x7D9,
/**
- * Foreign agent rejected MIP registration because of reverse tunnel was unavailable.
+ * Foreign agent rejected MIP (Mobile IP) registration because of reverse tunnel was
+ * unavailable.
*/
- MIP_FA_REV_TUNNEL_UNAVAILABLE = 0x7DA,
+ MIP_FA_REVERSE_TUNNEL_UNAVAILABLE = 0x7DA,
/**
- * Foreign agent rejected MIP registration because of reverse tunnel was mandatory but not
- * requested by device.
+ * Foreign agent rejected MIP (Mobile IP) registration because of reverse tunnel was mandatory
+ * but not requested by device.
*/
- MIP_FA_REV_TUNNEL_IS_MAND_AND_T_BIT_NOT_SET = 0x7DB,
+ MIP_FA_REVERSE_TUNNEL_IS_MANDATORY = 0x7DB,
/**
- * Foreign agent rejected MIP registration because of delivery style was not supported.
+ * Foreign agent rejected MIP (Mobile IP) registration because of delivery style was not
+ * supported.
*/
- MIP_FA_DELIVERY_STYLE_NOT_SUPP = 0x7DC,
+ MIP_FA_DELIVERY_STYLE_NOT_SUPPORTED = 0x7DC,
/**
- * Foreign agent rejected MIP registration because of missing NAI.
+ * Foreign agent rejected MIP (Mobile IP) registration because of missing NAI (Network Access
+ * Identifier).
*/
MIP_FA_MISSING_NAI = 0x7DD,
/**
- * Foreign agent rejected MIP registration because of missing Home Agent.
+ * Foreign agent rejected MIP (Mobile IP) registration because of missing Home Agent.
*/
- MIP_FA_MISSING_HA = 0x7DE,
+ MIP_FA_MISSING_HOME_AGENT = 0x7DE,
/**
- * Foreign agent rejected MIP registration because of missing Home Address.
+ * Foreign agent rejected MIP (Mobile IP) registration because of missing Home Address.
*/
- MIP_FA_MISSING_HOME_ADDR = 0x7DF,
+ MIP_FA_MISSING_HOME_ADDRESS = 0x7DF,
/**
- * Foreign agent rejected MIP registration because of unknown challenge.
+ * Foreign agent rejected MIP (Mobile IP) registration because of unknown challenge.
*/
MIP_FA_UNKNOWN_CHALLENGE = 0x7E0,
/**
- * Foreign agent rejected MIP registration because of missing challenge.
+ * Foreign agent rejected MIP (Mobile IP) registration because of missing challenge.
*/
MIP_FA_MISSING_CHALLENGE = 0x7E1,
/**
- * Foreign agent rejected MIP registration because of stale challenge.
+ * Foreign agent rejected MIP (Mobile IP) registration because of stale challenge.
*/
MIP_FA_STALE_CHALLENGE = 0x7E2,
/**
- * Reason unspecified for home agent rejected MIP registration.
+ * Reason unspecified for home agent rejected MIP (Mobile IP) registration.
*/
MIP_HA_REASON_UNSPECIFIED = 0x7E3,
/**
- * Home agent administratively prohibited MIP registration.
+ * Home agent administratively prohibited MIP (Mobile IP) registration.
*/
MIP_HA_ADMIN_PROHIBITED = 0x7E4,
/**
- * Home agent rejected MIP registration because of insufficient resources.
+ * Home agent rejected MIP (Mobile IP) registration because of insufficient resources.
*/
MIP_HA_INSUFFICIENT_RESOURCES = 0x7E5,
/**
- * Home agent rejected MIP registration because of MN-HA authenticator was wrong.
+ * Home agent rejected MIP (Mobile IP) registration because of MN-HA authenticator was wrong.
*/
- MIP_HA_MOBILE_NODE_AUTH_FAILURE = 0x7E6,
+ MIP_HA_MOBILE_NODE_AUTHENTICATION_FAILURE = 0x7E6,
/**
- * Home agent rejected MIP registration because of foreign agent authentication failure.
+ * Home agent rejected MIP (Mobile IP) registration because of foreign agent authentication
+ * failure.
*/
- MIP_HA_FA_AUTH_FAILURE = 0x7E7,
+ MIP_HA_FOREIGN_AGENT_AUTHENTICATION_FAILURE = 0x7E7,
/**
- * Home agent rejected MIP registration because of registration id mismatch.
+ * Home agent rejected MIP (Mobile IP) registration because of registration id mismatch.
*/
MIP_HA_REGISTRATION_ID_MISMATCH = 0x7E8,
/**
- * Home agent rejected MIP registration because of malformed request.
+ * Home agent rejected MIP (Mobile IP) registration because of malformed request.
*/
MIP_HA_MALFORMED_REQUEST = 0x7E9,
/**
- * Home agent rejected MIP registration because of unknown home agent address.
+ * Home agent rejected MIP (Mobile IP) registration because of unknown home agent address.
*/
- MIP_HA_UNKNOWN_HA_ADDR = 0x7EA,
+ MIP_HA_UNKNOWN_HOME_AGENT_ADDRESS = 0x7EA,
/**
- * Home agent rejected MIP registration because of reverse tunnel was unavailable.
+ * Home agent rejected MIP (Mobile IP) registration because of reverse tunnel was unavailable.
*/
- MIP_HA_REV_TUNNEL_UNAVAILABLE = 0x7EB,
+ MIP_HA_REVERSE_TUNNEL_UNAVAILABLE = 0x7EB,
/**
- * Home agent rejected MIP registration because of reverse tunnel is mandatory but not
- * requested by device.
+ * Home agent rejected MIP (Mobile IP) registration because of reverse tunnel is mandatory but
+ * not requested by device.
*/
- MIP_HA_REV_TUNNEL_IS_MANDATORY_AND_T_BIT_NOT_SET = 0x7EC,
+ MIP_HA_REVERSE_TUNNEL_IS_MANDATORY = 0x7EC,
/**
- * Home agent rejected MIP registration because of encapsulation unavailable.
+ * Home agent rejected MIP (Mobile IP) registration because of encapsulation unavailable.
*/
MIP_HA_ENCAPSULATION_UNAVAILABLE = 0x7ED,
/**
@@ -365,29 +405,29 @@
/**
* Brought down by the network.
*/
- NW_INITIATED_TERMINATION = 0x7EF,
+ NETWORK_INITIATED_TERMINATION = 0x7EF,
/**
* Another application in modem preempts the data call.
*/
MODEM_APP_PREEMPTED = 0x7F0,
/**
- * V4 PDN is in throttled state due to network providing only V6 address during the previous
+ * IPV4 PDN is in throttled state due to network providing only IPV6 address during the previous
* VSNCP bringup (subs_limited_to_v6).
*/
- ERR_PDN_IPV4_CALL_DISALLOWED = 0x7F1,
+ PDN_IPV4_CALL_DISALLOWED = 0x7F1,
/**
- * V4 PDN is in throttled state due to previous VSNCP bringup failure(s).
+ * IPV4 PDN is in throttled state due to previous VSNCP bringup failure(s).
*/
- ERR_PDN_IPV4_CALL_THROTTLED = 0x7F2,
+ PDN_IPV4_CALL_THROTTLED = 0x7F2,
/**
- * V6 PDN is in throttled state due to network providing only V4 address during the previous
+ * IPV6 PDN is in throttled state due to network providing only IPV4 address during the previous
* VSNCP bringup (subs_limited_to_v4).
*/
- ERR_PDN_IPV6_CALL_DISALLOWED = 0x7F3,
+ PDN_IPV6_CALL_DISALLOWED = 0x7F3,
/**
- * V6 PDN is in throttled state due to previous VSNCP bringup failure(s).
+ * IPV6 PDN is in throttled state due to previous VSNCP bringup failure(s).
*/
- ERR_PDN_IPV6_CALL_THROTTLED = 0x7F4,
+ PDN_IPV6_CALL_THROTTLED = 0x7F4,
/**
* Modem restart.
*/
@@ -403,7 +443,7 @@
/**
* Physical link is in the process of cleanup.
*/
- PHYS_LINK_CLOSE_IN_PROGRESS = 0x7F8,
+ PHYSICAL_LINK_CLOSE_IN_PROGRESS = 0x7F8,
/**
* Interface bring up is attempted for an APN that is yet to be handed over to target RAT.
*/
@@ -415,11 +455,11 @@
/**
* Card was refreshed or removed.
*/
- SIM_CARD_EVT = 0x7FB,
+ SIM_CARD_CHANGED = 0x7FB,
/**
* Device is going into lower power mode or powering down.
*/
- LPM_OR_PWR_DOWN = 0x7FC,
+ LOW_POWER_MODE_OR_POWERING_DOWN = 0x7FC,
/**
* APN has been disabled.
*/
@@ -431,7 +471,7 @@
/**
* IPv6 address transfer failed.
*/
- IPV6_ADDR_TRANSFER_FAILED = 0x7FF,
+ IPV6_ADDRESS_TRANSFER_FAILED = 0x7FF,
/**
* Target RAT swap failed.
*/
@@ -453,12 +493,12 @@
* IPv4 data call bring up is rejected because the UE already maintains the allotted maximum
* number of IPv4 data connections.
*/
- MAX_V4_CONNECTIONS = 0x804,
+ MAX_IPV4_CONNECTIONS = 0x804,
/**
* IPv6 data call bring up is rejected because the UE already maintains the allotted maximum
* number of IPv6 data connections.
*/
- MAX_V6_CONNECTIONS = 0x805,
+ MAX_IPV6_CONNECTIONS = 0x805,
/**
* New PDN bring up is rejected during interface selection because the UE has already allotted
* the available interfaces for other PDNs.
@@ -480,835 +520,834 @@
/**
* The current interface is being in use.
*/
- IFACE_IN_USE = 0x80A,
+ INTERFACE_IN_USE = 0x80A,
/**
* PDN connection to the APN is disallowed on the roaming network.
*/
- APN_DISALLOWED_ON_ROAMING = 0x80C,
+ APN_DISALLOWED_ON_ROAMING = 0x80B,
/**
* APN-related parameters are changed.
*/
- APN_PARAM_CHANGED = 0x80D,
+ APN_PARAMETERS_CHANGED = 0x80C,
/**
* PDN is attempted to be brought up with NULL APN but NULL APN is not supported.
*/
- NULL_APN_DISALLOWED = 0x80E,
+ NULL_APN_DISALLOWED = 0x80D,
/**
* Thermal level increases and causes calls to be torn down when normal mode of operation is
* not allowed.
*/
- THERMAL_MITIGATION = 0x80F,
+ THERMAL_MITIGATION = 0x80E,
/**
* PDN Connection to a given APN is disallowed because data is disabled from the device user
* interface settings.
*/
- DATA_SETTINGS_DISABLED = 0x810,
+ DATA_SETTINGS_DISABLED = 0x80F,
/**
* PDN Connection to a given APN is disallowed because data roaming is disabled from the device
* user interface settings and the UE is roaming.
*/
- DATA_ROAMING_SETTINGS_DISABLED = 0x811,
+ DATA_ROAMING_SETTINGS_DISABLED = 0x810,
/**
- * Default data subscription switch occurs.
+ * DDS (Default data subscription) switch occurs.
*/
- DDS_CALL_ABORT = 0x812,
+ DDS_SWITCHED = 0x811,
/**
* PDN being brought up with an APN that is part of forbidden APN Name list.
*/
- INVALID_APN_NAME = 0x813,
+ FORBIDDEN_APN_NAME = 0x812,
/**
* Default data subscription switch is in progress.
*/
- DDS_SWITCH_IN_PROGRESS = 0x814,
+ DDS_SWITCH_IN_PROGRESS = 0x813,
/**
* Roaming is disallowed during call bring up.
*/
- CALL_DISALLOWED_IN_ROAMING = 0x815,
+ CALL_DISALLOWED_IN_ROAMING = 0x814,
/**
* UE is unable to bring up a non-IP data call because the device is not camped on a NB1 cell.
*/
- NON_IP_NOT_SUPPORTED = 0x816,
+ NON_IP_NOT_SUPPORTED = 0x815,
/**
* Non-IP PDN is in throttled state due to previous VSNCP bringup failure(s).
*/
- ERR_PDN_NON_IP_CALL_THROTTLED = 0x817,
+ PDN_NON_IP_CALL_THROTTLED = 0x816,
/**
* Non-IP PDN is in disallowed state due to the network providing only an IP address.
*/
- ERR_PDN_NON_IP_CALL_DISALLOWED = 0x818,
+ PDN_NON_IP_CALL_DISALLOWED = 0x817,
/**
* Device in CDMA locked state.
*/
- CDMA_LOCK = 0x819,
+ CDMA_LOCK = 0x818,
/**
* Received an intercept order from the base station.
*/
- CDMA_INTERCEPT = 0x81A,
+ CDMA_INTERCEPT = 0x819,
/**
* Receiving a reorder from the base station.
*/
- CDMA_REORDER = 0x81B,
+ CDMA_REORDER = 0x81A,
/**
- * Receiving a release from the base station with a SO Reject reason.
+ * Receiving a release from the base station with a SO (Service Option) Reject reason.
*/
- CDMA_REL_SO_REJ = 0x81C,
+ CDMA_RELEASE_DUE_TO_SO_REJECTION = 0x81B,
/**
* Receiving an incoming call from the base station.
*/
- CDMA_INCOM_CALL = 0x81D,
+ CDMA_INCOMING_CALL = 0x81C,
/**
- * RL/FL fade or receiving a call release from the base station.
+ * Received an alert stop from the base station due to incoming only.
*/
- CDMA_ALERT_STOP = 0x81E,
+ CDMA_ALERT_STOP = 0x81D,
/**
* Channel acquisition failures. This indicates that device has failed acquiring all the
* channels in the PRL.
*/
- CHANNEL_ACQUISITION_FAILURE = 0x81F,
+ CHANNEL_ACQUISITION_FAILURE = 0x81E,
/**
* Maximum access probes transmitted.
*/
- MAX_ACCESS_PROBE = 0x820,
+ MAX_ACCESS_PROBE = 0x81F,
/**
* Concurrent service is not supported by base station.
*/
- CCS_NOT_SUPPORTED_BY_BS = 0x821,
+ CONCURRENT_SERVICE_NOT_SUPPORTED_BY_BASE_STATION = 0x820,
/**
* There was no response received from the base station.
*/
- NO_RESPONSE_FROM_BS = 0x822,
+ NO_RESPONSE_FROM_BASE_STATION = 0x821,
/**
* The base station rejecting the call.
*/
- REJECTED_BY_BS = 0x823,
+ REJECTED_BY_BASE_STATION = 0x822,
/**
* The concurrent services requested were not compatible.
*/
- CCS_INCOMPATIBLE = 0x824,
+ CONCURRENT_SERVICES_INCOMPATIBLE = 0x823,
/**
* Device does not have CDMA service.
*/
- NO_CDMA_SRV = 0x825,
+ NO_CDMA_SERVICE = 0x824,
/**
* RUIM not being present.
*/
- UIM_NOT_PRESENT = 0x826,
+ RUIM_NOT_PRESENT = 0x825,
/**
* Receiving a retry order from the base station.
*/
- CDMA_RETRY_ORDER = 0x827,
+ CDMA_RETRY_ORDER = 0x826,
/**
* Access blocked by the base station.
*/
- ACCESS_BLOCK = 0x828,
+ ACCESS_BLOCK = 0x827,
/**
* Access blocked by the base station for all mobile devices.
*/
- ACCESS_BLOCK_ALL = 0x829,
+ ACCESS_BLOCK_ALL = 0x828,
/**
* Maximum access probes for the IS-707B call.
*/
- IS707B_MAX_ACC = 0x82A,
+ IS707B_MAX_ACCESS_PROBES = 0x829,
/**
* Put device in thermal emergency.
*/
- THERMAL_EMERGENCY = 0x82B,
+ THERMAL_EMERGENCY = 0x82A,
/**
* In favor of a voice call or SMS when concurrent voice and data are not supported.
*/
- CCS_NOT_ALLOWED = 0x82C,
+ CONCURRENT_SERVICES_NOT_ALLOWED = 0x82B,
/**
* The other clients rejected incoming call.
*/
- INCOM_REJ = 0x82D,
+ INCOMING_CALL_REJECTED = 0x82C,
/**
* No service on the gateway.
*/
- NO_GATEWAY_SRV = 0x82E,
+ NO_SERVICE_ON_GATEWAY = 0x82D,
/**
* GPRS context is not available.
*/
- NO_GPRS_CONTEXT = 0x82F,
+ NO_GPRS_CONTEXT = 0x82E,
/**
* Network refuses service to the MS because either an identity of the MS is not acceptable to
* the network or the MS does not pass the authentication check.
*/
- ILLEGAL_MS = 0x830,
+ ILLEGAL_MS = 0x82F,
/**
* ME could not be authenticated and the ME used is not acceptable to the network.
*/
- ILLEGAL_ME = 0x831,
+ ILLEGAL_ME = 0x830,
/**
* Not allowed to operate either GPRS or non-GPRS services.
*/
- GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 0x832,
+ GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 0x831,
/**
* MS is not allowed to operate GPRS services.
*/
- GPRS_SERVICES_NOT_ALLOWED = 0x833,
+ GPRS_SERVICES_NOT_ALLOWED = 0x832,
/**
* No matching identity or context could be found in the network.
*/
- MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK = 0x834,
+ MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK = 0x833,
/**
- * Mobile reachable timer has expired, or the GMM context data related to the subscription dose
+ * Mobile reachable timer has expired, or the GMM context data related to the subscription does
* not exist in the SGSN.
*/
- IMPLICITLY_DETACHED = 0x835,
+ IMPLICITLY_DETACHED = 0x834,
/**
* UE requests GPRS service, or the network initiates a detach request in a PLMN which does not
* offer roaming for GPRS services to that MS.
*/
- PLMN_NOT_ALLOWED = 0x836,
+ PLMN_NOT_ALLOWED = 0x835,
/**
* MS requests service, or the network initiates a detach request, in a location area where the
* HPLMN determines that the MS, by subscription, is not allowed to operate.
*/
- LA_NOT_ALLOWED = 0x837,
+ LOCATION_AREA_NOT_ALLOWED = 0x836,
/**
* UE requests GPRS service or the network initiates a detach request in a PLMN that does not
* offer roaming for GPRS services.
*/
- GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN = 0x838,
+ GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN = 0x837,
/**
* PDP context already exists.
*/
- PDP_DUPLICATE = 0x839,
+ PDP_DUPLICATE = 0x838,
/**
* RAT change on the UE.
*/
- UE_RAT_CHANGE = 0x83A,
+ UE_RAT_CHANGE = 0x839,
/**
* Network cannot serve a request from the MS due to congestion.
*/
- CONGESTION = 0x83B,
+ CONGESTION = 0x83A,
/**
* MS requests an establishment of the radio access bearers for all active PDP contexts by
* sending a service request message indicating data to the network, but the SGSN does not have
* any active PDP context.
*/
- NO_PDP_CONTEXT_ACTIVATED = 0x83C,
+ NO_PDP_CONTEXT_ACTIVATED = 0x83B,
/**
* Access class blocking restrictions for the current camped cell.
*/
- ACCESS_CLASS_DSAC_REJECTION = 0x83D,
+ ACCESS_CLASS_DSAC_REJECTION = 0x83C,
/**
* SM attempts PDP activation for a maximum of four attempts.
*/
- PDP_ACTIVATE_MAX_RETRY_FAILED = 0x83E,
+ PDP_ACTIVATE_MAX_RETRY_FAILED = 0x83D,
/**
* Radio access bearer failure.
*/
- RAB_FAILURE = 0x83F,
+ RADIO_ACCESS_BEARER_FAILURE = 0x83E,
/**
* Invalid EPS bearer identity in the request.
*/
- ESM_UNKNOWN_EPS_BEARER_CONTEXT = 0x840,
+ ESM_UNKNOWN_EPS_BEARER_CONTEXT = 0x83F,
/**
* Data radio bearer is released by the RRC.
*/
- DRB_RELEASED_AT_RRC = 0x841,
+ DRB_RELEASED_BY_RRC = 0x840,
/**
* Indicate the connection was released.
*/
- NAS_SIG_CONN_RELEASED = 0x842,
+ CONNECTION_RELEASED = 0x841,
/**
* UE is detached.
*/
- EMM_DETACHED = 0x843,
+ EMM_DETACHED = 0x842,
/**
* Attach procedure is rejected by the network.
*/
- EMM_ATTACH_FAILED = 0x844,
+ EMM_ATTACH_FAILED = 0x843,
/**
* Attach procedure is started for EMC purposes.
*/
- EMM_ATTACH_STARTED = 0x845,
+ EMM_ATTACH_STARTED = 0x844,
/**
* Service request procedure failure.
*/
- LTE_NAS_SERVICE_REQ_FAILED = 0x846,
+ LTE_NAS_SERVICE_REQUEST_FAILED = 0x845,
/**
- * Active dedication bearer was requested using the same default bearer ID.
+ * Active dedicated bearer was requested using the same default bearer ID.
*/
- ESM_ACTIVE_DEDICATED_BEARER_REACTIVATED_BY_NW = 0x847,
+ DUPLICATE_BEARER_ID = 0x846,
/**
* Collision scenarios for the UE and network-initiated procedures.
*/
- ESM_LOWER_LAYER_FAILURE = 0x848,
+ ESM_COLLISION_SCENARIOS = 0x847,
/**
* Bearer must be deactivated to synchronize with the network.
*/
- ESM_SYNC_UP_WITH_NW = 0x849,
+ ESM_BEARER_DEACTIVATED_TO_SYNC_WITH_NETWORK = 0x848,
/**
- * Active dedication bearer was requested for an existing default bearer.
+ * Active dedicated bearer was requested for an existing default bearer.
*/
- ESM_NW_ACTIVATED_DED_BEARER_WITH_ID_OF_DEF_BEARER = 0x84A,
+ ESM_NW_ACTIVATED_DED_BEARER_WITH_ID_OF_DEF_BEARER = 0x849,
/**
* Bad OTA message is received from the network.
*/
- ESM_BAD_OTA_MESSAGE = 0x84B,
+ ESM_BAD_OTA_MESSAGE = 0x84A,
/**
* Download server rejected the call.
*/
- ESM_DS_REJECTED_THE_CALL = 0x84C,
+ ESM_DOWNLOAD_SERVER_REJECTED_THE_CALL = 0x84B,
/**
* PDN was disconnected by the downlaod server due to IRAT.
*/
- ESM_CONTEXT_TRANSFERED_DUE_TO_IRAT = 0x84D,
+ ESM_CONTEXT_TRANSFERRED_DUE_TO_IRAT = 0x84C,
/**
* Dedicated bearer will be deactivated regardless of the network response.
*/
- DS_EXPLICIT_DEACT = 0x84E,
+ DS_EXPLICIT_DEACTIVATION = 0x84D,
/**
* No specific local cause is mentioned, usually a valid OTA cause.
*/
- ESM_LOCAL_CAUSE_NONE = 0x84F,
+ ESM_LOCAL_CAUSE_NONE = 0x84E,
/**
* Throttling is not needed for this service request failure.
*/
- LTE_NAS_SERVICE_REQ_FAILED_NO_THROTTLE = 0x850,
+ LTE_THROTTLING_NOT_REQUIRED = 0x84F,
/**
* Access control list check failure at the lower layer.
*/
- ACCESS_CONTROL_LIST_CHECK_FAILURE = 0x851,
+ ACCESS_CONTROL_LIST_CHECK_FAILURE = 0x850,
/**
* Service is not allowed on the requested PLMN.
*/
- LTE_NAS_SERVICE_REQ_FAILED_DS_DISALLOW = 0x852,
+ SERVICE_NOT_ALLOWED_ON_PLMN = 0x851,
/**
* T3417 timer expiration of the service request procedure.
*/
- EMM_T3417_EXPIRED = 0x853,
+ EMM_T3417_EXPIRED = 0x852,
/**
* Extended service request fails due to expiration of the T3417 EXT timer.
*/
- EMM_T3417_EXT_EXPIRED = 0x854,
+ EMM_T3417_EXT_EXPIRED = 0x853,
/**
- * Transmission failure of uplink data.
+ * Transmission failure of radio resource control (RRC) uplink data.
*/
- LRRC_UL_DATA_CNF_FAILURE_TXN = 0x855,
+ RRC_UPLINK_DATA_TRANSMISSION_FAILURE = 0x854,
/**
- * Uplink data delivery failed due to a handover.
+ * Radio resource control (RRC) uplink data delivery failed due to a handover.
*/
- LRRC_UL_DATA_CNF_FAILURE_HO = 0x856,
+ RRC_UPLINK_DELIVERY_FAILED_DUE_TO_HANDOVER = 0x855,
/**
- * Uplink data delivery failed due to a connection release.
+ * Radio resource control (RRC) uplink data delivery failed due to a connection release.
*/
- LRRC_UL_DATA_CNF_FAILURE_CONN_REL = 0x857,
+ RRC_UPLINK_CONNECTION_RELEASE = 0x856,
/**
- * Uplink data delivery failed due to a radio link failure.
+ * Radio resource control (RRC) uplink data delivery failed due to a radio link failure.
*/
- LRRC_UL_DATA_CNF_FAILURE_RLF = 0x858,
+ RRC_UPLINK_RADIO_LINK_FAILURE = 0x857,
/**
- * RRC is not connected but the NAS sends an uplink data request.
+ * Radio resource control (RRC) is not connected but the non-access stratum (NAS) sends an
+ * uplink data request.
*/
- LRRC_UL_DATA_CNF_FAILURE_CTRL_NOT_CONN = 0x859,
+ RRC_UPLINK_ERROR_REQUEST_FROM_NAS = 0x858,
/**
- * Connection failure at access stratum.
+ * Radio resource control (RRC) connection failure at access stratum.
*/
- LRRC_CONN_EST_FAILURE = 0x85A,
+ RRC_CONNECTION_ACCESS_STRATUM_FAILURE = 0x859,
/**
- * Connection establishment is aborted due to another procedure.
+ * Radio resource control (RRC) connection establishment is aborted due to another procedure.
*/
- LRRC_CONN_EST_FAILURE_ABORTED = 0x85B,
+ RRC_CONNECTION_ANOTHER_PROCEDURE_IN_PROGRESS = 0x85A,
/**
- * Connection establishment failed due to a lower layer RRC connection failure.
+ * Radio resource control (RRC) connection establishment failed due to access barrred.
*/
- LRRC_CONN_EST_FAILURE_ACCESS_BARRED = 0x85C,
+ RRC_CONNECTION_ACCESS_BARRED = 0x85B,
/**
- * Connection establishment failed due to cell reselection at access stratum.
+ * Radio resource control (RRC) connection establishment failed due to cell reselection at
+ * access stratum.
*/
- LRRC_CONN_EST_FAILURE_CELL_RESEL = 0x85D,
+ RRC_CONNECTION_CELL_RESELECTION = 0x85C,
/**
- * Connection establishment failed due to configuration failure at the RRC.
+ * Connection establishment failed due to configuration failure at the radio resource control
+ * (RRC).
*/
- LRRC_CONN_EST_FAILURE_CONFIG_FAILURE = 0x85E,
+ RRC_CONNECTION_CONFIG_FAILURE = 0x85D,
/**
- * Connection could not be established in the time limit.
+ * Radio resource control (RRC) connection could not be established in the time limit.
*/
- LRRC_CONN_EST_FAILURE_TIMER_EXPIRED = 0x85F,
+ RRC_CONNECTION_TIMER_EXPIRED = 0x85E,
/**
- * Connection establishment failed due to a link failure at the RRC.
+ * Connection establishment failed due to a link failure at the radio resource control (RRC).
*/
- LRRC_CONN_EST_FAILURE_LINK_FAILURE = 0x860,
+ RRC_CONNECTION_LINK_FAILURE = 0x85F,
/**
- * Connection establishment failed as the RRC is not camped on any cell.
+ * Connection establishment failed as the radio resource control (RRC) is not camped on any
+ * cell.
*/
- LRRC_CONN_EST_FAILURE_NOT_CAMPED = 0x861,
+ RRC_CONNECTION_CELL_NOT_CAMPED = 0x860,
/**
- * Connection establishment failed due to a service interval failure at the RRC.
+ * Connection establishment failed due to a service interval failure at the radio resource
+ * control (RRC).
*/
- LRRC_CONN_EST_FAILURE_SI_FAILURE = 0x862,
+ RRC_CONNECTION_SYSTEM_INTERVAL_FAILURE = 0x861,
/**
- * Connection establishment failed due to the network rejecting the UE connection request.
+ * Radio resource control (RRC) connection establishment failed due to the network rejecting the
+ * UE connection request.
*/
- LRRC_CONN_EST_FAILURE_CONN_REJECT = 0x863,
+ RRC_CONNECTION_REJECT_BY_NETWORK = 0x862,
/**
- * Normal connection release.
+ * Normal radio resource control (RRC) connection release.
*/
- LRRC_CONN_REL_NORMAL = 0x864,
+ RRC_CONNECTION_NORMAL_RELEASE = 0x863,
/**
- * Connection release failed due to radio link failure conditions.
+ * Radio resource control (RRC) connection release failed due to radio link failure conditions.
*/
- LRRC_CONN_REL_RLF = 0x865,
+ RRC_CONNECTION_RADIO_LINK_FAILURE = 0x864,
/**
- * Connection reestablishment failure.
+ * Radio resource control (RRC) connection re-establishment failure.
*/
- LRRC_CONN_REL_CRE_FAILURE = 0x866,
+ RRC_CONNECTION_REESTABLISHMENT_FAILURE = 0x865,
/**
* UE is out of service during the call register.
*/
- LRRC_CONN_REL_OOS_DURING_CRE = 0x867,
+ RRC_CONNECTION_OUT_OF_SERVICE_DURING_CELL_REGISTER = 0x866,
/**
- * Connection has been released by the RRC due to an abort request.
+ * Connection has been released by the radio resource control (RRC) due to an abort request.
*/
- LRRC_CONN_REL_ABORTED = 0x868,
+ RRC_CONNECTION_ABORT_REQUEST = 0x867,
/**
- * Connection released due to a system information block read error.
+ * Radio resource control (RRC) connection released due to a system information block read
+ * error.
*/
- LRRC_CONN_REL_SIB_READ_ERROR = 0x869,
+ RRC_CONNECTION_SYSTEM_INFORMATION_BLOCK_READ_ERROR = 0x868,
/**
* Network-initiated detach with reattach.
*/
- DETACH_WITH_REATTACH_LTE_NW_DETACH = 0x86A,
+ NETWORK_INITIATED_DETACH_WITH_AUTO_REATTACH = 0x869,
/**
* Network-initiated detach without reattach.
*/
- DETACH_WITHOUT_REATTACH_LTE_NW_DETACH = 0x86B,
+ NETWORK_INITIATED_DETACH_NO_AUTO_REATTACH = 0x86A,
/**
* ESM procedure maximum attempt timeout failure.
*/
- ESM_PROC_TIME_OUT = 0x86C,
+ ESM_PROCEDURE_TIME_OUT = 0x86B,
/**
* No PDP exists with the given connection ID while modifying or deactivating or activation for
* an already active PDP.
*/
- INVALID_CONNECTION_ID = 0x86D,
+ INVALID_CONNECTION_ID = 0x86C,
/**
* Maximum NSAPIs have been exceeded during PDP activation.
*/
- INVALID_NSAPI = 0x86E,
+ MAXIMIUM_NSAPIS_EXCEEDED = 0x86D,
/**
* Primary context for NSAPI does not exist.
*/
- INVALID_PRI_NSAPI = 0x86F,
+ INVALID_PRIMARY_NSAPI = 0x86E,
/**
* Unable to encode the OTA message for MT PDP or deactivate PDP.
*/
- INVALID_FIELD = 0x870,
+ CANNOT_ENCODE_OTA_MESSAGE = 0x86F,
/**
* Radio access bearer is not established by the lower layers during activation, modification,
* or deactivation.
*/
- RAB_SETUP_FAILURE = 0x871,
+ RADIO_ACCESS_BEARER_SETUP_FAILURE = 0x870,
/**
* Expiration of the PDP establish timer with a maximum of five retries.
*/
- PDP_ESTABLISH_MAX_TIMEOUT = 0x872,
+ PDP_ESTABLISH_TIMEOUT_EXPIRED = 0x871,
/**
* Expiration of the PDP modify timer with a maximum of four retries.
*/
- PDP_MODIFY_MAX_TIMEOUT = 0x873,
+ PDP_MODIFY_TIMEOUT_EXPIRED = 0x872,
/**
* Expiration of the PDP deactivate timer with a maximum of four retries.
*/
- PDP_INACTIVE_MAX_TIMEOUT = 0x874,
+ PDP_INACTIVE_TIMEOUT_EXPIRED = 0x873,
/**
* PDP activation failed due to RRC_ABORT or a forbidden PLMN.
*/
- PDP_LOWERLAYER_ERROR = 0x875,
+ PDP_LOWERLAYER_ERROR = 0x874,
/**
* MO PDP modify collision when the MT PDP is already in progress.
*/
- PDP_MODIFY_COLLISION = 0x876,
- /**
- * Radio resource is not available.
- */
- SM_NO_RADIO_AVAILABLE = 0x877,
- /**
- * Abort due to service not available.
- */
- SM_ABORT_SERVICE_NOT_AVAILABLE = 0x878,
+ PDP_MODIFY_COLLISION = 0x875,
/**
* Maximum size of the L2 message was exceeded.
*/
- MESSAGE_EXCEED_MAX_L2_LIMIT = 0x879,
+ MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876,
/**
- * NAS request was rejected by the network.
+ * Non-access stratum (NAS) request was rejected by the network.
*/
- SM_NAS_SRV_REQ_FAILURE = 0x87A,
+ NAS_REQUEST_REJECTED_BY_NETWORK = 0x877,
/**
- * RRC connection establishment failure due to an error in the request message.
+ * Radio resource control (RRC) connection establishment failure due to an error in the request
+ * message.
*/
- RRC_CONN_EST_FAILURE_REQ_ERROR = 0x87B,
+ RRC_CONNECTION_INVALID_REQUEST = 0x878,
/**
- * RRC connection establishment failure due to a change in the tracking area ID.
+ * Radio resource control (RRC) connection establishment failure due to a change in the tracking
+ * area ID.
*/
- RRC_CONN_EST_FAILURE_TAI_CHANGE = 0x87C,
+ RRC_CONNECTION_TRACKING_AREA_ID_CHANGED = 0x879,
/**
- * RRC connection establishment failure because the RF was unavailable.
+ * Radio resource control (RRC) connection establishment failure due to the RF was unavailable.
*/
- RRC_CONN_EST_FAILURE_RF_UNAVAILABLE = 0x87D,
+ RRC_CONNECTION_RF_UNAVAILABLE = 0x87A,
/**
- * Connection was aborted before deactivating the LTE stack due to a successful LX IRAT.
- * (e.g., after IRAT handovers)
+ * Radio resource control (RRC) connection was aborted before deactivating the LTE stack due to
+ * a successful LTE to WCDMA/GSM/TD-SCDMA IRAT change.
*/
- RRC_CONN_REL_ABORTED_IRAT_SUCCESS = 0x87E,
+ RRC_CONNECTION_ABORTED_DUE_TO_IRAT_CHANGE = 0x87B,
/**
- * If the UE has an LTE radio link failure before security is established, the connection must
- * be released and the UE must return to idle.
+ * If the UE has an LTE radio link failure before security is established, the radio resource
+ * control (RRC) connection must be released and the UE must return to idle.
*/
- RRC_CONN_REL_RLF_SEC_NOT_ACTIVE = 0x87F,
+ RRC_CONNECTION_RELEASED_SECURITY_NOT_ACTIVE = 0x87C,
/**
- * Connection was aborted by the NAS after an IRAT to LTE IRAT handover.
+ * Radio resource control (RRC) connection was aborted by the non-access stratum (NAS) after an
+ * IRAT to LTE IRAT handover.
*/
- RRC_CONN_REL_IRAT_TO_LTE_ABORTED = 0x880,
+ RRC_CONNECTION_ABORTED_AFTER_HANDOVER = 0x87D,
/**
- * Connection was aborted before deactivating the LTE stack after a successful LR IRAT cell
+ * Radio resource control (RRC) connection was aborted before deactivating the LTE stack after a
+ * successful LTE to GSM/EDGE IRAT cell change order procedure.
+ */
+ RRC_CONNECTION_ABORTED_AFTER_IRAT_CELL_CHANGE = 0x87E,
+ /**
+ * Radio resource control (RRC) connection was aborted in the middle of a LTE to GSM IRAT cell
* change order procedure.
*/
- RRC_CONN_REL_IRAT_FROM_LTE_TO_G_CCO_SUCCESS = 0x881,
- /**
- * Connection was aborted in the middle of a LG IRAT cell change order.
- */
- RRC_CONN_REL_IRAT_FROM_LTE_TO_G_CCO_ABORTED = 0x882,
+ RRC_CONNECTION_ABORTED_DURING_IRAT_CELL_CHANGE = 0x87F,
/**
* IMSI present in the UE is unknown in the home subscriber server.
*/
- IMSI_UNKNOWN_IN_HSS = 0x883,
+ IMSI_UNKNOWN_IN_HOME_SUBSCRIBER_SERVER = 0x880,
/**
* IMEI of the UE is not accepted by the network.
*/
- IMEI_NOT_ACCEPTED = 0x884,
+ IMEI_NOT_ACCEPTED = 0x881,
/**
* EPS and non-EPS services are not allowed by the network.
*/
- EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = 0x885,
+ EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = 0x882,
/**
* EPS services are not allowed in the PLMN.
*/
- EPS_SERVICES_NOT_ALLOWED_IN_PLMN = 0x886,
+ EPS_SERVICES_NOT_ALLOWED_IN_PLMN = 0x883,
/**
* Mobile switching center is temporarily unreachable.
*/
- MSC_TEMPORARILY_NOT_REACHABLE = 0x887,
+ MSC_TEMPORARILY_NOT_REACHABLE = 0x884,
/**
* CS domain is not available.
*/
- CS_DOMAIN_NOT_AVAILABLE = 0x888,
+ CS_DOMAIN_NOT_AVAILABLE = 0x885,
/**
* ESM level failure.
*/
- ESM_FAILURE = 0x889,
+ ESM_FAILURE = 0x886,
/**
* MAC level failure.
*/
- MAC_FAILURE = 0x88A,
+ MAC_FAILURE = 0x887,
/**
* Synchronization failure.
*/
- SYNCH_FAILURE = 0x88B,
+ SYNCHRONIZATION_FAILURE = 0x888,
/**
* UE security capabilities mismatch.
*/
- UE_SECURITY_CAPABILITIES_MISMATCH = 0x88C,
+ UE_SECURITY_CAPABILITIES_MISMATCH = 0x889,
/**
* Unspecified security mode reject.
*/
- SECURITY_MODE_REJ_UNSPECIFIED = 0x88D,
+ SECURITY_MODE_REJECTED = 0x88A,
/**
* Unacceptable non-EPS authentication.
*/
- NON_EPS_AUTH_UNACCEPTABLE = 0x88E,
+ UNACCEPTABLE_NON_EPS_AUTHENTICATION = 0x88B,
/**
* CS fallback call establishment is not allowed.
*/
- CS_FALLBACK_CALL_EST_NOT_ALLOWED = 0x88F,
+ CS_FALLBACK_CALL_ESTABLISHMENT_NOT_ALLOWED = 0x88C,
/**
* No EPS bearer context was activated.
*/
- NO_EPS_BEARER_CONTEXT_ACTIVATED = 0x890,
+ NO_EPS_BEARER_CONTEXT_ACTIVATED = 0x88D,
/**
* Invalid EMM state.
*/
- EMM_INVALID_STATE = 0x891,
+ INVALID_EMM_STATE = 0x88E,
/**
* Non-Access Spectrum layer failure.
*/
- NAS_LAYER_FAILURE = 0x892,
+ NAS_LAYER_FAILURE = 0x88F,
/**
* Multiple PDP call feature is disabled.
*/
- MULTI_PDN_NOT_ALLOWED = 0x893,
+ MULTIPLE_PDP_CALL_NOT_ALLOWED = 0x890,
/**
* Data call has been brought down because EMBMS is not enabled at the RRC layer.
*/
- EMBMS_NOT_ENABLED = 0x894,
+ EMBMS_NOT_ENABLED = 0x891,
/**
* Data call was unsuccessfully transferred during the IRAT handover.
*/
- PENDING_REDIAL_CALL_CLEANUP = 0x895,
+ IRAT_HANDOVER_FAILED = 0x892,
/**
* EMBMS data call has been successfully brought down.
*/
- EMBMS_REGULAR_DEACTIVATION = 0x896,
+ EMBMS_REGULAR_DEACTIVATION = 0x893,
/**
* Test loop-back data call has been successfully brought down.
*/
- TLB_REGULAR_DEACTIVATION = 0x897,
+ TEST_LOOPBACK_REGULAR_DEACTIVATION = 0x894,
/**
* Lower layer registration failure.
*/
- LOWER_LAYER_REGISTRATION_FAILURE = 0x898,
+ LOWER_LAYER_REGISTRATION_FAILURE = 0x895,
/**
- * Network initiates a detach on LTE with error cause ""data plan has been replenished or has
- * expired.
+ * Network initiates a detach on LTE with error cause "data plan has been replenished or has
+ * expired".
*/
- DETACH_EPS_SERVICES_NOT_ALLOWED = 0x899,
+ DATA_PLAN_EXPIRED = 0x896,
/**
* UMTS interface is brought down due to handover from UMTS to iWLAN.
*/
- SM_INTERNAL_PDP_DEACTIVATION = 0x89A,
+ UMTS_HANDOVER_TO_IWLAN = 0x897,
/**
- * The reception of a connection deny message with a deny code of general or network busy.
+ * Received a connection deny due to general or network busy on EVDO network.
*/
- CD_GEN_OR_BUSY = 0x89B,
+ EVDO_CONNECTION_DENY_BY_GENERAL_OR_NETWORK_BUSY = 0x898,
/**
- * The reception of a connection deny message with a deny code of billing failure or
- * authentication failure.
+ * Received a connection deny due to billing or authentication failure on EVDO network.
*/
- CD_BILL_OR_AUTH = 0x89C,
+ EVDO_CONNECTION_DENY_BY_BILLING_OR_AUTHENTICATION_FAILURE = 0x899,
/**
* HDR system has been changed due to redirection or the PRL was not preferred.
*/
- HDR_CHANGED = 0x89D,
+ EVDO_HDR_CHANGED = 0x89A,
/**
* Device exited HDR due to redirection or the PRL was not preferred.
*/
- HDR_EXITED = 0x89E,
+ EVDO_HDR_EXITED = 0x89B,
/**
* Device does not have an HDR session.
*/
- HDR_NO_SESSION = 0x89F,
+ EVDO_HDR_NO_SESSION = 0x89C,
/**
* It is ending an HDR call origination in favor of a GPS fix.
*/
- HDR_ORIG_DURING_GPS_FIX = 0x8A0,
+ EVDO_USING_GPS_FIX_INSTEAD_OF_HDR_CALL = 0x89D,
/**
* Connection setup on the HDR system was time out.
*/
- HDR_CS_TIMEOUT = 0x8A1,
+ EVDO_HDR_CONNECTION_SETUP_TIMEOUT = 0x89E,
/**
* Device failed to acquire a co-located HDR for origination.
*/
- COLLOC_ACQ_FAIL = 0x8A2,
+ FAILED_TO_ACQUIRE_COLOCATED_HDR = 0x89F,
/**
* OTASP commit is in progress.
*/
- OTASP_COMMIT_IN_PROG = 0x8A3,
+ OTASP_COMMIT_IN_PROGRESS = 0x8A0,
/**
* Device has no hybrid HDR service.
*/
- NO_HYBR_HDR_SRV = 0x8A4,
+ NO_HYBRID_HDR_SERVICE = 0x8A1,
/**
* HDR module could not be obtained because of the RF locked.
*/
- HDR_NO_LOCK_GRANTED = 0x8A5,
+ HDR_NO_LOCK_GRANTED = 0x8A2,
/**
* DBM or SMS is in progress.
*/
- HOLD_OTHER_IN_PROG = 0x8A6,
+ DBM_OR_SMS_IN_PROGRESS = 0x8A3,
/**
* HDR module released the call due to fade.
*/
- HDR_FADE = 0x8A7,
+ HDR_FADE = 0x8A4,
/**
* HDR system access failure.
*/
- HDR_ACC_FAIL = 0x8A8,
+ HDR_ACCESS_FAILURE = 0x8A5,
/**
* P_rev supported by 1 base station is less than 6, which is not supported for a 1X data call.
* The UE must be in the footprint of BS which has p_rev >= 6 to support this SO33 call.
*/
- UNSUPPORTED_1X_PREV = 0x8A9,
+ UNSUPPORTED_1X_PREV = 0x8A6,
/**
* Client ended the data call.
*/
- LOCAL_END = 0x8AA,
+ LOCAL_END = 0x8A7,
/**
* Device has no service.
*/
- NO_SRV = 0x8AB,
+ NO_SERVICE = 0x8A8,
/**
* Device lost the system due to fade.
*/
- FADE = 0x8AC,
+ FADE = 0x8A9,
/**
* Receiving a release from the base station with no reason.
*/
- REL_NORMAL = 0x8AD,
+ NORMAL_RELEASE = 0x8AA,
/**
* Access attempt is already in progress.
*/
- ACC_IN_PROG = 0x8AE,
- /**
- * Access failure.
- */
- ACC_FAIL = 0x8AF,
+ ACCESS_ATTEMPT_ALREADY_IN_PROGRESS = 0x8AB,
/**
* Device is in the process of redirecting or handing off to a different target system.
*/
- REDIR_OR_HANDOFF = 0x8B0,
+ REDIRECTION_OR_HANDOFF_IN_PROGRESS = 0x8AC,
/**
* Device is operating in Emergency mode.
*/
- EMERGENCY_MODE = 0x8B1,
+ EMERGENCY_MODE = 0x8AD,
/**
* Device is in use (e.g., voice call).
*/
- PHONE_IN_USE = 0x8B2,
+ PHONE_IN_USE = 0x8AE,
/**
- * Device operational mode is different from the mode requested in the traffic channel bring up
+ * Device operational mode is different from the mode requested in the traffic channel bring up.
*/
- INVALID_MODE = 0x8B3,
+ INVALID_MODE = 0x8AF,
/**
* SIM was marked by the network as invalid for the circuit and/or packet service domain.
*/
- INVALID_SIM_STATE = 0x8B4,
+ INVALID_SIM_STATE = 0x8B0,
/**
* There is no co-located HDR.
*/
- NO_COLLOC_HDR = 0x8B5,
+ NO_COLLOCATED_HDR = 0x8B1,
/**
* UE is entering power save mode.
*/
- EMM_DETACHED_PSM = 0x8B6,
+ UE_IS_ENTERING_POWERSAVE_MODE = 0x8B2,
/**
* Dual switch from single standby to dual standby is in progress.
*/
- DUAL_SWITCH = 0x8B7,
+ DUAL_SWITCH = 0x8B3,
/**
- * Data call bring up fails in the PPP setup due to a timeout.
- * (e.g., an LCP conf ack was not received from the network)
+ * Data call bring up fails in the PPP setup due to a timeout. (e.g., an LCP conf ack was not
+ * received from the network)
*/
- PPP_TIMEOUT = 0x8B8,
+ PPP_TIMEOUT = 0x8B4,
/**
* Data call bring up fails in the PPP setup due to an authorization failure.
* (e.g., authorization is required, but not negotiated with the network during an LCP phase)
*/
- PPP_AUTH_FAILURE = 0x8B9,
+ PPP_AUTH_FAILURE = 0x8B5,
/**
* Data call bring up fails in the PPP setup due to an option mismatch.
*/
- PPP_OPTION_MISMATCH = 0x8BA,
+ PPP_OPTION_MISMATCH = 0x8B6,
/**
* Data call bring up fails in the PPP setup due to a PAP failure.
*/
- PPP_PAP_FAILURE = 0x8BB,
+ PPP_PAP_FAILURE = 0x8B7,
/**
* Data call bring up fails in the PPP setup due to a CHAP failure.
*/
- PPP_CHAP_FAILURE = 0x8BC,
+ PPP_CHAP_FAILURE = 0x8B8,
/**
* Data call bring up fails in the PPP setup because the PPP is in the process of cleaning the
* previous PPP session.
*/
- PPP_ERR_CLOSE_IN_PROGRESS = 0x8BD,
+ PPP_CLOSE_IN_PROGRESS = 0x8B9,
/**
* IPv6 interface bring up fails because the network provided only the IPv4 address for the
* upcoming PDN permanent client can reattempt a IPv6 call bring up after the IPv4 interface is
* also brought down. However, there is no guarantee that the network will provide a IPv6
* address.
*/
- EHRPD_SUBS_LIMITED_TO_V4 = 0x8BE,
+ LIMITED_TO_IPV4 = 0x8BA,
/**
* IPv4 interface bring up fails because the network provided only the IPv6 address for the
* upcoming PDN permanent client can reattempt a IPv4 call bring up after the IPv6 interface is
* also brought down. However there is no guarantee that the network will provide a IPv4
* address.
*/
- EHRPD_SUBS_LIMITED_TO_V6 = 0x8BF,
+ LIMITED_TO_IPV6 = 0x8BB,
/**
* Data call bring up fails in the VSNCP phase due to a VSNCP timeout error.
*/
- EHRPD_VSNCP_TIMEOUT = 0x8C0,
+ VSNCP_TIMEOUT = 0x8BC,
/**
- * Data call bring up fails in the VSNCP phase due to a general error
+ * Data call bring up fails in the VSNCP phase due to a general error. It's used when there is
+ * no other specific error code available to report the failure.
*/
- EHRPD_VSNCP_GEN_ERROR = 0x8C1,
+ VSNCP_GEN_ERROR = 0x8BD,
/**
* Data call bring up fails in the VSNCP phase due to a network rejection of the VSNCP
* configuration request because the requested APN is unauthorized.
*/
- EHRPD_VSNCP_UNAUTH_APN = 0x8C2,
+ VSNCP_APN_UNATHORIZED = 0x8BE,
/**
* Data call bring up fails in the VSNCP phase due to a network rejection of the VSNCP
* configuration request because the PDN limit has been exceeded.
*/
- EHRPD_VSNCP_PDN_LIMIT_EXCEED = 0x8C3,
+ VSNCP_PDN_LIMIT_EXCEEDED = 0x8BF,
/**
- * Data call bring up fails in the VSNCP phase because the network rejected the VSNCP
- * configuration request due to no PDN gateway.
+ * Data call bring up fails in the VSNCP phase due to the network rejected the VSNCP
+ * configuration request due to no PDN gateway address.
*/
- EHRPD_VSNCP_NO_PDN_GW = 0x8C4,
+ VSNCP_NO_PDN_GATEWAY_ADDRESS = 0x8C0,
/**
* Data call bring up fails in the VSNCP phase due to a network rejection of the VSNCP
* configuration request because the PDN gateway is unreachable.
*/
- EHRPD_VSNCP_PDN_GW_UNREACH = 0x8C5,
+ VSNCP_PDN_GATEWAY_UNREACHABLE = 0x8C1,
/**
* Data call bring up fails in the VSNCP phase due to a network rejection of the VSNCP
* configuration request due to a PDN gateway reject.
*/
- EHRPD_VSNCP_PDN_GW_REJ = 0x8C6,
+ VSNCP_PDN_GATEWAY_REJECT = 0x8C2,
/**
* Data call bring up fails in the VSNCP phase due to a network rejection of the VSNCP
* configuration request with the reason of insufficient parameter.
*/
- EHRPD_VSNCP_INSUFF_PARAM = 0x8C7,
+ VSNCP_INSUFFICIENT_PARAMETERS = 0x8C3,
/**
* Data call bring up fails in the VSNCP phase due to a network rejection of the VSNCP
* configuration request with the reason of resource unavailable.
*/
- EHRPD_VSNCP_RESOURCE_UNAVAIL = 0x8C8,
+ VSNCP_RESOURCE_UNAVAILABLE = 0x8C4,
/**
* Data call bring up fails in the VSNCP phase due to a network rejection of the VSNCP
- * configuration request with the reason of admin prohibited.
+ * configuration request with the reason of administratively prohibited at the HSGW.
*/
- EHRPD_VSNCP_ADMIN_PROHIBIT = 0x8C9,
+ VSNCP_ADMINISTRATIVELY_PROHIBITED = 0x8C5,
/**
* Data call bring up fails in the VSNCP phase due to a network rejection of PDN ID in use, or
* all existing PDNs are brought down with this end reason because one of the PDN bring up was
* rejected by the network with the reason of PDN ID in use.
*/
- EHRPD_VSNCP_PDN_ID_IN_USE = 0x8CA,
+ VSNCP_PDN_ID_IN_USE = 0x8C6,
/**
* Data call bring up fails in the VSNCP phase due to a network rejection of the VSNCP
* configuration request for the reason of subscriber limitation.
*/
- EHRPD_VSNCP_SUBSCR_LIMITATION = 0x8CB,
+ VSNCP_SUBSCRIBER_LIMITATION = 0x8C7,
/**
* Data call bring up fails in the VSNCP phase due to a network rejection of the VSNCP
* configuration request because the PDN exists for this APN.
*/
- EHRPD_VSNCP_PDN_EXISTS_FOR_THIS_APN = 0x8CC,
+ VSNCP_PDN_EXISTS_FOR_THIS_APN = 0x8C8,
/**
* Data call bring up fails in the VSNCP phase due to a network rejection of the VSNCP
* configuration request with reconnect to this PDN not allowed, or an active data call is
* terminated by the network because reconnection to this PDN is not allowed. Upon receiving
- * this error code from the network, the modem infinitely throttles the PDN until the next
- * power cycle.
+ * this error code from the network, the modem infinitely throttles the PDN until the next power
+ * cycle.
*/
- EHRPD_VSNCP_RECONNECT_NOT_ALLOWED = 0x8CD,
+ VSNCP_RECONNECT_NOT_ALLOWED = 0x8C9,
/**
* Device failure to obtain the prefix from the network.
*/
- IPV6_PREFIX_UNAVAILABLE = 0x8CE,
+ IPV6_PREFIX_UNAVAILABLE = 0x8CA,
/**
* System preference change back to SRAT during handoff
*/
- HANDOFF_PREF_SYS_BACK_TO_SRAT = 0x8CF,
+ HANDOFF_PREFERENCE_CHANGED = 0x8CB,
};
/**
@@ -1358,13 +1397,9 @@
*/
NON_IP = 4,
/**
- * Ethernet protocol
- */
- ETHERNET = 5,
- /**
* Transfer of Unstructured data to the Data Network via N6
*/
- UNSTRUCTURED = 6,
+ UNSTRUCTURED = 5,
};
safe_union RadioFrequencyInfo {
@@ -1500,15 +1535,15 @@
/** Overwritten from @1.2::CellInfo in order to update the CellInfoLte to 1.4 version. */
struct CellInfo {
- /** Cell type for selecting from union CellInfo. */
- CellInfoType cellInfoType;
-
/**
* True if the phone is registered to a mobile network that provides service on this cell and
* this cell is being used or would be used for network signaling.
*/
bool isRegistered;
+ /** Connection status for the cell. */
+ CellConnectionStatus connectionStatus;
+
/** CellInfo details, cellInfoType can tell which cell info should be used. */
safe_union Info {
CellInfoGsm gsm;
@@ -1700,3 +1735,38 @@
*/
int32_t mtu;
};
+
+enum SimLockMultiSimPolicy : int32_t {
+ /**
+ * Indicates that configuration applies to each slot independently.
+ */
+ NO_MULTISIM_POLICY = 0,
+ /**
+ * Indicates that any SIM card can be used as far as one valid card is present in the device.
+ * For the modem, a SIM card is valid when its content (i.e. MCC, MNC, GID, SPN) matches the
+ * carrier restriction configuration.
+ */
+ ONE_VALID_SIM_MUST_BE_PRESENT = 1,
+};
+
+struct CarrierRestrictionsWithPriority {
+ /**
+ * List of allowed carriers.
+ * The character '?' is used as wildcard character to match any value.
+ */
+ vec<Carrier> allowedCarriers;
+ /**
+ * List of excluded carriers.
+ * The character '?' is used as wildcard character to match any value.
+ */
+ vec<Carrier> excludedCarriers;
+ /**
+ * True means that only carriers included in the allowed list and not in the excluded list
+ * are permitted. Eg. allowedCarriers match mcc/mnc, excludedCarriers has same mcc/mnc and
+ * gid1 is ABCD. It means except the carrier whose gid1 is ABCD, all carriers with the
+ * same mcc/mnc are allowed.
+ * False means that all carriers are allowed except those included in the excluded list
+ * and not in the allowed list.
+ */
+ bool allowedCarriersPrioritized;
+};
diff --git a/radio/config/1.1/Android.bp b/radio/config/1.1/Android.bp
index 056510c..151a0a3 100644
--- a/radio/config/1.1/Android.bp
+++ b/radio/config/1.1/Android.bp
@@ -7,10 +7,10 @@
enabled: true,
},
srcs: [
+ "types.hal",
"IRadioConfig.hal",
"IRadioConfigIndication.hal",
"IRadioConfigResponse.hal",
- "types.hal",
],
interfaces: [
"android.hardware.radio.config@1.0",
@@ -19,6 +19,7 @@
],
types: [
"ModemInfo",
+ "ModemsConfig",
"PhoneCapability",
],
gen_java: true,
diff --git a/radio/config/1.1/IRadioConfig.hal b/radio/config/1.1/IRadioConfig.hal
index bc63339..7b0c6b6 100644
--- a/radio/config/1.1/IRadioConfig.hal
+++ b/radio/config/1.1/IRadioConfig.hal
@@ -19,6 +19,7 @@
import @1.0::IRadioConfig;
import @1.1::IRadioConfigResponse;
import @1.1::PhoneCapability;
+import @1.1::ModemsConfig;
/**
* Note: IRadioConfig 1.1 is an intermediate layer between Android P and Android Q.
@@ -56,4 +57,36 @@
* Response callback is IRadioConfigResponse.setPreferredDataModemResponse()
*/
oneway setPreferredDataModem(int32_t serial, uint8_t modemId);
+
+ /**
+ * Set modems configurations by specifying the number of live modems (i.e modems that are
+ * enabled and actively working as part of a working telephony stack).
+ *
+ * Example: this interface can be used to switch to single/multi sim mode by specifying
+ * the number of live modems as 1, 2, etc
+ *
+ * Note: by setting the number of live modems in this API, that number of modems will
+ * subsequently get enabled/disabled
+ *
+ * @param serial serial number of request.
+ * @param modemsConfig ModemsConfig object including the number of live modems
+ *
+ * Response callback is IRadioResponse.setModemsConfigResponse()
+ */
+ oneway setModemsConfig(int32_t serial, ModemsConfig modemsConfig);
+
+ /**
+ * Get modems configurations. This interface is used to get modem configurations
+ * which includes the number of live modems (i.e modems that are
+ * enabled and actively working as part of a working telephony stack)
+ *
+ * Note: in order to get the overall number of modems available on the phone,
+ * refer to getPhoneCapability API
+ *
+ * @param serial Serial number of request.
+ *
+ * Response callback is IRadioResponse.getModemsConfigResponse() which
+ * will return <@1.1::ModemsConfig>.
+ */
+ oneway getModemsConfig(int32_t serial);
};
diff --git a/radio/config/1.1/IRadioConfigResponse.hal b/radio/config/1.1/IRadioConfigResponse.hal
index 42a31b1..d42ff06 100644
--- a/radio/config/1.1/IRadioConfigResponse.hal
+++ b/radio/config/1.1/IRadioConfigResponse.hal
@@ -19,6 +19,7 @@
import @1.0::IRadioConfigResponse;
import @1.1::PhoneCapability;
import android.hardware.radio@1.0::RadioResponseInfo;
+import @1.1::ModemsConfig;
/**
* Note: IRadioConfig 1.1 is an intermediate layer between Android P and Android Q.
@@ -50,4 +51,27 @@
* RadioError:INVALID_ARGUMENTS
*/
oneway setPreferredDataModemResponse(RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:INVALID_ARGUMENTS
+ */
+ oneway setModemsConfigResponse(RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ * @param modemsConfig <@1.1::ModemsConfig> it defines all the modems' configurations
+ * at this time, only the number of live modems
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:REQUEST_NOT_SUPPORTED
+ */
+ oneway getModemsConfigResponse(RadioResponseInfo info, ModemsConfig modemsConfig);
};
diff --git a/radio/config/1.1/types.hal b/radio/config/1.1/types.hal
index a7b9f86..89a4723 100644
--- a/radio/config/1.1/types.hal
+++ b/radio/config/1.1/types.hal
@@ -61,3 +61,11 @@
*/
vec<ModemInfo> logicalModemList;
};
+
+struct ModemsConfig {
+ /**
+ * variable to indicate the number of live modems i.e modems that are enabled
+ * and actively working as part of a working connectivity stack
+ */
+ uint8_t numOfLiveModems;
+};
\ No newline at end of file
diff --git a/radio/config/1.1/vts/functional/Android.bp b/radio/config/1.1/vts/functional/Android.bp
new file mode 100644
index 0000000..de909a3
--- /dev/null
+++ b/radio/config/1.1/vts/functional/Android.bp
@@ -0,0 +1,33 @@
+//
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+ name: "VtsHalRadioConfigV1_1TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: [
+ "radio_config_hidl_hal_api.cpp",
+ "radio_config_hidl_hal_test.cpp",
+ "radio_config_response.cpp",
+ "VtsHalRadioConfigV1_1TargetTest.cpp",
+ ],
+ static_libs: [
+ "RadioVtsTestUtilBase",
+ "android.hardware.radio.config@1.0",
+ "android.hardware.radio.config@1.1",
+ ],
+ header_libs: ["radio.util.header@1.0"],
+ test_suites: ["general-tests"],
+}
diff --git a/radio/config/1.1/vts/functional/VtsHalRadioConfigV1_1TargetTest.cpp b/radio/config/1.1/vts/functional/VtsHalRadioConfigV1_1TargetTest.cpp
new file mode 100644
index 0000000..2fc6b62
--- /dev/null
+++ b/radio/config/1.1/vts/functional/VtsHalRadioConfigV1_1TargetTest.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <radio_config_hidl_hal_utils.h>
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(RadioConfigHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ RadioConfigHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
+}
diff --git a/radio/config/1.1/vts/functional/radio_config_hidl_hal_api.cpp b/radio/config/1.1/vts/functional/radio_config_hidl_hal_api.cpp
new file mode 100644
index 0000000..a1639d8
--- /dev/null
+++ b/radio/config/1.1/vts/functional/radio_config_hidl_hal_api.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <radio_config_hidl_hal_utils.h>
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+
+/*
+ * Test IRadioConfig.getModemsConfig()
+ */
+TEST_F(RadioConfigHidlTest, getModemsConfig) {
+ serial = GetRandomSerialNumber();
+ Return<void> res = radioConfig->getModemsConfig(serial);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
+ ALOGI("getModemsConfig, rspInfo.error = %s\n", toString(radioConfigRsp->rspInfo.error).c_str());
+
+ ASSERT_TRUE(CheckAnyOfErrors(radioConfigRsp->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+}
+
+/*
+ * Test IRadioConfig.setModemsConfig()
+ */
+TEST_F(RadioConfigHidlTest, setModemsConfig_invalidArgument) {
+ serial = GetRandomSerialNumber();
+ ModemsConfig* mConfig = new ModemsConfig();
+ Return<void> res = radioConfig->setModemsConfig(serial, *mConfig);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
+ ALOGI("setModemsConfig, rspInfo.error = %s\n", toString(radioConfigRsp->rspInfo.error).c_str());
+
+ ASSERT_TRUE(
+ CheckAnyOfErrors(radioConfigRsp->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
+}
+
+/*
+ * Test IRadioConfig.setModemsConfig()
+ */
+TEST_F(RadioConfigHidlTest, setModemsConfig_goodRequest) {
+ serial = GetRandomSerialNumber();
+ ModemsConfig* mConfig = new ModemsConfig();
+ mConfig->numOfLiveModems = 1;
+ Return<void> res = radioConfig->setModemsConfig(serial, *mConfig);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
+ ALOGI("setModemsConfig, rspInfo.error = %s\n", toString(radioConfigRsp->rspInfo.error).c_str());
+
+ ASSERT_TRUE(CheckAnyOfErrors(radioConfigRsp->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
+}
diff --git a/radio/config/1.1/vts/functional/radio_config_hidl_hal_test.cpp b/radio/config/1.1/vts/functional/radio_config_hidl_hal_test.cpp
new file mode 100644
index 0000000..a8c257d
--- /dev/null
+++ b/radio/config/1.1/vts/functional/radio_config_hidl_hal_test.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <radio_config_hidl_hal_utils.h>
+
+void RadioConfigHidlTest::SetUp() {
+ radioConfig = ::testing::VtsHalHidlTargetTestBase::getService<IRadioConfig>(
+ RadioConfigHidlEnvironment::Instance()->getServiceName<IRadioConfig>(
+ hidl_string(RADIO_SERVICE_NAME)));
+ if (radioConfig == NULL) {
+ sleep(60);
+ radioConfig = ::testing::VtsHalHidlTargetTestBase::getService<IRadioConfig>(
+ RadioConfigHidlEnvironment::Instance()->getServiceName<IRadioConfig>(
+ hidl_string(RADIO_SERVICE_NAME)));
+ }
+ ASSERT_NE(nullptr, radioConfig.get());
+
+ radioConfigRsp = new (std::nothrow) RadioConfigResponse(*this);
+ ASSERT_NE(nullptr, radioConfigRsp.get());
+
+ count_ = 0;
+
+ radioConfig->setResponseFunctions(radioConfigRsp, nullptr);
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
+ EXPECT_EQ(RadioError::NONE, radioConfigRsp->rspInfo.error);
+}
+
+/*
+ * Notify that the response message is received.
+ */
+void RadioConfigHidlTest::notify(int receivedSerial) {
+ std::unique_lock<std::mutex> lock(mtx_);
+ if (serial == receivedSerial) {
+ count_++;
+ cv_.notify_one();
+ }
+}
+
+/*
+ * Wait till the response message is notified or till TIMEOUT_PERIOD.
+ */
+std::cv_status RadioConfigHidlTest::wait() {
+ std::unique_lock<std::mutex> lock(mtx_);
+
+ std::cv_status status = std::cv_status::no_timeout;
+ auto now = std::chrono::system_clock::now();
+ while (count_ == 0) {
+ status = cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
+ if (status == std::cv_status::timeout) {
+ return status;
+ }
+ }
+ count_--;
+ return status;
+}
\ No newline at end of file
diff --git a/radio/config/1.1/vts/functional/radio_config_hidl_hal_utils.h b/radio/config/1.1/vts/functional/radio_config_hidl_hal_utils.h
new file mode 100644
index 0000000..1747ce8
--- /dev/null
+++ b/radio/config/1.1/vts/functional/radio_config_hidl_hal_utils.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android-base/logging.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+
+#include <android/hardware/radio/config/1.1/IRadioConfig.h>
+#include <android/hardware/radio/config/1.1/IRadioConfigResponse.h>
+#include <android/hardware/radio/config/1.1/types.h>
+
+#include "vts_test_util.h"
+
+using namespace ::android::hardware::radio::config::V1_1;
+
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::radio::config::V1_0::SimSlotStatus;
+using ::android::hardware::radio::V1_0::RadioResponseInfo;
+using ::android::hardware::radio::V1_0::RadioResponseType;
+
+#define TIMEOUT_PERIOD 75
+#define RADIO_SERVICE_NAME "slot1"
+
+class RadioConfigHidlTest;
+
+/* Callback class for radio config response */
+class RadioConfigResponse : public IRadioConfigResponse {
+ protected:
+ RadioConfigHidlTest& parent;
+
+ public:
+ RadioResponseInfo rspInfo;
+
+ RadioConfigResponse(RadioConfigHidlTest& parent);
+ virtual ~RadioConfigResponse() = default;
+
+ Return<void> getSimSlotsStatusResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<SimSlotStatus>& slotStatus);
+
+ Return<void> setSimSlotsMappingResponse(const RadioResponseInfo& info);
+
+ Return<void> getPhoneCapabilityResponse(const RadioResponseInfo& info,
+ const PhoneCapability& phoneCapability);
+
+ Return<void> setPreferredDataModemResponse(const RadioResponseInfo& info);
+
+ Return<void> getModemsConfigResponse(const RadioResponseInfo& info,
+ const ModemsConfig& mConfig);
+
+ Return<void> setModemsConfigResponse(const RadioResponseInfo& info);
+};
+
+// Test environment for Radio HIDL HAL.
+class RadioConfigHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static RadioConfigHidlEnvironment* Instance() {
+ static RadioConfigHidlEnvironment* instance = new RadioConfigHidlEnvironment;
+ return instance;
+ }
+ virtual void registerTestServices() override { registerTestService<IRadioConfig>(); }
+
+ private:
+ RadioConfigHidlEnvironment() {}
+};
+
+// The main test class for Radio config HIDL.
+class RadioConfigHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ protected:
+ std::mutex mtx_;
+ std::condition_variable cv_;
+ int count_;
+
+ public:
+ virtual void SetUp() override;
+
+ /* Used as a mechanism to inform the test about data/event callback */
+ void notify(int receivedSerial);
+
+ /* Test code calls this function to wait for response */
+ std::cv_status wait();
+
+ void updateSimCardStatus();
+
+ /* Serial number for radio request */
+ int serial;
+
+ /* radio config service handle */
+ sp<IRadioConfig> radioConfig;
+
+ /* radio config response handle */
+ sp<RadioConfigResponse> radioConfigRsp;
+};
diff --git a/radio/config/1.1/vts/functional/radio_config_response.cpp b/radio/config/1.1/vts/functional/radio_config_response.cpp
new file mode 100644
index 0000000..8c9e4d7
--- /dev/null
+++ b/radio/config/1.1/vts/functional/radio_config_response.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <radio_config_hidl_hal_utils.h>
+
+// SimSlotStatus slotStatus;
+
+RadioConfigResponse::RadioConfigResponse(RadioConfigHidlTest& parent) : parent(parent) {}
+
+Return<void> RadioConfigResponse::getSimSlotsStatusResponse(
+ const RadioResponseInfo& /* info */,
+ const ::android::hardware::hidl_vec<SimSlotStatus>& /* slotStatus */) {
+ return Void();
+}
+
+Return<void> RadioConfigResponse::setSimSlotsMappingResponse(const RadioResponseInfo& /* info */) {
+ return Void();
+}
+
+Return<void> RadioConfigResponse::getPhoneCapabilityResponse(
+ const RadioResponseInfo& /* info */, const PhoneCapability& /* phoneCapability */) {
+ return Void();
+}
+
+Return<void> RadioConfigResponse::setPreferredDataModemResponse(
+ const RadioResponseInfo& /* info */) {
+ return Void();
+}
+
+Return<void> RadioConfigResponse::getModemsConfigResponse(const RadioResponseInfo& /* info */,
+ const ModemsConfig& /* mConfig */) {
+ return Void();
+}
+
+Return<void> RadioConfigResponse::setModemsConfigResponse(const RadioResponseInfo& /* info */) {
+ return Void();
+}
\ No newline at end of file
diff --git a/sensors/2.0/ISensors.hal b/sensors/2.0/ISensors.hal
index 1685a0a..3a9af46 100644
--- a/sensors/2.0/ISensors.hal
+++ b/sensors/2.0/ISensors.hal
@@ -95,11 +95,15 @@
* The Wake Lock FMQ is used by the framework to notify the HAL when it is
* safe to release its wake_lock. When the framework receives WAKE_UP events
* from the Event FMQ and the framework has acquired a wake_lock, the
- * framework must write a WakeLockEvent to the Wake Lock FMQ with the number
- * of WAKE_UP events processed. When the HAL reads the WakeLockEvent from
- * the Wake Lock FMQ, the HAL should decrement its current count of
- * unprocessed WAKE_UP events and release its wake_lock if the current
- * count of unprocessed WAKE_UP events is zero.
+ * framework must write the number of WAKE_UP events processed to the Wake
+ * Lock FMQ. When the HAL reads the data from the Wake Lock FMQ, the HAL
+ * decrements its current count of unprocessed WAKE_UP events and releases
+ * its wake_lock if the current count of unprocessed WAKE_UP events is
+ * zero.
+ *
+ * The framework must use the WakeLockQueueFlagBits::DATA_WRITTEN value to
+ * notify the HAL that data has been written to the Wake Lock FMQ and must
+ * be read by HAL.
*
* The ISensorsCallback is used by the HAL to notify the framework of
* asynchronous events, such as a dynamic sensor connection.
diff --git a/sensors/2.0/default/Android.bp b/sensors/2.0/default/Android.bp
index db0b148..d83a9c3 100644
--- a/sensors/2.0/default/Android.bp
+++ b/sensors/2.0/default/Android.bp
@@ -35,4 +35,5 @@
"libpower",
"libutils",
],
+ vintf_fragments: ["android.hardware.sensors@2.0.xml"],
}
diff --git a/sensors/2.0/default/Sensors.cpp b/sensors/2.0/default/Sensors.cpp
index efc8b05..15fe86f 100644
--- a/sensors/2.0/default/Sensors.cpp
+++ b/sensors/2.0/default/Sensors.cpp
@@ -31,6 +31,7 @@
using ::android::hardware::sensors::V1_0::Result;
using ::android::hardware::sensors::V1_0::SharedMemInfo;
using ::android::hardware::sensors::V2_0::SensorTimeout;
+using ::android::hardware::sensors::V2_0::WakeLockQueueFlagBits;
constexpr const char* kWakeLockName = "SensorsHAL_WAKEUP";
@@ -86,6 +87,17 @@
const sp<ISensorsCallback>& sensorsCallback) {
Result result = Result::OK;
+ // Ensure that all sensors are disabled
+ for (auto sensor : mSensors) {
+ sensor.second->activate(false /* enable */);
+ }
+
+ // Stop the Wake Lock thread if it is currently running
+ if (mReadWakeLockQueueRun.load()) {
+ mReadWakeLockQueueRun = false;
+ mWakeLockThread.join();
+ }
+
// Save a reference to the callback
mCallback = sensorsCallback;
@@ -215,7 +227,9 @@
// Read events from the Wake Lock FMQ. Timeout after a reasonable amount of time to ensure
// that any held wake lock is able to be released if it is held for too long.
- mWakeLockQueue->readBlocking(&eventsHandled, 1 /* count */, kReadTimeoutNs);
+ mWakeLockQueue->readBlocking(&eventsHandled, 1 /* count */, 0 /* readNotification */,
+ static_cast<uint32_t>(WakeLockQueueFlagBits::DATA_WRITTEN),
+ kReadTimeoutNs);
updateWakeLock(0 /* eventsWritten */, eventsHandled);
}
}
diff --git a/sensors/2.0/default/android.hardware.sensors@2.0.xml b/sensors/2.0/default/android.hardware.sensors@2.0.xml
new file mode 100644
index 0000000..1acc8e6
--- /dev/null
+++ b/sensors/2.0/default/android.hardware.sensors@2.0.xml
@@ -0,0 +1,11 @@
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>android.hardware.sensors</name>
+ <transport>hwbinder</transport>
+ <version>2.0</version>
+ <interface>
+ <name>ISensors</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+</manifest>
diff --git a/sensors/2.0/types.hal b/sensors/2.0/types.hal
index f9defa2..4457544 100644
--- a/sensors/2.0/types.hal
+++ b/sensors/2.0/types.hal
@@ -40,3 +40,11 @@
*/
EVENTS_READ = 1 << 1,
};
+
+enum WakeLockQueueFlagBits : uint32_t {
+ /**
+ * Used to notify the HAL that the framework has written data to the Wake
+ * Lock FMQ.
+ */
+ DATA_WRITTEN = 1 << 0,
+};
diff --git a/sensors/2.0/vts/functional/SensorsHidlEnvironmentV2_0.cpp b/sensors/2.0/vts/functional/SensorsHidlEnvironmentV2_0.cpp
index 37b7349..be7415b 100644
--- a/sensors/2.0/vts/functional/SensorsHidlEnvironmentV2_0.cpp
+++ b/sensors/2.0/vts/functional/SensorsHidlEnvironmentV2_0.cpp
@@ -24,10 +24,12 @@
using ::android::hardware::EventFlag;
using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
using ::android::hardware::sensors::V1_0::Result;
using ::android::hardware::sensors::V1_0::SensorInfo;
using ::android::hardware::sensors::V2_0::EventQueueFlagBits;
using ::android::hardware::sensors::V2_0::ISensors;
+using ::android::hardware::sensors::V2_0::ISensorsCallback;
template <typename EnumType>
constexpr typename std::underlying_type<EnumType>::type asBaseType(EnumType value) {
@@ -36,6 +38,16 @@
constexpr size_t SensorsHidlEnvironmentV2_0::MAX_RECEIVE_BUFFER_EVENT_COUNT;
+struct SensorsCallback : ISensorsCallback {
+ Return<void> onDynamicSensorsConnected(const hidl_vec<SensorInfo>& /* sensorInfos */) {
+ return Return<void>();
+ }
+
+ Return<void> onDynamicSensorsDisconnected(const hidl_vec<int32_t>& /* sensorHandles */) {
+ return Return<void>();
+ }
+};
+
bool SensorsHidlEnvironmentV2_0::resetHal() {
bool succeed = false;
do {
@@ -63,7 +75,7 @@
}
mSensors->initialize(*mEventQueue->getDesc(), *mWakeLockQueue->getDesc(),
- nullptr /* TODO: callback */);
+ new SensorsCallback());
std::vector<SensorInfo> sensorList;
if (!mSensors->getSensorsList([&](const hidl_vec<SensorInfo>& list) { sensorList = list; })
diff --git a/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp b/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp
index ac020ad..4a1f8f1 100644
--- a/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp
+++ b/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp
@@ -41,6 +41,8 @@
using ::android::hardware::sensors::V1_0::SharedMemType;
using ::android::hardware::sensors::V1_0::Vec3;
+constexpr size_t kEventSize = static_cast<size_t>(SensorsEventFormatOffset::TOTAL_LENGTH);
+
class EventCallback : public IEventCallback {
public:
void reset() {
@@ -170,6 +172,7 @@
std::vector<SensorInfo> getOneShotSensors();
std::vector<SensorInfo> getInjectEventSensors();
int32_t getInvalidSensorHandle();
+ bool getDirectChannelSensor(SensorInfo* sensor, SharedMemType* memType, RateLevel* rate);
void verifyDirectChannel(SharedMemType memType);
void verifyRegisterDirectChannel(const SensorInfo& sensor, SharedMemType memType,
std::shared_ptr<SensorsTestSharedMemory> mem,
@@ -632,6 +635,32 @@
activateAllSensors(false);
}
+TEST_F(SensorsHidlTest, CleanupConnectionsOnInitialize) {
+ activateAllSensors(true);
+
+ // Verify that events are received
+ constexpr useconds_t kCollectionTimeoutUs = 1000 * 1000; // 1s
+ constexpr int32_t kNumEvents = 1;
+ ASSERT_GE(collectEvents(kCollectionTimeoutUs, kNumEvents, getEnvironment()).size(), kNumEvents);
+
+ // Clear the active sensor handles so they are not disabled during TearDown
+ auto handles = mSensorHandles;
+ mSensorHandles.clear();
+ getEnvironment()->TearDown();
+ getEnvironment()->SetUp();
+
+ // Verify no events are received until sensors are re-activated
+ ASSERT_EQ(collectEvents(kCollectionTimeoutUs, kNumEvents, getEnvironment()).size(), 0);
+ activateAllSensors(true);
+ ASSERT_GE(collectEvents(kCollectionTimeoutUs, kNumEvents, getEnvironment()).size(), kNumEvents);
+
+ // Disable sensors
+ activateAllSensors(false);
+
+ // Restore active sensors prior to clearing the environment
+ mSensorHandles = handles;
+}
+
void SensorsHidlTest::runSingleFlushTest(const std::vector<SensorInfo>& sensors,
bool activateSensor, int32_t expectedFlushCount,
Result expectedResponse) {
@@ -893,7 +922,6 @@
}
void SensorsHidlTest::verifyDirectChannel(SharedMemType memType) {
- constexpr size_t kEventSize = static_cast<size_t>(SensorsEventFormatOffset::TOTAL_LENGTH);
constexpr size_t kNumEvents = 1;
constexpr size_t kMemSize = kNumEvents * kEventSize;
@@ -917,30 +945,96 @@
verifyDirectChannel(SharedMemType::GRALLOC);
}
-TEST_F(SensorsHidlTest, ConfigureDirectChannelWithInvalidHandle) {
- for (const SensorInfo& sensor : getSensorsList()) {
- if (isDirectChannelTypeSupported(sensor, SharedMemType::ASHMEM) ||
- isDirectChannelTypeSupported(sensor, SharedMemType::GRALLOC)) {
- // Find a supported rate level
- RateLevel rate = RateLevel::STOP;
- if (isDirectReportRateSupported(sensor, RateLevel::NORMAL)) {
- rate = RateLevel::NORMAL;
- } else if (isDirectReportRateSupported(sensor, RateLevel::FAST)) {
- rate = RateLevel::FAST;
- } else if (isDirectReportRateSupported(sensor, RateLevel::VERY_FAST)) {
- rate = RateLevel::VERY_FAST;
- }
-
- // Ensure that at least one rate level is supported
- ASSERT_NE(rate, RateLevel::STOP);
-
- // Verify that an invalid channel handle produces a BAD_VALUE result
- configDirectReport(sensor.sensorHandle, -1, rate,
- [](Result result, int32_t /* reportToken */) {
- ASSERT_EQ(result, Result::BAD_VALUE);
- });
+bool SensorsHidlTest::getDirectChannelSensor(SensorInfo* sensor, SharedMemType* memType,
+ RateLevel* rate) {
+ bool found = false;
+ for (const SensorInfo& curSensor : getSensorsList()) {
+ if (isDirectChannelTypeSupported(curSensor, SharedMemType::ASHMEM)) {
+ *memType = SharedMemType::ASHMEM;
+ *sensor = curSensor;
+ found = true;
+ break;
+ } else if (isDirectChannelTypeSupported(curSensor, SharedMemType::GRALLOC)) {
+ *memType = SharedMemType::GRALLOC;
+ *sensor = curSensor;
+ found = true;
+ break;
}
}
+
+ if (found) {
+ // Find a supported rate level
+ constexpr int kNumRateLevels = 3;
+ RateLevel rates[kNumRateLevels] = {RateLevel::NORMAL, RateLevel::FAST,
+ RateLevel::VERY_FAST};
+ *rate = RateLevel::STOP;
+ for (int i = 0; i < kNumRateLevels; i++) {
+ if (isDirectReportRateSupported(*sensor, rates[i])) {
+ *rate = rates[i];
+ }
+ }
+
+ // At least one rate level must be supported
+ EXPECT_NE(*rate, RateLevel::STOP);
+ }
+ return found;
+}
+
+TEST_F(SensorsHidlTest, ConfigureDirectChannelWithInvalidHandle) {
+ SensorInfo sensor;
+ SharedMemType memType;
+ RateLevel rate;
+ if (!getDirectChannelSensor(&sensor, &memType, &rate)) {
+ return;
+ }
+
+ // Verify that an invalid channel handle produces a BAD_VALUE result
+ configDirectReport(sensor.sensorHandle, -1, rate, [](Result result, int32_t /* reportToken */) {
+ ASSERT_EQ(result, Result::BAD_VALUE);
+ });
+}
+
+TEST_F(SensorsHidlTest, CleanupDirectConnectionOnInitialize) {
+ constexpr size_t kNumEvents = 1;
+ constexpr size_t kMemSize = kNumEvents * kEventSize;
+
+ SensorInfo sensor;
+ SharedMemType memType;
+ RateLevel rate;
+
+ if (!getDirectChannelSensor(&sensor, &memType, &rate)) {
+ return;
+ }
+
+ std::shared_ptr<SensorsTestSharedMemory> mem(
+ SensorsTestSharedMemory::create(memType, kMemSize));
+ ASSERT_NE(mem, nullptr);
+
+ int32_t directChannelHandle = 0;
+ registerDirectChannel(mem->getSharedMemInfo(), [&](Result result, int32_t channelHandle) {
+ ASSERT_EQ(result, Result::OK);
+ directChannelHandle = channelHandle;
+ });
+
+ // Configure the channel and expect success
+ configDirectReport(
+ sensor.sensorHandle, directChannelHandle, rate,
+ [](Result result, int32_t /* reportToken */) { ASSERT_EQ(result, Result::OK); });
+
+ // Call initialize() via the environment setup to cause the HAL to re-initialize
+ // Clear the active direct connections so they are not stopped during TearDown
+ auto handles = mDirectChannelHandles;
+ mDirectChannelHandles.clear();
+ getEnvironment()->TearDown();
+ getEnvironment()->SetUp();
+
+ // Attempt to configure the direct channel and expect it to fail
+ configDirectReport(
+ sensor.sensorHandle, directChannelHandle, rate,
+ [](Result result, int32_t /* reportToken */) { ASSERT_EQ(result, Result::BAD_VALUE); });
+
+ // Restore original handles, though they should already be deactivated
+ mDirectChannelHandles = handles;
}
int main(int argc, char** argv) {
diff --git a/soundtrigger/2.2/default/SoundTriggerHw.cpp b/soundtrigger/2.2/default/SoundTriggerHw.cpp
index 3cf72c8..4586544 100644
--- a/soundtrigger/2.2/default/SoundTriggerHw.cpp
+++ b/soundtrigger/2.2/default/SoundTriggerHw.cpp
@@ -704,6 +704,11 @@
}
}
+ if (mHwDevice->common.version < SOUND_TRIGGER_DEVICE_API_VERSION_1_2) {
+ ALOGE("Get model state not supported");
+ return -ENODEV;
+ }
+
if (mHwDevice->get_model_state == NULL) {
ALOGE("Failed to get model state from device, no such method");
return -ENODEV;
diff --git a/thermal/2.0/default/Android.bp b/thermal/2.0/default/Android.bp
index f620e6e..dab0d33 100644
--- a/thermal/2.0/default/Android.bp
+++ b/thermal/2.0/default/Android.bp
@@ -14,7 +14,7 @@
// limitations under the License.
cc_binary {
- name: "android.hardware.thermal@2.0-service",
+ name: "android.hardware.thermal@2.0-service.mock",
defaults: ["hidl_defaults"],
relative_install_path: "hw",
vendor: true,
diff --git a/thermal/2.0/default/android.hardware.thermal@2.0-service.rc b/thermal/2.0/default/android.hardware.thermal@2.0-service.rc
index de49d20..046c771 100644
--- a/thermal/2.0/default/android.hardware.thermal@2.0-service.rc
+++ b/thermal/2.0/default/android.hardware.thermal@2.0-service.rc
@@ -1,4 +1,4 @@
-service vendor.thermal-hal-2-0-mock /vendor/bin/hw/android.hardware.thermal@2.0-service
+service vendor.thermal-hal-2-0-mock /vendor/bin/hw/android.hardware.thermal@2.0-service.mock
interface android.hardware.thermal@2.0::IThermal default
class hal
user system
diff --git a/tv/cec/1.0/types.hal b/tv/cec/1.0/types.hal
index c734c4d..ebe65ae 100644
--- a/tv/cec/1.0/types.hal
+++ b/tv/cec/1.0/types.hal
@@ -114,6 +114,8 @@
VENDOR_COMMAND_WITH_ID = 0xA0,
CLEAR_EXTERNAL_TIMER = 0xA1,
SET_EXTERNAL_TIMER = 0xA2,
+ REPORT_SHORT_AUDIO_DESCRIPTOR = 0xA3,
+ REQUEST_SHORT_AUDIO_DESCRIPTOR = 0xA4,
INITIATE_ARC = 0xC0,
REPORT_ARC_INITIATED = 0xC1,
REPORT_ARC_TERMINATED = 0xC2,
diff --git a/tv/cec/2.0/Android.bp b/tv/cec/2.0/Android.bp
new file mode 100644
index 0000000..998cb23
--- /dev/null
+++ b/tv/cec/2.0/Android.bp
@@ -0,0 +1,46 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.tv.cec@2.0",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "types.hal",
+ "IHdmiCec.hal",
+ "IHdmiCecCallback.hal",
+ ],
+ interfaces: [
+ "android.hidl.base@1.0",
+ "android.hidl.safe_union@1.0",
+ ],
+ types: [
+ "AbortReason",
+ "CecAllDeviceTypeValue",
+ "CecDeviceFeature",
+ "CecDeviceInfo",
+ "CecDeviceType",
+ "CecLogicalAddress",
+ "CecMessage",
+ "CecMessageType",
+ "CecPowerState",
+ "CecRcProfile",
+ "CecRcProfile1",
+ "CecRcProfileId",
+ "CecRcProfileSource",
+ "CecTopologyEvent",
+ "CecTopologyEventType",
+ "CecUICommandCodes",
+ "CecVersion",
+ "HdmiPortInfo",
+ "HdmiPortType",
+ "HotplugEvent",
+ "MaxLength",
+ "OptionKey",
+ "Result",
+ "SendMessageResult",
+ ],
+ gen_java: true,
+}
+
diff --git a/tv/cec/2.0/IHdmiCec.hal b/tv/cec/2.0/IHdmiCec.hal
new file mode 100644
index 0000000..0723bad
--- /dev/null
+++ b/tv/cec/2.0/IHdmiCec.hal
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.tv.cec@2.0;
+
+import IHdmiCecCallback;
+
+/**
+ * HDMI-CEC HAL interface definition.
+ */
+interface IHdmiCec {
+ /**
+ * Passes Primary Device Type that must be used in this system.
+ *
+ * HAL must use it to allocate logical address as specified in CEC section
+ * 11.3.2 of the CEC spec 2.0b. Then CEC commands addressed the given
+ * logical address can be filtered in.
+ * This method shall be able to be called up to twice to support two Primary
+ * Device Type as specified in CEC Table 11-8 of the CEC spec 2.0b.
+ *
+ * @param deviceType that must be used in this system. It must be a valid
+ * value in CecDeviceType for the call to succeed.
+ * @return result Result status of the operation. SUCCESS if successful,
+ * FAILURE_INVALID_ARGS if the given device type is invalid,
+ * FAILURE_BUSY if device or resource is busy
+ */
+ @callflow(next={"*"})
+ addDeviceType(CecDeviceType deviceType) generates (Result result);
+
+ /**
+ * Clears all Primary Device Types.
+ *
+ * It is used when the system plan to reconfigure Primary Device Type,
+ * hence to tell HAL to release all logical address associated to them,
+ * and change the state back to the beginning.
+ */
+ @callflow(next="addDeviceType")
+ @exit
+ clearDeviceTypes();
+
+ /**
+ * Set All Device Types for a Primary Device Type.
+ *
+ * This value must be used in REPORT_FEATURES message to response
+ * GIVE_FEATURES message in HAL.
+ *
+ * @param allDeviceTypes device all device types for a Primary Device Type.
+ */
+ @callflow(next="addDeviceType")
+ setAllDeviceTypes(CecAllDeviceTypes allDeviceTypes);
+
+ /**
+ * Set Device Features for a Primary Device Type.
+ *
+ * This value must be used in REPORT_FEATURES message to response
+ * GIVE_FEATURES message in HAL.
+ *
+ * @param deviceType The device Primary Device Type.
+ * @param deviceFeatures device features for a Primary Device Type.
+ */
+ @callflow(next="addDeviceType")
+ setDeviceFeatures(CecDeviceType deviceType,
+ CecDeviceFeatures deviceFeatures);
+
+ /**
+ * Set Remote Control Profile for a Primary Device Type.
+ *
+ * This value must be used in REPORT_FEATURES message to response
+ * GIVE_FEATURES message in HAL.
+ *
+ * @param deviceType The device Primary Device Type.
+ * @param rcProliles remote control profiles for a Primary Device Type.
+ */
+ @callflow(next="addDeviceType")
+ setRcProfile(CecDeviceType deviceType, CecRcProfile rcProfile);
+
+ /**
+ * Retrieve CEC device information.
+ *
+ * CEC section 11.3 of the CEC spec 2.0b specify that a device should not
+ * ask for static information that another device has already supplied.
+ * Therefore, CEC 2.0 software stack need a map to store all cec
+ * devices’ information of current CEC network.
+ * The device information is broadcasted by a device after it allocates a
+ * logical address. Messages used to send out these information are
+ * REPORT_FEATURES, REPORT_PHYSICAL_ADDRESS, DEVICE_VENDOR_ID.
+ * The spec also requires less than 1 second between REPORT_FEATURES and
+ * REPORT_PHYSICAL_ADDRESS message, and less than 2 second between
+ * REPORT_PHYSICAL_ADDRESS and DEVICE_VENDOR_ID. An Implementation of
+ * device information map in hal can help to meet the timing constraints.
+ * Logical addressing is part of the process to build this map, so the
+ * implementation shall include allocating logical address too.
+ * Whenever a device plug/unplug, the topology of CEC network changes.
+ * The hal implementation shall update devices’ information map, and
+ * send out onTopologyEvent to Android system. Then Android system
+ * will use readDeviceInfo to retreive latest devices’ information of CEC
+ * network.
+ * If SYSTEM_CEC_CONTROL is false, the hal implementation need continue to
+ * maintain and update device information map, and send out pending
+ * onTopologyEvent to Android system when SYSTEM_CEC_CONTROL is
+ * changed to true.
+ *
+ * @param logicalAddress logical address of CEC device.
+ * @param physicalAddress physical address of CEC device.
+ * @return CecDeviceInfo from device information map.
+ * @return result Result status of the operation. SUCCESS if successful,
+ * FAILURE_INVALID_ARGS if logical or physical address is invalid.
+ * FAILURE_INVALID_STATE if device information isn't available yet.
+ */
+ @callflow(next="onTopologyChangeEvent")
+ readDeviceInfo(CecLogicalAddress logicalAddress,
+ CecPhysicalAddress physicalAddress)
+ generates (Result result, CecDeviceInfo deviceInfo);
+
+ /**
+ * Transmits HDMI-CEC message to other HDMI device.
+ *
+ * The method must be designed to return in a certain amount of time and not
+ * hanging forever. This method MUST complete with in 1 second.
+ *
+ * It must try retransmission at least once as specified in the section '7.1
+ * Frame Re-transmissions' of the CEC Spec 1.4b.
+ *
+ * @param message CEC message to be sent to other HDMI device.
+ * @return result Result status of the operation. SUCCESS if successful,
+ * NACK if the sent message is not acknowledged,
+ * BUSY if the CEC bus is busy.
+ */
+ @callflow(next="*")
+ sendMessage(CecMessage message) generates (SendMessageResult result);
+
+ /**
+ * Set the callback
+ *
+ * It is used by the framework to receive CecMessages, HDMI hotplug event
+ * and topology update event. Only one callback client is supported.
+ *
+ * @param callback Callback object to pass hdmi events to the system. The
+ * previously registered callback must be replaced with this one.
+ */
+ @callflow(next={"*"})
+ @entry
+ setCallback(IHdmiCecCallback callback);
+
+ /**
+ * Gets the hdmi port information of underlying hardware.
+ *
+ * @return infos The list of HDMI port information
+ */
+ @callflow(next={"*"})
+ getPortInfo() generates (vec<HdmiPortInfo> infos);
+
+ /**
+ * Sets flags controlling the way HDMI-CEC service works down to HAL
+ * implementation. Those flags must be used in case the feature needs update
+ * in HAL itself, firmware or microcontroller.
+ *
+ * @param key The key of the option to be updated with a new value.
+ * @param value Value to be set.
+ */
+ @callflow(next="*")
+ setOption(OptionKey key, bool value);
+
+ /**
+ * Passes the updated language information of Android system. Contains
+ * three-letter code as defined in ISO/FDIS 639-2. Must be used for HAL to
+ * respond to <Get Menu Language> while in standby mode.
+ *
+ * @param language Three-letter code defined in ISO/FDIS 639-2. Must be
+ * lowercase letters. (e.g., eng for English)
+ */
+ @callflow(next="*")
+ setLanguage(string language);
+
+ /**
+ * Configures ARC circuit in the hardware logic to start or stop the
+ * feature.
+ *
+ * @param portId Port id to be configured.
+ * @param enable Flag must be either true to start the feature or false to
+ * stop it.
+ */
+ @callflow(next="*")
+ enableAudioReturnChannel(HdmiPortId portId, bool enable);
+
+ /**
+ * Gets the connection status of the specified port.
+ *
+ * It's specified in CEC section 10.8 of the CEC spec 2.0b
+ *
+ * @param portId Port id to be inspected for the connection status.
+ * @return status True if a device is connected, otherwise false.
+ */
+ @callflow(next="*")
+ isConnected(HdmiPortId portId) generates (bool connected);
+};
diff --git a/tv/cec/2.0/IHdmiCecCallback.hal b/tv/cec/2.0/IHdmiCecCallback.hal
new file mode 100644
index 0000000..1a8a489
--- /dev/null
+++ b/tv/cec/2.0/IHdmiCecCallback.hal
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.tv.cec@2.0;
+
+interface IHdmiCecCallback {
+ /**
+ * The callback function that must be called by HAL implementation to notify
+ * the system of new CEC message arrival.
+ */
+ oneway onCecMessage(CecMessage message);
+
+ /**
+ * The callback function that must be called by HAL implementation to notify
+ * the system of new hotplug event.
+ */
+ oneway onHotplugEvent(HotplugEvent event);
+
+ /**
+ * The callback function must be called by HAL implementation to notify the
+ * system whenever CEC device information of CEC network change.
+ * HAL shall be ready for readDeviceInfo call before invoke this callback.
+ * This event is triggered by topology change of whole CEC network. It's
+ * different from HotplugEvent which is triggered between devices which are
+ * connected directly through HDMI cable.
+ */
+ oneway onTopologyEvent(CecTopologyEvent event);
+};
diff --git a/tv/cec/2.0/default/Android.bp b/tv/cec/2.0/default/Android.bp
new file mode 100644
index 0000000..6e624e3
--- /dev/null
+++ b/tv/cec/2.0/default/Android.bp
@@ -0,0 +1,42 @@
+cc_library_shared {
+ name: "android.hardware.tv.cec@2.0-impl",
+ defaults: ["hidl_defaults"],
+ vendor: true,
+ relative_install_path: "hw",
+ srcs: ["HdmiCec.cpp"],
+
+ shared_libs: [
+ "libhidlbase",
+ "libhidltransport",
+ "liblog",
+ "libbase",
+ "libutils",
+ "libhardware",
+ "android.hardware.tv.cec@2.0",
+ ],
+
+}
+
+cc_binary {
+ name: "android.hardware.tv.cec@2.0-service",
+ vintf_fragments: ["android.hardware.tv.cec@2.0-service.xml"],
+ defaults: ["hidl_defaults"],
+ relative_install_path: "hw",
+ vendor: true,
+ init_rc: ["android.hardware.tv.cec@2.0-service.rc"],
+ srcs: ["service.cpp"],
+
+ shared_libs: [
+ "liblog",
+ "libcutils",
+ "libdl",
+ "libbase",
+ "libutils",
+ "libhardware_legacy",
+ "libhardware",
+ "libhidlbase",
+ "libhidltransport",
+ "android.hardware.tv.cec@2.0",
+ ],
+
+}
diff --git a/tv/cec/2.0/default/HdmiCec.cpp b/tv/cec/2.0/default/HdmiCec.cpp
new file mode 100644
index 0000000..f451719
--- /dev/null
+++ b/tv/cec/2.0/default/HdmiCec.cpp
@@ -0,0 +1,421 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "android.hardware.tv.cec@2.0-impl"
+#include <android-base/logging.h>
+
+#include <hardware/hardware.h>
+#include <hardware/hdmi_cec.h>
+#include "HdmiCec.h"
+
+namespace android {
+namespace hardware {
+namespace tv {
+namespace cec {
+namespace V2_0 {
+namespace implementation {
+
+static_assert(CEC_DEVICE_INACTIVE == static_cast<int>(CecDeviceType::INACTIVE),
+ "CecDeviceType::INACTIVE must match legacy value.");
+static_assert(CEC_DEVICE_TV == static_cast<int>(CecDeviceType::TV),
+ "CecDeviceType::TV must match legacy value.");
+static_assert(CEC_DEVICE_RECORDER == static_cast<int>(CecDeviceType::RECORDER),
+ "CecDeviceType::RECORDER must match legacy value.");
+static_assert(CEC_DEVICE_TUNER == static_cast<int>(CecDeviceType::TUNER),
+ "CecDeviceType::TUNER must match legacy value.");
+static_assert(CEC_DEVICE_PLAYBACK == static_cast<int>(CecDeviceType::PLAYBACK),
+ "CecDeviceType::PLAYBACK must match legacy value.");
+static_assert(CEC_DEVICE_AUDIO_SYSTEM == static_cast<int>(CecDeviceType::AUDIO_SYSTEM),
+ "CecDeviceType::AUDIO_SYSTEM must match legacy value.");
+/* TODO: Adjust for cec@2.0
+static_assert(CEC_DEVICE_MAX == static_cast<int>(CecDeviceType::MAX),
+ "CecDeviceType::MAX must match legacy value.");
+*/
+static_assert(CEC_ADDR_TV == static_cast<int>(CecLogicalAddress::TV),
+ "CecLogicalAddress::TV must match legacy value.");
+static_assert(CEC_ADDR_RECORDER_1 == static_cast<int>(CecLogicalAddress::RECORDER_1),
+ "CecLogicalAddress::RECORDER_1 must match legacy value.");
+static_assert(CEC_ADDR_RECORDER_2 == static_cast<int>(CecLogicalAddress::RECORDER_2),
+ "CecLogicalAddress::RECORDER_2 must match legacy value.");
+static_assert(CEC_ADDR_TUNER_1 == static_cast<int>(CecLogicalAddress::TUNER_1),
+ "CecLogicalAddress::TUNER_1 must match legacy value.");
+static_assert(CEC_ADDR_PLAYBACK_1 == static_cast<int>(CecLogicalAddress::PLAYBACK_1),
+ "CecLogicalAddress::PLAYBACK_1 must match legacy value.");
+static_assert(CEC_ADDR_AUDIO_SYSTEM == static_cast<int>(CecLogicalAddress::AUDIO_SYSTEM),
+ "CecLogicalAddress::AUDIO_SYSTEM must match legacy value.");
+static_assert(CEC_ADDR_TUNER_2 == static_cast<int>(CecLogicalAddress::TUNER_2),
+ "CecLogicalAddress::TUNER_2 must match legacy value.");
+static_assert(CEC_ADDR_TUNER_3 == static_cast<int>(CecLogicalAddress::TUNER_3),
+ "CecLogicalAddress::TUNER_3 must match legacy value.");
+static_assert(CEC_ADDR_PLAYBACK_2 == static_cast<int>(CecLogicalAddress::PLAYBACK_2),
+ "CecLogicalAddress::PLAYBACK_2 must match legacy value.");
+static_assert(CEC_ADDR_RECORDER_3 == static_cast<int>(CecLogicalAddress::RECORDER_3),
+ "CecLogicalAddress::RECORDER_3 must match legacy value.");
+static_assert(CEC_ADDR_TUNER_4 == static_cast<int>(CecLogicalAddress::TUNER_4),
+ "CecLogicalAddress::TUNER_4 must match legacy value.");
+static_assert(CEC_ADDR_PLAYBACK_3 == static_cast<int>(CecLogicalAddress::PLAYBACK_3),
+ "CecLogicalAddress::PLAYBACK_3 must match legacy value.");
+/* TODO: Adjust for cec@2.0
+static_assert(CEC_ADDR_FREE_USE == static_cast<int>(CecLogicalAddress::FREE_USE),
+ "CecLogicalAddress::FREE_USE must match legacy value.");
+*/
+static_assert(CEC_ADDR_UNREGISTERED == static_cast<int>(CecLogicalAddress::UNREGISTERED),
+ "CecLogicalAddress::UNREGISTERED must match legacy value.");
+static_assert(CEC_ADDR_BROADCAST == static_cast<int>(CecLogicalAddress::BROADCAST),
+ "CecLogicalAddress::BROADCAST must match legacy value.");
+
+static_assert(CEC_MESSAGE_FEATURE_ABORT == static_cast<int>(CecMessageType::FEATURE_ABORT),
+ "CecMessageType::FEATURE_ABORT must match legacy value.");
+static_assert(CEC_MESSAGE_IMAGE_VIEW_ON == static_cast<int>(CecMessageType::IMAGE_VIEW_ON),
+ "CecMessageType::IMAGE_VIEW_ON must match legacy value.");
+static_assert(CEC_MESSAGE_TUNER_STEP_INCREMENT ==
+ static_cast<int>(CecMessageType::TUNER_STEP_INCREMENT),
+ "CecMessageType::TUNER_STEP_INCREMENT must match legacy value.");
+static_assert(CEC_MESSAGE_TUNER_STEP_DECREMENT ==
+ static_cast<int>(CecMessageType::TUNER_STEP_DECREMENT),
+ "CecMessageType::TUNER_STEP_DECREMENT must match legacy value.");
+static_assert(CEC_MESSAGE_TUNER_DEVICE_STATUS ==
+ static_cast<int>(CecMessageType::TUNER_DEVICE_STATUS),
+ "CecMessageType::TUNER_DEVICE_STATUS must match legacy value.");
+static_assert(CEC_MESSAGE_GIVE_TUNER_DEVICE_STATUS ==
+ static_cast<int>(CecMessageType::GIVE_TUNER_DEVICE_STATUS),
+ "CecMessageType::GIVE_TUNER_DEVICE_STATUS must match legacy value.");
+static_assert(CEC_MESSAGE_RECORD_ON == static_cast<int>(CecMessageType::RECORD_ON),
+ "CecMessageType::RECORD_ON must match legacy value.");
+static_assert(CEC_MESSAGE_RECORD_STATUS == static_cast<int>(CecMessageType::RECORD_STATUS),
+ "CecMessageType::RECORD_STATUS must match legacy value.");
+static_assert(CEC_MESSAGE_RECORD_OFF == static_cast<int>(CecMessageType::RECORD_OFF),
+ "CecMessageType::RECORD_OFF must match legacy value.");
+static_assert(CEC_MESSAGE_TEXT_VIEW_ON == static_cast<int>(CecMessageType::TEXT_VIEW_ON),
+ "CecMessageType::TEXT_VIEW_ON must match legacy value.");
+static_assert(CEC_MESSAGE_RECORD_TV_SCREEN == static_cast<int>(CecMessageType::RECORD_TV_SCREEN),
+ "CecMessageType::RECORD_TV_SCREEN must match legacy value.");
+static_assert(CEC_MESSAGE_GIVE_DECK_STATUS == static_cast<int>(CecMessageType::GIVE_DECK_STATUS),
+ "CecMessageType::GIVE_DECK_STATUS must match legacy value.");
+static_assert(CEC_MESSAGE_STANDBY == static_cast<int>(CecMessageType::STANDBY),
+ "CecMessageType::STANDBY must match legacy value.");
+static_assert(CEC_MESSAGE_PLAY == static_cast<int>(CecMessageType::PLAY),
+ "CecMessageType::PLAY must match legacy value.");
+static_assert(CEC_MESSAGE_DECK_CONTROL == static_cast<int>(CecMessageType::DECK_CONTROL),
+ "CecMessageType::DECK_CONTROL must match legacy value.");
+static_assert(CEC_MESSAGE_TIMER_CLEARED_STATUS ==
+ static_cast<int>(CecMessageType::TIMER_CLEARED_STATUS),
+ "CecMessageType::TIMER_CLEARED_STATUS must match legacy value.");
+static_assert(CEC_MESSAGE_USER_CONTROL_PRESSED ==
+ static_cast<int>(CecMessageType::USER_CONTROL_PRESSED),
+ "CecMessageType::USER_CONTROL_PRESSED must match legacy value.");
+static_assert(CEC_MESSAGE_USER_CONTROL_RELEASED ==
+ static_cast<int>(CecMessageType::USER_CONTROL_RELEASED),
+ "CecMessageType::USER_CONTROL_RELEASED must match legacy value.");
+static_assert(CEC_MESSAGE_GIVE_OSD_NAME == static_cast<int>(CecMessageType::GIVE_OSD_NAME),
+ "CecMessageType::GIVE_OSD_NAME must match legacy value.");
+static_assert(CEC_MESSAGE_SET_OSD_NAME == static_cast<int>(CecMessageType::SET_OSD_NAME),
+ "CecMessageType::SET_OSD_NAME must match legacy value.");
+static_assert(CEC_MESSAGE_SYSTEM_AUDIO_MODE_REQUEST ==
+ static_cast<int>(CecMessageType::SYSTEM_AUDIO_MODE_REQUEST),
+ "CecMessageType::SYSTEM_AUDIO_MODE_REQUEST must match legacy value.");
+static_assert(CEC_MESSAGE_GIVE_AUDIO_STATUS == static_cast<int>(CecMessageType::GIVE_AUDIO_STATUS),
+ "CecMessageType::GIVE_AUDIO_STATUS must match legacy value.");
+static_assert(CEC_MESSAGE_SET_SYSTEM_AUDIO_MODE ==
+ static_cast<int>(CecMessageType::SET_SYSTEM_AUDIO_MODE),
+ "CecMessageType::SET_SYSTEM_AUDIO_MODE must match legacy value.");
+static_assert(CEC_MESSAGE_REPORT_AUDIO_STATUS ==
+ static_cast<int>(CecMessageType::REPORT_AUDIO_STATUS),
+ "CecMessageType::REPORT_AUDIO_STATUS must match legacy value.");
+static_assert(CEC_MESSAGE_GIVE_SYSTEM_AUDIO_MODE_STATUS ==
+ static_cast<int>(CecMessageType::GIVE_SYSTEM_AUDIO_MODE_STATUS),
+ "CecMessageType::GIVE_SYSTEM_AUDIO_MODE_STATUS must match legacy value.");
+static_assert(CEC_MESSAGE_SYSTEM_AUDIO_MODE_STATUS ==
+ static_cast<int>(CecMessageType::SYSTEM_AUDIO_MODE_STATUS),
+ "CecMessageType::SYSTEM_AUDIO_MODE_STATUS must match legacy value.");
+static_assert(CEC_MESSAGE_ROUTING_CHANGE == static_cast<int>(CecMessageType::ROUTING_CHANGE),
+ "CecMessageType::ROUTING_CHANGE must match legacy value.");
+static_assert(CEC_MESSAGE_ROUTING_INFORMATION ==
+ static_cast<int>(CecMessageType::ROUTING_INFORMATION),
+ "CecMessageType::ROUTING_INFORMATION must match legacy value.");
+static_assert(CEC_MESSAGE_ACTIVE_SOURCE == static_cast<int>(CecMessageType::ACTIVE_SOURCE),
+ "CecMessageType::ACTIVE_SOURCE must match legacy value.");
+static_assert(CEC_MESSAGE_GIVE_PHYSICAL_ADDRESS ==
+ static_cast<int>(CecMessageType::GIVE_PHYSICAL_ADDRESS),
+ "CecMessageType::GIVE_PHYSICAL_ADDRESS must match legacy value.");
+static_assert(CEC_MESSAGE_REPORT_PHYSICAL_ADDRESS ==
+ static_cast<int>(CecMessageType::REPORT_PHYSICAL_ADDRESS),
+ "CecMessageType::REPORT_PHYSICAL_ADDRESS must match legacy value.");
+static_assert(CEC_MESSAGE_REQUEST_ACTIVE_SOURCE ==
+ static_cast<int>(CecMessageType::REQUEST_ACTIVE_SOURCE),
+ "CecMessageType::REQUEST_ACTIVE_SOURCE must match legacy value.");
+static_assert(CEC_MESSAGE_SET_STREAM_PATH == static_cast<int>(CecMessageType::SET_STREAM_PATH),
+ "CecMessageType::SET_STREAM_PATH must match legacy value.");
+static_assert(CEC_MESSAGE_DEVICE_VENDOR_ID == static_cast<int>(CecMessageType::DEVICE_VENDOR_ID),
+ "CecMessageType::DEVICE_VENDOR_ID must match legacy value.");
+static_assert(CEC_MESSAGE_VENDOR_COMMAND == static_cast<int>(CecMessageType::VENDOR_COMMAND),
+ "CecMessageType::VENDOR_COMMAND must match legacy value.");
+static_assert(CEC_MESSAGE_VENDOR_REMOTE_BUTTON_DOWN ==
+ static_cast<int>(CecMessageType::VENDOR_REMOTE_BUTTON_DOWN),
+ "CecMessageType::VENDOR_REMOTE_BUTTON_DOWN must match legacy value.");
+static_assert(CEC_MESSAGE_VENDOR_REMOTE_BUTTON_UP ==
+ static_cast<int>(CecMessageType::VENDOR_REMOTE_BUTTON_UP),
+ "CecMessageType::VENDOR_REMOTE_BUTTON_UP must match legacy value.");
+static_assert(CEC_MESSAGE_GIVE_DEVICE_VENDOR_ID ==
+ static_cast<int>(CecMessageType::GIVE_DEVICE_VENDOR_ID),
+ "CecMessageType::GIVE_DEVICE_VENDOR_ID must match legacy value.");
+static_assert(CEC_MESSAGE_MENU_REQUEST == static_cast<int>(CecMessageType::MENU_REQUEST),
+ "CecMessageType::MENU_REQUEST must match legacy value.");
+static_assert(CEC_MESSAGE_MENU_STATUS == static_cast<int>(CecMessageType::MENU_STATUS),
+ "CecMessageType::MENU_STATUS must match legacy value.");
+static_assert(CEC_MESSAGE_GIVE_DEVICE_POWER_STATUS ==
+ static_cast<int>(CecMessageType::GIVE_DEVICE_POWER_STATUS),
+ "CecMessageType::GIVE_DEVICE_POWER_STATUS must match legacy value.");
+static_assert(CEC_MESSAGE_REPORT_POWER_STATUS ==
+ static_cast<int>(CecMessageType::REPORT_POWER_STATUS),
+ "CecMessageType::REPORT_POWER_STATUS must match legacy value.");
+static_assert(CEC_MESSAGE_GET_MENU_LANGUAGE == static_cast<int>(CecMessageType::GET_MENU_LANGUAGE),
+ "CecMessageType::GET_MENU_LANGUAGE must match legacy value.");
+static_assert(CEC_MESSAGE_SELECT_ANALOG_SERVICE ==
+ static_cast<int>(CecMessageType::SELECT_ANALOG_SERVICE),
+ "CecMessageType::SELECT_ANALOG_SERVICE must match legacy value.");
+static_assert(CEC_MESSAGE_SELECT_DIGITAL_SERVICE ==
+ static_cast<int>(CecMessageType::SELECT_DIGITAL_SERVICE),
+ "CecMessageType::SELECT_DIGITAL_SERVICE must match legacy value.");
+static_assert(CEC_MESSAGE_SET_DIGITAL_TIMER == static_cast<int>(CecMessageType::SET_DIGITAL_TIMER),
+ "CecMessageType::SET_DIGITAL_TIMER must match legacy value.");
+static_assert(CEC_MESSAGE_CLEAR_DIGITAL_TIMER ==
+ static_cast<int>(CecMessageType::CLEAR_DIGITAL_TIMER),
+ "CecMessageType::CLEAR_DIGITAL_TIMER must match legacy value.");
+static_assert(CEC_MESSAGE_SET_AUDIO_RATE == static_cast<int>(CecMessageType::SET_AUDIO_RATE),
+ "CecMessageType::SET_AUDIO_RATE must match legacy value.");
+static_assert(CEC_MESSAGE_INACTIVE_SOURCE == static_cast<int>(CecMessageType::INACTIVE_SOURCE),
+ "CecMessageType::INACTIVE_SOURCE must match legacy value.");
+static_assert(CEC_MESSAGE_CEC_VERSION == static_cast<int>(CecMessageType::CEC_VERSION),
+ "CecMessageType::CEC_VERSION must match legacy value.");
+static_assert(CEC_MESSAGE_GET_CEC_VERSION == static_cast<int>(CecMessageType::GET_CEC_VERSION),
+ "CecMessageType::GET_CEC_VERSION must match legacy value.");
+static_assert(CEC_MESSAGE_VENDOR_COMMAND_WITH_ID ==
+ static_cast<int>(CecMessageType::VENDOR_COMMAND_WITH_ID),
+ "CecMessageType::VENDOR_COMMAND_WITH_ID must match legacy value.");
+static_assert(CEC_MESSAGE_CLEAR_EXTERNAL_TIMER ==
+ static_cast<int>(CecMessageType::CLEAR_EXTERNAL_TIMER),
+ "CecMessageType::CLEAR_EXTERNAL_TIMER must match legacy value.");
+static_assert(CEC_MESSAGE_SET_EXTERNAL_TIMER ==
+ static_cast<int>(CecMessageType::SET_EXTERNAL_TIMER),
+ "CecMessageType::SET_EXTERNAL_TIMER must match legacy value.");
+static_assert(CEC_MESSAGE_INITIATE_ARC == static_cast<int>(CecMessageType::INITIATE_ARC),
+ "CecMessageType::INITIATE_ARC must match legacy value.");
+static_assert(CEC_MESSAGE_REPORT_ARC_INITIATED ==
+ static_cast<int>(CecMessageType::REPORT_ARC_INITIATED),
+ "CecMessageType::REPORT_ARC_INITIATED must match legacy value.");
+static_assert(CEC_MESSAGE_REPORT_ARC_TERMINATED ==
+ static_cast<int>(CecMessageType::REPORT_ARC_TERMINATED),
+ "CecMessageType::REPORT_ARC_TERMINATED must match legacy value.");
+static_assert(CEC_MESSAGE_REQUEST_ARC_INITIATION ==
+ static_cast<int>(CecMessageType::REQUEST_ARC_INITIATION),
+ "CecMessageType::REQUEST_ARC_INITIATION must match legacy value.");
+static_assert(CEC_MESSAGE_REQUEST_ARC_TERMINATION ==
+ static_cast<int>(CecMessageType::REQUEST_ARC_TERMINATION),
+ "CecMessageType::REQUEST_ARC_TERMINATION must match legacy value.");
+static_assert(CEC_MESSAGE_TERMINATE_ARC == static_cast<int>(CecMessageType::TERMINATE_ARC),
+ "CecMessageType::TERMINATE_ARC must match legacy value.");
+static_assert(CEC_MESSAGE_ABORT == static_cast<int>(CecMessageType::ABORT),
+ "CecMessageType::ABORT must match legacy value.");
+
+static_assert(ABORT_UNRECOGNIZED_MODE == static_cast<int>(AbortReason::UNRECOGNIZED_MODE),
+ "AbortReason::UNRECOGNIZED_MODE must match legacy value.");
+static_assert(ABORT_NOT_IN_CORRECT_MODE == static_cast<int>(AbortReason::NOT_IN_CORRECT_MODE),
+ "AbortReason::NOT_IN_CORRECT_MODE must match legacy value.");
+static_assert(ABORT_CANNOT_PROVIDE_SOURCE == static_cast<int>(AbortReason::CANNOT_PROVIDE_SOURCE),
+ "AbortReason::CANNOT_PROVIDE_SOURCE must match legacy value.");
+static_assert(ABORT_INVALID_OPERAND == static_cast<int>(AbortReason::INVALID_OPERAND),
+ "AbortReason::INVALID_OPERAND must match legacy value.");
+static_assert(ABORT_REFUSED == static_cast<int>(AbortReason::REFUSED),
+ "AbortReason::REFUSED must match legacy value.");
+static_assert(ABORT_UNABLE_TO_DETERMINE == static_cast<int>(AbortReason::UNABLE_TO_DETERMINE),
+ "AbortReason::UNABLE_TO_DETERMINE must match legacy value.");
+
+static_assert(HDMI_RESULT_SUCCESS == static_cast<int>(SendMessageResult::SUCCESS),
+ "SendMessageResult::SUCCESS must match legacy value.");
+static_assert(HDMI_RESULT_NACK == static_cast<int>(SendMessageResult::NACK),
+ "SendMessageResult::NACK must match legacy value.");
+static_assert(HDMI_RESULT_BUSY == static_cast<int>(SendMessageResult::BUSY),
+ "SendMessageResult::BUSY must match legacy value.");
+static_assert(HDMI_RESULT_FAIL == static_cast<int>(SendMessageResult::FAIL),
+ "SendMessageResult::FAIL must match legacy value.");
+
+static_assert(HDMI_INPUT == static_cast<int>(HdmiPortType::INPUT),
+ "HdmiPortType::INPUT must match legacy value.");
+static_assert(HDMI_OUTPUT == static_cast<int>(HdmiPortType::OUTPUT),
+ "HdmiPortType::OUTPUT must match legacy value.");
+
+static_assert(HDMI_OPTION_WAKEUP == static_cast<int>(OptionKey::WAKEUP),
+ "OptionKey::WAKEUP must match legacy value.");
+static_assert(HDMI_OPTION_ENABLE_CEC == static_cast<int>(OptionKey::ENABLE_CEC),
+ "OptionKey::ENABLE_CEC must match legacy value.");
+static_assert(HDMI_OPTION_SYSTEM_CEC_CONTROL == static_cast<int>(OptionKey::SYSTEM_CEC_CONTROL),
+ "OptionKey::SYSTEM_CEC_CONTROL must match legacy value.");
+
+sp<IHdmiCecCallback> HdmiCec::mCallback = nullptr;
+
+HdmiCec::HdmiCec(hdmi_cec_device_t* device) : mDevice(device) {}
+
+// Methods from ::android::hardware::tv::cec::V2_0::IHdmiCec follow.
+Return<Result> HdmiCec::addDeviceType(CecDeviceType deviceType) {
+ // TODO implement
+ if (deviceType <= CecDeviceType::MAX) {
+ return Result::SUCCESS;
+ } else {
+ return Result::FAILURE_INVALID_ARGS;
+ }
+}
+
+Return<void> HdmiCec::clearDeviceTypes() {
+ // TODO implement
+ return Void();
+}
+
+Return<void> HdmiCec::setAllDeviceTypes(CecAllDeviceTypes allDeviceTypes) {
+ // TODO implement
+ if (allDeviceTypes == 1) {
+ }
+ return Void();
+}
+
+Return<void> HdmiCec::setDeviceFeatures(CecDeviceType deviceType,
+ CecDeviceFeatures /* deviceFeatures */) {
+ // TODO implement
+ if (deviceType != CecDeviceType::MAX) {
+ }
+ return Void();
+}
+
+Return<void> HdmiCec::setRcProfile(CecDeviceType deviceType, const CecRcProfile& /* rcProfile */) {
+ // TODO implement
+ if (deviceType != CecDeviceType::MAX) {
+ }
+ return Void();
+}
+
+Return<void> HdmiCec::readDeviceInfo(CecLogicalAddress logicalAddress,
+ CecPhysicalAddress physicalAddress,
+ const readDeviceInfo_cb _hidl_cb) {
+ // TODO implement
+ CecDeviceInfo deviceInfo;
+
+ if (logicalAddress == CecLogicalAddress::TV) {
+ _hidl_cb(Result::SUCCESS, deviceInfo);
+ if (physicalAddress) {
+ }
+ }
+ return Void();
+}
+
+Return<SendMessageResult> HdmiCec::sendMessage(const CecMessage& message) {
+ cec_message_t legacyMessage{
+ .initiator = static_cast<cec_logical_address_t>(message.initiator),
+ .destination = static_cast<cec_logical_address_t>(message.destination),
+ .length = message.body.size(),
+ };
+ for (size_t i = 0; i < message.body.size(); ++i) {
+ legacyMessage.body[i] = static_cast<unsigned char>(message.body[i]);
+ }
+ return static_cast<SendMessageResult>(mDevice->send_message(mDevice, &legacyMessage));
+}
+
+Return<void> HdmiCec::setCallback(const sp<IHdmiCecCallback>& callback) {
+ if (mCallback != nullptr) {
+ mCallback->unlinkToDeath(this);
+ mCallback = nullptr;
+ }
+
+ if (callback != nullptr) {
+ mCallback = callback;
+ mCallback->linkToDeath(this, 0 /*cookie*/);
+ mDevice->register_event_callback(mDevice, eventCallback, nullptr);
+ }
+ return Void();
+}
+
+Return<void> HdmiCec::getPortInfo(getPortInfo_cb _hidl_cb) {
+ struct hdmi_port_info* legacyPorts;
+ int numPorts;
+ hidl_vec<HdmiPortInfo> portInfos;
+ mDevice->get_port_info(mDevice, &legacyPorts, &numPorts);
+ portInfos.resize(numPorts);
+ for (int i = 0; i < numPorts; ++i) {
+ portInfos[i] = {.type = static_cast<HdmiPortType>(legacyPorts[i].type),
+ .portId = static_cast<HdmiPortId>(legacyPorts[i].port_id),
+ .cecSupported = legacyPorts[i].cec_supported != 0,
+ .arcSupported = legacyPorts[i].arc_supported != 0,
+ .physicalAddress = legacyPorts[i].physical_address};
+ }
+ _hidl_cb(portInfos);
+ return Void();
+}
+
+Return<void> HdmiCec::setOption(OptionKey key, bool value) {
+ mDevice->set_option(mDevice, static_cast<int>(key), value ? 1 : 0);
+ return Void();
+}
+
+Return<void> HdmiCec::setLanguage(const hidl_string& language) {
+ if (language.size() != 3) {
+ LOG(ERROR) << "Wrong language code: expected 3 letters, but it was " << language.size()
+ << ".";
+ return Void();
+ }
+ const char* languageStr = language.c_str();
+ int convertedLanguage = ((languageStr[0] & 0xFF) << 16) | ((languageStr[1] & 0xFF) << 8) |
+ (languageStr[2] & 0xFF);
+ mDevice->set_option(mDevice, HDMI_OPTION_SET_LANG, convertedLanguage);
+ return Void();
+}
+
+Return<void> HdmiCec::enableAudioReturnChannel(HdmiPortId portId, bool enable) {
+ mDevice->set_audio_return_channel(mDevice, portId, enable ? 1 : 0);
+ return Void();
+}
+
+Return<bool> HdmiCec::isConnected(HdmiPortId portId) {
+ return mDevice->is_connected(mDevice, portId) > 0;
+}
+
+IHdmiCec* HIDL_FETCH_IHdmiCec(const char* hal) {
+ hdmi_cec_device_t* hdmi_cec_device;
+ int ret = 0;
+ const hw_module_t* hw_module = nullptr;
+
+ ret = hw_get_module(HDMI_CEC_HARDWARE_MODULE_ID, &hw_module);
+ if (ret == 0) {
+ ret = hdmi_cec_open(hw_module, &hdmi_cec_device);
+ if (ret != 0) {
+ LOG(ERROR) << "hdmi_cec_open " << hal << " failed: " << ret;
+ }
+ } else {
+ LOG(ERROR) << "hw_get_module " << hal << " failed: " << ret;
+ }
+
+ if (ret == 0) {
+ return new HdmiCec(hdmi_cec_device);
+ } else {
+ LOG(ERROR) << "Passthrough failed to load legacy HAL.";
+ return nullptr;
+ }
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace cec
+} // namespace tv
+} // namespace hardware
+} // namespace android
diff --git a/tv/cec/2.0/default/HdmiCec.h b/tv/cec/2.0/default/HdmiCec.h
new file mode 100644
index 0000000..ab54770
--- /dev/null
+++ b/tv/cec/2.0/default/HdmiCec.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_TV_CEC_V2_0_HDMICEC_H
+#define ANDROID_HARDWARE_TV_CEC_V2_0_HDMICEC_H
+
+#include <algorithm>
+
+#include <android/hardware/tv/cec/2.0/IHdmiCec.h>
+#include <hardware/hardware.h>
+#include <hardware/hdmi_cec.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace tv {
+namespace cec {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::tv::cec::V2_0::CecLogicalAddress;
+using ::android::hardware::tv::cec::V2_0::CecMessage;
+using ::android::hardware::tv::cec::V2_0::CecPhysicalAddress;
+using ::android::hardware::tv::cec::V2_0::HdmiPortId;
+using ::android::hardware::tv::cec::V2_0::HdmiPortInfo;
+using ::android::hardware::tv::cec::V2_0::IHdmiCec;
+using ::android::hardware::tv::cec::V2_0::IHdmiCecCallback;
+using ::android::hardware::tv::cec::V2_0::MaxLength;
+using ::android::hardware::tv::cec::V2_0::OptionKey;
+using ::android::hardware::tv::cec::V2_0::Result;
+using ::android::hardware::tv::cec::V2_0::SendMessageResult;
+
+struct HdmiCec : public IHdmiCec, public hidl_death_recipient {
+ HdmiCec(hdmi_cec_device_t* device);
+ // Methods from ::android::hardware::tv::cec::V2_0::IHdmiCec follow.
+ Return<Result> addDeviceType(CecDeviceType deviceType) override;
+ Return<void> clearDeviceTypes() override;
+ Return<void> setAllDeviceTypes(CecAllDeviceTypes allDeviceTypes) override;
+ Return<void> setDeviceFeatures(CecDeviceType deviceType,
+ CecDeviceFeatures /* deviceFeatures */) override;
+ Return<void> setRcProfile(CecDeviceType deviceType,
+ const CecRcProfile& /* rcProfile */) override;
+ Return<void> readDeviceInfo(CecLogicalAddress logicalAddress,
+ CecPhysicalAddress physicalAddress,
+ const readDeviceInfo_cb _hidl_cb) override;
+ Return<SendMessageResult> sendMessage(const CecMessage& message) override;
+ Return<void> setCallback(const sp<IHdmiCecCallback>& callback) override;
+ Return<void> getPortInfo(getPortInfo_cb _hidl_cb) override;
+ Return<void> setOption(OptionKey key, bool value) override;
+ Return<void> setLanguage(const hidl_string& language) override;
+ Return<void> enableAudioReturnChannel(HdmiPortId portId, bool enable) override;
+ Return<bool> isConnected(HdmiPortId portId) override;
+
+ static void eventCallback(const hdmi_event_t* event, void* /* arg */) {
+ if (mCallback != nullptr && event != nullptr) {
+ if (event->type == HDMI_EVENT_CEC_MESSAGE) {
+ size_t length =
+ std::min(event->cec.length, static_cast<size_t>(MaxLength::MESSAGE_BODY));
+ CecMessage cecMessage{
+ .initiator = static_cast<CecLogicalAddress>(event->cec.initiator),
+ .destination = static_cast<CecLogicalAddress>(event->cec.destination),
+ };
+ cecMessage.body.resize(length);
+ for (size_t i = 0; i < length; ++i) {
+ cecMessage.body[i] = static_cast<uint8_t>(event->cec.body[i]);
+ }
+ mCallback->onCecMessage(cecMessage);
+ } else if (event->type == HDMI_EVENT_HOT_PLUG) {
+ HotplugEvent hotplugEvent{
+ .connected = event->hotplug.connected > 0,
+ .portId = static_cast<HdmiPortId>(event->hotplug.port_id)};
+ mCallback->onHotplugEvent(hotplugEvent);
+ }
+ }
+ }
+
+ virtual void serviceDied(uint64_t /*cookie*/,
+ const wp<::android::hidl::base::V1_0::IBase>& /*who*/) {
+ setCallback(nullptr);
+ }
+
+ private:
+ static sp<IHdmiCecCallback> mCallback;
+ const hdmi_cec_device_t* mDevice;
+};
+
+extern "C" IHdmiCec* HIDL_FETCH_IHdmiCec(const char* name);
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace cec
+} // namespace tv
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_TV_CEC_V2_0_HDMICEC_H
diff --git a/tv/cec/2.0/default/OWNERS b/tv/cec/2.0/default/OWNERS
new file mode 100644
index 0000000..1b3d095
--- /dev/null
+++ b/tv/cec/2.0/default/OWNERS
@@ -0,0 +1,4 @@
+nchalko@google.com
+amyjojo@google.com
+shubang@google.com
+quxiangfang@google.com
diff --git a/tv/cec/2.0/default/android.hardware.tv.cec@2.0-service.rc b/tv/cec/2.0/default/android.hardware.tv.cec@2.0-service.rc
new file mode 100644
index 0000000..1e8cd80
--- /dev/null
+++ b/tv/cec/2.0/default/android.hardware.tv.cec@2.0-service.rc
@@ -0,0 +1,4 @@
+service vendor.cec-hal-2-0 /vendor/bin/hw/android.hardware.tv.cec@2.0-service
+ class hal
+ user system
+ group system
diff --git a/tv/cec/2.0/default/android.hardware.tv.cec@2.0-service.xml b/tv/cec/2.0/default/android.hardware.tv.cec@2.0-service.xml
new file mode 100644
index 0000000..61fb1bb
--- /dev/null
+++ b/tv/cec/2.0/default/android.hardware.tv.cec@2.0-service.xml
@@ -0,0 +1,11 @@
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>android.hardware.tv.cec</name>
+ <transport>hwbinder</transport>
+ <version>2.0</version>
+ <interface>
+ <name>IHdmiCec</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+</manifest>
diff --git a/tv/cec/2.0/default/service.cpp b/tv/cec/2.0/default/service.cpp
new file mode 100644
index 0000000..dacc38c
--- /dev/null
+++ b/tv/cec/2.0/default/service.cpp
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "android.hardware.tv.cec@2.0-service"
+
+#include <android/hardware/tv/cec/2.0/IHdmiCec.h>
+#include <hidl/LegacySupport.h>
+
+using android::hardware::defaultPassthroughServiceImplementation;
+using android::hardware::tv::cec::V2_0::IHdmiCec;
+
+int main() {
+ return defaultPassthroughServiceImplementation<IHdmiCec>();
+}
diff --git a/tv/cec/2.0/types.hal b/tv/cec/2.0/types.hal
new file mode 100644
index 0000000..cad6c39
--- /dev/null
+++ b/tv/cec/2.0/types.hal
@@ -0,0 +1,548 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.tv.cec@2.0;
+
+import android.hidl.safe_union@1.0;
+
+/**
+ * CEC device type as specified in CEC Table 11-7 of the CEC spec 2.0b.
+ */
+enum CecDeviceType : int32_t {
+ INACTIVE = -1,
+ TV = 0,
+ RECORDER = 1,
+ TUNER = 3,
+ PLAYBACK = 4,
+ AUDIO_SYSTEM = 5,
+ PURE_CEC_SWITCH = 6,
+ PROCESSOR = 7,
+ MAX = PROCESSOR,
+};
+
+/**
+ * CEC logical address as specified in CEC Table 11-9 of the CEC spec 2.0b.
+ */
+enum CecLogicalAddress : int32_t {
+ TV = 0,
+ RECORDER_1 = 1,
+ RECORDER_2 = 2,
+ TUNER_1 = 3,
+ PLAYBACK_1 = 4,
+ AUDIO_SYSTEM = 5,
+ TUNER_2 = 6,
+ TUNER_3 = 7,
+ PLAYBACK_2 = 8,
+ RECORDER_3 = 9,
+ TUNER_4 = 10,
+ PLAYBACK_3 = 11,
+ BACKUP_1 = 12, // backup1 for Playback/Recording/Tuner/Processor device
+ BACKUP_2 = 13, // backup2 for Playback/Recording/Tuner/Processor device
+ SPECIFIC_USE = 14,
+ UNREGISTERED = 15, // as Initiator address
+ BROADCAST = 15, // as Destination address
+};
+
+/**
+ * HDMI CEC message types.
+ *
+ * The assigned values represent opcode used in CEC frame as specified in
+ * Section 11.10 of the CEC spec 2.0b on top of Section CEC 15 of the CEC
+ * Spec 1.4b.
+ */
+enum CecMessageType : int32_t {
+ FEATURE_ABORT = 0x00,
+ IMAGE_VIEW_ON = 0x04,
+ TUNER_STEP_INCREMENT = 0x05,
+ TUNER_STEP_DECREMENT = 0x06,
+ TUNER_DEVICE_STATUS = 0x07,
+ GIVE_TUNER_DEVICE_STATUS = 0x08,
+ RECORD_ON = 0x09,
+ RECORD_STATUS = 0x0A,
+ RECORD_OFF = 0x0B,
+ TEXT_VIEW_ON = 0x0D,
+ RECORD_TV_SCREEN = 0x0F,
+ GIVE_DECK_STATUS = 0x1A,
+ DECK_STATUS = 0x1B,
+ SET_MENU_LANGUAGE = 0x32,
+ CLEAR_ANALOG_TIMER = 0x33,
+ SET_ANALOG_TIMER = 0x34,
+ TIMER_STATUS = 0x35,
+ STANDBY = 0x36,
+ PLAY = 0x41,
+ DECK_CONTROL = 0x42,
+ TIMER_CLEARED_STATUS = 0x43,
+ USER_CONTROL_PRESSED = 0x44,
+ USER_CONTROL_RELEASED = 0x45,
+ GIVE_OSD_NAME = 0x46,
+ SET_OSD_NAME = 0x47,
+ SET_OSD_STRING = 0x64,
+ SET_TIMER_PROGRAM_TITLE = 0x67,
+ SYSTEM_AUDIO_MODE_REQUEST = 0x70,
+ GIVE_AUDIO_STATUS = 0x71,
+ SET_SYSTEM_AUDIO_MODE = 0x72,
+ REPORT_AUDIO_STATUS = 0x7A,
+ GIVE_SYSTEM_AUDIO_MODE_STATUS = 0x7D,
+ SYSTEM_AUDIO_MODE_STATUS = 0x7E,
+ ROUTING_CHANGE = 0x80,
+ ROUTING_INFORMATION = 0x81,
+ ACTIVE_SOURCE = 0x82,
+ GIVE_PHYSICAL_ADDRESS = 0x83,
+ REPORT_PHYSICAL_ADDRESS = 0x84,
+ REQUEST_ACTIVE_SOURCE = 0x85,
+ SET_STREAM_PATH = 0x86,
+ DEVICE_VENDOR_ID = 0x87,
+ VENDOR_COMMAND = 0x89,
+ VENDOR_REMOTE_BUTTON_DOWN = 0x8A,
+ VENDOR_REMOTE_BUTTON_UP = 0x8B,
+ GIVE_DEVICE_VENDOR_ID = 0x8C,
+ MENU_REQUEST = 0x8D,
+ MENU_STATUS = 0x8E,
+ GIVE_DEVICE_POWER_STATUS = 0x8F,
+ REPORT_POWER_STATUS = 0x90,
+ GET_MENU_LANGUAGE = 0x91,
+ SELECT_ANALOG_SERVICE = 0x92,
+ SELECT_DIGITAL_SERVICE = 0x93,
+ SET_DIGITAL_TIMER = 0x97,
+ CLEAR_DIGITAL_TIMER = 0x99,
+ SET_AUDIO_RATE = 0x9A,
+ INACTIVE_SOURCE = 0x9D,
+ CEC_VERSION = 0x9E,
+ GET_CEC_VERSION = 0x9F,
+ VENDOR_COMMAND_WITH_ID = 0xA0,
+ CLEAR_EXTERNAL_TIMER = 0xA1,
+ SET_EXTERNAL_TIMER = 0xA2,
+ REPORT_SHORT_AUDIO_DESCRIPTOR = 0xA3,
+ REQUEST_SHORT_AUDIO_DESCRIPTOR = 0xA4,
+ GIVE_FEATURES = 0XA5,
+ REPORT_FEATURES = 0xA6,
+ REQUEST_CURRENT_LATENCY = 0xA7,
+ REPORT_CURRENT_LATENCY = 0xA8,
+ INITIATE_ARC = 0xC0,
+ REPORT_ARC_INITIATED = 0xC1,
+ REPORT_ARC_TERMINATED = 0xC2,
+ REQUEST_ARC_INITIATION = 0xC3,
+ REQUEST_ARC_TERMINATION = 0xC4,
+ TERMINATE_ARC = 0xC5,
+ ABORT = 0xFF,
+ POLLING_MESSAGE = 0xFFFFFF00, // used for cec polling message
+};
+
+/**
+ * Abort Reason as specified in CEC Table 29 of the CEC spec 1.4b.
+ */
+enum AbortReason : int32_t {
+ UNRECOGNIZED_MODE = 0,
+ NOT_IN_CORRECT_MODE = 1,
+ CANNOT_PROVIDE_SOURCE = 2,
+ INVALID_OPERAND = 3,
+ REFUSED = 4,
+ UNABLE_TO_DETERMINE = 5,
+};
+
+enum MaxLength : int32_t {
+ MESSAGE_BODY = 14,
+};
+
+struct CecMessage {
+ /** logical address of sender */
+ CecLogicalAddress initiator;
+
+ /** logical address of receiver */
+ CecLogicalAddress destination;
+
+ /** cec message type */
+ CecMessageType cecMessageType;
+
+ /**
+ * The maximum size of body is 14 (MaxLength::MESSAGE_BODY) as specified in
+ * the section 6 of the CEC Spec 1.4b. Overflowed data must be ignored.
+ */
+ vec<uint8_t> body;
+};
+
+/**
+ * error code used for send_message.
+ */
+enum SendMessageResult : int32_t {
+ SUCCESS = 0,
+ NACK = 1, // not acknowledged
+ BUSY = 2, // bus is busy
+ FAIL = 3,
+};
+
+/**
+ * CEC All Device Type Value as specified in Table 11-30 of the CEC spec 2.0b.
+ */
+enum CecAllDeviceTypeValue : uint8_t {
+ RESERVED_DEVICE_2 = 1 << 0,
+ RESERVED_DEVICE_1 = 1 << 1,
+ CEC_SWITCH_DEVICE = 1 << 2,
+ AUDIO_DEVICE = 1 << 3,
+ PLAYBACK_DEVICE = 1 << 4,
+ TUNER_DEVICE = 1 << 5,
+ RECORDING_DEVICE = 1 << 6,
+ TV_DEVICE = 1 << 7,
+};
+
+/**
+ * CEC All Device Types
+ *
+ * It is a combination of all supported type from CecAllDeviceTypeValue.
+ * For example a record with tuner functionalitye,
+ * cecAllDeviceTypes = ((CecAllDeviceTypeValue::RECORDING_DEVICE)
+ * |(CecAllDeviceTypeValue::TUNER_DEVICE))
+ */
+typedef bitfield<CecAllDeviceTypeValue> CecAllDeviceTypes;
+
+/**
+ * CEC Versions as specified in CEC Table 11-30 of the CEC spec 2.0b.
+ */
+enum CecVersion : int32_t {
+ V_1_3_A = 0x04,
+ V_1_4 = 0x05, // indicate CEC 1.4, 1.4a or 1.4b
+ V_2_0 = 0x06,
+};
+
+/**
+ * Device Feature
+ *
+ * It is specified in CEC Table 11-30 of the CEC spec 2.0b. As a uint32 there
+ * is room for future extensions aka DeviceFeature2 through DeviceFeature4.
+ */
+enum CecDeviceFeature : uint32_t {
+ RESERVED = 1 << 0,
+ SOURCE_SUPPORT_ARC_RX = 1 << 1,
+ SINK_SUPPORT_ARC_TX = 1 << 2,
+ SOURCE_SUPPORT_SET_AUDIO_RATE = 1 << 3,
+ SUPPORT_CONTROLLED_BY_DECK = 1 << 4,
+ TV_SUPPORT_SET_OSD_STRINGS = 1 << 5,
+ TV_SUPPORT_RECORD_TV_SCREEN = 1 << 6,
+};
+
+/**
+ * CEC Device Features
+ *
+ * It is a combination of all supported features from CecDeviceFeature.
+ * For example a TV with OSD and ARC capabilities,
+ * CecDeviceFeatures = ((CecDeviceFeature::TV_SUPPORT_SET_OSD_STRINGS)
+ * |(CecDeviceFeature::SINK_SUPPORT_ARC_TX))
+ */
+typedef bitfield<CecDeviceFeature> CecDeviceFeatures;
+
+/**
+ * Remote Control Profile
+ *
+ * It is specified in CEC Table 11-30 of the CEC spec 2.0b.
+ */
+enum CecRcProfileId : uint8_t {
+ NONE = 0, // TV doesn’t support any of these profiles
+ RC_PROFILE_1 = 0x02, // minimalistic zapper (low button count)
+ RC_PROFILE_2 = 0x06, // intermediate between profile 1 and profile 3
+ RC_PROFILE_3 = 0x0A, // typical TV remote
+ RC_PROFILE_4 = 0x0E, // extended form of profile 3
+};
+
+/**
+ * Remote Control Profile Source
+ *
+ * It is specified in CEC Table 11-30 of the CEC spec 2.0b.
+ */
+enum CecRcProfileSource : uint8_t {
+ MEDIA_CONTEXT_SENSITIVE = 1 << 0, // source can handle UI command 0x11
+ MEDIA_TO = 1 << 1, // source can handle UI command 0x10
+ CONTENTS = 1 << 2, // source can handle UI command 0x0B
+ DEVICE_SETUP = 1 << 3, // source can handle UI command 0x0A
+ DEVICE_ROOT = 1 << 4, // source can handle UI command 0x09
+ SOURCE_FLAG = 1 << 6, // Indicate the profile is for source
+};
+
+/**
+ * Remote Control Profile for either TV or Source.
+ */
+safe_union CecRcProfile1 {
+ /** CEC remote control profile for TV. */
+ CecRcProfileId profileId;
+
+ /* CEC remote control profile for source
+ *
+ * It is a combination of all supported profiles from CecRcProfileSource.
+ * For example a playback device support root menu and setup menu,
+ * profileSource = ((CecRcProfileSource::DEVICE_ROOT)
+ * |(CecRcProfileSource::DEVICE_SETUP)
+ * |(CecRcProfileSource::SOURCE_FLAG))
+ */
+ bitfield<CecRcProfileSource> profileSource;
+};
+
+/**
+ * CEC Remote Control Profiles
+ *
+ * CEC 2.0 only use one byte to represent Remote Control Profile.
+ */
+struct CecRcProfile {
+ CecRcProfile1 rcProfile1;
+};
+
+/**
+ * CEC device power states as specified in CEC Table 11-10 of the CEC spec 2.0b
+ */
+enum CecPowerState : int8_t {
+ ON = 0,
+ STANDBY = 1,
+ ON_TO_STANDBY = 2,
+ STANDBY_TO_ON = 4,
+ UNKNOWN = 0xFF, // some devices may not report power status
+};
+
+/** CEC physical address of device */
+typedef uint16_t CecPhysicalAddress;
+
+/**
+ * CEC device information
+ *
+ * It is initially built during addressing specified in CEC section 11.3 of
+ * the CEC spec 2.0b. It may be updated with cec devices's status changed.
+ */
+struct CecDeviceInfo {
+ /** CEC version which device supports */
+ CecVersion version;
+
+ /** CEC device primary type */
+ CecDeviceType devceType;
+
+ /** CEC all device types */
+ CecAllDeviceTypes allDeviceTypes;
+
+ /** CEC device features */
+ CecDeviceFeatures deviceFeatures;
+
+ /** CEC Device Remote Control Profile */
+ CecRcProfile rcProfile;
+
+ /** CEC Device Vendor ID */
+ uint32_t vendorId;
+
+ /** logical address of device */
+ CecLogicalAddress logicalAddress;
+
+ /** physical of device */
+ CecPhysicalAddress physicalAddress;
+
+ /** power status of device */
+ CecPowerState powerState;
+};
+
+/**
+ * Topology Event Type.
+ */
+enum CecTopologyEventType : int32_t {
+ DEVICE_ADDED,
+ DEVICE_REMOVED,
+ DEVICE_UPDATED,
+};
+
+/**
+ * Topology Event.
+ */
+struct CecTopologyEvent {
+ CecTopologyEventType eventType;
+ CecLogicalAddress logicalAddress;
+ CecPhysicalAddress physicalAddress;
+
+ /** true if the event is about the device which the system run on */
+ bool isHostDevice;
+};
+
+
+/**
+ * CEC UI Command Codes as specified in CEC Table 11-31 of the CEC spec 2.0b
+ */
+enum CecUICommandCodes : int32_t {
+ SELECT_OK = 0x00,
+ UP = 0x01,
+ DOWN = 0x02,
+ LEFT = 0x03,
+ RIGHT = 0x04,
+ RIGHT_UP = 0x05,
+ RIGHT_DOWN = 0x06,
+ LEFT_UP = 0x07,
+ LEFT_DOWN = 0x08,
+ DEVICE_ROOT_MENU = 0x09,
+ DEVICE_SETUP_MENU = 0x0A,
+ CONTENTS_MENU = 0x0B,
+ FAVORITE_MENU = 0x0C,
+ BACK = 0x0D,
+ MEDIA_TOP_MENU = 0x10,
+ MEDIA_CONTEXT_SENSITIVE_MENU = 0x11,
+ NUMBER_ENTRY_MODE = 0x1D,
+ NUMBER_11 = 0x1E,
+ NUMBER_12 = 0x1F,
+ NUMBER_0 = 0x20, // or NUMBER 10
+ NUMBER_1 = 0x21,
+ NUMBER_2 = 0x22,
+ NUMBER_3 = 0x23,
+ NUMBER_4 = 0x24,
+ NUMBER_5 = 0x25,
+ NUMBER_6 = 0x26,
+ NUMBER_7 = 0x27,
+ NUMBER_8 = 0x28,
+ NUMBER_9 = 0x29,
+ DOT = 0x2A,
+ ENTER = 0x2B,
+ CLEAR = 0x2C,
+ NEXT_FAVORITE = 0x2F,
+ CHANNEL_UP = 0x30,
+ CHANNEL_DOWN = 0x31,
+ PREVIOUS_CHANNEL = 0x32,
+ SOUND_SELECT = 0x33,
+ INPUT_SELECT = 0x34,
+ DISPLAY_INFORMATION = 0x35,
+ HELP = 0x36,
+ PAGE_UP = 0x37,
+ PAGE_DOWN = 0x38,
+ POWER = 0x40,
+ VOLUME_UP = 0x41,
+ VOLUME_DOWN = 0x42,
+ MUTE = 0x43,
+ PLAY = 0x44,
+ STOP = 0x45,
+ PAUSE = 0x46,
+ RECORD = 0x47,
+ REWIND = 0x48,
+ FAST_FORWARD = 0x49,
+ EJECT = 0x4A,
+ SKIP_FORWARD = 0x4B,
+ SKIP_BACKWARD = 0x4C,
+ STOP_RECORD = 0x4D,
+ PAUSE_RECORD = 0x4E,
+ ANGLE = 0x50,
+ SUB_PICTURE = 0x51,
+ VIDEO_ON_DEMAND = 0x52,
+ ELECTRONIC_PROGRAM_GUIDE = 0x53,
+ TIMER_PROGRAMMING = 0x54,
+ INITIAL_CONFIGURATION = 0x55,
+ SELECT_BROADCAST_TYPE = 0x56,
+ SELECT_SOUND_PRESENTATION = 0x57,
+ AUDIO_DESCRIPTION = 0x58,
+ INTERNET = 0x59,
+ THREE_DIMENSIONAL_MODE = 0x5A,
+ PLAY_FUNCTION = 0x60,
+ PAUSE_PLAY_FUNCTION = 0x61,
+ RECORD_FUNCTION = 0x62,
+ PAUSE_RECORD_FUNCTION = 0x63,
+ STOP_FUNCTION = 0x64,
+ MUTE_FUNCTION = 0x65,
+ RESTORE_VOLUME_FUNCTION = 0x66,
+ TUNE_FUNCTION = 0x67,
+ SELECT_MEDIA_FUNCTION = 0x68,
+ SELECT_AV_INPUT_FUNCTION = 0x69,
+ SELECT_AUDIO_INPUT_FUNCTION = 0x6A,
+ POWER_TOGGLE_FUNCTION = 0x6B,
+ POWER_OFF_FUNCTION = 0x6C,
+ POWER_ON_FUNCTION = 0x6D,
+ F1 = 0x71, // BLUE
+ F2 = 0x72, // RED
+ F3 = 0x73, // GREEN
+ F4 = 0x74, // YELLOW
+ F5 = 0x75,
+ DATA = 0x76,
+};
+
+/**
+ * HDMI port type.
+ */
+enum HdmiPortType : int32_t {
+ INPUT = 0,
+ OUTPUT = 1,
+};
+
+/**
+ * Options used for IHdmiCec.setOption()
+ */
+enum OptionKey : int32_t {
+ /**
+ * When set to false, HAL does not wake up the system upon receiving <Image
+ * View On> or <Text View On>. Used when user changes the TV settings to
+ * disable the auto TV on functionality.
+ * Deprecated since <Image View On> and <Text View On> become mandatory
+ * featrues for CEC device. Use ENABLE_CEC OptionKey to disable CEC
+ * functionality instead.
+ * True by Default
+ */
+ WAKEUP = 1,
+
+ /**
+ * When set to false, all the CEC commands are discarded. if logical address
+ * is ever used, it shall be released. Used when user changes the TV
+ * settings to disable CEC functionality.
+ * True by default.
+ *
+ */
+ ENABLE_CEC = 2,
+
+ /**
+ * Setting this flag to false means Android system must stop handling CEC
+ * service and yield the control over to the microprocessor that is powered
+ * on through the standby mode.The microprocessor shall keep current logical
+ * and physical address. It shall response POLLING_MESSAGE, GIVE_FEATURES,
+ * GIVE_DEVICE_POWER_STATUS,GIVE_DEVICE_VENDOR_ID and GIVE_PHYSICAL_ADDRESS
+ * to allow other CEC devices to build CEC devices map specified in CEC
+ * section 11.3 of the CEC spec 2.0b.
+ * When set to true, the system must gain the control over, hence telling
+ * the microprocessor to start forwarding CEC messages to Android system.
+ * For example, this may be called when system goes in and out of
+ * standby mode to notify the microprocessor that it should start/stop
+ * handling CEC commands on behalf of the system.
+ * True by default.
+ */
+ SYSTEM_CEC_CONTROL = 3,
+
+ /* Option 4 not used */
+};
+
+/**
+ * Hdmi port ID.
+ *
+ * It shall start from 1 which corresponds to HDMI "port 1".
+ */
+typedef uint32_t HdmiPortId;
+
+/** Hdmi hotplug event */
+struct HotplugEvent {
+ bool connected;
+ HdmiPortId portId;
+};
+
+/**
+ * HDMI port descriptor
+ */
+struct HdmiPortInfo {
+ HdmiPortType type;
+ HdmiPortId portId;
+ bool cecSupported;
+ bool arcSupported;
+ CecPhysicalAddress physicalAddress;
+};
+
+enum Result : int32_t {
+ SUCCESS = 0,
+ FAILURE_UNKNOWN = 1,
+ FAILURE_INVALID_ARGS = 2,
+ FAILURE_INVALID_STATE = 3,
+ FAILURE_NOT_SUPPORTED = 4,
+ FAILURE_BUSY = 5,
+};
diff --git a/usb/1.2/Android.bp b/usb/1.2/Android.bp
new file mode 100644
index 0000000..55ffad0
--- /dev/null
+++ b/usb/1.2/Android.bp
@@ -0,0 +1,29 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.usb@1.2",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "types.hal",
+ "IUsb.hal",
+ "IUsbCallback.hal",
+ ],
+ interfaces: [
+ "android.hardware.usb@1.0",
+ "android.hardware.usb@1.1",
+ "android.hidl.base@1.0",
+ ],
+ types: [
+ "ContaminantDetectionStatus",
+ "ContaminantProtectionMode",
+ "ContaminantProtectionStatus",
+ "PortStatus",
+ "Status",
+ ],
+ gen_java: true,
+ gen_java_constants: true,
+}
+
diff --git a/usb/1.2/IUsb.hal b/usb/1.2/IUsb.hal
new file mode 100644
index 0000000..ecc911e
--- /dev/null
+++ b/usb/1.2/IUsb.hal
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.usb@1.2;
+
+import android.hardware.usb@1.1::IUsb;
+
+/**
+ * The setCallback function in V1_0 is used to register the V1_2
+ * IUsbCallback object as well. The implementation can use the
+ * castFrom method to cast the IUsbCallback object.
+ */
+interface IUsb extends @1.1::IUsb {
+ /**
+ * When supportsEnableContaminantPresenceDetection is true,
+ * enableContaminantPresenceDetection enables/disables contaminant
+ * presence detection algorithm. Calling enableContaminantPresenceDetection
+ * when supportsEnableContaminantPresenceDetection is false does
+ * not have any effect.
+ * Change in contantaminant presence status should notify should
+ * be notified to the client via notifyPortStatusChange_1_2 through
+ * PortStatus.
+ *
+ * @param portName name of the port.
+ * @param enable true Enable contaminant presence detection algorithm.
+ * false Disable contaminant presence detection algorithm.
+ */
+ oneway enableContaminantPresenceDetection(string portName, bool enable);
+
+ /**
+ * When supportsEnableContaminantPresenceProtection is true,
+ * enableContaminantPresenceProtection enables/disables contaminant
+ * presence protection algorithm. Calling
+ * enableContaminantPresenceProtection
+ * when supportsEnableContaminantPresenceProtection is false does
+ * not have any effect.
+ * Used to enable/disable contaminant presence protection algorithm.
+ * Enabling port protection algoritm must make the lower layers to autonomously
+ * act on taking the corresponding preventive measure mentioned at
+ * ContaminantProtectionModes when contaminant is detected on the USB Port.
+ * Calling this method with enable set to true must set to contaminantProtectionEnabled
+ * to true upon success and vice versa.
+ * currentContaminantProtectionMode should be updated whenever there is a
+ * change in the status of contaminant presence protection algorithm.
+ *
+ * @param portName name of the port.
+ * @param enable true Reduce capabilities of the port to protect port
+ * from damage due to contaminant presence.
+ * false No action is taken upon contaminant presence.
+ */
+ oneway enableContaminantPresenceProtection(string portName, bool enable);
+};
diff --git a/usb/1.2/IUsbCallback.hal b/usb/1.2/IUsbCallback.hal
new file mode 100644
index 0000000..8cc16df
--- /dev/null
+++ b/usb/1.2/IUsbCallback.hal
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.usb@1.2;
+
+import android.hardware.usb@1.1::IUsbCallback;
+import android.hardware.usb@1.0::Status;
+
+/**
+ * Callback object used for all the IUsb async methods which expects a result.
+ * Caller is expected to register the callback object using setCallback method
+ * to receive updates on the PortStatus.
+ */
+interface IUsbCallback extends @1.1::IUsbCallback {
+ /**
+ * Used to convey the current port status to the caller.
+ * Must be called either when PortState changes due to the port partner or
+ * when caller requested for the PortStatus update through queryPortStatus.
+ *
+ * @param currentPortStatus vector object of current status(PortStatus
+ * of all the typeC ports in the device.
+ * @param retval SUCCESS when the required information was enquired form
+ * kernel and the PortStatus_1_2 object was built.
+ * ERROR otherwise.
+ */
+ oneway notifyPortStatusChange_1_2(vec<PortStatus> currentPortStatus,
+ @1.0::Status retval);
+};
+
diff --git a/usb/1.2/types.hal b/usb/1.2/types.hal
new file mode 100644
index 0000000..081a643
--- /dev/null
+++ b/usb/1.2/types.hal
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.usb@1.2;
+
+import android.hardware.usb@1.1::PortStatus_1_1;
+import android.hardware.usb@1.0::Status;
+
+enum Status : @1.0::Status {
+ /**
+ * Error value returned when the operation is not supported.
+ */
+ NOT_SUPPORTED = 4,
+};
+
+@export
+enum ContaminantDetectionStatus : uint32_t {
+ /**
+ * Contaminant presence detection is not supported.
+ */
+ NOT_SUPPORTED = 0,
+
+ /**
+ * Contaminant presence detection is supported but disabled.
+ */
+ DISABLED = 1,
+
+ /**
+ * Contaminant presence detection is enabled and contaminant not detected.
+ */
+ NOT_DETECTED = 2,
+
+ /**
+ * Contaminant presence detection is enabled and contaminant detected.
+ */
+ DETECTED = 3,
+};
+
+@export
+enum ContaminantProtectionMode : uint32_t {
+ /**
+ * No action performed upon detection of contaminant presence.
+ */
+ NONE = 0,
+
+ /**
+ * Upon detection of contaminant presence, Port is forced to sink only
+ * mode where a port shall only detect chargers until contaminant presence
+ * is no longer detected.
+ */
+ FORCE_SINK = 1 << 0,
+
+ /**
+ * Upon detection of contaminant presence, Port is forced to source only
+ * mode where a port shall only detect usb accessories such as headsets
+ * until contaminant presence is no longer detected.
+ */
+ FORCE_SOURCE = 1 << 1,
+
+ /**
+ * Upon detection of contaminant presence, port is disabled until contaminant
+ * presence is no longer detected. In the disabled state port will
+ * not respond to connection of chargers or usb accessories.
+ */
+ FORCE_DISABLE = 1 << 2,
+};
+
+@export
+enum ContaminantProtectionStatus : ContaminantProtectionMode {
+ /**
+ * Client disabled cotaminant protection by calling
+ * enableContaminantPresencePortProtection set to false. Low level drivers should
+ * not autmomously take any corrective action when contaminant presence is detected.
+ */
+ DISABLED = 1 << 3,
+};
+
+struct PortStatus {
+ PortStatus_1_1 status_1_1;
+
+ /**
+ * Contaminant presence protection modes supported by the port.
+ */
+ bitfield<ContaminantProtectionMode> supportedContaminantProtectionModes;
+
+ /**
+ * Client can enable/disable contaminant presence protection through
+ * enableContaminantPresenceProtection when true.
+ */
+ bool supportsEnableContaminantPresenceProtection;
+
+ /**
+ * Contaminant presence protection modes currently active for the port.
+ */
+ ContaminantProtectionStatus contaminantProtectionStatus;
+
+ /**
+ * Client can enable/disable contaminant presence detection through
+ * enableContaminantPresenceDetection when true.
+ */
+ bool supportsEnableContaminantPresenceDetection;
+
+ /**
+ * Current status of contaminant detection algorithm.
+ */
+ ContaminantDetectionStatus contaminantDetectionStatus;
+};
diff --git a/usb/1.2/vts/OWNERS b/usb/1.2/vts/OWNERS
new file mode 100644
index 0000000..f60d39a
--- /dev/null
+++ b/usb/1.2/vts/OWNERS
@@ -0,0 +1,2 @@
+badhri@google.com
+yim@google.com
diff --git a/usb/1.2/vts/functional/Android.bp b/usb/1.2/vts/functional/Android.bp
new file mode 100644
index 0000000..761d37f
--- /dev/null
+++ b/usb/1.2/vts/functional/Android.bp
@@ -0,0 +1,28 @@
+//
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+ name: "VtsHalUsbV1_2TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: ["VtsHalUsbV1_2TargetTest.cpp"],
+ static_libs: [
+ "android.hardware.usb@1.0",
+ "android.hardware.usb@1.1",
+ "android.hardware.usb@1.2",
+ ],
+ test_suites: ["general-tests"],
+}
+
diff --git a/usb/1.2/vts/functional/VtsHalUsbV1_2TargetTest.cpp b/usb/1.2/vts/functional/VtsHalUsbV1_2TargetTest.cpp
new file mode 100644
index 0000000..7b3dea9
--- /dev/null
+++ b/usb/1.2/vts/functional/VtsHalUsbV1_2TargetTest.cpp
@@ -0,0 +1,380 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "VtsHalUsbV1_2TargetTest"
+#include <android-base/logging.h>
+
+#include <android/hardware/usb/1.2/IUsb.h>
+#include <android/hardware/usb/1.2/IUsbCallback.h>
+#include <android/hardware/usb/1.2/types.h>
+
+#include <VtsHalHidlTargetCallbackBase.h>
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+#include <log/log.h>
+#include <stdlib.h>
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::usb::V1_0::PortDataRole;
+using ::android::hardware::usb::V1_0::PortMode;
+using ::android::hardware::usb::V1_0::PortPowerRole;
+using ::android::hardware::usb::V1_0::PortRole;
+using ::android::hardware::usb::V1_0::PortRoleType;
+using ::android::hardware::usb::V1_0::Status;
+using ::android::hardware::usb::V1_1::PortMode_1_1;
+using ::android::hardware::usb::V1_1::PortStatus_1_1;
+using ::android::hardware::usb::V1_2::ContaminantDetectionStatus;
+using ::android::hardware::usb::V1_2::ContaminantProtectionMode;
+using ::android::hardware::usb::V1_2::ContaminantProtectionStatus;
+using ::android::hardware::usb::V1_2::IUsb;
+using ::android::hardware::usb::V1_2::IUsbCallback;
+using ::android::hardware::usb::V1_2::PortStatus;
+using ::android::hidl::base::V1_0::IBase;
+
+constexpr char kCallbackNameNotifyPortStatusChange_1_2[] = "notifyPortStatusChange_1_2";
+const int kCallbackIdentifier = 2;
+
+// Worst case wait time 20secs
+#define WAIT_FOR_TIMEOUT std::chrono::milliseconds(20000)
+
+class UsbClientCallbackArgs {
+ public:
+ // The last conveyed status of the USB ports.
+ // Stores information of currentt_data_role, power_role for all the USB ports
+ PortStatus usb_last_port_status;
+
+ // Status of the last role switch operation.
+ Status usb_last_status;
+
+ // Identifier for the usb callback object.
+ // Stores the cookie of the last invoked usb callback object.
+ int last_usb_cookie;
+};
+
+// Callback class for the USB HIDL hal.
+// Usb Hal will call this object upon role switch or port query.
+class UsbCallback : public ::testing::VtsHalHidlTargetCallbackBase<UsbClientCallbackArgs>,
+ public IUsbCallback {
+ int cookie;
+
+ public:
+ UsbCallback(int cookie) : cookie(cookie){};
+
+ virtual ~UsbCallback() = default;
+
+ // V1_0 Callback method for the port status.
+ // This should not be called so not signalling the Test here assuming that
+ // the test thread will timeout
+ Return<void> notifyPortStatusChange(const hidl_vec<android::hardware::usb::V1_0::PortStatus>&
+ /* currentPortStatus */,
+ Status /* retval */) override {
+ return Void();
+ };
+
+ // V1_1 Callback method for the port status.
+ // This should not be called so not signalling the Test here assuming that
+ // the test thread will timeout
+ Return<void> notifyPortStatusChange_1_1(const hidl_vec<PortStatus_1_1>& /* currentPortStatus */,
+ Status /* retval */) override {
+ return Void();
+ }
+
+ // This callback method should be used.
+ Return<void> notifyPortStatusChange_1_2(const hidl_vec<PortStatus>& currentPortStatus,
+ Status retval) override {
+ UsbClientCallbackArgs arg;
+ if (retval == Status::SUCCESS) {
+ arg.usb_last_port_status.status_1_1.status.supportedModes =
+ currentPortStatus[0].status_1_1.status.supportedModes;
+ arg.usb_last_port_status.status_1_1.status.currentMode =
+ currentPortStatus[0].status_1_1.status.currentMode;
+ arg.usb_last_port_status.status_1_1.status.portName =
+ currentPortStatus[0].status_1_1.status.portName;
+ arg.usb_last_port_status.contaminantDetectionStatus =
+ currentPortStatus[0].contaminantDetectionStatus;
+ arg.usb_last_port_status.contaminantProtectionStatus =
+ currentPortStatus[0].contaminantProtectionStatus;
+ arg.usb_last_port_status.supportsEnableContaminantPresenceProtection =
+ currentPortStatus[0].supportsEnableContaminantPresenceProtection;
+ arg.usb_last_port_status.supportsEnableContaminantPresenceDetection =
+ currentPortStatus[0].supportsEnableContaminantPresenceDetection;
+ arg.usb_last_port_status.supportedContaminantProtectionModes =
+ currentPortStatus[0].supportedContaminantProtectionModes;
+ }
+ arg.usb_last_status = retval;
+ arg.last_usb_cookie = cookie;
+
+ NotifyFromCallback(kCallbackNameNotifyPortStatusChange_1_2, arg);
+ return Void();
+ }
+
+ // Callback method for the status of role switch operation.
+ // RoleSwitch operation has not changed since V1_0 so leaving
+ // the callback blank here.
+ Return<void> notifyRoleSwitchStatus(const hidl_string& /*portName*/,
+ const PortRole& /*newRole*/, Status /*retval*/) override {
+ return Void();
+ };
+};
+
+// Test environment for Usb HIDL HAL.
+class UsbHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static UsbHidlEnvironment* Instance() {
+ static UsbHidlEnvironment* instance = new UsbHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IUsb>(); }
+};
+
+// The main test class for the USB hidl HAL
+class UsbHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ virtual void SetUp() override {
+ ALOGI(__FUNCTION__);
+ usb = ::testing::VtsHalHidlTargetTestBase::getService<IUsb>();
+ ASSERT_NE(usb, nullptr);
+
+ usb_cb_2 = new UsbCallback(kCallbackIdentifier);
+ ASSERT_NE(usb_cb_2, nullptr);
+ usb_cb_2->SetWaitTimeout(kCallbackNameNotifyPortStatusChange_1_2, WAIT_FOR_TIMEOUT);
+ Return<void> ret = usb->setCallback(usb_cb_2);
+ ASSERT_TRUE(ret.isOk());
+ }
+
+ virtual void TearDown() override { ALOGI("Teardown"); }
+
+ // USB hidl hal Proxy
+ sp<IUsb> usb;
+
+ // Callback objects for usb hidl
+ // Methods of these objects are called to notify port status updates.
+ sp<UsbCallback> usb_cb_1;
+ sp<UsbCallback> usb_cb_2;
+};
+
+/*
+ * Test to see if setCallback on V1_1 callback object succeeds.
+ * Callback oject is created and registered.
+ * Check to see if the hidl transaction succeeded.
+ */
+TEST_F(UsbHidlTest, setCallback) {
+ usb_cb_1 = new UsbCallback(1);
+ ASSERT_NE(usb_cb_1, nullptr);
+ Return<void> ret = usb->setCallback(usb_cb_1);
+ ASSERT_TRUE(ret.isOk());
+}
+
+/*
+ * Check to see if querying type-c
+ * port status succeeds.
+ * HAL service should call notifyPortStatusChange_1_2
+ * instead of notifyPortStatusChange of V1_0/V1_1 interface
+ */
+TEST_F(UsbHidlTest, queryPortStatus) {
+ Return<void> ret = usb->queryPortStatus();
+ ASSERT_TRUE(ret.isOk());
+ auto res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+ EXPECT_TRUE(res.no_timeout);
+ EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+ EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status_1_1.status.currentMode);
+ EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status_1_1.status.supportedModes);
+ EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+}
+
+/*
+ * supportedContaminantProtectionModes is immutable.
+ * Check if supportedContaminantProtectionModes changes across queryPortStatus
+ * call.
+ */
+TEST_F(UsbHidlTest, checkSupportedContaminantProtectionModes) {
+ Return<void> ret = usb->queryPortStatus();
+ ASSERT_TRUE(ret.isOk());
+ auto res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+ EXPECT_TRUE(res.no_timeout);
+ EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+ EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status_1_1.status.currentMode);
+ EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status_1_1.status.supportedModes);
+ EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+
+ uint32_t supportedContaminantProtectionModes = static_cast<uint32_t>(
+ res.args->usb_last_port_status.supportedContaminantProtectionModes);
+ for (int runs = 1; runs <= 10; runs++) {
+ ret = usb->queryPortStatus();
+ ASSERT_TRUE(ret.isOk());
+ res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+ EXPECT_TRUE(res.no_timeout);
+ EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+ EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status_1_1.status.currentMode);
+ EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status_1_1.status.supportedModes);
+ EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+ EXPECT_EQ(supportedContaminantProtectionModes,
+ static_cast<uint32_t>(
+ res.args->usb_last_port_status.supportedContaminantProtectionModes));
+ }
+}
+
+/*
+ * When supportsEnableContaminantPresenceDetection is set false,
+ * enableContaminantPresenceDetection should not enable/disable
+ * contaminantPresenceProtection.
+ */
+TEST_F(UsbHidlTest, presenceDetectionSupportedCheck) {
+ Return<void> ret = usb->queryPortStatus();
+ ASSERT_TRUE(ret.isOk());
+ auto res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+ EXPECT_TRUE(res.no_timeout);
+ EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+ EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+
+ if (!res.args->usb_last_port_status.supportsEnableContaminantPresenceDetection) {
+ for (int runs = 1; runs <= 10; runs++) {
+ bool currentStatus = !(res.args->usb_last_port_status.contaminantDetectionStatus ==
+ ContaminantDetectionStatus::DISABLED);
+
+ ret = usb->enableContaminantPresenceDetection(
+ res.args->usb_last_port_status.status_1_1.status.portName, !currentStatus);
+ ASSERT_TRUE(ret.isOk());
+
+ res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+ EXPECT_TRUE(res.no_timeout);
+ EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+ EXPECT_EQ(currentStatus, !(res.args->usb_last_port_status.contaminantDetectionStatus ==
+ ContaminantDetectionStatus::DISABLED));
+ }
+ }
+}
+
+/*
+ * enableContaminantPresenceDetection should succeed atleast 90% when supported.
+ */
+TEST_F(UsbHidlTest, contaminantPresenceDetectionStability) {
+ int successCount = 0;
+ bool currentStatus;
+ bool supported = true;
+
+ Return<void> ret = usb->queryPortStatus();
+ ASSERT_TRUE(ret.isOk());
+ auto res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+ EXPECT_TRUE(res.no_timeout);
+ EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+ EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+
+ if (!res.args->usb_last_port_status.supportsEnableContaminantPresenceDetection) return;
+
+ for (int count = 1; count <= 10; count++) {
+ currentStatus = !(res.args->usb_last_port_status.contaminantDetectionStatus ==
+ ContaminantDetectionStatus::DISABLED);
+
+ ret = usb->enableContaminantPresenceDetection(
+ res.args->usb_last_port_status.status_1_1.status.portName, !currentStatus);
+ ASSERT_TRUE(ret.isOk());
+ res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+ EXPECT_TRUE(res.no_timeout);
+ EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+ if (!currentStatus == !(res.args->usb_last_port_status.contaminantDetectionStatus ==
+ ContaminantDetectionStatus::DISABLED))
+ successCount++;
+ }
+
+ if (!supported) EXPECT_GE(successCount, 9);
+}
+
+/*
+ * When supportsEnableContaminantPresenceProtection is set false,
+ * enableContaminantPresenceProtection should not enable/disable
+ * contaminantPresenceProtection.
+ */
+TEST_F(UsbHidlTest, presenceProtectionSupportedCheck) {
+ Return<void> ret = usb->queryPortStatus();
+ ASSERT_TRUE(ret.isOk());
+ auto res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+ EXPECT_TRUE(res.no_timeout);
+ EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+ EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+
+ if (!res.args->usb_last_port_status.supportsEnableContaminantPresenceProtection) {
+ for (int runs = 1; runs <= 10; runs++) {
+ bool currentStatus = !(res.args->usb_last_port_status.contaminantProtectionStatus ==
+ ContaminantProtectionStatus::DISABLED);
+
+ ret = usb->enableContaminantPresenceProtection(
+ res.args->usb_last_port_status.status_1_1.status.portName, !currentStatus);
+ ASSERT_TRUE(ret.isOk());
+
+ res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+ EXPECT_TRUE(res.no_timeout);
+ EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+ EXPECT_EQ(currentStatus, !(res.args->usb_last_port_status.contaminantProtectionStatus ==
+ ContaminantProtectionStatus::DISABLED));
+ }
+ }
+}
+
+/*
+ * enableContaminantPresenceProtection should succeed atleast 90% when supported.
+ */
+TEST_F(UsbHidlTest, contaminantPresenceProtectionStability) {
+ int successCount = 0;
+ bool currentStatus;
+ bool supported = true;
+
+ Return<void> ret = usb->queryPortStatus();
+ ASSERT_TRUE(ret.isOk());
+ auto res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+ EXPECT_TRUE(res.no_timeout);
+ EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+ EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+
+ if (!res.args->usb_last_port_status.supportsEnableContaminantPresenceProtection) return;
+
+ for (int count = 1; count <= 10; count++) {
+ currentStatus = !(res.args->usb_last_port_status.contaminantProtectionStatus ==
+ ContaminantProtectionStatus::DISABLED);
+
+ ret = usb->enableContaminantPresenceProtection(
+ res.args->usb_last_port_status.status_1_1.status.portName, !currentStatus);
+ ASSERT_TRUE(ret.isOk());
+ res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+ EXPECT_TRUE(res.no_timeout);
+ EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+ if (!currentStatus == !(res.args->usb_last_port_status.contaminantProtectionStatus ==
+ ContaminantProtectionStatus::DISABLED))
+ successCount++;
+ }
+
+ if (!supported) EXPECT_GE(successCount, 9);
+}
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(UsbHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ UsbHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ return status;
+}
diff --git a/vibrator/1.3/Android.bp b/vibrator/1.3/Android.bp
new file mode 100644
index 0000000..28370d6
--- /dev/null
+++ b/vibrator/1.3/Android.bp
@@ -0,0 +1,20 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.vibrator@1.3",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "IVibrator.hal",
+ ],
+ interfaces: [
+ "android.hardware.vibrator@1.0",
+ "android.hardware.vibrator@1.1",
+ "android.hardware.vibrator@1.2",
+ "android.hidl.base@1.0",
+ ],
+ gen_java: true,
+}
+
diff --git a/vibrator/1.3/IVibrator.hal b/vibrator/1.3/IVibrator.hal
new file mode 100644
index 0000000..01c2801
--- /dev/null
+++ b/vibrator/1.3/IVibrator.hal
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.vibrator@1.3;
+
+import @1.0::Status;
+import @1.2::IVibrator;
+
+interface IVibrator extends @1.2::IVibrator {
+ /**
+ * Returns whether the vibrator supports control through an alternate interface.
+ */
+ supportsExternalControl() generates (bool supports);
+
+ /**
+ * Enables/disables control override of vibrator to audio.
+ *
+ * When this API is set, the vibrator control should be ceded to audio system
+ * for haptic audio. While this is enabled, issuing of other commands to control
+ * the vibrator is unsupported and the resulting behavior is undefined. Amplitude
+ * control may or may not be supported and is reflected in the return value of
+ * supportsAmplitudeControl() while this is enabled. When this is disabled, the
+ * vibrator should resume to an off state.
+ *
+ * @param enabled Whether external control should be enabled or disabled.
+ * @return status Whether the command was successful or not. Must return
+ * Status::UNSUPPORTED_OPERATION if external control is
+ * not supported by the device.
+ */
+ setExternalControl(bool enabled) generates (Status status);
+};
diff --git a/vibrator/1.3/vts/functional/Android.bp b/vibrator/1.3/vts/functional/Android.bp
new file mode 100644
index 0000000..5b4c893
--- /dev/null
+++ b/vibrator/1.3/vts/functional/Android.bp
@@ -0,0 +1,29 @@
+//
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+ name: "VtsHalVibratorV1_3TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: ["VtsHalVibratorV1_3TargetTest.cpp"],
+ static_libs: [
+ "android.hardware.vibrator@1.0",
+ "android.hardware.vibrator@1.1",
+ "android.hardware.vibrator@1.2",
+ "android.hardware.vibrator@1.3",
+ ],
+ test_suites: ["general-tests"],
+}
+
diff --git a/vibrator/1.3/vts/functional/VtsHalVibratorV1_3TargetTest.cpp b/vibrator/1.3/vts/functional/VtsHalVibratorV1_3TargetTest.cpp
new file mode 100644
index 0000000..a67d1dc
--- /dev/null
+++ b/vibrator/1.3/vts/functional/VtsHalVibratorV1_3TargetTest.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "vibrator_hidl_hal_test"
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+#include <android-base/logging.h>
+#include <android/hardware/vibrator/1.0/types.h>
+#include <android/hardware/vibrator/1.3/IVibrator.h>
+#include <unistd.h>
+
+using ::android::sp;
+using ::android::hardware::vibrator::V1_0::Status;
+using ::android::hardware::vibrator::V1_3::IVibrator;
+
+// Test environment for Vibrator HIDL HAL.
+class VibratorHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static VibratorHidlEnvironment* Instance() {
+ static VibratorHidlEnvironment* instance = new VibratorHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IVibrator>(); }
+
+ private:
+ VibratorHidlEnvironment() {}
+};
+
+// The main test class for VIBRATOR HIDL HAL 1.3.
+class VibratorHidlTest_1_3 : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ virtual void SetUp() override {
+ vibrator = ::testing::VtsHalHidlTargetTestBase::getService<IVibrator>(
+ VibratorHidlEnvironment::Instance()->getServiceName<IVibrator>());
+ ASSERT_NE(vibrator, nullptr);
+ }
+
+ virtual void TearDown() override {}
+
+ sp<IVibrator> vibrator;
+};
+
+TEST_F(VibratorHidlTest_1_3, ChangeVibrationalExternalControl) {
+ if (vibrator->supportsExternalControl()) {
+ EXPECT_EQ(Status::OK, vibrator->setExternalControl(true));
+ sleep(1);
+ EXPECT_EQ(Status::OK, vibrator->setExternalControl(false));
+ sleep(1);
+ }
+}
+
+TEST_F(VibratorHidlTest_1_3, SetExternalControlReturnUnsupportedOperationIfNotSupported) {
+ if (!vibrator->supportsExternalControl()) {
+ EXPECT_EQ(Status::UNSUPPORTED_OPERATION, vibrator->setExternalControl(true));
+ }
+}
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(VibratorHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ VibratorHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
+}
diff --git a/wifi/1.0/vts/functional/Android.bp b/wifi/1.0/vts/functional/Android.bp
index 3189db4..397ad17 100644
--- a/wifi/1.0/vts/functional/Android.bp
+++ b/wifi/1.0/vts/functional/Android.bp
@@ -45,6 +45,7 @@
static_libs: [
"VtsHalWifiV1_0TargetTestUtil",
"android.hardware.wifi@1.0",
+ "android.hardware.wifi@1.1",
"android.hardware.wifi@1.2",
"android.hardware.wifi@1.3",
],
diff --git a/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp
index a3fdf27..3555c2e 100644
--- a/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp
+++ b/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp
@@ -17,6 +17,7 @@
#include <android-base/logging.h>
#include <android/hardware/wifi/1.0/IWifiChip.h>
+#include <android/hardware/wifi/1.3/IWifiChip.h>
#include <VtsHalHidlTargetTestBase.h>
@@ -87,7 +88,19 @@
uint32_t configureChipForStaIfaceAndGetCapabilities() {
configureChipForIfaceType(IfaceType::STA, true);
- const auto& status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities);
+
+ sp<::android::hardware::wifi::V1_3::IWifiChip> chip_converted =
+ ::android::hardware::wifi::V1_3::IWifiChip::castFrom(wifi_chip_);
+
+ std::pair<WifiStatus, uint32_t> status_and_caps;
+
+ if (chip_converted != nullptr) {
+ // Call the newer HAL version
+ status_and_caps = HIDL_INVOKE(chip_converted, getCapabilities_1_3);
+ } else {
+ status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities);
+ }
+
if (status_and_caps.first.code != WifiStatusCode::SUCCESS) {
EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED, status_and_caps.first.code);
return 0;
diff --git a/wifi/1.1/vts/functional/Android.bp b/wifi/1.1/vts/functional/Android.bp
index 78d7a85..6662314 100644
--- a/wifi/1.1/vts/functional/Android.bp
+++ b/wifi/1.1/vts/functional/Android.bp
@@ -24,6 +24,8 @@
"VtsHalWifiV1_0TargetTestUtil",
"android.hardware.wifi@1.0",
"android.hardware.wifi@1.1",
+ "android.hardware.wifi@1.2",
+ "android.hardware.wifi@1.3",
],
test_suites: ["general-tests"],
}
diff --git a/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
index d3a983c..6323547 100644
--- a/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
+++ b/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
@@ -18,6 +18,7 @@
#include <android/hardware/wifi/1.1/IWifi.h>
#include <android/hardware/wifi/1.1/IWifiChip.h>
+#include <android/hardware/wifi/1.3/IWifiChip.h>
#include <VtsHalHidlTargetTestBase.h>
@@ -58,7 +59,19 @@
ChipModeId mode_id;
EXPECT_TRUE(configureChipToSupportIfaceType(
wifi_chip_, IfaceType::STA, &mode_id));
- const auto& status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities);
+
+ sp<::android::hardware::wifi::V1_3::IWifiChip> chip_converted =
+ ::android::hardware::wifi::V1_3::IWifiChip::castFrom(wifi_chip_);
+
+ std::pair<WifiStatus, uint32_t> status_and_caps;
+
+ if (chip_converted != nullptr) {
+ // Call the newer HAL version
+ status_and_caps = HIDL_INVOKE(chip_converted, getCapabilities_1_3);
+ } else {
+ status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities);
+ }
+
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code);
return status_and_caps.second;
}
diff --git a/wifi/1.2/vts/functional/Android.bp b/wifi/1.2/vts/functional/Android.bp
index a969f65..b2956ce 100644
--- a/wifi/1.2/vts/functional/Android.bp
+++ b/wifi/1.2/vts/functional/Android.bp
@@ -27,6 +27,7 @@
"android.hardware.wifi@1.0",
"android.hardware.wifi@1.1",
"android.hardware.wifi@1.2",
+ "android.hardware.wifi@1.3",
],
test_suites: ["general-tests"],
}
diff --git a/wifi/1.2/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.2/vts/functional/wifi_chip_hidl_test.cpp
index a5457b7..9d567fe 100644
--- a/wifi/1.2/vts/functional/wifi_chip_hidl_test.cpp
+++ b/wifi/1.2/vts/functional/wifi_chip_hidl_test.cpp
@@ -18,6 +18,7 @@
#include <android/hardware/wifi/1.2/IWifiChip.h>
#include <android/hardware/wifi/1.2/IWifiChipEventCallback.h>
+#include <android/hardware/wifi/1.3/IWifiChip.h>
#include <VtsHalHidlTargetCallbackBase.h>
#include <VtsHalHidlTargetTestBase.h>
@@ -104,7 +105,19 @@
ChipModeId mode_id;
EXPECT_TRUE(
configureChipToSupportIfaceType(wifi_chip_, IfaceType::STA, &mode_id));
- const auto& status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities);
+
+ sp<::android::hardware::wifi::V1_3::IWifiChip> chip_converted =
+ ::android::hardware::wifi::V1_3::IWifiChip::castFrom(wifi_chip_);
+
+ std::pair<WifiStatus, uint32_t> status_and_caps;
+
+ if (chip_converted != nullptr) {
+ // Call the newer HAL version
+ status_and_caps = HIDL_INVOKE(chip_converted, getCapabilities_1_3);
+ } else {
+ status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities);
+ }
+
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code);
return status_and_caps.second;
}
diff --git a/wifi/1.3/IWifiChip.hal b/wifi/1.3/IWifiChip.hal
index be00ee5..fc6dbac 100644
--- a/wifi/1.3/IWifiChip.hal
+++ b/wifi/1.3/IWifiChip.hal
@@ -31,7 +31,12 @@
/**
* Set Latency Mode.
*/
- SET_LATENCY_MODE = 1 << 12
+ SET_LATENCY_MODE = 1 << 12,
+
+ /**
+ * Support P2P MAC randomization
+ */
+ P2P_RAND_MAC = 1 << 13
};
/**
diff --git a/wifi/1.3/default/hidl_struct_util.cpp b/wifi/1.3/default/hidl_struct_util.cpp
index a24d048..49c1477 100644
--- a/wifi/1.3/default/hidl_struct_util.cpp
+++ b/wifi/1.3/default/hidl_struct_util.cpp
@@ -83,6 +83,8 @@
return HidlChipCaps::D2AP_RTT;
case WIFI_FEATURE_SET_LATENCY_MODE:
return HidlChipCaps::SET_LATENCY_MODE;
+ case WIFI_FEATURE_P2P_RAND_MAC:
+ return HidlChipCaps::P2P_RAND_MAC;
};
CHECK(false) << "Unknown legacy feature: " << feature;
return {};
@@ -141,14 +143,18 @@
convertLegacyLoggerFeatureToHidlChipCapability(feature);
}
}
- for (const auto feature :
- {WIFI_FEATURE_SET_TX_POWER_LIMIT, WIFI_FEATURE_USE_BODY_HEAD_SAR,
- WIFI_FEATURE_D2D_RTT, WIFI_FEATURE_D2AP_RTT,
- WIFI_FEATURE_SET_LATENCY_MODE}) {
+ std::vector<uint32_t> features = {WIFI_FEATURE_SET_TX_POWER_LIMIT,
+ WIFI_FEATURE_USE_BODY_HEAD_SAR,
+ WIFI_FEATURE_D2D_RTT,
+ WIFI_FEATURE_D2AP_RTT,
+ WIFI_FEATURE_SET_LATENCY_MODE,
+ WIFI_FEATURE_P2P_RAND_MAC};
+ for (const auto feature : features) {
if (feature & legacy_feature_set) {
*hidl_caps |= convertLegacyFeatureToHidlChipCapability(feature);
}
}
+
// There are no flags for these 3 in the legacy feature set. Adding them to
// the set because all the current devices support it.
*hidl_caps |= HidlChipCaps::DEBUG_RING_BUFFER_VENDOR_DATA;
@@ -1253,6 +1259,10 @@
hidl_request.debugConfigs
.useSdfInBandVal[(size_t)NanBandIndex::NAN_BAND_5GHZ];
+ // disable NANv3 NDPe
+ legacy_request->config_ndpe_attr = 1;
+ legacy_request->use_ndpe_attr = 0;
+
return true;
}
@@ -1764,6 +1774,10 @@
hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ]
.discoveryWindowIntervalVal;
+ // disable NANv3 NDPe
+ legacy_request->config_ndpe_attr = 1;
+ legacy_request->use_ndpe_attr = 0;
+
return true;
}
diff --git a/wifi/1.3/default/tests/wifi_chip_unit_tests.cpp b/wifi/1.3/default/tests/wifi_chip_unit_tests.cpp
index 32ba760..3fcc39e 100644
--- a/wifi/1.3/default/tests/wifi_chip_unit_tests.cpp
+++ b/wifi/1.3/default/tests/wifi_chip_unit_tests.cpp
@@ -16,6 +16,7 @@
#include <android-base/logging.h>
#include <android-base/macros.h>
+#include <cutils/properties.h>
#include <gmock/gmock.h>
#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38
@@ -117,6 +118,19 @@
.WillRepeatedly(testing::Return(modes));
}
+ void setup_MultiIfaceCombination() {
+ // clang-format off
+ const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinations = {
+ {{{{IfaceType::STA}, 3}}}
+ };
+ const std::vector<V1_0::IWifiChip::ChipMode> modes = {
+ {feature_flags::chip_mode_ids::kV3, combinations}
+ };
+ // clang-format on
+ EXPECT_CALL(*feature_flags_, getChipModes())
+ .WillRepeatedly(testing::Return(modes));
+ }
+
void assertNumberOfModes(uint32_t num_modes) {
chip_->getAvailableModes(
[num_modes](const WifiStatus& status,
@@ -655,6 +669,58 @@
ASSERT_TRUE(createIface(IfaceType::AP).empty());
}
+class WifiChip_MultiIfaceTest : public WifiChipTest {
+ public:
+ void SetUp() override {
+ setup_MultiIfaceCombination();
+ WifiChipTest::SetUp();
+ }
+};
+
+TEST_F(WifiChip_MultiIfaceTest, Create3Sta) {
+ findModeAndConfigureForIfaceType(IfaceType::STA);
+ ASSERT_FALSE(createIface(IfaceType::STA).empty());
+ ASSERT_FALSE(createIface(IfaceType::STA).empty());
+ ASSERT_FALSE(createIface(IfaceType::STA).empty());
+ ASSERT_TRUE(createIface(IfaceType::STA).empty());
+}
+
+TEST_F(WifiChip_MultiIfaceTest, CreateStaWithDefaultNames) {
+ property_set("wifi.interface.0", "");
+ property_set("wifi.interface.1", "");
+ property_set("wifi.interface.2", "");
+ property_set("wifi.interface", "");
+ property_set("wifi.concurrent.interface", "");
+ findModeAndConfigureForIfaceType(IfaceType::STA);
+ ASSERT_EQ(createIface(IfaceType::STA), "wlan0");
+ ASSERT_EQ(createIface(IfaceType::STA), "wlan1");
+ ASSERT_EQ(createIface(IfaceType::STA), "wlan2");
+}
+
+TEST_F(WifiChip_MultiIfaceTest, CreateStaWithCustomNames) {
+ property_set("wifi.interface.0", "test0");
+ property_set("wifi.interface.1", "test1");
+ property_set("wifi.interface.2", "test2");
+ property_set("wifi.interface", "bad0");
+ property_set("wifi.concurrent.interface", "bad1");
+ findModeAndConfigureForIfaceType(IfaceType::STA);
+ ASSERT_EQ(createIface(IfaceType::STA), "test0");
+ ASSERT_EQ(createIface(IfaceType::STA), "test1");
+ ASSERT_EQ(createIface(IfaceType::STA), "test2");
+}
+
+TEST_F(WifiChip_MultiIfaceTest, CreateStaWithCustomAltNames) {
+ property_set("wifi.interface.0", "");
+ property_set("wifi.interface.1", "");
+ property_set("wifi.interface.2", "");
+ property_set("wifi.interface", "testA0");
+ property_set("wifi.concurrent.interface", "testA1");
+ findModeAndConfigureForIfaceType(IfaceType::STA);
+ ASSERT_EQ(createIface(IfaceType::STA), "testA0");
+ ASSERT_EQ(createIface(IfaceType::STA), "testA1");
+ ASSERT_EQ(createIface(IfaceType::STA), "wlan2");
+}
+
} // namespace implementation
} // namespace V1_3
} // namespace wifi
diff --git a/wifi/1.3/default/wifi_chip.cpp b/wifi/1.3/default/wifi_chip.cpp
index 1f1aa95..e7ebc3b 100644
--- a/wifi/1.3/default/wifi_chip.cpp
+++ b/wifi/1.3/default/wifi_chip.cpp
@@ -41,6 +41,7 @@
constexpr uint32_t kMaxRingBufferFileAgeSeconds = 60 * 60 * 10;
constexpr uint32_t kMaxRingBufferFileNum = 20;
constexpr char kTombstoneFolderPath[] = "/data/vendor/tombstones/wifi/";
+constexpr unsigned kMaxWlanIfaces = 100;
template <typename Iface>
void invalidateAndClear(std::vector<sp<Iface>>& ifaces, sp<Iface> iface) {
@@ -78,16 +79,25 @@
return nullptr;
}
-std::string getWlan0IfaceName() {
- std::array<char, PROPERTY_VALUE_MAX> buffer;
- property_get("wifi.interface", buffer.data(), "wlan0");
- return buffer.data();
-}
+std::string getWlanIfaceName(unsigned idx) {
+ if (idx >= kMaxWlanIfaces) {
+ CHECK(false) << "Requested interface beyond wlan" << kMaxWlanIfaces;
+ return {};
+ }
-std::string getWlan1IfaceName() {
std::array<char, PROPERTY_VALUE_MAX> buffer;
- property_get("wifi.concurrent.interface", buffer.data(), "wlan1");
- return buffer.data();
+ std::string propName = "wifi.interface." + std::to_string(idx);
+ auto res = property_get(propName.c_str(), buffer.data(), nullptr);
+ if (res > 0) return buffer.data();
+
+ if (idx == 0 || idx == 1) {
+ const char* altPropName =
+ (idx == 0) ? "wifi.interface" : "wifi.concurrent.interface";
+ res = property_get(altPropName, buffer.data(), nullptr);
+ if (res > 0) return buffer.data();
+ }
+
+ return "wlan" + std::to_string(idx);
}
std::string getP2pIfaceName() {
@@ -636,13 +646,14 @@
legacy_hal::wifi_error legacy_status;
uint32_t legacy_feature_set;
uint32_t legacy_logger_feature_set;
+ const auto ifname = getWlanIfaceName(0);
std::tie(legacy_status, legacy_feature_set) =
- legacy_hal_.lock()->getSupportedFeatureSet(getWlan0IfaceName());
+ legacy_hal_.lock()->getSupportedFeatureSet(ifname);
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
return {createWifiStatusFromLegacyError(legacy_status), 0};
}
std::tie(legacy_status, legacy_logger_feature_set) =
- legacy_hal_.lock()->getLoggerSupportedFeatureSet(getWlan0IfaceName());
+ legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname);
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
// some devices don't support querying logger feature set
legacy_logger_feature_set = 0;
@@ -703,8 +714,9 @@
IWifiChip::ChipDebugInfo result;
legacy_hal::wifi_error legacy_status;
std::string driver_desc;
+ const auto ifname = getWlanIfaceName(0);
std::tie(legacy_status, driver_desc) =
- legacy_hal_.lock()->getDriverVersion(getWlan0IfaceName());
+ legacy_hal_.lock()->getDriverVersion(ifname);
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get driver version: "
<< legacyErrorToString(legacy_status);
@@ -716,7 +728,7 @@
std::string firmware_desc;
std::tie(legacy_status, firmware_desc) =
- legacy_hal_.lock()->getFirmwareVersion(getWlan0IfaceName());
+ legacy_hal_.lock()->getFirmwareVersion(ifname);
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get firmware version: "
<< legacyErrorToString(legacy_status);
@@ -734,7 +746,7 @@
legacy_hal::wifi_error legacy_status;
std::vector<uint8_t> driver_dump;
std::tie(legacy_status, driver_dump) =
- legacy_hal_.lock()->requestDriverMemoryDump(getWlan0IfaceName());
+ legacy_hal_.lock()->requestDriverMemoryDump(getWlanIfaceName(0));
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get driver debug dump: "
<< legacyErrorToString(legacy_status);
@@ -749,7 +761,7 @@
legacy_hal::wifi_error legacy_status;
std::vector<uint8_t> firmware_dump;
std::tie(legacy_status, firmware_dump) =
- legacy_hal_.lock()->requestFirmwareMemoryDump(getWlan0IfaceName());
+ legacy_hal_.lock()->requestFirmwareMemoryDump(getWlanIfaceName(0));
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get firmware debug dump: "
<< legacyErrorToString(legacy_status);
@@ -809,7 +821,7 @@
return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
}
// These are still assumed to be based on wlan0.
- std::string ifname = getWlan0IfaceName();
+ std::string ifname = getWlanIfaceName(0);
sp<WifiNanIface> iface = new WifiNanIface(ifname, legacy_hal_);
nan_ifaces_.push_back(iface);
for (const auto& callback : event_cb_handler_.getCallbacks()) {
@@ -952,7 +964,7 @@
return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
}
sp<WifiRttController> rtt =
- new WifiRttController(getWlan0IfaceName(), bound_iface, legacy_hal_);
+ new WifiRttController(getWlanIfaceName(0), bound_iface, legacy_hal_);
rtt_controllers_.emplace_back(rtt);
return {createWifiStatus(WifiStatusCode::SUCCESS), rtt};
}
@@ -963,7 +975,7 @@
std::vector<legacy_hal::wifi_ring_buffer_status>
legacy_ring_buffer_status_vec;
std::tie(legacy_status, legacy_ring_buffer_status_vec) =
- legacy_hal_.lock()->getRingBuffersStatus(getWlan0IfaceName());
+ legacy_hal_.lock()->getRingBuffersStatus(getWlanIfaceName(0));
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
return {createWifiStatusFromLegacyError(legacy_status), {}};
}
@@ -985,7 +997,7 @@
}
legacy_hal::wifi_error legacy_status =
legacy_hal_.lock()->startRingBufferLogging(
- getWlan0IfaceName(), ring_name,
+ getWlanIfaceName(0), ring_name,
static_cast<
std::underlying_type<WifiDebugRingBufferVerboseLevel>::type>(
verbose_level),
@@ -1002,7 +1014,7 @@
return status;
}
legacy_hal::wifi_error legacy_status =
- legacy_hal_.lock()->getRingBufferData(getWlan0IfaceName(), ring_name);
+ legacy_hal_.lock()->getRingBufferData(getWlanIfaceName(0), ring_name);
return createWifiStatusFromLegacyError(legacy_status);
}
@@ -1018,7 +1030,7 @@
WifiStatus WifiChip::stopLoggingToDebugRingBufferInternal() {
legacy_hal::wifi_error legacy_status =
legacy_hal_.lock()->deregisterRingBufferCallbackHandler(
- getWlan0IfaceName());
+ getWlanIfaceName(0));
return createWifiStatusFromLegacyError(legacy_status);
}
@@ -1027,7 +1039,7 @@
legacy_hal::wifi_error legacy_status;
legacy_hal::WakeReasonStats legacy_stats;
std::tie(legacy_status, legacy_stats) =
- legacy_hal_.lock()->getWakeReasonStats(getWlan0IfaceName());
+ legacy_hal_.lock()->getWakeReasonStats(getWlanIfaceName(0));
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
return {createWifiStatusFromLegacyError(legacy_status), {}};
}
@@ -1059,10 +1071,10 @@
}
};
legacy_status = legacy_hal_.lock()->registerErrorAlertCallbackHandler(
- getWlan0IfaceName(), on_alert_callback);
+ getWlanIfaceName(0), on_alert_callback);
} else {
legacy_status = legacy_hal_.lock()->deregisterErrorAlertCallbackHandler(
- getWlan0IfaceName());
+ getWlanIfaceName(0));
}
return createWifiStatusFromLegacyError(legacy_status);
}
@@ -1070,20 +1082,20 @@
WifiStatus WifiChip::selectTxPowerScenarioInternal(
V1_1::IWifiChip::TxPowerScenario scenario) {
auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario(
- getWlan0IfaceName(),
+ getWlanIfaceName(0),
hidl_struct_util::convertHidlTxPowerScenarioToLegacy(scenario));
return createWifiStatusFromLegacyError(legacy_status);
}
WifiStatus WifiChip::resetTxPowerScenarioInternal() {
auto legacy_status =
- legacy_hal_.lock()->resetTxPowerScenario(getWlan0IfaceName());
+ legacy_hal_.lock()->resetTxPowerScenario(getWlanIfaceName(0));
return createWifiStatusFromLegacyError(legacy_status);
}
WifiStatus WifiChip::setLatencyModeInternal(LatencyMode mode) {
auto legacy_status = legacy_hal_.lock()->setLatencyMode(
- getWlan0IfaceName(),
+ getWlanIfaceName(0),
hidl_struct_util::convertHidlLatencyModeToLegacy(mode));
return createWifiStatusFromLegacyError(legacy_status);
}
@@ -1099,7 +1111,7 @@
WifiStatus WifiChip::selectTxPowerScenarioInternal_1_2(
TxPowerScenario scenario) {
auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario(
- getWlan0IfaceName(),
+ getWlanIfaceName(0),
hidl_struct_util::convertHidlTxPowerScenarioToLegacy_1_2(scenario));
return createWifiStatusFromLegacyError(legacy_status);
}
@@ -1179,7 +1191,7 @@
};
legacy_hal::wifi_error legacy_status =
legacy_hal_.lock()->registerRingBufferCallbackHandler(
- getWlan0IfaceName(), on_ring_buffer_data_callback);
+ getWlanIfaceName(0), on_ring_buffer_data_callback);
if (legacy_status == legacy_hal::WIFI_SUCCESS) {
debug_ring_buffer_cb_registered_ = true;
@@ -1213,7 +1225,7 @@
};
legacy_hal::wifi_error legacy_status =
legacy_hal_.lock()->registerRadioModeChangeCallbackHandler(
- getWlan0IfaceName(), on_radio_mode_change_callback);
+ getWlanIfaceName(0), on_radio_mode_change_callback);
return createWifiStatusFromLegacyError(legacy_status);
}
@@ -1330,22 +1342,17 @@
return false;
}
-// Return "wlan0", if "wlan0" is not already in use, else return "wlan1".
-// This is based on the assumption that we'll have a max of 2 concurrent
-// AP/STA ifaces.
+// Return the first wlan (wlan0, wlan1 etc.) not already in use.
+// This doesn't check the actual presence of these interfaces.
std::string WifiChip::allocateApOrStaIfaceName() {
- auto ap_iface = findUsingName(ap_ifaces_, getWlan0IfaceName());
- auto sta_iface = findUsingName(sta_ifaces_, getWlan0IfaceName());
- if (!ap_iface.get() && !sta_iface.get()) {
- return getWlan0IfaceName();
- }
- ap_iface = findUsingName(ap_ifaces_, getWlan1IfaceName());
- sta_iface = findUsingName(sta_ifaces_, getWlan1IfaceName());
- if (!ap_iface.get() && !sta_iface.get()) {
- return getWlan1IfaceName();
+ for (unsigned i = 0; i < kMaxWlanIfaces; i++) {
+ const auto ifname = getWlanIfaceName(i);
+ if (findUsingName(ap_ifaces_, ifname)) continue;
+ if (findUsingName(sta_ifaces_, ifname)) continue;
+ return ifname;
}
// This should never happen. We screwed up somewhere if it did.
- CHECK(0) << "wlan0 and wlan1 in use already!";
+ CHECK(false) << "All wlan interfaces in use already!";
return {};
}
diff --git a/wifi/1.3/vts/functional/wifi_sta_iface_hidl_test.cpp b/wifi/1.3/vts/functional/wifi_sta_iface_hidl_test.cpp
index e195ade..71e90ac 100644
--- a/wifi/1.3/vts/functional/wifi_sta_iface_hidl_test.cpp
+++ b/wifi/1.3/vts/functional/wifi_sta_iface_hidl_test.cpp
@@ -43,6 +43,13 @@
virtual void TearDown() override { stopWifi(); }
protected:
+ bool isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask cap_mask) {
+ const auto& status_and_caps =
+ HIDL_INVOKE(wifi_sta_iface_, getCapabilities);
+ EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code);
+ return (status_and_caps.second & cap_mask) != 0;
+ }
+
sp<IWifiStaIface> wifi_sta_iface_;
};
@@ -61,3 +68,30 @@
EXPECT_NE(0, status_and_mac.second[i]);
}
}
+
+/*
+ * GetLinkLayerStats_1_3
+ * Ensures that calls to get link layer stats V1_3 will retrieve a non-empty
+ * StaLinkLayerStats after link layer stats collection is enabled.
+ */
+TEST_F(WifiStaIfaceHidlTest, GetLinkLayerStats_1_3) {
+ if (!isCapabilitySupported(
+ IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS)) {
+ // No-op if link layer stats is not supported.
+ return;
+ }
+
+ // Enable link layer stats collection.
+ EXPECT_EQ(WifiStatusCode::SUCCESS,
+ HIDL_INVOKE(wifi_sta_iface_, enableLinkLayerStatsCollection, true)
+ .code);
+ // Retrieve link layer stats.
+ const auto& status_and_stats =
+ HIDL_INVOKE(wifi_sta_iface_, getLinkLayerStats_1_3);
+ EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_stats.first.code);
+ EXPECT_GT(status_and_stats.second.timeStampInMs, 0u);
+ // Disable link layer stats collection.
+ EXPECT_EQ(
+ WifiStatusCode::SUCCESS,
+ HIDL_INVOKE(wifi_sta_iface_, disableLinkLayerStatsCollection).code);
+}
diff --git a/wifi/hostapd/1.0/vts/OWNERS b/wifi/hostapd/1.0/vts/OWNERS
new file mode 100644
index 0000000..8bfb148
--- /dev/null
+++ b/wifi/hostapd/1.0/vts/OWNERS
@@ -0,0 +1,2 @@
+rpius@google.com
+etancohen@google.com
diff --git a/wifi/hostapd/1.0/vts/functional/Android.bp b/wifi/hostapd/1.0/vts/functional/Android.bp
index 79c5183..93867d2 100644
--- a/wifi/hostapd/1.0/vts/functional/Android.bp
+++ b/wifi/hostapd/1.0/vts/functional/Android.bp
@@ -24,6 +24,7 @@
static_libs: [
"VtsHalWifiV1_0TargetTestUtil",
"android.hardware.wifi.hostapd@1.0",
+ "android.hardware.wifi.hostapd@1.1",
"android.hardware.wifi@1.0",
"libcrypto",
"libgmock",
@@ -43,6 +44,7 @@
"VtsHalWifiV1_0TargetTestUtil",
"VtsHalWifiHostapdV1_0TargetTestUtil",
"android.hardware.wifi.hostapd@1.0",
+ "android.hardware.wifi.hostapd@1.1",
"android.hardware.wifi@1.0",
"libcrypto",
"libgmock",
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
index 504f4c8..fa780f9 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
@@ -138,9 +138,11 @@
* Access point creation should pass.
*/
TEST_F(HostapdHidlTest, AddPskAccessPointWithAcs) {
- auto status = HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithAcs(),
- getPskNwParams());
- EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ if (!is_1_1(hostapd_)) {
+ auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
+ getIfaceParamsWithAcs(), getPskNwParams());
+ EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ }
}
/**
@@ -148,9 +150,11 @@
* Access point creation should pass.
*/
TEST_F(HostapdHidlTest, AddOpenAccessPointWithAcs) {
- auto status = HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithAcs(),
- getOpenNwParams());
- EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ if (!is_1_1(hostapd_)) {
+ auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
+ getIfaceParamsWithAcs(), getOpenNwParams());
+ EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ }
}
/**
@@ -158,9 +162,11 @@
* Access point creation should pass.
*/
TEST_F(HostapdHidlTest, AddPskAccessPointWithoutAcs) {
- auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
- getIfaceParamsWithoutAcs(), getPskNwParams());
- EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ if (!is_1_1(hostapd_)) {
+ auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
+ getIfaceParamsWithoutAcs(), getPskNwParams());
+ EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ }
}
/**
@@ -168,9 +174,12 @@
* Access point creation should pass.
*/
TEST_F(HostapdHidlTest, AddOpenAccessPointWithoutAcs) {
- auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
- getIfaceParamsWithoutAcs(), getOpenNwParams());
- EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ if (!is_1_1(hostapd_)) {
+ auto status =
+ HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithoutAcs(),
+ getOpenNwParams());
+ EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ }
}
/**
@@ -178,12 +187,14 @@
* Access point creation & removal should pass.
*/
TEST_F(HostapdHidlTest, RemoveAccessPointWithAcs) {
- auto status = HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithAcs(),
- getPskNwParams());
- EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
- status =
- HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
- EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ if (!is_1_1(hostapd_)) {
+ auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
+ getIfaceParamsWithAcs(), getPskNwParams());
+ EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ status =
+ HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
+ EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ }
}
/**
@@ -191,12 +202,14 @@
* Access point creation & removal should pass.
*/
TEST_F(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
- auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
- getIfaceParamsWithoutAcs(), getPskNwParams());
- EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
- status =
- HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
- EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ if (!is_1_1(hostapd_)) {
+ auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
+ getIfaceParamsWithoutAcs(), getPskNwParams());
+ EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ status =
+ HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
+ EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ }
}
/**
@@ -204,10 +217,12 @@
* Access point creation should fail.
*/
TEST_F(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) {
- auto status =
- HIDL_INVOKE(hostapd_, addAccessPoint,
- getIfaceParamsWithInvalidChannel(), getPskNwParams());
- EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
+ if (!is_1_1(hostapd_)) {
+ auto status =
+ HIDL_INVOKE(hostapd_, addAccessPoint,
+ getIfaceParamsWithInvalidChannel(), getPskNwParams());
+ EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
+ }
}
/**
@@ -215,10 +230,12 @@
* Access point creation should fail.
*/
TEST_F(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) {
- auto status =
- HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithoutAcs(),
- getInvalidPskNwParams());
- EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
+ if (!is_1_1(hostapd_)) {
+ auto status =
+ HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithoutAcs(),
+ getInvalidPskNwParams());
+ EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
+ }
}
/*
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
index e5ba8ef..22dbb52 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
@@ -130,6 +130,12 @@
ASSERT_TRUE(notification_listener->waitForHidlService(200, service_name));
}
+bool is_1_1(const sp<IHostapd>& hostapd) {
+ sp<::android::hardware::wifi::hostapd::V1_1::IHostapd> hostapd_1_1 =
+ ::android::hardware::wifi::hostapd::V1_1::IHostapd::castFrom(hostapd);
+ return hostapd_1_1.get() != nullptr;
+}
+
sp<IHostapd> getHostapd() {
return ::testing::VtsHalHidlTargetTestBase::getService<IHostapd>(
gEnv->getServiceName<IHostapd>());
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
index 1b92477..8e2f1a3 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
@@ -18,6 +18,7 @@
#define HOSTAPD_HIDL_TEST_UTILS_H
#include <android/hardware/wifi/hostapd/1.0/IHostapd.h>
+#include <android/hardware/wifi/hostapd/1.1/IHostapd.h>
#include <VtsHalHidlTargetTestEnvBase.h>
@@ -34,6 +35,8 @@
// These helper functions should be modified to return vectors if we support
// multiple instances.
android::sp<android::hardware::wifi::hostapd::V1_0::IHostapd> getHostapd();
+bool is_1_1(const android::sp<android::hardware::wifi::hostapd::V1_0::IHostapd>&
+ hostapd);
class WifiHostapdHidlEnvironment
: public ::testing::VtsHalHidlTargetTestEnvBase {
diff --git a/wifi/hostapd/1.1/IHostapd.hal b/wifi/hostapd/1.1/IHostapd.hal
index 4e59ffc..c144f6a 100644
--- a/wifi/hostapd/1.1/IHostapd.hal
+++ b/wifi/hostapd/1.1/IHostapd.hal
@@ -26,6 +26,64 @@
*/
interface IHostapd extends @1.0::IHostapd {
/**
+ * Parameters to specify the channel range for ACS.
+ */
+ struct AcsChannelRange {
+ /**
+ * Channel number (IEEE 802.11) at the start of the range.
+ */
+ uint32_t start;
+ /**
+ * Channel number (IEEE 802.11) at the end of the range.
+ */
+ uint32_t end;
+ };
+
+ /**
+ * Parameters to control the channel selection for the interface.
+ */
+ struct ChannelParams {
+ /**
+ * This option can be used to specify the channels selected by ACS.
+ * If this is an empty list, all channels allowed in selected HW mode
+ * are specified implicitly.
+ * Note: channels may be overridden by firmware.
+ * Note: this option is ignored if ACS is disabled.
+ */
+ vec<AcsChannelRange> acsChannelRanges;
+ };
+
+ /**
+ * Parameters to use for setting up the access point interface.
+ */
+ struct IfaceParams {
+ /**
+ * Baseline information as defined in HAL 1.0.
+ */
+ @1.0::IHostapd.IfaceParams V1_0;
+ /** Additional Channel params for the interface */
+ ChannelParams channelParams;
+ };
+
+ /**
+ * Adds a new access point for hostapd to control.
+ *
+ * This should trigger the setup of an access point with the specified
+ * interface and network params.
+ *
+ * @param ifaceParams AccessPoint Params for the access point.
+ * @param nwParams Network Params for the access point.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |HostapdStatusCode.SUCCESS|,
+ * |HostapdStatusCode.FAILURE_ARGS_INVALID|,
+ * |HostapdStatusCode.FAILURE_UNKNOWN|,
+ * |HostapdStatusCode.FAILURE_IFACE_EXISTS|
+ */
+ addAccessPoint_1_1(IfaceParams ifaceParams, NetworkParams nwParams)
+ generates(HostapdStatus status);
+
+ /**
* Register for callbacks from the hostapd service.
*
* These callbacks are invoked for global events that are not specific
diff --git a/wifi/hostapd/1.1/vts/OWNERS b/wifi/hostapd/1.1/vts/OWNERS
new file mode 100644
index 0000000..8bfb148
--- /dev/null
+++ b/wifi/hostapd/1.1/vts/OWNERS
@@ -0,0 +1,2 @@
+rpius@google.com
+etancohen@google.com
diff --git a/wifi/hostapd/1.1/vts/functional/Android.bp b/wifi/hostapd/1.1/vts/functional/Android.bp
new file mode 100644
index 0000000..bbf5246
--- /dev/null
+++ b/wifi/hostapd/1.1/vts/functional/Android.bp
@@ -0,0 +1,58 @@
+//
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "VtsHalWifiHostapdV1_1TargetTestUtil",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: ["hostapd_hidl_test_utils_1_1.cpp"],
+ export_include_dirs: [
+ "."
+ ],
+ static_libs: [
+ "VtsHalWifiV1_0TargetTestUtil",
+ "VtsHalWifiHostapdV1_0TargetTestUtil",
+ "android.hardware.wifi.hostapd@1.0",
+ "android.hardware.wifi.hostapd@1.1",
+ "android.hardware.wifi@1.0",
+ "libcrypto",
+ "libgmock",
+ "libwifi-system",
+ "libwifi-system-iface",
+ ],
+}
+
+cc_test {
+ name: "VtsHalWifiHostapdV1_1TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: [
+ "VtsHalWifiHostapdV1_1TargetTest.cpp",
+ "hostapd_hidl_test.cpp",
+ ],
+ static_libs: [
+ "VtsHalWifiV1_0TargetTestUtil",
+ "VtsHalWifiHostapdV1_0TargetTestUtil",
+ "VtsHalWifiHostapdV1_1TargetTestUtil",
+ "android.hardware.wifi.hostapd@1.0",
+ "android.hardware.wifi.hostapd@1.1",
+ "android.hardware.wifi@1.0",
+ "libcrypto",
+ "libgmock",
+ "libwifi-system",
+ "libwifi-system-iface",
+ ],
+ test_suites: ["general-tests"],
+}
+
diff --git a/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp b/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp
new file mode 100644
index 0000000..6916db2
--- /dev/null
+++ b/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android-base/logging.h>
+#include <android/hardware/wifi/1.0/IWifi.h>
+
+#include "hostapd_hidl_test_utils.h"
+#include "hostapd_hidl_test_utils_1_1.h"
+
+class WifiHostapdHidlEnvironment_1_1 : public WifiHostapdHidlEnvironment {
+ public:
+ // get the test environment singleton
+ static WifiHostapdHidlEnvironment_1_1* Instance() {
+ static WifiHostapdHidlEnvironment_1_1* instance =
+ new WifiHostapdHidlEnvironment_1_1;
+ return instance;
+ }
+
+ virtual void registerTestServices() override {
+ registerTestService<::android::hardware::wifi::V1_0::IWifi>();
+ registerTestService<android::hardware::wifi::hostapd::V1_0::IHostapd>();
+ registerTestService<android::hardware::wifi::hostapd::V1_1::IHostapd>();
+ }
+
+ private:
+ WifiHostapdHidlEnvironment_1_1() {}
+};
+
+WifiHostapdHidlEnvironment* gEnv = WifiHostapdHidlEnvironment_1_1::Instance();
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(gEnv);
+ ::testing::InitGoogleTest(&argc, argv);
+ gEnv->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
+}
diff --git a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp
new file mode 100644
index 0000000..d1af655
--- /dev/null
+++ b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android-base/logging.h>
+#include <cutils/properties.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+#include <android/hardware/wifi/hostapd/1.1/IHostapd.h>
+
+#include "hostapd_hidl_call_util.h"
+#include "hostapd_hidl_test_utils.h"
+#include "hostapd_hidl_test_utils_1_1.h"
+
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::wifi::hostapd::V1_0::HostapdStatus;
+using ::android::hardware::wifi::hostapd::V1_0::HostapdStatusCode;
+using ::android::hardware::wifi::hostapd::V1_1::IHostapd;
+using ::android::hardware::wifi::hostapd::V1_1::IHostapdCallback;
+
+class HostapdHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ virtual void SetUp() override {
+ startHostapdAndWaitForHidlService();
+ hostapd_ = getHostapd_1_1();
+ ASSERT_NE(hostapd_.get(), nullptr);
+ }
+
+ virtual void TearDown() override { stopHostapd(); }
+
+ protected:
+ // IHostapd object used for all tests in this fixture.
+ sp<IHostapd> hostapd_;
+};
+
+class IfaceCallback : public IHostapdCallback {
+ Return<void> onFailure(
+ const hidl_string& /* Name of the interface */) override {
+ return Void();
+ }
+};
+
+/*
+ * RegisterCallback
+ */
+TEST_F(HostapdHidlTest, registerCallback) {
+ hostapd_->registerCallback(
+ new IfaceCallback(), [](const HostapdStatus& status) {
+ EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+ });
+}
diff --git a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.cpp b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.cpp
new file mode 100644
index 0000000..8bb72a1
--- /dev/null
+++ b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <android-base/logging.h>
+
+#include "hostapd_hidl_test_utils.h"
+#include "hostapd_hidl_test_utils_1_1.h"
+
+using ::android::sp;
+using ::android::hardware::wifi::hostapd::V1_1::IHostapd;
+
+sp<IHostapd> getHostapd_1_1() { return IHostapd::castFrom(getHostapd()); }
diff --git a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.h b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.h
new file mode 100644
index 0000000..c43ddfa
--- /dev/null
+++ b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HOSTAPD_HIDL_TEST_UTILS_1_1_H
+#define HOSTAPD_HIDL_TEST_UTILS_1_1_H
+
+#include <android/hardware/wifi/hostapd/1.1/IHostapd.h>
+
+#include <VtsHalHidlTargetTestEnvBase.h>
+
+// Helper functions to obtain references to the various HIDL interface objects.
+// Note: We only have a single instance of each of these objects currently.
+// These helper functions should be modified to return vectors if we support
+// multiple instances.
+android::sp<android::hardware::wifi::hostapd::V1_1::IHostapd> getHostapd_1_1();
+
+#endif /* HOSTAPD_HIDL_TEST_UTILS_1_1_H */
diff --git a/wifi/supplicant/1.2/ISupplicantP2pIface.hal b/wifi/supplicant/1.2/ISupplicantP2pIface.hal
index 7f6970f..d58f46b 100644
--- a/wifi/supplicant/1.2/ISupplicantP2pIface.hal
+++ b/wifi/supplicant/1.2/ISupplicantP2pIface.hal
@@ -68,4 +68,16 @@
addGroup_1_2(Ssid ssid, string pskPassphrase, bool persistent,
uint32_t freq, MacAddress peerAddress, bool joinExistingGroup)
generates (SupplicantStatus status);
+
+ /**
+ * Set MAC randomization enabled/disabled.
+ *
+ * @param enable true to enable, false to disable.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ setMacRandomization(bool enable) generates (SupplicantStatus status);
};
diff --git a/wifi/supplicant/1.2/ISupplicantStaNetwork.hal b/wifi/supplicant/1.2/ISupplicantStaNetwork.hal
index 6c356a4..7c3da6f 100644
--- a/wifi/supplicant/1.2/ISupplicantStaNetwork.hal
+++ b/wifi/supplicant/1.2/ISupplicantStaNetwork.hal
@@ -28,6 +28,12 @@
interface ISupplicantStaNetwork extends @1.1::ISupplicantStaNetwork {
/** Possble mask of values for KeyMgmt param. */
enum KeyMgmtMask : @1.0::ISupplicantStaNetwork.KeyMgmtMask {
+ /** WPA using EAP authentication with stronger SHA256-based algorithms */
+ WPA_EAP_SHA256 = 1 << 7,
+
+ /** WPA pre-shared key with stronger SHA256-based algorithms */
+ WPA_PSK_SHA256 = 1 << 8,
+
/** WPA3-Personal SAE Key management */
SAE = 1 << 10,
diff --git a/wifi/supplicant/1.2/types.hal b/wifi/supplicant/1.2/types.hal
index 576b4f5..eaf2546 100644
--- a/wifi/supplicant/1.2/types.hal
+++ b/wifi/supplicant/1.2/types.hal
@@ -60,4 +60,5 @@
BUSY,
TIMEOUT,
FAILURE,
+ NOT_SUPPORTED,
};
diff --git a/wifi/supplicant/1.2/vts/OWNERS b/wifi/supplicant/1.2/vts/OWNERS
new file mode 100644
index 0000000..8bfb148
--- /dev/null
+++ b/wifi/supplicant/1.2/vts/OWNERS
@@ -0,0 +1,2 @@
+rpius@google.com
+etancohen@google.com
diff --git a/wifi/supplicant/1.2/vts/functional/Android.bp b/wifi/supplicant/1.2/vts/functional/Android.bp
new file mode 100644
index 0000000..1b970e1
--- /dev/null
+++ b/wifi/supplicant/1.2/vts/functional/Android.bp
@@ -0,0 +1,88 @@
+//
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "VtsHalWifiSupplicantV1_2TargetTestUtil",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: ["supplicant_hidl_test_utils_1_2.cpp"],
+ export_include_dirs: [
+ "."
+ ],
+ static_libs: [
+ "VtsHalWifiV1_0TargetTestUtil",
+ "VtsHalWifiSupplicantV1_0TargetTestUtil",
+ "VtsHalWifiSupplicantV1_1TargetTestUtil",
+ "android.hardware.wifi.supplicant@1.0",
+ "android.hardware.wifi.supplicant@1.1",
+ "android.hardware.wifi.supplicant@1.2",
+ "android.hardware.wifi@1.0",
+ "libcrypto",
+ "libgmock",
+ "libwifi-system",
+ "libwifi-system-iface",
+ ],
+}
+
+cc_test {
+ name: "VtsHalWifiSupplicantV1_2TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: [
+ "VtsHalWifiSupplicantV1_2TargetTest.cpp",
+ "supplicant_sta_iface_hidl_test.cpp",
+ "supplicant_sta_network_hidl_test.cpp",
+ ],
+ static_libs: [
+ "VtsHalWifiV1_0TargetTestUtil",
+ "VtsHalWifiSupplicantV1_0TargetTestUtil",
+ "VtsHalWifiSupplicantV1_1TargetTestUtil",
+ "VtsHalWifiSupplicantV1_2TargetTestUtil",
+ "android.hardware.wifi.supplicant@1.0",
+ "android.hardware.wifi.supplicant@1.1",
+ "android.hardware.wifi.supplicant@1.2",
+ "android.hardware.wifi@1.0",
+ "android.hardware.wifi@1.1",
+ "libcrypto",
+ "libgmock",
+ "libwifi-system",
+ "libwifi-system-iface",
+ ],
+ test_suites: ["general-tests"],
+}
+
+cc_test {
+ name: "VtsHalWifiSupplicantP2pV1_2TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: [
+ "VtsHalWifiSupplicantV1_2TargetTest.cpp",
+ "supplicant_p2p_iface_hidl_test.cpp",
+ ],
+ static_libs: [
+ "VtsHalWifiV1_0TargetTestUtil",
+ "VtsHalWifiSupplicantV1_0TargetTestUtil",
+ "VtsHalWifiSupplicantV1_1TargetTestUtil",
+ "VtsHalWifiSupplicantV1_2TargetTestUtil",
+ "android.hardware.wifi.supplicant@1.0",
+ "android.hardware.wifi.supplicant@1.1",
+ "android.hardware.wifi.supplicant@1.2",
+ "android.hardware.wifi@1.0",
+ "android.hardware.wifi@1.1",
+ "libcrypto",
+ "libgmock",
+ "libwifi-system",
+ "libwifi-system-iface",
+ ],
+}
+
diff --git a/wifi/supplicant/1.2/vts/functional/VtsHalWifiSupplicantV1_2TargetTest.cpp b/wifi/supplicant/1.2/vts/functional/VtsHalWifiSupplicantV1_2TargetTest.cpp
new file mode 100644
index 0000000..267fa67
--- /dev/null
+++ b/wifi/supplicant/1.2/vts/functional/VtsHalWifiSupplicantV1_2TargetTest.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android-base/logging.h>
+#include <android/hardware/wifi/1.1/IWifi.h>
+#include <android/hardware/wifi/supplicant/1.2/ISupplicant.h>
+
+#include "supplicant_hidl_test_utils.h"
+#include "wifi_hidl_test_utils.h"
+
+class WifiSupplicantHidlEnvironment_1_2 : public WifiSupplicantHidlEnvironment {
+ public:
+ // get the test environment singleton
+ static WifiSupplicantHidlEnvironment_1_2* Instance() {
+ static WifiSupplicantHidlEnvironment_1_2* instance =
+ new WifiSupplicantHidlEnvironment_1_2;
+ return instance;
+ }
+ virtual void registerTestServices() override {
+ registerTestService<::android::hardware::wifi::V1_0::IWifi>();
+ registerTestService<::android::hardware::wifi::V1_1::IWifi>();
+ registerTestService<
+ ::android::hardware::wifi::supplicant::V1_0::ISupplicant>();
+ registerTestService<
+ ::android::hardware::wifi::supplicant::V1_1::ISupplicant>();
+ registerTestService<
+ ::android::hardware::wifi::supplicant::V1_2::ISupplicant>();
+ }
+
+ private:
+ WifiSupplicantHidlEnvironment_1_2() {}
+};
+
+WifiSupplicantHidlEnvironment* gEnv =
+ WifiSupplicantHidlEnvironment_1_2::Instance();
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(gEnv);
+ ::testing::InitGoogleTest(&argc, argv);
+ gEnv->init(&argc, argv);
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ }
+ return status;
+}
diff --git a/wifi/supplicant/1.2/vts/functional/supplicant_hidl_test_utils_1_2.cpp b/wifi/supplicant/1.2/vts/functional/supplicant_hidl_test_utils_1_2.cpp
new file mode 100644
index 0000000..f270bff
--- /dev/null
+++ b/wifi/supplicant/1.2/vts/functional/supplicant_hidl_test_utils_1_2.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <android-base/logging.h>
+
+#include "supplicant_hidl_test_utils.h"
+#include "supplicant_hidl_test_utils_1_2.h"
+
+using ::android::sp;
+using ::android::hardware::wifi::supplicant::V1_2::ISupplicant;
+using ::android::hardware::wifi::supplicant::V1_2::ISupplicantP2pIface;
+using ::android::hardware::wifi::supplicant::V1_2::ISupplicantStaIface;
+using ::android::hardware::wifi::supplicant::V1_2::ISupplicantStaNetwork;
+
+sp<ISupplicant> getSupplicant_1_2() {
+ return ISupplicant::castFrom(getSupplicant());
+}
+
+sp<ISupplicantStaIface> getSupplicantStaIface_1_2() {
+ return ISupplicantStaIface::castFrom(getSupplicantStaIface());
+}
+
+sp<ISupplicantStaNetwork> createSupplicantStaNetwork_1_2() {
+ return ISupplicantStaNetwork::castFrom(createSupplicantStaNetwork());
+}
+
+sp<ISupplicantP2pIface> getSupplicantP2pIface_1_2() {
+ return ISupplicantP2pIface::castFrom(getSupplicantP2pIface());
+}
diff --git a/wifi/supplicant/1.2/vts/functional/supplicant_hidl_test_utils_1_2.h b/wifi/supplicant/1.2/vts/functional/supplicant_hidl_test_utils_1_2.h
new file mode 100644
index 0000000..8a7ccc5
--- /dev/null
+++ b/wifi/supplicant/1.2/vts/functional/supplicant_hidl_test_utils_1_2.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SUPPLICANT_HIDL_TEST_UTILS_1_2_H
+#define SUPPLICANT_HIDL_TEST_UTILS_1_2_H
+
+#include <android/hardware/wifi/supplicant/1.2/ISupplicant.h>
+#include <android/hardware/wifi/supplicant/1.2/ISupplicantP2pIface.h>
+#include <android/hardware/wifi/supplicant/1.2/ISupplicantStaIface.h>
+#include <android/hardware/wifi/supplicant/1.2/ISupplicantStaNetwork.h>
+
+android::sp<android::hardware::wifi::supplicant::V1_2::ISupplicant>
+getSupplicant_1_2();
+
+android::sp<android::hardware::wifi::supplicant::V1_2::ISupplicantStaIface>
+getSupplicantStaIface_1_2();
+
+android::sp<android::hardware::wifi::supplicant::V1_2::ISupplicantStaNetwork>
+createSupplicantStaNetwork_1_2();
+
+android::sp<android::hardware::wifi::supplicant::V1_2::ISupplicantP2pIface>
+getSupplicantP2pIface_1_2();
+
+#endif /* SUPPLICANT_HIDL_TEST_UTILS_1_2_H */
diff --git a/wifi/supplicant/1.2/vts/functional/supplicant_p2p_iface_hidl_test.cpp b/wifi/supplicant/1.2/vts/functional/supplicant_p2p_iface_hidl_test.cpp
new file mode 100644
index 0000000..9249045
--- /dev/null
+++ b/wifi/supplicant/1.2/vts/functional/supplicant_p2p_iface_hidl_test.cpp
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android-base/logging.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+#include <android/hardware/wifi/supplicant/1.2/ISupplicantP2pIface.h>
+
+#include "supplicant_hidl_test_utils.h"
+#include "supplicant_hidl_test_utils_1_2.h"
+
+using ::android::sp;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
+using ::android::hardware::wifi::supplicant::V1_2::ISupplicantP2pIface;
+
+namespace {
+constexpr uint8_t kTestSsid[] = {'D', 'I', 'R', 'E', 'C', 'T', '-', 'x',
+ 'y', '-', 'H', 'E', 'L', 'L', 'O'};
+constexpr char kTestPassphrase[] = "P2pWorld1234";
+constexpr uint8_t kTestZeroMacAddr[] = {[0 ... 5] = 0x0};
+} // namespace
+
+class SupplicantP2pIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ virtual void SetUp() override {
+ startSupplicantAndWaitForHidlService();
+ EXPECT_TRUE(turnOnExcessiveLogging());
+ p2p_iface_ = getSupplicantP2pIface_1_2();
+ ASSERT_NE(p2p_iface_.get(), nullptr);
+ }
+
+ virtual void TearDown() override { stopSupplicant(); }
+
+ protected:
+ // ISupplicantP2pIface object used for all tests in this fixture.
+ sp<ISupplicantP2pIface> p2p_iface_;
+};
+
+/*
+ * Verify that AddGroup_1_2 could create a group successfully.
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, AddGroup_1_2_Success) {
+ std::vector<uint8_t> ssid(kTestSsid, kTestSsid + sizeof(kTestSsid));
+ std::string passphrase = kTestPassphrase;
+ int freq = 5;
+ std::array<uint8_t, 6> zero_mac_addr;
+ memcpy(zero_mac_addr.data(), kTestZeroMacAddr, zero_mac_addr.size());
+ bool persistent = false;
+ int is_join = false;
+
+ p2p_iface_->addGroup_1_2(ssid, passphrase, persistent, freq, zero_mac_addr,
+ is_join, [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+ status.code);
+ });
+}
+
+/*
+ * Verify that AddGroup_1_2 fails due to invalid SSID.
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, AddGroup_1_2_FailureInvalidSsid) {
+ std::vector<uint8_t> ssid;
+ std::string passphrase = kTestPassphrase;
+ int freq = 5;
+ std::array<uint8_t, 6> zero_mac_addr;
+ memcpy(zero_mac_addr.data(), kTestZeroMacAddr, zero_mac_addr.size());
+ bool persistent = false;
+ int is_join = false;
+
+ p2p_iface_->addGroup_1_2(
+ ssid, passphrase, persistent, freq, zero_mac_addr, is_join,
+ [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::FAILURE_ARGS_INVALID, status.code);
+ });
+}
+
+/*
+ * Verify that AddGroup_1_2 fails due to invalid passphrase.
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, AddGroup_1_2_FailureInvalidPassphrase) {
+ std::vector<uint8_t> ssid(kTestSsid, kTestSsid + sizeof(kTestSsid));
+ std::string passphrase = "1234";
+ int freq = 5;
+ std::array<uint8_t, 6> zero_mac_addr;
+ memcpy(zero_mac_addr.data(), kTestZeroMacAddr, zero_mac_addr.size());
+ bool persistent = false;
+ int is_join = false;
+
+ p2p_iface_->addGroup_1_2(
+ ssid, passphrase, persistent, freq, zero_mac_addr, is_join,
+ [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::FAILURE_ARGS_INVALID, status.code);
+ });
+}
+
+/*
+ * Verify that AddGroup_1_2 fails due to invalid frequency.
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, AddGroup_1_2_FailureInvalidFrequency) {
+ std::vector<uint8_t> ssid(kTestSsid, kTestSsid + sizeof(kTestSsid));
+ std::string passphrase = kTestPassphrase;
+ int freq = 9999;
+ std::array<uint8_t, 6> zero_mac_addr;
+ memcpy(zero_mac_addr.data(), kTestZeroMacAddr, zero_mac_addr.size());
+ bool persistent = false;
+ int is_join = false;
+
+ p2p_iface_->addGroup_1_2(
+ ssid, passphrase, persistent, freq, zero_mac_addr, is_join,
+ [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
+ });
+}
+
+/*
+ * Verify that setMacRandomization successes.
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, EnableMacRandomization) {
+ p2p_iface_->setMacRandomization(true, [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ // enable twice
+ p2p_iface_->setMacRandomization(true, [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ p2p_iface_->setMacRandomization(false, [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ // disable twice
+ p2p_iface_->setMacRandomization(false, [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+}
diff --git a/wifi/supplicant/1.2/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.2/vts/functional/supplicant_sta_iface_hidl_test.cpp
new file mode 100644
index 0000000..4425281
--- /dev/null
+++ b/wifi/supplicant/1.2/vts/functional/supplicant_sta_iface_hidl_test.cpp
@@ -0,0 +1,418 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.h>
+#include <android/hardware/wifi/supplicant/1.0/types.h>
+#include <android/hardware/wifi/supplicant/1.1/ISupplicantStaIfaceCallback.h>
+#include <android/hardware/wifi/supplicant/1.2/ISupplicantStaIface.h>
+#include <android/hardware/wifi/supplicant/1.2/ISupplicantStaIfaceCallback.h>
+#include <android/hardware/wifi/supplicant/1.2/ISupplicantStaNetwork.h>
+#include <android/hardware/wifi/supplicant/1.2/types.h>
+#include <hidl/HidlSupport.h>
+#include <hidl/Status.h>
+
+#include "supplicant_hidl_test_utils.h"
+#include "supplicant_hidl_test_utils_1_2.h"
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
+using ::android::hardware::wifi::supplicant::V1_2::DppAkm;
+using ::android::hardware::wifi::supplicant::V1_2::DppFailureCode;
+using ::android::hardware::wifi::supplicant::V1_2::DppNetRole;
+using ::android::hardware::wifi::supplicant::V1_2::DppProgressCode;
+using ::android::hardware::wifi::supplicant::V1_2::DppSuccessCode;
+using ::android::hardware::wifi::supplicant::V1_2::ISupplicantStaIface;
+using ::android::hardware::wifi::supplicant::V1_2::ISupplicantStaIfaceCallback;
+using ::android::hardware::wifi::supplicant::V1_2::ISupplicantStaNetwork;
+
+#define TIMEOUT_PERIOD 60
+class IfaceDppCallback;
+
+class SupplicantStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ virtual void SetUp() override {
+ startSupplicantAndWaitForHidlService();
+ EXPECT_TRUE(turnOnExcessiveLogging());
+ sta_iface_ = getSupplicantStaIface_1_2();
+ ASSERT_NE(sta_iface_.get(), nullptr);
+ count_ = 0;
+ }
+
+ virtual void TearDown() override { stopSupplicant(); }
+
+ enum DppCallbackType {
+ ANY_CALLBACK = -2,
+ INVALID = -1,
+
+ EVENT_SUCCESS = 0,
+ EVENT_SUCCESS_CONFIG_RECEIVED,
+ EVENT_PROGRESS,
+ EVENT_FAILURE,
+ };
+
+ DppCallbackType dppCallbackType;
+ uint32_t code;
+
+ /* Used as a mechanism to inform the test about data/event callback */
+ inline void notify() {
+ std::unique_lock<std::mutex> lock(mtx_);
+ count_++;
+ cv_.notify_one();
+ }
+
+ /* Test code calls this function to wait for data/event callback */
+ inline std::cv_status wait(DppCallbackType waitForCallbackType) {
+ std::unique_lock<std::mutex> lock(mtx_);
+ EXPECT_NE(INVALID, waitForCallbackType); // can't ASSERT in a
+ // non-void-returning method
+ auto now = std::chrono::system_clock::now();
+ std::cv_status status =
+ cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
+ return status;
+ }
+
+ private:
+ // synchronization objects
+ std::mutex mtx_;
+ std::condition_variable cv_;
+ int count_;
+
+ protected:
+ // ISupplicantStaIface object used for all tests in this fixture.
+ sp<ISupplicantStaIface> sta_iface_;
+ bool isDppSupported() {
+ uint32_t keyMgmtMask = 0;
+
+ // We need to first get the key management capabilities from the device.
+ // If DPP is not supported, we just pass the test.
+ sta_iface_->getKeyMgmtCapabilities(
+ [&](const SupplicantStatus& status, uint32_t keyMgmtMaskInternal) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+
+ keyMgmtMask = keyMgmtMaskInternal;
+ });
+
+ if (!(keyMgmtMask & ISupplicantStaNetwork::KeyMgmtMask::DPP)) {
+ // DPP not supported
+ return false;
+ }
+
+ return true;
+ }
+};
+
+class IfaceCallback : public ISupplicantStaIfaceCallback {
+ Return<void> onNetworkAdded(uint32_t /* id */) override { return Void(); }
+ Return<void> onNetworkRemoved(uint32_t /* id */) override { return Void(); }
+ Return<void> onStateChanged(
+ ISupplicantStaIfaceCallback::State /* newState */,
+ const hidl_array<uint8_t, 6>& /*bssid */, uint32_t /* id */,
+ const hidl_vec<uint8_t>& /* ssid */) override {
+ return Void();
+ }
+ Return<void> onAnqpQueryDone(
+ const hidl_array<uint8_t, 6>& /* bssid */,
+ const ISupplicantStaIfaceCallback::AnqpData& /* data */,
+ const ISupplicantStaIfaceCallback::Hs20AnqpData& /* hs20Data */)
+ override {
+ return Void();
+ }
+ virtual Return<void> onHs20IconQueryDone(
+ const hidl_array<uint8_t, 6>& /* bssid */,
+ const hidl_string& /* fileName */,
+ const hidl_vec<uint8_t>& /* data */) override {
+ return Void();
+ }
+ virtual Return<void> onHs20SubscriptionRemediation(
+ const hidl_array<uint8_t, 6>& /* bssid */,
+ ISupplicantStaIfaceCallback::OsuMethod /* osuMethod */,
+ const hidl_string& /* url*/) override {
+ return Void();
+ }
+ Return<void> onHs20DeauthImminentNotice(
+ const hidl_array<uint8_t, 6>& /* bssid */, uint32_t /* reasonCode */,
+ uint32_t /* reAuthDelayInSec */,
+ const hidl_string& /* url */) override {
+ return Void();
+ }
+ Return<void> onDisconnected(const hidl_array<uint8_t, 6>& /* bssid */,
+ bool /* locallyGenerated */,
+ ISupplicantStaIfaceCallback::ReasonCode
+ /* reasonCode */) override {
+ return Void();
+ }
+ Return<void> onAssociationRejected(
+ const hidl_array<uint8_t, 6>& /* bssid */,
+ ISupplicantStaIfaceCallback::StatusCode /* statusCode */,
+ bool /*timedOut */) override {
+ return Void();
+ }
+ Return<void> onAuthenticationTimeout(
+ const hidl_array<uint8_t, 6>& /* bssid */) override {
+ return Void();
+ }
+ Return<void> onBssidChanged(
+ ISupplicantStaIfaceCallback::BssidChangeReason /* reason */,
+ const hidl_array<uint8_t, 6>& /* bssid */) override {
+ return Void();
+ }
+ Return<void> onEapFailure() override { return Void(); }
+ Return<void> onEapFailure_1_1(
+ ISupplicantStaIfaceCallback::EapErrorCode /* eapErrorCode */) override {
+ return Void();
+ }
+ Return<void> onWpsEventSuccess() override { return Void(); }
+ Return<void> onWpsEventFail(
+ const hidl_array<uint8_t, 6>& /* bssid */,
+ ISupplicantStaIfaceCallback::WpsConfigError /* configError */,
+ ISupplicantStaIfaceCallback::WpsErrorIndication /* errorInd */)
+ override {
+ return Void();
+ }
+ Return<void> onWpsEventPbcOverlap() override { return Void(); }
+ Return<void> onExtRadioWorkStart(uint32_t /* id */) override {
+ return Void();
+ }
+ Return<void> onExtRadioWorkTimeout(uint32_t /* id*/) override {
+ return Void();
+ }
+ Return<void> onDppSuccessConfigReceived(
+ const hidl_vec<uint8_t>& /* ssid */, const hidl_string& /* password */,
+ const hidl_array<uint8_t, 32>& /* psk */,
+ DppAkm /* securityAkm */) override {
+ return Void();
+ }
+ Return<void> onDppSuccess(DppSuccessCode /* code */) override {
+ return Void();
+ }
+ Return<void> onDppProgress(DppProgressCode /* code */) override {
+ return Void();
+ }
+ Return<void> onDppFailure(DppFailureCode /* code */) override {
+ return Void();
+ }
+};
+
+class IfaceDppCallback : public IfaceCallback {
+ SupplicantStaIfaceHidlTest& parent_;
+
+ Return<void> onDppSuccessConfigReceived(
+ const hidl_vec<uint8_t>& /* ssid */, const hidl_string& /* password */,
+ const hidl_array<uint8_t, 32>& /* psk */,
+ DppAkm /* securityAkm */) override {
+ parent_.code = 0;
+ parent_.dppCallbackType = SupplicantStaIfaceHidlTest::DppCallbackType::
+ EVENT_SUCCESS_CONFIG_RECEIVED;
+ parent_.notify();
+ return Void();
+ }
+ Return<void> onDppSuccess(DppSuccessCode code) override {
+ parent_.code = (uint32_t)code;
+ parent_.dppCallbackType =
+ SupplicantStaIfaceHidlTest::DppCallbackType::EVENT_SUCCESS;
+ parent_.notify();
+ return Void();
+ }
+ Return<void> onDppProgress(DppProgressCode code) override {
+ parent_.code = (uint32_t)code;
+ parent_.dppCallbackType =
+ SupplicantStaIfaceHidlTest::DppCallbackType::EVENT_PROGRESS;
+ parent_.notify();
+ return Void();
+ }
+ Return<void> onDppFailure(DppFailureCode code) override {
+ parent_.code = (uint32_t)code;
+ parent_.dppCallbackType =
+ SupplicantStaIfaceHidlTest::DppCallbackType::EVENT_FAILURE;
+ parent_.notify();
+ return Void();
+ }
+
+ public:
+ IfaceDppCallback(SupplicantStaIfaceHidlTest& parent) : parent_(parent){};
+};
+
+/*
+ * RegisterCallback_1_2
+ */
+TEST_F(SupplicantStaIfaceHidlTest, RegisterCallback_1_2) {
+ sta_iface_->registerCallback_1_2(
+ new IfaceCallback(), [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+}
+
+/*
+ * GetKeyMgmtCapabilities
+ */
+TEST_F(SupplicantStaIfaceHidlTest, GetKeyMgmtCapabilities) {
+ sta_iface_->getKeyMgmtCapabilities(
+ [&](const SupplicantStatus& status, uint32_t keyMgmtMask) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+
+ // Even though capabilities vary, these two are always set in HAL
+ // v1.2
+ EXPECT_TRUE(keyMgmtMask & ISupplicantStaNetwork::KeyMgmtMask::NONE);
+ EXPECT_TRUE(keyMgmtMask &
+ ISupplicantStaNetwork::KeyMgmtMask::IEEE8021X);
+ });
+}
+
+/*
+ * AddDppPeerUriAndRomveUri
+ */
+TEST_F(SupplicantStaIfaceHidlTest, AddDppPeerUriAndRomveUri) {
+ // We need to first get the key management capabilities from the device.
+ // If DPP is not supported, we just pass the test.
+ if (!isDppSupported()) {
+ // DPP not supported
+ return;
+ }
+
+ hidl_string uri =
+ "DPP:C:81/1;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj"
+ "0DAQcDIgAD0edY4X3N//HhMFYsZfMbQJTiNFtNIWF/cIwMB/gzqOM=;;";
+ uint32_t peer_id = 0;
+
+ // Add a peer URI
+ sta_iface_->addDppPeerUri(
+ uri, [&](const SupplicantStatus& status, uint32_t id) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ EXPECT_NE(0, id);
+ EXPECT_NE(-1, id);
+
+ peer_id = id;
+ });
+
+ // ...and then remove it.
+ sta_iface_->removeDppUri(peer_id, [&](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+}
+
+/*
+ * StartDppEnrolleeInitiator
+ */
+TEST_F(SupplicantStaIfaceHidlTest, StartDppEnrolleeInitiator) {
+ // We need to first get the key management capabilities from the device.
+ // If DPP is not supported, we just pass the test.
+ if (!isDppSupported()) {
+ // DPP not supported
+ return;
+ }
+
+ hidl_string uri =
+ "DPP:C:81/1;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj"
+ "0DAQcDIgAD0edY4X3N//HhMFYsZfMbQJTiNFtNIWF/cIwMB/gzqOM=;;";
+ uint32_t peer_id = 0;
+
+ // Register callbacks
+ sta_iface_->registerCallback_1_2(
+ new IfaceDppCallback(*this), [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ // Add a peer URI
+ sta_iface_->addDppPeerUri(
+ uri, [&](const SupplicantStatus& status, uint32_t id) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ EXPECT_NE(0, id);
+ EXPECT_NE(-1, id);
+
+ peer_id = id;
+ });
+
+ // Start DPP as Enrollee-Initiator. Since this operation requires two
+ // devices, we start the operation and expect a timeout.
+ sta_iface_->startDppEnrolleeInitiator(
+ peer_id, 0, [&](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ // Wait for the timeout callback
+ ASSERT_EQ(std::cv_status::no_timeout,
+ wait(SupplicantStaIfaceHidlTest::DppCallbackType::EVENT_FAILURE));
+ ASSERT_EQ(SupplicantStaIfaceHidlTest::DppCallbackType::EVENT_FAILURE,
+ dppCallbackType);
+
+ // ...and then remove the peer URI.
+ sta_iface_->removeDppUri(peer_id, [&](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+}
+
+/*
+ * StartDppConfiguratorInitiator
+ */
+TEST_F(SupplicantStaIfaceHidlTest, StartDppConfiguratorInitiator) {
+ // We need to first get the key management capabilities from the device.
+ // If DPP is not supported, we just pass the test.
+ if (!isDppSupported()) {
+ // DPP not supported
+ return;
+ }
+
+ hidl_string uri =
+ "DPP:C:81/1;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj"
+ "0DAQcDIgAD0edY4X3N//HhMFYsZfMbQJTiNFtNIWF/cIwMB/gzqOM=;;";
+ uint32_t peer_id = 0;
+
+ // Register callbacks
+ sta_iface_->registerCallback_1_2(
+ new IfaceDppCallback(*this), [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ // Add a peer URI
+ sta_iface_->addDppPeerUri(
+ uri, [&](const SupplicantStatus& status, uint32_t id) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ EXPECT_NE(0, id);
+ EXPECT_NE(-1, id);
+
+ peer_id = id;
+ });
+
+ std::string ssid =
+ "6D795F746573745F73736964"; // 'my_test_ssid' encoded in hex
+ std::string password = "746F70736563726574"; // 'topsecret' encoded in hex
+
+ // Start DPP as Configurator-Initiator. Since this operation requires two
+ // devices, we start the operation and expect a timeout.
+ sta_iface_->startDppConfiguratorInitiator(
+ peer_id, 0, ssid, password, NULL, DppNetRole::STA, DppAkm::PSK,
+ [&](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ // Wait for the timeout callback
+ ASSERT_EQ(std::cv_status::no_timeout,
+ wait(SupplicantStaIfaceHidlTest::DppCallbackType::EVENT_FAILURE));
+ ASSERT_EQ(SupplicantStaIfaceHidlTest::DppCallbackType::EVENT_FAILURE,
+ dppCallbackType);
+
+ // ...and then remove the peer URI.
+ sta_iface_->removeDppUri(peer_id, [&](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+}
diff --git a/wifi/supplicant/1.2/vts/functional/supplicant_sta_network_hidl_test.cpp b/wifi/supplicant/1.2/vts/functional/supplicant_sta_network_hidl_test.cpp
new file mode 100644
index 0000000..ed421d7
--- /dev/null
+++ b/wifi/supplicant/1.2/vts/functional/supplicant_sta_network_hidl_test.cpp
@@ -0,0 +1,192 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android-base/logging.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <android/hardware/wifi/supplicant/1.1/ISupplicantStaNetwork.h>
+
+#include "supplicant_hidl_test_utils.h"
+#include "supplicant_hidl_test_utils_1_2.h"
+
+using ::android::sp;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
+using ::android::hardware::wifi::supplicant::V1_2::ISupplicantStaNetwork;
+// namespace {
+// constexpr uint8_t kTestIdentity[] = {0x45, 0x67, 0x98, 0x67, 0x56};
+// constexpr uint8_t kTestEncryptedIdentity[] = {0x35, 0x37, 0x58, 0x57, 0x26};
+//} // namespace
+
+class SupplicantStaNetworkHidlTest
+ : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ virtual void SetUp() override {
+ startSupplicantAndWaitForHidlService();
+ EXPECT_TRUE(turnOnExcessiveLogging());
+ sta_network_ = createSupplicantStaNetwork_1_2();
+ ASSERT_NE(sta_network_.get(), nullptr);
+ }
+
+ virtual void TearDown() override { stopSupplicant(); }
+
+ protected:
+ // ISupplicantStaNetwork object used for all tests in this fixture.
+ sp<ISupplicantStaNetwork> sta_network_;
+};
+
+/*
+ * SetGetSaePassword
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetSaePassword) {
+ std::string password = "topsecret";
+
+ sta_network_->setSaePassword(password, [](const SupplicantStatus &status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ sta_network_->getSaePassword(
+ [&password](const SupplicantStatus &status, std::string passwordOut) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ EXPECT_EQ(passwordOut.compare(password), 0);
+ });
+}
+
+/*
+ * SetGetSaePasswordId
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetSaePasswordId) {
+ std::string passwordId = "id1";
+
+ sta_network_->setSaePasswordId(
+ passwordId, [](const SupplicantStatus &status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ sta_network_->getSaePasswordId([&passwordId](const SupplicantStatus &status,
+ std::string passwordIdOut) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ EXPECT_EQ(passwordIdOut.compare(passwordId), 0);
+ });
+}
+
+/*
+ * SetGetGroupMgmtCipher
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetGroupMgmtCipher) {
+ uint32_t groupMgmtCipher =
+ (uint32_t)ISupplicantStaNetwork::GroupMgmtCipherMask::BIP_GMAC_256;
+
+ sta_network_->setGroupMgmtCipher(
+ groupMgmtCipher, [](const SupplicantStatus &status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ sta_network_->getGroupMgmtCipher(
+ [&groupMgmtCipher](const SupplicantStatus &status,
+ uint32_t groupMgmtCipherOut) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ EXPECT_EQ(groupMgmtCipherOut, groupMgmtCipher);
+ });
+}
+
+/*
+ * SetGetKeyMgmt_1_2
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetKeyMgmt_1_2) {
+ uint32_t keyMgmt = (uint32_t)ISupplicantStaNetwork::KeyMgmtMask::SAE;
+
+ sta_network_->setKeyMgmt_1_2(keyMgmt, [](const SupplicantStatus &status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ sta_network_->getKeyMgmt_1_2(
+ [&keyMgmt](const SupplicantStatus &status, uint32_t keyMgmtOut) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ EXPECT_EQ(keyMgmtOut, keyMgmt);
+ });
+}
+
+/*
+ * SetGetGroupCipher_1_2
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetGroupCipher_1_2) {
+ uint32_t groupCipher =
+ (uint32_t)ISupplicantStaNetwork::GroupCipherMask::GCMP_256;
+
+ sta_network_->setGroupCipher_1_2(
+ groupCipher, [](const SupplicantStatus &status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ sta_network_->getGroupCipher_1_2(
+ [&groupCipher](const SupplicantStatus &status,
+ uint32_t groupCipherOut) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ EXPECT_EQ(groupCipherOut, groupCipher);
+ });
+}
+
+/*
+ * SetGetPairwiseCipher_1_2
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetPairwiseCipher_1_2) {
+ uint32_t pairwiseCipher =
+ (uint32_t)ISupplicantStaNetwork::PairwiseCipherMask::GCMP_256;
+
+ sta_network_->setPairwiseCipher_1_2(
+ pairwiseCipher, [](const SupplicantStatus &status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ sta_network_->getPairwiseCipher_1_2(
+ [&pairwiseCipher](const SupplicantStatus &status,
+ uint32_t pairwiseCipherOut) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ EXPECT_EQ(pairwiseCipherOut, pairwiseCipher);
+ });
+}
+
+/*
+ * EnableSuiteBEapOpenSslCiphers
+ */
+TEST_F(SupplicantStaNetworkHidlTest, EnableSuiteBEapOpenSslCiphers) {
+ sta_network_->enableSuiteBEapOpenSslCiphers(
+ [](const SupplicantStatus &status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ sta_network_->enableSuiteBEapOpenSslCiphers(
+ [](const SupplicantStatus &status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+}
+
+/*
+ * EnableTlsSuiteBEapPhase1Param
+ */
+TEST_F(SupplicantStaNetworkHidlTest, EnableTlsSuiteBEapPhase1Param) {
+ sta_network_->enableTlsSuiteBEapPhase1Param(
+ true, [](const SupplicantStatus &status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+
+ sta_network_->enableTlsSuiteBEapPhase1Param(
+ false, [](const SupplicantStatus &status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+}