Merge "Add 1.2 NN HAL: IPreparedModel & callbacks."
diff --git a/audio/4.0/config/Android.bp b/audio/4.0/config/Android.bp
new file mode 100644
index 0000000..6aac899
--- /dev/null
+++ b/audio/4.0/config/Android.bp
@@ -0,0 +1,7 @@
+
+xsd_config {
+    name: "audio_policy_configuration_V4_0",
+    srcs: ["audio_policy_configuration.xsd"],
+    package_name: "audio.policy.configuration.V4_0",
+}
+
diff --git a/audio/4.0/config/api/current.txt b/audio/4.0/config/api/current.txt
new file mode 100644
index 0000000..f0814bf
--- /dev/null
+++ b/audio/4.0/config/api/current.txt
@@ -0,0 +1,401 @@
+package audio.policy.configuration.V4_0 {
+
+  public class AttachedDevices {
+    ctor public AttachedDevices();
+    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();
+    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;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_BACK_MIC;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_BLUETOOTH_A2DP;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_BLUETOOTH_BLE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_BUILTIN_MIC;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_BUS;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_COMMUNICATION;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_DEFAULT;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_FM_TUNER;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_HDMI;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_IP;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_LINE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_LOOPBACK;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_PROXY;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_REMOTE_SUBMIX;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_SPDIF;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_STUB;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_TELEPHONY_RX;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_TV_TUNER;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_USB_ACCESSORY;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_USB_DEVICE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_USB_HEADSET;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_VOICE_CALL;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_IN_WIRED_HEADSET;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_NONE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_AUX_DIGITAL;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_AUX_LINE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_A2DP;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_SCO;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_BUS;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_DEFAULT;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_EARPIECE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_ECHO_CANCELLER;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_FM;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_HDMI;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_HDMI_ARC;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_HEARING_AID;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_IP;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_LINE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_PROXY;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_REMOTE_SUBMIX;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_SPDIF;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_SPEAKER;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_SPEAKER_SAFE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_STUB;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_TELEPHONY_TX;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_USB_ACCESSORY;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_USB_DEVICE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_USB_HEADSET;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioDevice AUDIO_DEVICE_OUT_WIRED_HEADPHONE;
+    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();
+    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;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_ELD;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_ERLC;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_HE_V1;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_HE_V2;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_LC;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_LD;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_LTP;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_MAIN;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_SCALABLE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_SSR;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ELD;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_ERLC;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_HE_V1;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_HE_V2;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_LC;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_LD;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_LTP;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_MAIN;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_SCALABLE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AAC_SSR;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AC3;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AC4;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_ALAC;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AMR_NB;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AMR_WB;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_AMR_WB_PLUS;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_APE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_APTX;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_APTX_HD;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_DOLBY_TRUEHD;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_DSD;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_DTS;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_DTS_HD;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_EVRC;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_EVRCB;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_EVRCNW;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_EVRCWB;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_E_AC3;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_FLAC;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_HE_AAC_V1;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_HE_AAC_V2;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_IEC61937;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_LDAC;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_MP2;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_MP3;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_OPUS;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_PCM_16_BIT;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_PCM_24_BIT_PACKED;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_PCM_32_BIT;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_PCM_8_24_BIT;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_PCM_8_BIT;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_PCM_FLOAT;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_QCELP;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_SBC;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_VORBIS;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_WMA;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioFormat AUDIO_FORMAT_WMA_PRO;
+  }
+
+  public class AudioPolicyConfiguration {
+    ctor public AudioPolicyConfiguration();
+    method public audio.policy.configuration.V4_0.GlobalConfiguration getGlobalConfiguration();
+    method public java.util.List<audio.policy.configuration.V4_0.Modules> getModules();
+    method public audio.policy.configuration.V4_0.Version getVersion();
+    method public java.util.List<audio.policy.configuration.V4_0.Volumes> getVolumes();
+    method public void setGlobalConfiguration(audio.policy.configuration.V4_0.GlobalConfiguration);
+    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();
+    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;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioUsage AUDIO_USAGE_ASSISTANCE_SONIFICATION;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioUsage AUDIO_USAGE_ASSISTANT;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioUsage AUDIO_USAGE_GAME;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioUsage AUDIO_USAGE_MEDIA;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioUsage AUDIO_USAGE_NOTIFICATION;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioUsage AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioUsage AUDIO_USAGE_UNKNOWN;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioUsage AUDIO_USAGE_VIRTUAL_SOURCE;
+    enum_constant public static final audio.policy.configuration.V4_0.AudioUsage AUDIO_USAGE_VOICE_COMMUNICATION;
+    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();
+    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;
+    enum_constant public static final audio.policy.configuration.V4_0.DeviceCategory DEVICE_CATEGORY_HEARING_AID;
+    enum_constant public static final audio.policy.configuration.V4_0.DeviceCategory DEVICE_CATEGORY_SPEAKER;
+  }
+
+  public class DevicePorts {
+    ctor public DevicePorts();
+    method public java.util.List<audio.policy.configuration.V4_0.DevicePorts.DevicePort> getDevicePort();
+  }
+
+  public static class DevicePorts.DevicePort {
+    ctor public DevicePorts.DevicePort();
+    method public java.lang.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 boolean get_default();
+    method public void setAddress(java.lang.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 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();
+    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;
+  }
+
+  public class Gains {
+    ctor public Gains();
+    method public java.util.List<audio.policy.configuration.V4_0.Gains.Gain> getGain();
+  }
+
+  public static class Gains.Gain {
+    ctor public Gains.Gain();
+    method public java.lang.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 int getStepValueMB();
+    method public void setChannel_mask(java.lang.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 setStepValueMB(int);
+  }
+
+  public class GlobalConfiguration {
+    ctor public GlobalConfiguration();
+    method public boolean getSpeaker_drc_enabled();
+    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();
+    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;
+  }
+
+  public class MixPorts {
+    ctor public MixPorts();
+    method public java.util.List<audio.policy.configuration.V4_0.MixPorts.MixPort> getMixPort();
+  }
+
+  public static class MixPorts.MixPort {
+    ctor public MixPorts.MixPort();
+    method public java.lang.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 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 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 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();
+    enum_constant public static final audio.policy.configuration.V4_0.MixType mix;
+    enum_constant public static final audio.policy.configuration.V4_0.MixType mux;
+  }
+
+  public class Modules {
+    ctor public Modules();
+    method public java.util.List<audio.policy.configuration.V4_0.Modules.Module> getModule();
+  }
+
+  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 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 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 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 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);
+  }
+
+  public class Reference {
+    ctor public Reference();
+    method public java.lang.String getName();
+    method public java.util.List<java.lang.String> getPoint();
+    method public void setName(java.lang.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();
+    enum_constant public static final audio.policy.configuration.V4_0.Role sink;
+    enum_constant public static final audio.policy.configuration.V4_0.Role source;
+  }
+
+  public class Routes {
+    ctor public Routes();
+    method public java.util.List<audio.policy.configuration.V4_0.Routes.Route> getRoute();
+  }
+
+  public static class Routes.Route {
+    ctor public Routes.Route();
+    method public java.lang.String getSink();
+    method public java.lang.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 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();
+    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;
+    enum_constant public static final audio.policy.configuration.V4_0.Stream AUDIO_STREAM_DTMF;
+    enum_constant public static final audio.policy.configuration.V4_0.Stream AUDIO_STREAM_ENFORCED_AUDIBLE;
+    enum_constant public static final audio.policy.configuration.V4_0.Stream AUDIO_STREAM_MUSIC;
+    enum_constant public static final audio.policy.configuration.V4_0.Stream AUDIO_STREAM_NOTIFICATION;
+    enum_constant public static final audio.policy.configuration.V4_0.Stream AUDIO_STREAM_PATCH;
+    enum_constant public static final audio.policy.configuration.V4_0.Stream AUDIO_STREAM_REROUTING;
+    enum_constant public static final audio.policy.configuration.V4_0.Stream AUDIO_STREAM_RING;
+    enum_constant public static final audio.policy.configuration.V4_0.Stream AUDIO_STREAM_SYSTEM;
+    enum_constant public static final audio.policy.configuration.V4_0.Stream AUDIO_STREAM_TTS;
+    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();
+    enum_constant public static final audio.policy.configuration.V4_0.Version _1_0;
+  }
+
+  public class Volume {
+    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 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 setStream(audio.policy.configuration.V4_0.Stream);
+  }
+
+  public class Volumes {
+    ctor public Volumes();
+    method public java.util.List<audio.policy.configuration.V4_0.Reference> getReference();
+    method public java.util.List<audio.policy.configuration.V4_0.Volume> getVolume();
+  }
+
+  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 void skip(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+  }
+
+}
+
diff --git a/audio/4.0/config/api/last_current.txt b/audio/4.0/config/api/last_current.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/audio/4.0/config/api/last_current.txt
diff --git a/audio/4.0/config/api/last_removed.txt b/audio/4.0/config/api/last_removed.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/audio/4.0/config/api/last_removed.txt
diff --git a/audio/4.0/config/api/removed.txt b/audio/4.0/config/api/removed.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/audio/4.0/config/api/removed.txt
diff --git a/audio/5.0/config/Android.bp b/audio/5.0/config/Android.bp
new file mode 100644
index 0000000..a3f1c33
--- /dev/null
+++ b/audio/5.0/config/Android.bp
@@ -0,0 +1,7 @@
+
+xsd_config {
+    name: "audio_policy_configuration_V5_0",
+    srcs: ["audio_policy_configuration.xsd"],
+    package_name: "audio.policy.configuration.V5_0",
+}
+
diff --git a/audio/5.0/config/api/current.txt b/audio/5.0/config/api/current.txt
new file mode 100644
index 0000000..4334172
--- /dev/null
+++ b/audio/5.0/config/api/current.txt
@@ -0,0 +1,428 @@
+package audio.policy.configuration.V5_0 {
+
+  public class AttachedDevices {
+    ctor public AttachedDevices();
+    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();
+    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;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_BACK_MIC;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_BLUETOOTH_A2DP;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_BLUETOOTH_BLE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_BUILTIN_MIC;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_BUS;
+    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_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_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;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_PROXY;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_REMOTE_SUBMIX;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_SPDIF;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_STUB;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_TELEPHONY_RX;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_TV_TUNER;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_USB_ACCESSORY;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_USB_DEVICE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_USB_HEADSET;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_VOICE_CALL;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_WIRED_HEADSET;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_NONE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_AUX_DIGITAL;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_AUX_LINE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_A2DP;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_SCO;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_BUS;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_DEFAULT;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_EARPIECE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_ECHO_CANCELLER;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_FM;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_HDMI;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_HDMI_ARC;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_HEARING_AID;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_IP;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_LINE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_PROXY;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_REMOTE_SUBMIX;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_SPDIF;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_SPEAKER;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_SPEAKER_SAFE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_STUB;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_TELEPHONY_TX;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_USB_ACCESSORY;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_USB_DEVICE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_USB_HEADSET;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_OUT_WIRED_HEADPHONE;
+    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();
+    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;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_ELD;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_ERLC;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_HE_V1;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_HE_V2;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_LC;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_LD;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_LTP;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_MAIN;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_SCALABLE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_SSR;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ADTS_XHE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ELD;
+    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_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;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_MAIN;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_SCALABLE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_SSR;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_XHE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AC3;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AC4;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_ALAC;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AMR_NB;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AMR_WB;
+    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_HD;
+    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;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_DTS_HD;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_EVRC;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_EVRCB;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_EVRCNW;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_EVRCWB;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_E_AC3;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_E_AC3_JOC;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_FLAC;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_HE_AAC_V1;
+    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_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;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_MP2;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_MP3;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_OPUS;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_PCM_16_BIT;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_PCM_24_BIT_PACKED;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_PCM_32_BIT;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_PCM_8_24_BIT;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_PCM_8_BIT;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_PCM_FLOAT;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_QCELP;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_SBC;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_VORBIS;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_WMA;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_WMA_PRO;
+  }
+
+  public class AudioPolicyConfiguration {
+    ctor public AudioPolicyConfiguration();
+    method public audio.policy.configuration.V5_0.GlobalConfiguration getGlobalConfiguration();
+    method public java.util.List<audio.policy.configuration.V5_0.Modules> getModules();
+    method public audio.policy.configuration.V5_0.SurroundSound getSurroundSound();
+    method public audio.policy.configuration.V5_0.Version getVersion();
+    method public java.util.List<audio.policy.configuration.V5_0.Volumes> getVolumes();
+    method public void setGlobalConfiguration(audio.policy.configuration.V5_0.GlobalConfiguration);
+    method public void setSurroundSound(audio.policy.configuration.V5_0.SurroundSound);
+    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();
+    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;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioUsage AUDIO_USAGE_ASSISTANCE_SONIFICATION;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioUsage AUDIO_USAGE_ASSISTANT;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioUsage AUDIO_USAGE_GAME;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioUsage AUDIO_USAGE_MEDIA;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioUsage AUDIO_USAGE_NOTIFICATION;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioUsage AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioUsage AUDIO_USAGE_UNKNOWN;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioUsage AUDIO_USAGE_VIRTUAL_SOURCE;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioUsage AUDIO_USAGE_VOICE_COMMUNICATION;
+    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();
+    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;
+    enum_constant public static final audio.policy.configuration.V5_0.DeviceCategory DEVICE_CATEGORY_HEARING_AID;
+    enum_constant public static final audio.policy.configuration.V5_0.DeviceCategory DEVICE_CATEGORY_SPEAKER;
+  }
+
+  public class DevicePorts {
+    ctor public DevicePorts();
+    method public java.util.List<audio.policy.configuration.V5_0.DevicePorts.DevicePort> getDevicePort();
+  }
+
+  public static class DevicePorts.DevicePort {
+    ctor public DevicePorts.DevicePort();
+    method public java.lang.String getAddress();
+    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 boolean get_default();
+    method public void setAddress(java.lang.String);
+    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 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();
+    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;
+  }
+
+  public class Gains {
+    ctor public Gains();
+    method public java.util.List<audio.policy.configuration.V5_0.Gains.Gain> getGain();
+  }
+
+  public static class Gains.Gain {
+    ctor public Gains.Gain();
+    method public java.lang.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 int getStepValueMB();
+    method public void setChannel_mask(java.lang.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 setStepValueMB(int);
+  }
+
+  public class GlobalConfiguration {
+    ctor public GlobalConfiguration();
+    method public boolean getSpeaker_drc_enabled();
+    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();
+    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;
+  }
+
+  public class MixPorts {
+    ctor public MixPorts();
+    method public java.util.List<audio.policy.configuration.V5_0.MixPorts.MixPort> getMixPort();
+  }
+
+  public static class MixPorts.MixPort {
+    ctor public MixPorts.MixPort();
+    method public java.lang.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 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 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 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();
+    enum_constant public static final audio.policy.configuration.V5_0.MixType mix;
+    enum_constant public static final audio.policy.configuration.V5_0.MixType mux;
+  }
+
+  public class Modules {
+    ctor public Modules();
+    method public java.util.List<audio.policy.configuration.V5_0.Modules.Module> getModule();
+  }
+
+  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 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 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 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 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);
+  }
+
+  public class Reference {
+    ctor public Reference();
+    method public java.lang.String getName();
+    method public java.util.List<java.lang.String> getPoint();
+    method public void setName(java.lang.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();
+    enum_constant public static final audio.policy.configuration.V5_0.Role sink;
+    enum_constant public static final audio.policy.configuration.V5_0.Role source;
+  }
+
+  public class Routes {
+    ctor public Routes();
+    method public java.util.List<audio.policy.configuration.V5_0.Routes.Route> getRoute();
+  }
+
+  public static class Routes.Route {
+    ctor public Routes.Route();
+    method public java.lang.String getSink();
+    method public java.lang.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 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();
+    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;
+    enum_constant public static final audio.policy.configuration.V5_0.Stream AUDIO_STREAM_DTMF;
+    enum_constant public static final audio.policy.configuration.V5_0.Stream AUDIO_STREAM_ENFORCED_AUDIBLE;
+    enum_constant public static final audio.policy.configuration.V5_0.Stream AUDIO_STREAM_MUSIC;
+    enum_constant public static final audio.policy.configuration.V5_0.Stream AUDIO_STREAM_NOTIFICATION;
+    enum_constant public static final audio.policy.configuration.V5_0.Stream AUDIO_STREAM_PATCH;
+    enum_constant public static final audio.policy.configuration.V5_0.Stream AUDIO_STREAM_REROUTING;
+    enum_constant public static final audio.policy.configuration.V5_0.Stream AUDIO_STREAM_RING;
+    enum_constant public static final audio.policy.configuration.V5_0.Stream AUDIO_STREAM_SYSTEM;
+    enum_constant public static final audio.policy.configuration.V5_0.Stream AUDIO_STREAM_TTS;
+    enum_constant public static final audio.policy.configuration.V5_0.Stream AUDIO_STREAM_VOICE_CALL;
+  }
+
+  public class SurroundFormats {
+    ctor public SurroundFormats();
+    method public java.util.List<audio.policy.configuration.V5_0.SurroundFormats.Format> getFormat();
+  }
+
+  public static class SurroundFormats.Format {
+    ctor public SurroundFormats.Format();
+    method public audio.policy.configuration.V5_0.AudioFormat getName();
+    method public java.util.List<audio.policy.configuration.V5_0.AudioFormat> getSubformats();
+    method public void setName(audio.policy.configuration.V5_0.AudioFormat);
+    method public void setSubformats(java.util.List<audio.policy.configuration.V5_0.AudioFormat>);
+  }
+
+  public class SurroundSound {
+    ctor public SurroundSound();
+    method public audio.policy.configuration.V5_0.SurroundFormats getFormats();
+    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();
+    enum_constant public static final audio.policy.configuration.V5_0.Version _1_0;
+  }
+
+  public class Volume {
+    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 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 setStream(audio.policy.configuration.V5_0.Stream);
+  }
+
+  public class Volumes {
+    ctor public Volumes();
+    method public java.util.List<audio.policy.configuration.V5_0.Reference> getReference();
+    method public java.util.List<audio.policy.configuration.V5_0.Volume> getVolume();
+  }
+
+  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 void skip(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+  }
+
+}
+
diff --git a/audio/5.0/config/api/last_current.txt b/audio/5.0/config/api/last_current.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/audio/5.0/config/api/last_current.txt
diff --git a/audio/5.0/config/api/last_removed.txt b/audio/5.0/config/api/last_removed.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/audio/5.0/config/api/last_removed.txt
diff --git a/audio/5.0/config/api/removed.txt b/audio/5.0/config/api/removed.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/audio/5.0/config/api/removed.txt
diff --git a/audio/common/5.0/types.hal b/audio/common/5.0/types.hal
index 2ce2929..e5919cb 100644
--- a/audio/common/5.0/types.hal
+++ b/audio/common/5.0/types.hal
@@ -376,6 +376,16 @@
     OUT_TOP_SIDE_LEFT         = 0x40000,
     OUT_TOP_SIDE_RIGHT        = 0x80000,
 
+    /**
+     * Haptic channel characteristics are specific to a device and
+     * only used to play device specific resources (eg: ringtones).
+     * The HAL can freely map A and B to haptic controllers, the
+     * framework shall not interpret those values and forward them
+     * from the device audio assets.
+     */
+    OUT_HAPTIC_A              = 0x20000000,
+    OUT_HAPTIC_B              = 0x10000000,
+
     OUT_MONO     = OUT_FRONT_LEFT,
     OUT_STEREO   = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT),
     OUT_2POINT1  = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_LOW_FREQUENCY),
