hal: retrieve license info during init.
FFV/Allplay requires licensing info during init.
- Retrieve Product_Id using "meta_info_key" from platfrom xml file during HAL-Init.
- Retrieve Product_License using "audio_calibration_info" from ACDB.
- Extend QAHW GetParam API to access AllPlay License information.
Change-Id: Ie759f795d76e0038cba3f14ee9084f1c46b64c0a
diff --git a/hal/audio_extn/audio_defs.h b/hal/audio_extn/audio_defs.h
index 3921f49..1b34c53 100755
--- a/hal/audio_extn/audio_defs.h
+++ b/hal/audio_extn/audio_defs.h
@@ -117,6 +117,10 @@
/* MAX SECTORS for sourcetracking feature */
#define MAX_SECTORS 8
+/* Max length for license string */
+#define AUDIO_PRODUCT_STR_MAX_LENGTH (64)
+#define AUDIO_LICENSE_STR_MAX_LENGTH (64)
+
struct source_tracking_param {
uint8_t vad[MAX_SECTORS];
uint16_t doa_speech;
@@ -255,6 +259,13 @@
uint32_t mixer_coeffs[AUDIO_CHANNEL_COUNT_MAX][AUDIO_CHANNEL_COUNT_MAX];
} mix_matrix_params_t;
+
+typedef struct audio_license_params {
+ char product[AUDIO_PRODUCT_STR_MAX_LENGTH + 1];
+ int key;
+ char license[AUDIO_LICENSE_STR_MAX_LENGTH + 1];
+} audio_license_params_t;
+
typedef union {
struct source_tracking_param st_params;
struct sound_focus_param sf_params;
@@ -268,6 +279,7 @@
struct audio_out_channel_map_param channel_map_param;
struct audio_device_cfg_param device_cfg;
struct mix_matrix_params mm_params;
+ struct audio_license_params license_params;
} audio_extn_param_payload;
typedef enum {
@@ -288,7 +300,9 @@
/* Pan/scale params to be set on ASM */
AUDIO_EXTN_PARAM_OUT_MIX_MATRIX_PARAMS,
/* Downmix params to be set on ADM */
- AUDIO_EXTN_PARAM_CH_MIX_MATRIX_PARAMS
+ AUDIO_EXTN_PARAM_CH_MIX_MATRIX_PARAMS,
+ /* License information */
+ AUDIO_EXTN_PARAM_LICENSE_PARAMS,
} audio_extn_param_id;
#endif /* AUDIO_DEFS_H */
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index faf4e4f..c6c0924 100755
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -1329,7 +1329,15 @@
if (ssr_supported) {
return audio_extn_ssr_set_usecase(in, config, update_params);
} else if (audio_extn_ffv_check_usecase(in)) {
- return audio_extn_ffv_set_usecase(in);
+ char ffv_lic[LICENSE_STR_MAX_LEN + 1] = {0};
+ int ffv_key = 0;
+ if(platform_get_license_by_product(adev->platform, PRODUCT_FFV, &ffv_key, ffv_lic))
+ {
+ ALOGD("%s: Valid licence not availble for %s ", __func__, PRODUCT_FFV);
+ return -EINVAL;
+ }
+ ALOGD("%s: KEY: %d LICENSE: %s ", __func__, ffv_key, ffv_lic);
+ return audio_extn_ffv_set_usecase(in, ffv_key, ffv_lic);
} else {
return audio_extn_set_multichannel_mask(adev, in, config,
update_params);
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 4a0b8ce..894d80e 100755
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -998,8 +998,8 @@
#define audio_extn_ffv_init(adev) (0)
#define audio_extn_ffv_deinit() (0)
#define audio_extn_ffv_check_usecase(in) (0)
-#define audio_extn_ffv_set_usecase(in) (0)
-#define audio_extn_ffv_stream_init(in) (0)
+#define audio_extn_ffv_set_usecase(in, key, lic) (0)
+#define audio_extn_ffv_stream_init(in, key, lic) (0)
#define audio_extn_ffv_stream_deinit() (0)
#define audio_extn_ffv_update_enabled() (0)
#define audio_extn_ffv_get_enabled() (0)
@@ -1016,8 +1016,8 @@
int32_t audio_extn_ffv_init(struct audio_device *adev);
int32_t audio_extn_ffv_deinit();
bool audio_extn_ffv_check_usecase(struct stream_in *in);
-int audio_extn_ffv_set_usecase(struct stream_in *in);
-int32_t audio_extn_ffv_stream_init(struct stream_in *in);
+int audio_extn_ffv_set_usecase( struct stream_in *in, int key, char* lic);
+int32_t audio_extn_ffv_stream_init(struct stream_in *in, int key, char* lic);
int32_t audio_extn_ffv_stream_deinit();
void audio_extn_ffv_update_enabled();
bool audio_extn_ffv_get_enabled();
@@ -1041,4 +1041,5 @@
#else
void audio_extn_send_dual_mono_mixing_coefficients(struct stream_out *out);
#endif
+int audio_extn_utils_get_license_params(const struct audio_device *adev, struct audio_license_params *lic_params);
#endif /* AUDIO_EXTN_H */
diff --git a/hal/audio_extn/ffv.c b/hal/audio_extn/ffv.c
old mode 100644
new mode 100755
index 027849c..be95b70
--- a/hal/audio_extn/ffv.c
+++ b/hal/audio_extn/ffv.c
@@ -100,7 +100,8 @@
static FfvStatusType (*ffv_init_fn)(void** handle, int num_tx_in_ch,
int num_out_ch, int num_ec_ref_ch, int frame_len, int sample_rate,
const char *config_file_name, char *svaModelBuffer,
- uint32_t svaModelSize, int* totMemSize);
+ uint32_t svaModelSize, int* totMemSize,
+ int product_id, const char* prduct_license);
static void (*ffv_deinit_fn)(void* handle);
static void (*ffv_process_fn)(void *handle, const int16_t *in_pcm,
int16_t *out_pcm, const int16_t *ec_ref_pcm);
@@ -365,12 +366,12 @@
return ret;
}
-int audio_extn_ffv_set_usecase(struct stream_in *in)
+int audio_extn_ffv_set_usecase(struct stream_in *in, int ffv_key, char* ffv_lic)
{
int ret = -EINVAL;
if (audio_extn_ffv_check_usecase(in)) {
- if (!audio_extn_ffv_stream_init(in)) {
+ if (!audio_extn_ffv_stream_init(in, ffv_key, ffv_lic)) {
ALOGD("%s: Created FFV session succesfully", __func__);
ret = 0;
} else {
@@ -414,7 +415,7 @@
return 0;
}
-int32_t audio_extn_ffv_stream_init(struct stream_in *in)
+int32_t audio_extn_ffv_stream_init(struct stream_in *in, int key, char* lic)
{
uint32_t ret = -EINVAL;
int num_tx_in_ch, num_out_ch, num_ec_ref_ch;
@@ -473,7 +474,7 @@
ALOGD("%s: config file path %s", __func__, config_file_path);
status_type = ffv_init_fn(&ffvmod.handle, num_tx_in_ch, num_out_ch, num_ec_ref_ch,
frame_len, sample_rate, config_file_path, sm_buffer, 0,
- &total_mem_size);
+ &total_mem_size, key, lic);
if (status_type) {
ALOGE("%s: ERROR. ffv_init returned %d", __func__, status_type);
ret = -EINVAL;
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
old mode 100644
new mode 100755
index e03fdc8..0d6008c
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -2452,3 +2452,15 @@
return -EINVAL;
}
+
+int audio_extn_utils_get_license_params
+(
+const struct audio_device *adev,
+struct audio_license_params *license_params
+)
+{
+ if(!license_params)
+ return -EINVAL;
+ return platform_get_license_by_product(adev->platform, (const char*)license_params->product, &license_params->key, license_params->license);
+}
+