@@ -423,6 +433,12 @@
     OUT_7POINT1POINT4  = (OUT_7POINT1 |
             OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT |
             OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT),
+    OUT_MONO_HAPTIC_A = (OUT_FRONT_LEFT | OUT_HAPTIC_A),
+    OUT_STEREO_HAPTIC_A = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_HAPTIC_A),
+    OUT_HAPTIC_AB = (OUT_HAPTIC_A | OUT_HAPTIC_B),
+    OUT_MONO_HAPTIC_AB = (OUT_FRONT_LEFT | OUT_HAPTIC_A | OUT_HAPTIC_B),
+    OUT_STEREO_HAPTIC_AB = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT |
+            OUT_HAPTIC_A | OUT_HAPTIC_B),
     // Note that the 2.0 OUT_ALL* have been moved to helper functions
 
     /* These are bits only, not complete values */
diff --git a/audio/common/all-versions/default/HidlUtils.cpp b/audio/common/all-versions/default/HidlUtils.cpp
index 5ed059c..26e08d7 100644
--- a/audio/common/all-versions/default/HidlUtils.cpp
+++ b/audio/common/all-versions/default/HidlUtils.cpp
@@ -19,18 +19,6 @@
 #include <common/all-versions/VersionUtils.h>
 #include <string.h>
 
-using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
-using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
-using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
-using ::android::hardware::audio::common::CPP_VERSION::AudioGainMode;
-using ::android::hardware::audio::common::CPP_VERSION::AudioMixLatencyClass;
-using ::android::hardware::audio::common::CPP_VERSION::AudioPortConfigMask;
-using ::android::hardware::audio::common::CPP_VERSION::AudioPortRole;
-using ::android::hardware::audio::common::CPP_VERSION::AudioPortType;
-using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
-using ::android::hardware::audio::common::CPP_VERSION::AudioStreamType;
-using ::android::hardware::audio::common::CPP_VERSION::AudioUsage;
-
 using ::android::hardware::audio::common::utils::EnumBitfield;
 
 namespace android {
@@ -38,6 +26,9 @@
 namespace audio {
 namespace common {
 namespace CPP_VERSION {
+namespace implementation {
+
+using namespace ::android::hardware::audio::common::CPP_VERSION;
 
 void HidlUtils::audioConfigFromHal(const audio_config_t& halConfig, AudioConfig* config) {
     config->sampleRateHz = halConfig.sample_rate;
@@ -356,6 +347,7 @@
     memcpy(halUuid->node, uuid.node.data(), uuid.node.size());
 }
 
+}  // namespace implementation
 }  // namespace CPP_VERSION
 }  // namespace common
 }  // namespace audio
diff --git a/audio/common/all-versions/default/HidlUtils.h b/audio/common/all-versions/default/HidlUtils.h
index 77c8b89..758a7f4 100644
--- a/audio/common/all-versions/default/HidlUtils.h
+++ b/audio/common/all-versions/default/HidlUtils.h
@@ -24,19 +24,15 @@
 #include <system/audio.h>
 
 using ::android::hardware::hidl_vec;
-using ::android::hardware::audio::common::CPP_VERSION::AudioConfig;
-using ::android::hardware::audio::common::CPP_VERSION::AudioGain;
-using ::android::hardware::audio::common::CPP_VERSION::AudioGainConfig;
-using ::android::hardware::audio::common::CPP_VERSION::AudioOffloadInfo;
-using ::android::hardware::audio::common::CPP_VERSION::AudioPort;
-using ::android::hardware::audio::common::CPP_VERSION::AudioPortConfig;
-using ::android::hardware::audio::common::CPP_VERSION::Uuid;
 
 namespace android {
 namespace hardware {
 namespace audio {
 namespace common {
 namespace CPP_VERSION {
+namespace implementation {
+
+using namespace ::android::hardware::audio::common::CPP_VERSION;
 
 class HidlUtils {
    public:
@@ -69,6 +65,7 @@
     static void uuidToHal(const Uuid& uuid, audio_uuid_t* halUuid);
 };
 
+}  // namespace implementation
 }  // namespace CPP_VERSION
 }  // namespace common
 }  // namespace audio
diff --git a/audio/core/all-versions/default/Conversions.cpp b/audio/core/all-versions/default/Conversions.cpp
index b1e6c60..9249780 100644
--- a/audio/core/all-versions/default/Conversions.cpp
+++ b/audio/core/all-versions/default/Conversions.cpp
@@ -26,7 +26,7 @@
 namespace CPP_VERSION {
 namespace implementation {
 
-using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
+using namespace ::android::hardware::audio::common::CPP_VERSION;
 
 std::string deviceAddressToHal(const DeviceAddress& address) {
     // HAL assumes that the address is NUL-terminated.
diff --git a/audio/core/all-versions/default/Device.cpp b/audio/core/all-versions/default/Device.cpp
index 6a04903..8e0b763 100644
--- a/audio/core/all-versions/default/Device.cpp
+++ b/audio/core/all-versions/default/Device.cpp
@@ -31,14 +31,14 @@
 
 #include <android/log.h>
 
-using ::android::hardware::audio::common::CPP_VERSION::HidlUtils;
-
 namespace android {
 namespace hardware {
 namespace audio {
 namespace CPP_VERSION {
 namespace implementation {
 
+using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils;
+
 Device::Device(audio_hw_device_t* device) : mDevice(device) {}
 
 Device::~Device() {
diff --git a/audio/core/all-versions/default/StreamIn.cpp b/audio/core/all-versions/default/StreamIn.cpp
index 8446382..db0eaf6 100644
--- a/audio/core/all-versions/default/StreamIn.cpp
+++ b/audio/core/all-versions/default/StreamIn.cpp
@@ -28,15 +28,15 @@
 #include <utils/Trace.h>
 #include <memory>
 
-using ::android::hardware::audio::common::CPP_VERSION::ThreadInfo;
-using ::android::hardware::audio::CPP_VERSION::MessageQueueFlagBits;
-
 namespace android {
 namespace hardware {
 namespace audio {
 namespace CPP_VERSION {
 namespace implementation {
 
+using namespace ::android::hardware::audio::common::CPP_VERSION;
+using namespace ::android::hardware::audio::CPP_VERSION;
+
 namespace {
 
 class ReadThread : public Thread {
diff --git a/audio/core/all-versions/default/include/core/default/Conversions.h b/audio/core/all-versions/default/include/core/default/Conversions.h
index 2c33c6b..4e22ece 100644
--- a/audio/core/all-versions/default/include/core/default/Conversions.h
+++ b/audio/core/all-versions/default/include/core/default/Conversions.h
@@ -29,7 +29,7 @@
 namespace CPP_VERSION {
 namespace implementation {
 
-using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
+using namespace ::android::hardware::audio::CPP_VERSION;
 
 std::string deviceAddressToHal(const DeviceAddress& address);
 
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 9975d5b..836259f 100644
--- a/audio/core/all-versions/default/include/core/default/Device.h
+++ b/audio/core/all-versions/default/include/core/default/Device.h
@@ -43,30 +43,10 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::CPP_VERSION::AudioConfig;
-using ::android::hardware::audio::common::CPP_VERSION::AudioHwSync;
-using ::android::hardware::audio::common::CPP_VERSION::AudioInputFlag;
-using ::android::hardware::audio::common::CPP_VERSION::AudioOutputFlag;
-using ::android::hardware::audio::common::CPP_VERSION::AudioPatchHandle;
-using ::android::hardware::audio::common::CPP_VERSION::AudioPort;
-using ::android::hardware::audio::common::CPP_VERSION::AudioPortConfig;
-using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
 using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioInputFlagBitfield;
 using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioOutputFlagBitfield;
-using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
-using ::android::hardware::audio::CPP_VERSION::IDevice;
-using ::android::hardware::audio::CPP_VERSION::IStreamIn;
-using ::android::hardware::audio::CPP_VERSION::IStreamOut;
-using ::android::hardware::audio::CPP_VERSION::ParameterValue;
-using ::android::hardware::audio::CPP_VERSION::Result;
-
-#if MAJOR_VERSION == 4
-using ::android::hardware::audio::CPP_VERSION::SinkMetadata;
-using ::android::hardware::audio::CPP_VERSION::SourceMetadata;
-#elif MAJOR_VERSION >= 5
-using ::android::hardware::audio::common::CPP_VERSION::SinkMetadata;
-using ::android::hardware::audio::common::CPP_VERSION::SourceMetadata;
-#endif
+using namespace ::android::hardware::audio::common::CPP_VERSION;
+using namespace ::android::hardware::audio::CPP_VERSION;
 
 struct Device : public IDevice, public ParametersUtil {
     explicit Device(audio_hw_device_t* device);
diff --git a/audio/core/all-versions/default/include/core/default/DevicesFactory.h b/audio/core/all-versions/default/include/core/default/DevicesFactory.h
index 3413853..9f93a38 100644
--- a/audio/core/all-versions/default/include/core/default/DevicesFactory.h
+++ b/audio/core/all-versions/default/include/core/default/DevicesFactory.h
@@ -35,9 +35,7 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::CPP_VERSION::IDevice;
-using ::android::hardware::audio::CPP_VERSION::IDevicesFactory;
-using ::android::hardware::audio::CPP_VERSION::Result;
+using namespace ::android::hardware::audio::CPP_VERSION;
 
 struct DevicesFactory : public IDevicesFactory {
 #if MAJOR_VERSION == 2
diff --git a/audio/core/all-versions/default/include/core/default/ParametersUtil.h b/audio/core/all-versions/default/include/core/default/ParametersUtil.h
index ba4ca0c..11007c9 100644
--- a/audio/core/all-versions/default/include/core/default/ParametersUtil.h
+++ b/audio/core/all-versions/default/include/core/default/ParametersUtil.h
@@ -33,9 +33,7 @@
 
 using ::android::hardware::hidl_string;
 using ::android::hardware::hidl_vec;
-using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
-using ::android::hardware::audio::CPP_VERSION::ParameterValue;
-using ::android::hardware::audio::CPP_VERSION::Result;
+using namespace ::android::hardware::audio::CPP_VERSION;
 
 class ParametersUtil {
    public:
diff --git a/audio/core/all-versions/default/include/core/default/PrimaryDevice.h b/audio/core/all-versions/default/include/core/default/PrimaryDevice.h
index 2f7332e..9d69cb0 100644
--- a/audio/core/all-versions/default/include/core/default/PrimaryDevice.h
+++ b/audio/core/all-versions/default/include/core/default/PrimaryDevice.h
@@ -36,20 +36,8 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::CPP_VERSION::AudioConfig;
-using ::android::hardware::audio::common::CPP_VERSION::AudioInputFlag;
-using ::android::hardware::audio::common::CPP_VERSION::AudioMode;
-using ::android::hardware::audio::common::CPP_VERSION::AudioOutputFlag;
-using ::android::hardware::audio::common::CPP_VERSION::AudioPort;
-using ::android::hardware::audio::common::CPP_VERSION::AudioPortConfig;
-using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
-using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
-using ::android::hardware::audio::CPP_VERSION::IDevice;
-using ::android::hardware::audio::CPP_VERSION::IPrimaryDevice;
-using ::android::hardware::audio::CPP_VERSION::IStreamIn;
-using ::android::hardware::audio::CPP_VERSION::IStreamOut;
-using ::android::hardware::audio::CPP_VERSION::ParameterValue;
-using ::android::hardware::audio::CPP_VERSION::Result;
+using namespace ::android::hardware::audio::common::CPP_VERSION;
+using namespace ::android::hardware::audio::CPP_VERSION;
 
 struct PrimaryDevice : public IPrimaryDevice {
     explicit PrimaryDevice(audio_hw_device_t* device);
diff --git a/audio/core/all-versions/default/include/core/default/Stream.h b/audio/core/all-versions/default/include/core/default/Stream.h
index 34d146e..91df0c7 100644
--- a/audio/core/all-versions/default/include/core/default/Stream.h
+++ b/audio/core/all-versions/default/include/core/default/Stream.h
@@ -41,14 +41,9 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
-using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
-using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
 using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioChannelBitfield;
-using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
-using ::android::hardware::audio::CPP_VERSION::IStream;
-using ::android::hardware::audio::CPP_VERSION::ParameterValue;
-using ::android::hardware::audio::CPP_VERSION::Result;
+using namespace ::android::hardware::audio::common::CPP_VERSION;
+using namespace ::android::hardware::audio::CPP_VERSION;
 
 struct Stream : public IStream, public ParametersUtil {
     explicit Stream(audio_stream_t* stream);
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 057c6f3..7a658b3 100644
--- a/audio/core/all-versions/default/include/core/default/StreamIn.h
+++ b/audio/core/all-versions/default/include/core/default/StreamIn.h
@@ -42,15 +42,8 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
-using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
-using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
-using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
-using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
-using ::android::hardware::audio::CPP_VERSION::IStream;
-using ::android::hardware::audio::CPP_VERSION::IStreamIn;
-using ::android::hardware::audio::CPP_VERSION::ParameterValue;
-using ::android::hardware::audio::CPP_VERSION::Result;
+using namespace ::android::hardware::audio::common::CPP_VERSION;
+using namespace ::android::hardware::audio::CPP_VERSION;
 
 struct StreamIn : public IStreamIn {
     typedef MessageQueue<ReadParameters, kSynchronizedReadWrite> CommandMQ;
diff --git a/audio/core/all-versions/default/include/core/default/StreamOut.h b/audio/core/all-versions/default/include/core/default/StreamOut.h
index bcae97f..b098005 100644
--- a/audio/core/all-versions/default/include/core/default/StreamOut.h
+++ b/audio/core/all-versions/default/include/core/default/StreamOut.h
@@ -42,17 +42,8 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
-using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
-using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
-using ::android::hardware::audio::CPP_VERSION::AudioDrain;
-using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
-using ::android::hardware::audio::CPP_VERSION::IStream;
-using ::android::hardware::audio::CPP_VERSION::IStreamOut;
-using ::android::hardware::audio::CPP_VERSION::IStreamOutCallback;
-using ::android::hardware::audio::CPP_VERSION::ParameterValue;
-using ::android::hardware::audio::CPP_VERSION::Result;
-using ::android::hardware::audio::CPP_VERSION::TimeSpec;
+using namespace ::android::hardware::audio::common::CPP_VERSION;
+using namespace ::android::hardware::audio::CPP_VERSION;
 
 struct StreamOut : public IStreamOut {
     typedef MessageQueue<WriteCommand, kSynchronizedReadWrite> CommandMQ;
diff --git a/audio/core/all-versions/default/include/core/default/Util.h b/audio/core/all-versions/default/include/core/default/Util.h
index 2b8c3fd..2c2a63e 100644
--- a/audio/core/all-versions/default/include/core/default/Util.h
+++ b/audio/core/all-versions/default/include/core/default/Util.h
@@ -30,7 +30,7 @@
 namespace CPP_VERSION {
 namespace implementation {
 
-using ::android::hardware::audio::CPP_VERSION::Result;
+using namespace ::android::hardware::audio::CPP_VERSION;
 
 /** @return true if gain is between 0 and 1 included. */
 constexpr bool isGainNormalized(float gain) {
diff --git a/audio/effect/all-versions/default/Conversions.cpp b/audio/effect/all-versions/default/Conversions.cpp
index 50b0562..b1c0b0d 100644
--- a/audio/effect/all-versions/default/Conversions.cpp
+++ b/audio/effect/all-versions/default/Conversions.cpp
@@ -17,14 +17,11 @@
 #include "Conversions.h"
 #include "HidlUtils.h"
 
-using ::android::hardware::audio::common::CPP_VERSION::HidlUtils;
-
 #include <memory.h>
 #include <stdio.h>
 
 #include <common/all-versions/VersionUtils.h>
 
-using ::android::hardware::audio::common::CPP_VERSION::HidlUtils;
 using ::android::hardware::audio::common::utils::EnumBitfield;
 
 namespace android {
@@ -34,6 +31,8 @@
 namespace CPP_VERSION {
 namespace implementation {
 
+using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils;
+
 void effectDescriptorFromHal(const effect_descriptor_t& halDescriptor,
                              EffectDescriptor* descriptor) {
     HidlUtils::uuidFromHal(halDescriptor.type, &descriptor->type);
diff --git a/audio/effect/all-versions/default/EffectsFactory.cpp b/audio/effect/all-versions/default/EffectsFactory.cpp
index d2d8a46..6283e7b 100644
--- a/audio/effect/all-versions/default/EffectsFactory.cpp
+++ b/audio/effect/all-versions/default/EffectsFactory.cpp
@@ -32,8 +32,6 @@
 #include "VisualizerEffect.h"
 #include "common/all-versions/default/EffectMap.h"
 
-using ::android::hardware::audio::common::CPP_VERSION::HidlUtils;
-
 #include <android/log.h>
 #include <media/EffectsFactoryApi.h>
 #include <system/audio_effects/effect_aec.h>
@@ -48,8 +46,6 @@
 #include <system/audio_effects/effect_virtualizer.h>
 #include <system/audio_effects/effect_visualizer.h>
 
-using ::android::hardware::audio::common::CPP_VERSION::HidlUtils;
-
 namespace android {
 namespace hardware {
 namespace audio {
@@ -57,6 +53,8 @@
 namespace CPP_VERSION {
 namespace implementation {
 
+using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils;
+
 // static
 sp<IEffect> EffectsFactory::dispatchEffectInstanceCreation(const effect_descriptor_t& halDescriptor,
                                                            effect_handle_t handle) {
diff --git a/biometrics/face/1.0/IBiometricsFace.hal b/biometrics/face/1.0/IBiometricsFace.hal
index 0ac788e..ee67497 100644
--- a/biometrics/face/1.0/IBiometricsFace.hal
+++ b/biometrics/face/1.0/IBiometricsFace.hal
@@ -84,7 +84,7 @@
      * @return result, with its "value" parameter representing a "challenge": a
      *     unique and cryptographically secure random token.
      */
-    @callflow(next={"enroll", "revokeChallenge", "setRequireAttention"})
+    @callflow(next={"enroll", "revokeChallenge", "setFeatureDisabled"})
     generateChallenge(uint32_t challengeTimeoutSec)
         generates (OptionalUint64 result);
 
@@ -113,19 +113,12 @@
      * @param timeoutSec A timeout in seconds, after which this enrollment
      *     attempt is cancelled. Note that the client still needs to
      *     call revokeChallenge() to terminate the enrollment session.
-     * @param requireAttention When set to true, requires user attention (e.g.
-     *     eyes open and looking at the device) for enrollment to complete, as
-     *     well as subsequent authentication. This is expected to be enabled by
-     *     default to improve security and decrease falsing (unintentional face
-     *     detection). This feature can be disabled at the user's request
-     *     during enrollment, e.g. for accessibility reasons. When enabled,
-     *     the FaceAcquiredInfo#POOR_GAZE message must be sent when the user's
-     *     attention has not been established. The UI should inform the user
-     *     to look at the device.
+     * @param disabledFeatures A list of features to be disabled during
+     *     enrollment. Note that all features are enabled by default.
      * @return status The status of this method call.
      */
     @callflow(next={"cancel", "enroll", "revokeChallenge", "remove"})
-    enroll(vec<uint8_t> hat, uint32_t timeoutSec, bool requireAttention)
+    enroll(vec<uint8_t> hat, uint32_t timeoutSec, vec<Feature> disabledFeatures)
         generates (Status status);
 
     /**
@@ -141,35 +134,33 @@
     revokeChallenge() generates (Status status);
 
     /**
-     * Requires that all subsequent authenticate calls to first have the
-     * user's attention. This method does not affect enroll, which has its
-     * own requireAttention parameter.
+     * Requires all subsequent enroll/authenticate calls to use the feature.
+     * This method does not affect enroll, which has its own feature list.
      *
      * Changes the state of previous enrollment setting. Because this may
      * decrease security, the user must enter their password before this method
      * is invoked (see @param HAT). The driver must verify the HAT before
-     * changing the requireAttention state.
+     * changing any feature state.
      * Note: In some cases it may not be possible to change the state of this
      * flag without re-enrolling. For example, if the user didn't provide
      * attention during the original enrollment. This flag reflects the same
      * persistent state as the one passed to enroll().
      *
-     * @param requireAttention When set to true, requires user attention for
-     *     authentication to succeed.
+     * @param feature The feature to be enabled or disabled.
+     * @param enabled True to enable the feature, false to disable.
      * @param hat A valid Hardware Authentication Token, generated as a result
      *     of getChallenge().
      * @return status The status of this method call.
      */
-    setRequireAttention(bool requireAttention, vec<uint8_t> hat)
+    setFeature(Feature feature, bool enabled, vec<uint8_t> hat)
         generates(Status status);
 
     /**
-     * Retrieves the current requireAttention state.
+     * Retrieves the current state of the feature.
      *
-     * @return result, with its value parameter representing the current
-     *     requireAttention state.
+     * @return enabled True if the feature is enabled, false if disabled.
      */
-    getRequireAttention(vec<uint8_t> hat) generates (OptionalBool result);
+    getFeature(Feature feature) generates (bool enabled);
 
     /**
      * Returns an identifier associated with the current face set.
diff --git a/biometrics/face/1.0/types.hal b/biometrics/face/1.0/types.hal
index f6827d5..1ec5b74 100644
--- a/biometrics/face/1.0/types.hal
+++ b/biometrics/face/1.0/types.hal
@@ -57,6 +57,21 @@
     NOT_ENROLLED = 4
 };
 
+enum Feature : uint32_t {
+    /**
+     * Require the user to look at the device during enrollment and
+     * authentication. Note this is to accommodate people who have limited
+     * vision. Must be enabled by default.
+     */
+    REQUIRE_ATTENTION = 1,
+
+    /**
+     * Require a diverse set of poses during enrollment. Note this is to
+     * accommodate people with limited mobility. Must be enabled by default.
+     */
+    REQUIRE_DIVERSITY = 2
+};
+
 /**
  * Face errors represent events that can't be immediately recovered by user
  * intervention. These are returned in the onError callback.
@@ -112,7 +127,7 @@
     /**
      * Used to enable a vendor-specific error message.
      */
-    VENDOR = 8,
+    VENDOR = 8
 };
 
 /**
diff --git a/camera/provider/2.4/default/Android.bp b/camera/provider/2.4/default/Android.bp
index 167954c..81e5738 100644
--- a/camera/provider/2.4/default/Android.bp
+++ b/camera/provider/2.4/default/Android.bp
@@ -43,14 +43,12 @@
     ],
 }
 
-cc_binary {
-    name: "android.hardware.camera.provider@2.4-service",
+cc_defaults {
+    name: "camera_service_defaults",
     defaults: ["hidl_defaults"],
     proprietary: true,
     relative_install_path: "hw",
     srcs: ["service.cpp"],
-    compile_multilib: "32",
-    init_rc: ["android.hardware.camera.provider@2.4-service.rc"],
     shared_libs: [
         "libhidlbase",
         "libhidltransport",
@@ -67,29 +65,36 @@
     ],
 }
 
+cc_binary {
+    name: "android.hardware.camera.provider@2.4-service",
+    defaults: ["camera_service_defaults"],
+    compile_multilib: "32",
+    init_rc: ["android.hardware.camera.provider@2.4-service.rc"],
+}
 
 cc_binary {
     name: "android.hardware.camera.provider@2.4-service_64",
-    defaults: ["hidl_defaults"],
-    proprietary: true,
-    relative_install_path: "hw",
-    srcs: ["service.cpp"],
+    defaults: ["camera_service_defaults"],
     compile_multilib: "64",
     init_rc: ["android.hardware.camera.provider@2.4-service_64.rc"],
-    shared_libs: [
-        "libhidlbase",
-        "libhidltransport",
-        "libbinder",
-        "liblog",
-        "libutils",
-        "android.hardware.camera.device@1.0",
-        "android.hardware.camera.device@3.2",
-        "android.hardware.camera.device@3.3",
-        "android.hardware.camera.device@3.4",
-        "android.hardware.camera.device@3.5",
-        "android.hardware.camera.provider@2.4",
-        "android.hardware.camera.common@1.0",
-    ],
+}
+
+cc_binary {
+    name: "android.hardware.camera.provider@2.4-service-lazy",
+    overrides: ["android.hardware.camera.provider@2.4-service"],
+    defaults: ["camera_service_defaults"],
+    compile_multilib: "32",
+    init_rc: ["android.hardware.camera.provider@2.4-service-lazy.rc"],
+    cflags: ["-DLAZY_SERVICE"],
+}
+
+cc_binary {
+    name: "android.hardware.camera.provider@2.4-service-lazy_64",
+    overrides: ["android.hardware.camera.provider@2.4-service_64"],
+    defaults: ["camera_service_defaults"],
+    compile_multilib: "64",
+    init_rc: ["android.hardware.camera.provider@2.4-service-lazy_64.rc"],
+    cflags: ["-DLAZY_SERVICE"],
 }
 
 cc_binary {
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-external-service.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-external-service.rc
index acdb200..64cf321 100644
--- a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-external-service.rc
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-external-service.rc
@@ -1,4 +1,5 @@
 service vendor.camera-provider-2-4-ext /vendor/bin/hw/android.hardware.camera.provider@2.4-external-service
+    interface android.hardware.camera.provider@2.4::ICameraProvider external/0
     class hal
     user cameraserver
     group audio camera input drmrpc usb
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy.rc
new file mode 100644
index 0000000..e8549ed
--- /dev/null
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy.rc
@@ -0,0 +1,10 @@
+service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service-lazy
+    interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
+    oneshot
+    disabled
+    class hal
+    user cameraserver
+    group audio camera input drmrpc
+    ioprio rt 4
+    capabilities SYS_NICE
+    writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy_64.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy_64.rc
new file mode 100644
index 0000000..2dfac76
--- /dev/null
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy_64.rc
@@ -0,0 +1,10 @@
+service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service-lazy_64
+    interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
+    oneshot
+    disabled
+    class hal
+    user cameraserver
+    group audio camera input drmrpc
+    ioprio rt 4
+    capabilities SYS_NICE
+    writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc
index c919628..913561b 100644
--- a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc
@@ -1,4 +1,5 @@
 service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service
+    interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
     class hal
     user cameraserver
     group audio camera input drmrpc
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service_64.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service_64.rc
index 4c721ec..fd4826e 100644
--- a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service_64.rc
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service_64.rc
@@ -1,4 +1,5 @@
 service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service_64
+    interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
     class hal
     user cameraserver
     group audio camera input drmrpc
diff --git a/camera/provider/2.4/default/service.cpp b/camera/provider/2.4/default/service.cpp
index 7eeb637..15d0ea6 100644
--- a/camera/provider/2.4/default/service.cpp
+++ b/camera/provider/2.4/default/service.cpp
@@ -14,15 +14,27 @@
  * limitations under the License.
  */
 
+#ifdef LAZY_SERVICE
+#define LOG_TAG "android.hardware.camera.provider@2.4-service-lazy"
+#else
 #define LOG_TAG "android.hardware.camera.provider@2.4-service"
+#endif
 
 #include <android/hardware/camera/provider/2.4/ICameraProvider.h>
 #include <hidl/LegacySupport.h>
 
 #include <binder/ProcessState.h>
 
-using android::hardware::camera::provider::V2_4::ICameraProvider;
+using android::status_t;
+using android::hardware::defaultLazyPassthroughServiceImplementation;
 using android::hardware::defaultPassthroughServiceImplementation;
+using android::hardware::camera::provider::V2_4::ICameraProvider;
+
+#ifdef LAZY_SERVICE
+const bool kLazyService = true;
+#else
+const bool kLazyService = false;
+#endif
 
 int main()
 {
@@ -30,5 +42,13 @@
     // The camera HAL may communicate to other vendor components via
     // /dev/vndbinder
     android::ProcessState::initWithDriver("/dev/vndbinder");
-    return defaultPassthroughServiceImplementation<ICameraProvider>("legacy/0", /*maxThreads*/ 6);
+    status_t status;
+    if (kLazyService) {
+        status = defaultLazyPassthroughServiceImplementation<ICameraProvider>("legacy/0",
+                                                                              /*maxThreads*/ 6);
+    } else {
+        status = defaultPassthroughServiceImplementation<ICameraProvider>("legacy/0",
+                                                                          /*maxThreads*/ 6);
+    }
+    return status;
 }
diff --git a/gnss/measurement_corrections/1.0/types.hal b/gnss/measurement_corrections/1.0/types.hal
index 192bec9..4b48e4e 100644
--- a/gnss/measurement_corrections/1.0/types.hal
+++ b/gnss/measurement_corrections/1.0/types.hal
@@ -60,8 +60,14 @@
     /** Error estimate (1-sigma) for the Excess path length estimate */
     float excessPathLengthUncertaintyMeters;
 
-    /** Defines the reflecting plane location and azimuth information */
-    ReflectingPlane reflectingPlance;
+    /**
+     * Defines the reflecting plane characteristics such as location and azimuth
+     *
+     * The value is only valid if HAS_REFLECTING_PLANE flag is set. An invalid reflecting plane
+     * means either reflection planes serving is not supported or the satellite signal has gone
+     * through multiple reflections.
+     */
+     ReflectingPlane reflectingPlane;
 };
 
 /**
@@ -91,10 +97,12 @@
 };
 
 /**
- * A struct containing the location and azimuth of the reflecting plane that the satellite signal
- * has bounced from.
+ * A struct containing the characteristics of the reflecting plane that the satellite signal has
+ * bounced from.
  *
- * This field is set only if the signal has bounced only once.
+ * The value is only valid if HAS_REFLECTING_PLANE flag is set. An invalid reflecting plane
+ * means either reflection planes serving is not supported or the satellite signal has gone
+ * through multiple reflections.
  */
 struct ReflectingPlane {
     /** Represents latitude of the reflecting plane in degrees. */
@@ -104,7 +112,8 @@
     double longitudeDegrees;
 
     /**
-     * Represents altitude of the reflecting plane in meters above the WGS 84 reference ellipsoid.
+     * Represents altitude of the reflecting point in the plane in meters above the WGS 84 reference
+     * ellipsoid.
      */
     double altitudeMeters;
 
diff --git a/media/c2/1.0/Android.bp b/media/c2/1.0/Android.bp
index 28829d2..c37c22b 100644
--- a/media/c2/1.0/Android.bp
+++ b/media/c2/1.0/Android.bp
@@ -19,7 +19,7 @@
     interfaces: [
         "android.hardware.graphics.bufferqueue@1.0",
         "android.hardware.graphics.common@1.0",
-        "android.hardware.media.bufferpool@1.0",
+        "android.hardware.media.bufferpool@2.0",
         "android.hardware.media.omx@1.0",
         "android.hardware.media@1.0",
         "android.hidl.base@1.0",
diff --git a/media/c2/1.0/IComponentStore.hal b/media/c2/1.0/IComponentStore.hal
index d2474cc..4bfa170 100644
--- a/media/c2/1.0/IComponentStore.hal
+++ b/media/c2/1.0/IComponentStore.hal
@@ -16,7 +16,7 @@
 
 package android.hardware.media.c2@1.0;
 
-import android.hardware.media.bufferpool@1.0::IClientManager;
+import android.hardware.media.bufferpool@2.0::IClientManager;
 import IComponentInterface;
 import IComponentListener;
 import IComponent;
diff --git a/media/c2/1.0/types.hal b/media/c2/1.0/types.hal
index c06b415..252d781 100644
--- a/media/c2/1.0/types.hal
+++ b/media/c2/1.0/types.hal
@@ -16,7 +16,7 @@
 
 package android.hardware.media.c2@1.0;
 
-import android.hardware.media.bufferpool@1.0::BufferStatusMessage;
+import android.hardware.media.bufferpool@2.0::BufferStatusMessage;
 
 enum Status : int32_t {
     /** operation completed successfully */
diff --git a/neuralnetworks/1.2/Android.bp b/neuralnetworks/1.2/Android.bp
index 528a2c7..7d13104 100644
--- a/neuralnetworks/1.2/Android.bp
+++ b/neuralnetworks/1.2/Android.bp
@@ -17,6 +17,7 @@
         "android.hardware.neuralnetworks@1.0",
         "android.hardware.neuralnetworks@1.1",
         "android.hidl.base@1.0",
+        "android.hidl.safe_union@1.0",
     ],
     types: [
         "Model",
diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal
index 45476ee..7c55cab 100644
--- a/neuralnetworks/1.2/types.hal
+++ b/neuralnetworks/1.2/types.hal
@@ -22,6 +22,8 @@
 import @1.0::PerformanceInfo;
 import @1.1::OperationType;
 
+import android.hidl.safe_union@1.0::Monostate;
+
 enum OperandType : @1.0::OperandType {
     /**
      * An 8 bit boolean scalar value.
@@ -40,7 +42,7 @@
      * scale is a 32 bit floating point with value greater then zero.
      */
     TENSOR_QUANT16_SYMM = 7,
-    /** A tensor of 16 bit floating point values. */
+    /** A tensor of IEEE 754 16 bit floating point values. */
     TENSOR_FLOAT16 = 8,
     /**
      * A tensor of 8 bit boolean values.
@@ -49,6 +51,31 @@
      * represents false; any other value represents true.
      */
     TENSOR_BOOL8 = 9,
+    /** An IEEE 754 16 bit floating point scalar value. */
+    FLOAT16 = 10,
+    /**
+     * A tensor of 8 bit signed integers that represent real numbers.
+     *
+     * This tensor is associated with additional fields that are
+     * used to convert the 8 bit signed integer to the real value and vice versa.
+     * These fields are:
+     * - channelDim: a 32 bit unsigned integer indicating channel dimension.
+     * - scales: an array of positive 32 bit floating point values.
+     * The size of the scales array must be equal to dimensions[channelDim].
+     * These fields are located inside Operand's extraParams union, inside the
+     * SymmPerChannelQuantParams struct.
+     *
+     * An Operand of this type must use 'channelQuant' field of its extraParams
+     * union.
+     *
+     * The channel dimension of this tensor must not be unknown (dimensions[channelDim] != 0).
+     *
+     * The formula for real values:
+     * realValue[..., C, ...] =
+     *     integerValue[..., C, ...] * scales[C]
+     * where C is an index in the Channel dimension.
+     */
+    TENSOR_QUANT8_SYMM_PER_CHANNEL = 11,
     /* ADDING A NEW FUNDAMENTAL TYPE REQUIRES UPDATING THE VALUE OF
      * OperandTypeRange::OPERAND_FUNDAMENTAL_MAX.
      */
@@ -62,7 +89,7 @@
  */
 enum OperandTypeRange : uint32_t {
     OPERAND_FUNDAMENTAL_MIN = 0,
-    OPERAND_FUNDAMENTAL_MAX = 9,
+    OPERAND_FUNDAMENTAL_MAX = 11,
     OPERAND_OEM_MIN     = 10000,
     OPERAND_OEM_MAX     = 10001,
 };
@@ -109,7 +136,7 @@
     QUANTIZE = 70,
     QUANTIZED_16BIT_LSTM = 71,
     RANDOM_MULTINOMIAL = 72,
-    REDUCE = 73,
+    REDUCE_PROD = 73,
     ROI_ALIGN = 74,
     RSQRT = 75,
     SELECT = 76,
@@ -128,6 +155,11 @@
     ROI_POOLING = 89,
     EQUAL = 90,
     NOT_EQUAL = 91,
+    REDUCE_SUM = 92,
+    REDUCE_MAX = 93,
+    REDUCE_MIN = 94,
+    REDUCE_ANY = 95,
+    REDUCE_ALL = 96,
     /* ADDING A NEW FUNDAMENTAL OPERATION REQUIRES UPDATING THE VALUE OF
      * OperationTypeRange::OPERATION_FUNDAMENTAL_MAX.
      */
@@ -141,7 +173,7 @@
  */
 enum OperationTypeRange : uint32_t {
     OPERATION_FUNDAMENTAL_MIN = 0,
-    OPERATION_FUNDAMENTAL_MAX = 91,
+    OPERATION_FUNDAMENTAL_MAX = 96,
     OPERATION_OEM_MIN = 10000,
     OPERATION_OEM_MAX = 10000,
 };
@@ -169,6 +201,25 @@
 };
 
 /**
+ * Parameters for TENSOR_QUANT8_SYMM_PER_CHANNEL operand.
+ */
+struct SymmPerChannelQuantParams {
+    /** Array of scaling values for each channel. Each value must be greater than zero. */
+    vec<float> scales;
+    /** Index of the channel dimension */
+    uint32_t channelDim;
+};
+
+// TODO(slavash): Operand Extension support
+// /**
+//  * Parameters for an unknown (as of 1.2) operand extension. This is
+//  * a vendor-specific extension or a platform extension (backport of
+//  * functionality from newer NNAPI interface).
+//  */
+// struct OperandParamsUnknown {
+// };
+
+/**
  * Describes one operand of the model's graph.
  */
 struct Operand {
@@ -261,6 +312,28 @@
      * - location.length is set.
      */
     DataLocation location;
+
+    /**
+     * Union of extra parameters, used by some types of Operands that need additional
+     * information for the complete definition of an Operand.
+     */
+    safe_union ExtraParams {
+       /**
+        * Placeholder for operand with no extra parameters.
+        */
+       Monostate none;
+
+       /**
+        * Used with TENSOR_QUANT8_SYMM_PER_CHANNEL operand type.
+        */
+       SymmPerChannelQuantParams channelQuant;
+
+       // TODO(slavash): Operand Extension support
+       // /**
+       //  * Used with Extension operand type.
+       //  */
+       // OperandParamsUnknown unknown;
+    } extraParams;
 };
 
 /**
diff --git a/neuralnetworks/1.2/vts/functional/ValidateModel.cpp b/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
index 4e0f2ff..7fccac3 100644
--- a/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
+++ b/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
@@ -151,6 +151,7 @@
 
 static uint32_t getInvalidRank(OperandType type) {
     switch (type) {
+        case OperandType::FLOAT16:
         case OperandType::FLOAT32:
         case OperandType::INT32:
         case OperandType::UINT32:
@@ -161,6 +162,7 @@
         case OperandType::TENSOR_INT32:
         case OperandType::TENSOR_QUANT8_ASYMM:
         case OperandType::TENSOR_QUANT16_SYMM:
+        case OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL:
             return 0;
         default:
             return 0;
@@ -182,12 +184,14 @@
 
 static float getInvalidScale(OperandType type) {
     switch (type) {
+        case OperandType::FLOAT16:
         case OperandType::FLOAT32:
         case OperandType::INT32:
         case OperandType::UINT32:
         case OperandType::BOOL:
         case OperandType::TENSOR_FLOAT16:
         case OperandType::TENSOR_FLOAT32:
+        case OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL:
             return 1.0f;
         case OperandType::TENSOR_INT32:
             return -1.0f;
@@ -214,6 +218,7 @@
 
 static std::vector<int32_t> getInvalidZeroPoints(OperandType type) {
     switch (type) {
+        case OperandType::FLOAT16:
         case OperandType::FLOAT32:
         case OperandType::INT32:
         case OperandType::UINT32:
@@ -221,6 +226,7 @@
         case OperandType::TENSOR_FLOAT16:
         case OperandType::TENSOR_FLOAT32:
         case OperandType::TENSOR_INT32:
+        case OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL:
             return {1};
         case OperandType::TENSOR_QUANT8_ASYMM:
             return {-1, 256};
@@ -257,6 +263,7 @@
     Operand newOperand = *operand;
     newOperand.type = type;
     switch (type) {
+        case OperandType::FLOAT16:
         case OperandType::FLOAT32:
         case OperandType::INT32:
         case OperandType::UINT32:
@@ -283,6 +290,21 @@
                 operand->dimensions.size() > 0 ? operand->dimensions : hidl_vec<uint32_t>({1});
             newOperand.scale = operand->scale != 0.0f ? operand->scale : 1.0f;
             break;
+        case OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL: {
+            newOperand.dimensions =
+                operand->dimensions.size() > 0 ? operand->dimensions : hidl_vec<uint32_t>({1});
+            newOperand.scale = 0.0f;
+            newOperand.zeroPoint = 0;
+
+            SymmPerChannelQuantParams channelQuant;
+            channelQuant.channelDim = 0;
+            channelQuant.scales = hidl_vec<float>(
+                operand->dimensions.size() > 0 ? static_cast<size_t>(operand->dimensions[0]) : 0);
+            for (size_t i = 0; i < channelQuant.scales.size(); ++i) {
+                channelQuant.scales[i] = 1.0f;
+            }
+            newOperand.extraParams.channelQuant(std::move(channelQuant));
+        } break;
         case OperandType::OEM:
         case OperandType::TENSOR_OEM_BYTE:
         default:
diff --git a/radio/1.4/IRadio.hal b/radio/1.4/IRadio.hal
index 8854453..11a45f2 100644
--- a/radio/1.4/IRadio.hal
+++ b/radio/1.4/IRadio.hal
@@ -105,6 +105,11 @@
      * Note this API is the same as IRadio.dial except using the
      * @1.4::EmergencyServiceCategory as the input param.
      *
+     * 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).
+     *
      * 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
diff --git a/radio/1.4/types.hal b/radio/1.4/types.hal
index 4e5b288..601e020 100644
--- a/radio/1.4/types.hal
+++ b/radio/1.4/types.hal
@@ -52,11 +52,14 @@
  * 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.
  *
- * 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 source of the emergency number is associated with country, field ‘mcc’ must be provided;
+ * otherwise the field ‘mcc’ must be an empty string.
  *
- * A unique EmergencyNumber has a unique combination of ‘number’, ‘mcc’ and 'categories' fields.
- * Multiple @1.4::EmergencyNumberSource should be merged into the bitfield for the same
+ * 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' 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
@@ -72,6 +75,10 @@
      */
     string mcc;
     /**
+     * 2 or 3-digit Mobile Network Code, 0..999. Empty string if not applicable.
+     */
+    string mnc;
+    /**
      * The bitfield of @1.4::EmergencyServiceCategory(s). See @1.4::EmergencyServiceCategory for
      * the value of each bit.
      */
diff --git a/renderscript/1.0/vts/functional/VtsScriptTests.cpp b/renderscript/1.0/vts/functional/VtsScriptTests.cpp
index 8268dcc..8d24cfa 100644
--- a/renderscript/1.0/vts/functional/VtsScriptTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsScriptTests.cpp
@@ -54,12 +54,12 @@
                            [&](const hidl_vec<uint8_t>& _data){ resultI = *((int*)_data.data()); });
     EXPECT_EQ(100, resultI);
 
-    context->scriptSetVarJ(script, mExportVarIdx_var_long, 101l);
+    context->scriptSetVarJ(script, mExportVarIdx_var_long, 101L);
     int resultJ = 0;
     context->scriptGetVarV(script, mExportVarIdx_var_long, sizeof(long),
                            [&](const hidl_vec<uint8_t>& _data){
                                resultJ = *((long*)_data.data()); });
-    EXPECT_EQ(101l, resultJ);
+    EXPECT_EQ(101L, resultJ);
 
     context->scriptSetVarF(script, mExportVarIdx_var_float, 102.0f);
     int resultF = 0.0f;
@@ -140,7 +140,7 @@
 
     // invoke test
     int resultI = 0;
-    long resultJ = 0l;
+    long resultJ = 0L;
     float resultF = 0.0f;
     double resultD = 0.0;
     uint32_t resultV = 0u;
@@ -165,7 +165,7 @@
                                resultVE = std::vector<int>(
                                    (int*)_data.data(), (int*)_data.data() + 2); });
     EXPECT_EQ(1, resultI);
-    EXPECT_EQ(2l, resultJ);
+    EXPECT_EQ(2L, resultJ);
     EXPECT_EQ(3.0f, resultF);
     EXPECT_EQ(4.0, resultD);
     EXPECT_EQ(5u, resultV);
diff --git a/thermal/2.0/Android.bp b/thermal/2.0/Android.bp
index 6eb4da0..c513739 100644
--- a/thermal/2.0/Android.bp
+++ b/thermal/2.0/Android.bp
@@ -22,7 +22,6 @@
         "TemperatureThreshold",
         "TemperatureType",
         "ThrottlingSeverity",
-        "ThrottlingSeverityCount",
     ],
     gen_java: true,
 }
diff --git a/thermal/2.0/types.hal b/thermal/2.0/types.hal
index a1c0325..3fc3fdc 100644
--- a/thermal/2.0/types.hal
+++ b/thermal/2.0/types.hal
@@ -22,12 +22,14 @@
 enum TemperatureType : @1.0::TemperatureType {
     USB_PORT = 4,
     POWER_AMPLIFIER = 5,
-    /**
-     * Battery Charge Limit - virtual thermal sensors
-     */
+
+    /** Battery Charge Limit - virtual thermal sensors */
     BCL_VOLTAGE = 6,
     BCL_CURRENT = 7,
     BCL_PERCENTAGE = 8,
+
+    /**  Neural Processing Unit */
+    NPU = 9,
 };
 
 
@@ -82,8 +84,6 @@
     SHUTDOWN,
 };
 
-enum ThrottlingSeverityCount : uint32_t {NUM_THROTTLING_LEVELS = 7};
-
 struct TemperatureThreshold {
     /**
      * This temperature's type.
@@ -103,7 +103,7 @@
      * happens when temperature >= threshold. If not available, set to NAN.
      * Unit is same as Temperature's value.
      */
-    float[ThrottlingSeverityCount:NUM_THROTTLING_LEVELS] hotThrottlingThresholds;
+    float[ThrottlingSeverity#len] hotThrottlingThresholds;
 
     /**
      * Cold throttling temperature constant for this temperature sensor in
@@ -111,7 +111,7 @@
      * happens when temperature <= threshold. If not available, set to NAN.
      * Unit is same as Temperature's value.
      */
-    float[ThrottlingSeverityCount:NUM_THROTTLING_LEVELS] coldThrottlingThresholds;
+    float[ThrottlingSeverity#len] coldThrottlingThresholds;
 
     /**
      * Threshold temperature above which the VR mode clockrate minimums cannot
diff --git a/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp b/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp
index cf1956d..3893014 100644
--- a/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp
+++ b/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp
@@ -37,7 +37,6 @@
 using ::android::hardware::thermal::V2_0::TemperatureThreshold;
 using ::android::hardware::thermal::V2_0::TemperatureType;
 using ::android::hardware::thermal::V2_0::ThrottlingSeverity;
-using ::android::hardware::thermal::V2_0::ThrottlingSeverityCount;
 
 constexpr char kCallbackNameNotifyThrottling[] = "notifyThrottling";
 static const Temperature kThrottleTemp = {
diff --git a/wifi/1.3/Android.bp b/wifi/1.3/Android.bp
index 163a870..45e2e88 100644
--- a/wifi/1.3/Android.bp
+++ b/wifi/1.3/Android.bp
@@ -21,6 +21,7 @@
     types: [
       "StaLinkLayerRadioStats",
       "StaLinkLayerStats",
+      "WifiChannelStats",
     ],
     gen_java: true,
 }
diff --git a/wifi/1.3/default/Android.mk b/wifi/1.3/default/Android.mk
index e05d2f0..8312c31 100644
--- a/wifi/1.3/default/Android.mk
+++ b/wifi/1.3/default/Android.mk
@@ -21,6 +21,9 @@
 LOCAL_MODULE_RELATIVE_PATH := hw
 LOCAL_PROPRIETARY_MODULE := true
 LOCAL_CPPFLAGS := -Wall -Werror -Wextra
+ifdef WIFI_HAL_INTERFACE_COMBINATIONS
+LOCAL_CPPFLAGS += -DWIFI_HAL_INTERFACE_COMBINATIONS="$(WIFI_HAL_INTERFACE_COMBINATIONS)"
+endif
 ifdef WIFI_HIDL_FEATURE_AWARE
 LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_AWARE
 endif
@@ -100,6 +103,7 @@
 include $(CLEAR_VARS)
 LOCAL_MODULE := android.hardware.wifi@1.0-service-tests
 LOCAL_PROPRIETARY_MODULE := true
+LOCAL_CPPFLAGS := -Wall -Werror -Wextra
 LOCAL_SRC_FILES := \
     tests/hidl_struct_util_unit_tests.cpp \
     tests/main.cpp \
diff --git a/wifi/1.3/default/hidl_struct_util.cpp b/wifi/1.3/default/hidl_struct_util.cpp
index b3d612f..a24d048 100644
--- a/wifi/1.3/default/hidl_struct_util.cpp
+++ b/wifi/1.3/default/hidl_struct_util.cpp
@@ -797,6 +797,55 @@
     return true;
 }
 
+bool convertLegacyLinkLayerRadioStatsToHidl(
+    const legacy_hal::LinkLayerRadioStats& legacy_radio_stat,
+    V1_3::StaLinkLayerRadioStats* hidl_radio_stat) {
+    if (!hidl_radio_stat) {
+        return false;
+    }
+    *hidl_radio_stat = {};
+
+    hidl_radio_stat->V1_0.onTimeInMs = legacy_radio_stat.stats.on_time;
+    hidl_radio_stat->V1_0.txTimeInMs = legacy_radio_stat.stats.tx_time;
+    hidl_radio_stat->V1_0.rxTimeInMs = legacy_radio_stat.stats.rx_time;
+    hidl_radio_stat->V1_0.onTimeInMsForScan =
+        legacy_radio_stat.stats.on_time_scan;
+    hidl_radio_stat->V1_0.txTimeInMsPerLevel =
+        legacy_radio_stat.tx_time_per_levels;
+    hidl_radio_stat->onTimeInMsForNanScan = legacy_radio_stat.stats.on_time_nbd;
+    hidl_radio_stat->onTimeInMsForBgScan =
+        legacy_radio_stat.stats.on_time_gscan;
+    hidl_radio_stat->onTimeInMsForRoamScan =
+        legacy_radio_stat.stats.on_time_roam_scan;
+    hidl_radio_stat->onTimeInMsForPnoScan =
+        legacy_radio_stat.stats.on_time_pno_scan;
+    hidl_radio_stat->onTimeInMsForHs20Scan =
+        legacy_radio_stat.stats.on_time_hs20;
+
+    std::vector<V1_3::WifiChannelStats> hidl_channel_stats;
+
+    for (const auto& channel_stat : legacy_radio_stat.channel_stats) {
+        V1_3::WifiChannelStats hidl_channel_stat;
+        hidl_channel_stat.onTimeInMs = channel_stat.on_time;
+        hidl_channel_stat.ccaBusyTimeInMs = channel_stat.cca_busy_time;
+        /*
+         * TODO once b/119142899 is fixed,
+         * replace below code with convertLegacyWifiChannelInfoToHidl()
+         */
+        hidl_channel_stat.channel.width = WifiChannelWidthInMhz::WIDTH_20;
+        hidl_channel_stat.channel.centerFreq = channel_stat.channel.center_freq;
+        hidl_channel_stat.channel.centerFreq0 =
+            channel_stat.channel.center_freq0;
+        hidl_channel_stat.channel.centerFreq1 =
+            channel_stat.channel.center_freq1;
+        hidl_channel_stats.push_back(hidl_channel_stat);
+    }
+
+    hidl_radio_stat->channelStats = hidl_channel_stats;
+
+    return true;
+}
+
 bool convertLegacyLinkLayerStatsToHidl(
     const legacy_hal::LinkLayerStats& legacy_stats,
     V1_3::StaLinkLayerStats* hidl_stats) {
@@ -843,23 +892,10 @@
     std::vector<V1_3::StaLinkLayerRadioStats> hidl_radios_stats;
     for (const auto& legacy_radio_stats : legacy_stats.radios) {
         V1_3::StaLinkLayerRadioStats hidl_radio_stats;
-        hidl_radio_stats.V1_0.onTimeInMs = legacy_radio_stats.stats.on_time;
-        hidl_radio_stats.V1_0.txTimeInMs = legacy_radio_stats.stats.tx_time;
-        hidl_radio_stats.V1_0.rxTimeInMs = legacy_radio_stats.stats.rx_time;
-        hidl_radio_stats.V1_0.onTimeInMsForScan =
-            legacy_radio_stats.stats.on_time_scan;
-        hidl_radio_stats.V1_0.txTimeInMsPerLevel =
-            legacy_radio_stats.tx_time_per_levels;
-        hidl_radio_stats.onTimeInMsForNanScan =
-            legacy_radio_stats.stats.on_time_nbd;
-        hidl_radio_stats.onTimeInMsForBgScan =
-            legacy_radio_stats.stats.on_time_gscan;
-        hidl_radio_stats.onTimeInMsForRoamScan =
-            legacy_radio_stats.stats.on_time_roam_scan;
-        hidl_radio_stats.onTimeInMsForPnoScan =
-            legacy_radio_stats.stats.on_time_pno_scan;
-        hidl_radio_stats.onTimeInMsForHs20Scan =
-            legacy_radio_stats.stats.on_time_hs20;
+        if (!convertLegacyLinkLayerRadioStatsToHidl(legacy_radio_stats,
+                                                    &hidl_radio_stats)) {
+            return false;
+        }
         hidl_radios_stats.push_back(hidl_radio_stats);
     }
     hidl_stats->radios = hidl_radios_stats;
diff --git a/wifi/1.3/default/tests/hidl_struct_util_unit_tests.cpp b/wifi/1.3/default/tests/hidl_struct_util_unit_tests.cpp
index 7056759..dbf7bd6 100644
--- a/wifi/1.3/default/tests/hidl_struct_util_unit_tests.cpp
+++ b/wifi/1.3/default/tests/hidl_struct_util_unit_tests.cpp
@@ -37,6 +37,7 @@
 namespace V1_3 {
 namespace implementation {
 using namespace android::hardware::wifi::V1_0;
+using ::android::hardware::wifi::V1_0::WifiChannelWidthInMhz;
 
 class HidlStructUtilTest : public Test {};
 
@@ -166,6 +167,17 @@
         for (int i = 0; i < 4; i++) {
             radio.tx_time_per_levels.push_back(rand());
         }
+
+        legacy_hal::wifi_channel_stat channel_stat1 = {
+            .channel = {legacy_hal::WIFI_CHAN_WIDTH_20, 2437, 2437, 0},
+            .cca_busy_time = 0x55,
+            .on_time = 0x1111};
+        legacy_hal::wifi_channel_stat channel_stat2 = {
+            .channel = {legacy_hal::WIFI_CHAN_WIDTH_20, 5180, 5180, 0},
+            .cca_busy_time = 0x66,
+            .on_time = 0x2222};
+        radio.channel_stats.push_back(channel_stat1);
+        radio.channel_stats.push_back(channel_stat2);
     }
 
     V1_3::StaLinkLayerStats converted{};
@@ -210,7 +222,7 @@
               converted.iface.wmeVoPktStats.retries);
 
     EXPECT_EQ(legacy_stats.radios.size(), converted.radios.size());
-    for (int i = 0; i < legacy_stats.radios.size(); i++) {
+    for (size_t i = 0; i < legacy_stats.radios.size(); i++) {
         EXPECT_EQ(legacy_stats.radios[i].stats.on_time,
                   converted.radios[i].V1_0.onTimeInMs);
         EXPECT_EQ(legacy_stats.radios[i].stats.tx_time,
@@ -221,7 +233,7 @@
                   converted.radios[i].V1_0.onTimeInMsForScan);
         EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels.size(),
                   converted.radios[i].V1_0.txTimeInMsPerLevel.size());
-        for (int j = 0; j < legacy_stats.radios[i].tx_time_per_levels.size();
+        for (size_t j = 0; j < legacy_stats.radios[i].tx_time_per_levels.size();
              j++) {
             EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels[j],
                       converted.radios[i].V1_0.txTimeInMsPerLevel[j]);
@@ -236,6 +248,24 @@
                   converted.radios[i].onTimeInMsForPnoScan);
         EXPECT_EQ(legacy_stats.radios[i].stats.on_time_hs20,
                   converted.radios[i].onTimeInMsForHs20Scan);
+        EXPECT_EQ(legacy_stats.radios[i].channel_stats.size(),
+                  converted.radios[i].channelStats.size());
+        for (size_t k = 0; k < legacy_stats.radios[i].channel_stats.size();
+             k++) {
+            auto& legacy_channel_st = legacy_stats.radios[i].channel_stats[k];
+            EXPECT_EQ(WifiChannelWidthInMhz::WIDTH_20,
+                      converted.radios[i].channelStats[k].channel.width);
+            EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq),
+                      converted.radios[i].channelStats[k].channel.centerFreq);
+            EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq0),
+                      converted.radios[i].channelStats[k].channel.centerFreq0);
+            EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq1),
+                      converted.radios[i].channelStats[k].channel.centerFreq1);
+            EXPECT_EQ(legacy_channel_st.cca_busy_time,
+                      converted.radios[i].channelStats[k].ccaBusyTimeInMs);
+            EXPECT_EQ(legacy_channel_st.on_time,
+                      converted.radios[i].channelStats[k].onTimeInMs);
+        }
     }
 }
 
diff --git a/wifi/1.3/default/tests/mock_wifi_feature_flags.h b/wifi/1.3/default/tests/mock_wifi_feature_flags.h
index 86c50a7..8b0baa4 100644
--- a/wifi/1.3/default/tests/mock_wifi_feature_flags.h
+++ b/wifi/1.3/default/tests/mock_wifi_feature_flags.h
@@ -18,6 +18,7 @@
 #define MOCK_WIFI_FEATURE_FLAGS_H_
 
 #include <gmock/gmock.h>
+#undef NAN  // This is weird, NAN is defined in bionic/libc/include/math.h:38
 
 #include "wifi_feature_flags.h"
 
@@ -32,9 +33,7 @@
    public:
     MockWifiFeatureFlags();
 
-    MOCK_METHOD0(isAwareSupported, bool());
-    MOCK_METHOD0(isDualInterfaceSupported, bool());
-    MOCK_METHOD0(isApDisabled, bool());
+    MOCK_METHOD0(getChipModes, std::vector<V1_0::IWifiChip::ChipMode>());
 };
 
 }  // namespace feature_flags
diff --git a/wifi/1.3/default/tests/runtests.sh b/wifi/1.3/default/tests/runtests.sh
index 6bce3ef..eefc697 100755
--- a/wifi/1.3/default/tests/runtests.sh
+++ b/wifi/1.3/default/tests/runtests.sh
@@ -23,4 +23,4 @@
 $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode android.hardware.wifi@1.0-service-tests
 adb root
 adb sync data
-adb shell /data/nativetest64/vendor/android.hardware.wifi@1.0-service-tests/android.hardware.wifi@1.0-service-tests
+adb shell /data/nativetest64/android.hardware.wifi@1.0-service-tests/android.hardware.wifi@1.0-service-tests
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 61060b5..32ba760 100644
--- a/wifi/1.3/default/tests/wifi_chip_unit_tests.cpp
+++ b/wifi/1.3/default/tests/wifi_chip_unit_tests.cpp
@@ -44,48 +44,77 @@
 class WifiChipTest : public Test {
    protected:
     void setupV1IfaceCombination() {
-        EXPECT_CALL(*feature_flags_, isAwareSupported())
-            .WillRepeatedly(testing::Return(false));
-        EXPECT_CALL(*feature_flags_, isDualInterfaceSupported())
-            .WillRepeatedly(testing::Return(false));
-        EXPECT_CALL(*feature_flags_, isApDisabled())
-            .WillRepeatedly(testing::Return(false));
+        // clang-format off
+        const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsSta = {
+            {{{{IfaceType::STA}, 1}, {{IfaceType::P2P}, 1}}}
+        };
+        const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsAp = {
+            {{{{IfaceType::AP}, 1}}}
+        };
+        const std::vector<V1_0::IWifiChip::ChipMode> modes = {
+            {feature_flags::chip_mode_ids::kV1Sta, combinationsSta},
+            {feature_flags::chip_mode_ids::kV1Ap, combinationsAp}
+        };
+        // clang-format on
+        EXPECT_CALL(*feature_flags_, getChipModes())
+            .WillRepeatedly(testing::Return(modes));
     }
 
     void setupV1_AwareIfaceCombination() {
-        EXPECT_CALL(*feature_flags_, isAwareSupported())
-            .WillRepeatedly(testing::Return(true));
-        EXPECT_CALL(*feature_flags_, isDualInterfaceSupported())
-            .WillRepeatedly(testing::Return(false));
-        EXPECT_CALL(*feature_flags_, isApDisabled())
-            .WillRepeatedly(testing::Return(false));
+        // clang-format off
+        const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsSta = {
+            {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}}
+        };
+        const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsAp = {
+            {{{{IfaceType::AP}, 1}}}
+        };
+        const std::vector<V1_0::IWifiChip::ChipMode> modes = {
+            {feature_flags::chip_mode_ids::kV1Sta, combinationsSta},
+            {feature_flags::chip_mode_ids::kV1Ap, combinationsAp}
+        };
+        // clang-format on
+        EXPECT_CALL(*feature_flags_, getChipModes())
+            .WillRepeatedly(testing::Return(modes));
     }
 
     void setupV1_AwareDisabledApIfaceCombination() {
-        EXPECT_CALL(*feature_flags_, isAwareSupported())
-            .WillRepeatedly(testing::Return(true));
-        EXPECT_CALL(*feature_flags_, isDualInterfaceSupported())
-            .WillRepeatedly(testing::Return(false));
-        EXPECT_CALL(*feature_flags_, isApDisabled())
-            .WillRepeatedly(testing::Return(true));
+        // clang-format off
+        const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsSta = {
+            {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}}
+        };
+        const std::vector<V1_0::IWifiChip::ChipMode> modes = {
+            {feature_flags::chip_mode_ids::kV1Sta, combinationsSta}
+        };
+        // clang-format on
+        EXPECT_CALL(*feature_flags_, getChipModes())
+            .WillRepeatedly(testing::Return(modes));
     }
 
     void setupV2_AwareIfaceCombination() {
-        EXPECT_CALL(*feature_flags_, isAwareSupported())
-            .WillRepeatedly(testing::Return(true));
-        EXPECT_CALL(*feature_flags_, isDualInterfaceSupported())
-            .WillRepeatedly(testing::Return(true));
-        EXPECT_CALL(*feature_flags_, isApDisabled())
-            .WillRepeatedly(testing::Return(false));
+        // clang-format off
+        const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinations = {
+            {{{{IfaceType::STA}, 1}, {{IfaceType::AP}, 1}}},
+            {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}}
+        };
+        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 setupV2_AwareDisabledApIfaceCombination() {
-        EXPECT_CALL(*feature_flags_, isAwareSupported())
-            .WillRepeatedly(testing::Return(true));
-        EXPECT_CALL(*feature_flags_, isDualInterfaceSupported())
-            .WillRepeatedly(testing::Return(true));
-        EXPECT_CALL(*feature_flags_, isApDisabled())
-            .WillRepeatedly(testing::Return(true));
+        // clang-format off
+        const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinations = {
+            {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}}
+        };
+        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) {
diff --git a/wifi/1.3/default/wifi_chip.cpp b/wifi/1.3/default/wifi_chip.cpp
index a80116a..dd6bd7c 100644
--- a/wifi/1.3/default/wifi_chip.cpp
+++ b/wifi/1.3/default/wifi_chip.cpp
@@ -36,15 +36,6 @@
 using android::hardware::wifi::V1_0::IfaceType;
 using android::hardware::wifi::V1_0::IWifiChip;
 
-constexpr ChipModeId kInvalidModeId = UINT32_MAX;
-// These mode ID's should be unique (even across combo versions). Refer to
-// handleChipConfiguration() for it's usage.
-// Mode ID's for V1
-constexpr ChipModeId kV1StaChipModeId = 0;
-constexpr ChipModeId kV1ApChipModeId = 1;
-// Mode ID for V2
-constexpr ChipModeId kV2ChipModeId = 2;
-
 constexpr char kCpioMagic[] = "070701";
 constexpr size_t kMaxBufferSizeBytes = 1024 * 1024;
 constexpr uint32_t kMaxRingBufferFileAgeSeconds = 60 * 60;
@@ -318,10 +309,9 @@
       mode_controller_(mode_controller),
       feature_flags_(feature_flags),
       is_valid_(true),
-      current_mode_id_(kInvalidModeId),
-      debug_ring_buffer_cb_registered_(false) {
-    populateModes();
-}
+      current_mode_id_(feature_flags::chip_mode_ids::kInvalid),
+      modes_(feature_flags.lock()->getChipModes()),
+      debug_ring_buffer_cb_registered_(false) {}
 
 void WifiChip::invalidate() {
     if (!writeRingbufferFilesInternal()) {
@@ -1118,9 +1108,9 @@
     }
     // Firmware mode change not needed for V2 devices.
     bool success = true;
-    if (mode_id == kV1StaChipModeId) {
+    if (mode_id == feature_flags::chip_mode_ids::kV1Sta) {
         success = mode_controller_.lock()->changeFirmwareMode(IfaceType::STA);
-    } else if (mode_id == kV1ApChipModeId) {
+    } else if (mode_id == feature_flags::chip_mode_ids::kV1Ap) {
         success = mode_controller_.lock()->changeFirmwareMode(IfaceType::AP);
     }
     if (!success) {
@@ -1212,81 +1202,6 @@
     return createWifiStatusFromLegacyError(legacy_status);
 }
 
-void WifiChip::populateModes() {
-    // The chip combination supported for current devices is fixed.
-    // They can be one of the following based on device features:
-    // a) 2 separate modes of operation with 1 interface combination each:
-    //    Mode 1 (STA mode): Will support 1 STA and 1 P2P or NAN(optional)
-    //                       concurrent iface operations.
-    //    Mode 2 (AP mode): Will support 1 AP iface operation.
-    //
-    // b) 1 mode of operation with 2 interface combinations
-    // (conditional on isDualInterfaceSupported()):
-    //    Interface Combination 1: Will support 1 STA and 1 P2P or NAN(optional)
-    //                             concurrent iface operations.
-    //    Interface Combination 2: Will support 1 STA and 1 AP concurrent
-    //                             iface operations.
-    // If Aware is enabled (conditional on isAwareSupported()), the iface
-    // combination will be modified to support either P2P or NAN in place of
-    // just P2P.
-    if (feature_flags_.lock()->isDualInterfaceSupported()) {
-        // V2 Iface combinations for Mode Id = 2.
-        const IWifiChip::ChipIfaceCombinationLimit
-            chip_iface_combination_limit_1 = {{IfaceType::STA}, 1};
-        const IWifiChip::ChipIfaceCombinationLimit
-            chip_iface_combination_limit_2 = {{IfaceType::AP}, 1};
-        IWifiChip::ChipIfaceCombinationLimit chip_iface_combination_limit_3;
-        if (feature_flags_.lock()->isAwareSupported()) {
-            chip_iface_combination_limit_3 = {{IfaceType::P2P, IfaceType::NAN},
-                                              1};
-        } else {
-            chip_iface_combination_limit_3 = {{IfaceType::P2P}, 1};
-        }
-        const IWifiChip::ChipIfaceCombination chip_iface_combination_1 = {
-            {chip_iface_combination_limit_1, chip_iface_combination_limit_2}};
-        const IWifiChip::ChipIfaceCombination chip_iface_combination_2 = {
-            {chip_iface_combination_limit_1, chip_iface_combination_limit_3}};
-        if (feature_flags_.lock()->isApDisabled()) {
-            const IWifiChip::ChipMode chip_mode = {kV2ChipModeId,
-                                                   {chip_iface_combination_2}};
-            modes_ = {chip_mode};
-        } else {
-            const IWifiChip::ChipMode chip_mode = {
-                kV2ChipModeId,
-                {chip_iface_combination_1, chip_iface_combination_2}};
-            modes_ = {chip_mode};
-        }
-    } else {
-        // V1 Iface combinations for Mode Id = 0. (STA Mode)
-        const IWifiChip::ChipIfaceCombinationLimit
-            sta_chip_iface_combination_limit_1 = {{IfaceType::STA}, 1};
-        IWifiChip::ChipIfaceCombinationLimit sta_chip_iface_combination_limit_2;
-        if (feature_flags_.lock()->isAwareSupported()) {
-            sta_chip_iface_combination_limit_2 = {
-                {IfaceType::P2P, IfaceType::NAN}, 1};
-        } else {
-            sta_chip_iface_combination_limit_2 = {{IfaceType::P2P}, 1};
-        }
-        const IWifiChip::ChipIfaceCombination sta_chip_iface_combination = {
-            {sta_chip_iface_combination_limit_1,
-             sta_chip_iface_combination_limit_2}};
-        const IWifiChip::ChipMode sta_chip_mode = {
-            kV1StaChipModeId, {sta_chip_iface_combination}};
-        // Iface combinations for Mode Id = 1. (AP Mode)
-        const IWifiChip::ChipIfaceCombinationLimit
-            ap_chip_iface_combination_limit = {{IfaceType::AP}, 1};
-        const IWifiChip::ChipIfaceCombination ap_chip_iface_combination = {
-            {ap_chip_iface_combination_limit}};
-        const IWifiChip::ChipMode ap_chip_mode = {kV1ApChipModeId,
-                                                  {ap_chip_iface_combination}};
-        if (feature_flags_.lock()->isApDisabled()) {
-            modes_ = {sta_chip_mode};
-        } else {
-            modes_ = {sta_chip_mode, ap_chip_mode};
-        }
-    }
-}
-
 std::vector<IWifiChip::ChipIfaceCombination>
 WifiChip::getCurrentModeIfaceCombinations() {
     if (!isValidModeId(current_mode_id_)) {
diff --git a/wifi/1.3/default/wifi_chip.h b/wifi/1.3/default/wifi_chip.h
index 11200f9..6695240 100644
--- a/wifi/1.3/default/wifi_chip.h
+++ b/wifi/1.3/default/wifi_chip.h
@@ -215,7 +215,6 @@
     WifiStatus registerDebugRingBufferCallback();
     WifiStatus registerRadioModeChangeCallback();
 
-    void populateModes();
     std::vector<IWifiChip::ChipIfaceCombination>
     getCurrentModeIfaceCombinations();
     std::map<IfaceType, size_t> getCurrentIfaceCombination();
diff --git a/wifi/1.3/default/wifi_feature_flags.cpp b/wifi/1.3/default/wifi_feature_flags.cpp
index 8d48c36..17b3bee 100644
--- a/wifi/1.3/default/wifi_feature_flags.cpp
+++ b/wifi/1.3/default/wifi_feature_flags.cpp
@@ -16,25 +16,6 @@
 
 #include "wifi_feature_flags.h"
 
-namespace {
-#ifdef WIFI_HIDL_FEATURE_AWARE
-static const bool wifiHidlFeatureAware = true;
-#else
-static const bool wifiHidlFeatureAware = false;
-#endif  // WIFI_HIDL_FEATURE_AWARE
-#ifdef WIFI_HIDL_FEATURE_DUAL_INTERFACE
-static const bool wifiHidlFeatureDualInterface = true;
-#else
-static const bool wifiHidlFeatureDualInterface = false;
-#endif  // WIFI_HIDL_FEATURE_DUAL_INTERFACE
-#ifdef WIFI_HIDL_FEATURE_DISABLE_AP
-static const bool wifiHidlFeatureDisableAp = true;
-#else
-static const bool wifiHidlFeatureDisableAp = false;
-#endif  // WIFI_HIDL_FEATURE_DISABLE_AP
-
-}  // namespace
-
 namespace android {
 namespace hardware {
 namespace wifi {
@@ -42,12 +23,132 @@
 namespace implementation {
 namespace feature_flags {
 
+using V1_0::ChipModeId;
+using V1_0::IfaceType;
+using V1_0::IWifiChip;
+
+/* The chip may either have a single mode supporting any number of combinations,
+ * or a fixed dual-mode (so it involves firmware loading to switch between
+ * modes) setting. If there is a need to support more modes, it needs to be
+ * implemented manually in WiFi HAL (see changeFirmwareMode in
+ * WifiChip::handleChipConfiguration).
+ *
+ * Supported combinations are defined in device's makefile, for example:
+ *    WIFI_HAL_INTERFACE_COMBINATIONS := {{{STA, AP}, 1}, {{P2P, NAN}, 1}},
+ *    WIFI_HAL_INTERFACE_COMBINATIONS += {{{STA}, 1}, {{AP}, 2}}
+ * What means:
+ *    Interface combination 1: 1 STA or AP and 1 P2P or NAN concurrent iface
+ *                             operations.
+ *    Interface combination 2: 1 STA and 2 AP concurrent iface operations.
+ *
+ * For backward compatibility, the following makefile flags can be used to
+ * generate combinations list:
+ *  - WIFI_HIDL_FEATURE_DUAL_INTERFACE
+ *  - WIFI_HIDL_FEATURE_DISABLE_AP
+ *  - WIFI_HIDL_FEATURE_AWARE
+ * However, they are ignored if WIFI_HAL_INTERFACE_COMBINATIONS was provided.
+ * With WIFI_HIDL_FEATURE_DUAL_INTERFACE flag set, there is a single mode with
+ * two interface combinations:
+ *    Interface Combination 1: Will support 1 STA and 1 P2P or NAN (optional)
+ *                             concurrent iface operations.
+ *    Interface Combination 2: Will support 1 STA and 1 AP concurrent
+ *                             iface operations.
+ *
+ * The only dual-mode configuration supported is for alternating STA and AP
+ * mode, that may involve firmware reloading. In such case, there are 2 separate
+ * modes of operation with 1 interface combination each:
+ *    Mode 1 (STA mode): Will support 1 STA and 1 P2P or NAN (optional)
+ *                       concurrent iface operations.
+ *    Mode 2 (AP mode): Will support 1 AP iface operation.
+ *
+ * If Aware is enabled, the iface combination will be modified to support either
+ * P2P or NAN in place of just P2P.
+ */
+// clang-format off
+#ifdef WIFI_HAL_INTERFACE_COMBINATIONS
+constexpr ChipModeId kMainModeId = chip_mode_ids::kV3;
+#elif defined(WIFI_HIDL_FEATURE_DUAL_INTERFACE)
+// former V2 (fixed dual interface) setup expressed as V3
+constexpr ChipModeId kMainModeId = chip_mode_ids::kV3;
+#  ifdef WIFI_HIDL_FEATURE_DISABLE_AP
+#    ifdef WIFI_HIDL_FEATURE_AWARE
+//     1 STA + 1 of (P2P or NAN)
+#      define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P, NAN}, 1}}
+#    else
+//     1 STA + 1 P2P
+#      define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P}, 1}}
+#    endif
+#  else
+#    ifdef WIFI_HIDL_FEATURE_AWARE
+//     (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN))
+#      define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{AP}, 1}},\
+                                              {{{STA}, 1}, {{P2P, NAN}, 1}}
+#    else
+//     (1 STA + 1 AP) or (1 STA + 1 P2P)
+#      define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{AP}, 1}},\
+                                              {{{STA}, 1}, {{P2P}, 1}}
+#    endif
+#  endif
+#else
+// V1 (fixed single interface, dual-mode chip)
+constexpr ChipModeId kMainModeId = chip_mode_ids::kV1Sta;
+#  ifdef WIFI_HIDL_FEATURE_AWARE
+//   1 STA + 1 of (P2P or NAN)
+#    define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P, NAN}, 1}}
+#  else
+//   1 STA + 1 P2P
+#    define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P}, 1}}
+#  endif
+
+#  ifndef WIFI_HIDL_FEATURE_DISABLE_AP
+#    define WIFI_HAL_INTERFACE_COMBINATIONS_AP {{{AP}, 1}}
+#  endif
+#endif
+// clang-format on
+
+/**
+ * Helper class to convert a collection of combination limits to a combination.
+ *
+ * The main point here is to simplify the syntax required by
+ * WIFI_HAL_INTERFACE_COMBINATIONS.
+ */
+struct ChipIfaceCombination
+    : public hidl_vec<IWifiChip::ChipIfaceCombinationLimit> {
+    ChipIfaceCombination(
+        const std::initializer_list<IWifiChip::ChipIfaceCombinationLimit> list)
+        : hidl_vec(list) {}
+
+    operator IWifiChip::ChipIfaceCombination() const { return {*this}; }
+
+    static hidl_vec<IWifiChip::ChipIfaceCombination> make_vec(
+        const std::initializer_list<ChipIfaceCombination> list) {
+        return hidl_vec<IWifiChip::ChipIfaceCombination>(  //
+            std::begin(list), std::end(list));
+    }
+};
+
+#define STA IfaceType::STA
+#define AP IfaceType::AP
+#define P2P IfaceType::P2P
+#define NAN IfaceType::NAN
+static const std::vector<IWifiChip::ChipMode> kChipModes{
+    {kMainModeId,
+     ChipIfaceCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS})},
+#ifdef WIFI_HAL_INTERFACE_COMBINATIONS_AP
+    {chip_mode_ids::kV1Ap,
+     ChipIfaceCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_AP})},
+#endif
+};
+#undef STA
+#undef AP
+#undef P2P
+#undef NAN
+
 WifiFeatureFlags::WifiFeatureFlags() {}
-bool WifiFeatureFlags::isAwareSupported() { return wifiHidlFeatureAware; }
-bool WifiFeatureFlags::isDualInterfaceSupported() {
-    return wifiHidlFeatureDualInterface;
+
+std::vector<IWifiChip::ChipMode> WifiFeatureFlags::getChipModes() {
+    return kChipModes;
 }
-bool WifiFeatureFlags::isApDisabled() { return wifiHidlFeatureDisableAp; }
 
 }  // namespace feature_flags
 }  // namespace implementation
diff --git a/wifi/1.3/default/wifi_feature_flags.h b/wifi/1.3/default/wifi_feature_flags.h
index ce74e23..b99a416 100644
--- a/wifi/1.3/default/wifi_feature_flags.h
+++ b/wifi/1.3/default/wifi_feature_flags.h
@@ -17,6 +17,8 @@
 #ifndef WIFI_FEATURE_FLAGS_H_
 #define WIFI_FEATURE_FLAGS_H_
 
+#include <android/hardware/wifi/1.2/IWifiChip.h>
+
 namespace android {
 namespace hardware {
 namespace wifi {
@@ -24,14 +26,23 @@
 namespace implementation {
 namespace feature_flags {
 
+namespace chip_mode_ids {
+// These mode ID's should be unique (even across combo versions). Refer to
+// handleChipConfiguration() for it's usage.
+constexpr V1_0::ChipModeId kInvalid = UINT32_MAX;
+// Mode ID's for V1
+constexpr V1_0::ChipModeId kV1Sta = 0;
+constexpr V1_0::ChipModeId kV1Ap = 1;
+// Mode ID for V3
+constexpr V1_0::ChipModeId kV3 = 3;
+}  // namespace chip_mode_ids
+
 class WifiFeatureFlags {
    public:
     WifiFeatureFlags();
     virtual ~WifiFeatureFlags() = default;
 
-    virtual bool isAwareSupported();
-    virtual bool isDualInterfaceSupported();
-    virtual bool isApDisabled();
+    virtual std::vector<V1_0::IWifiChip::ChipMode> getChipModes();
 };
 
 }  // namespace feature_flags
diff --git a/wifi/1.3/default/wifi_legacy_hal.cpp b/wifi/1.3/default/wifi_legacy_hal.cpp
index 2cd7c2a..2b90f92 100644
--- a/wifi/1.3/default/wifi_legacy_hal.cpp
+++ b/wifi/1.3/default/wifi_legacy_hal.cpp
@@ -551,6 +551,7 @@
                         on_results_user_callback(id, cached_scan_results);
                         return;
                     }
+                    FALLTHROUGH_INTENDED;
                 }
                 // Fall through if failed. Failure to retrieve cached scan
                 // results should trigger a background scan failure.
@@ -652,6 +653,8 @@
         [&link_stats_ptr](wifi_request_id /* id */,
                           wifi_iface_stat* iface_stats_ptr, int num_radios,
                           wifi_radio_stat* radio_stats_ptr) {
+            wifi_radio_stat* l_radio_stats_ptr;
+
             if (iface_stats_ptr != nullptr) {
                 link_stats_ptr->iface = *iface_stats_ptr;
                 link_stats_ptr->iface.num_peers = 0;
@@ -662,20 +665,35 @@
                 LOG(ERROR) << "Invalid radio stats in link layer stats";
                 return;
             }
+            l_radio_stats_ptr = radio_stats_ptr;
             for (int i = 0; i < num_radios; i++) {
                 LinkLayerRadioStats radio;
-                radio.stats = radio_stats_ptr[i];
+
+                radio.stats = *l_radio_stats_ptr;
                 // Copy over the tx level array to the separate vector.
-                if (radio_stats_ptr[i].num_tx_levels > 0 &&
-                    radio_stats_ptr[i].tx_time_per_levels != nullptr) {
+                if (l_radio_stats_ptr->num_tx_levels > 0 &&
+                    l_radio_stats_ptr->tx_time_per_levels != nullptr) {
                     radio.tx_time_per_levels.assign(
-                        radio_stats_ptr[i].tx_time_per_levels,
-                        radio_stats_ptr[i].tx_time_per_levels +
-                            radio_stats_ptr[i].num_tx_levels);
+                        l_radio_stats_ptr->tx_time_per_levels,
+                        l_radio_stats_ptr->tx_time_per_levels +
+                            l_radio_stats_ptr->num_tx_levels);
                 }
                 radio.stats.num_tx_levels = 0;
                 radio.stats.tx_time_per_levels = nullptr;
+                /* Copy over the channel stat to separate vector */
+                if (l_radio_stats_ptr->num_channels > 0) {
+                    /* Copy the channel stats */
+                    radio.channel_stats.assign(
+                        l_radio_stats_ptr->channels,
+                        l_radio_stats_ptr->channels +
+                            l_radio_stats_ptr->num_channels);
+                }
                 link_stats_ptr->radios.push_back(radio);
+                l_radio_stats_ptr =
+                    (wifi_radio_stat*)((u8*)l_radio_stats_ptr +
+                                       sizeof(wifi_radio_stat) +
+                                       (sizeof(wifi_channel_stat) *
+                                        l_radio_stats_ptr->num_channels));
             }
         };
 
diff --git a/wifi/1.3/default/wifi_legacy_hal.h b/wifi/1.3/default/wifi_legacy_hal.h
index 2f513c4..d6f05ae 100644
--- a/wifi/1.3/default/wifi_legacy_hal.h
+++ b/wifi/1.3/default/wifi_legacy_hal.h
@@ -61,6 +61,7 @@
 struct LinkLayerRadioStats {
     wifi_radio_stat stats;
     std::vector<uint32_t> tx_time_per_levels;
+    std::vector<wifi_channel_stat> channel_stats;
 };
 
 struct LinkLayerStats {
diff --git a/wifi/1.3/types.hal b/wifi/1.3/types.hal
index 4585ff3..3b292b0 100644
--- a/wifi/1.3/types.hal
+++ b/wifi/1.3/types.hal
@@ -19,6 +19,22 @@
 import @1.0::StaLinkLayerRadioStats;
 import @1.0::StaLinkLayerIfaceStats;
 import @1.0::TimeStampInMs;
+import @1.0::WifiChannelInfo;
+
+struct WifiChannelStats {
+    /**
+    * Channel information.
+    */
+    WifiChannelInfo channel;
+    /**
+     * Total time for which the radio is awake on this channel.
+     */
+    uint32_t onTimeInMs;
+    /**
+     * Total time for which CCA is held busy on this channel.
+     */
+    uint32_t ccaBusyTimeInMs;
+};
 
 struct StaLinkLayerRadioStats {
     /**
@@ -51,6 +67,11 @@
      * or crash.
      */
     uint32_t onTimeInMsForHs20Scan;
+
+    /**
+     * List of channel stats associated with this radio
+     */
+    vec<WifiChannelStats> channelStats;
 };
 
 /**