I just want to ask someone here about editing audio_effects.conf via sh script that will run in the recovery im not linux expert i just want to a portable app from other device as i dont want to ruin existing audio_effects.conf configuration that will cause problem. Yes I know why not just overwrite with my own audio_effects.conf to other devices, i believe different devices have diff audio setting so i want a generic script that will add the information i want.
As we all know audio_effects.conf is located in /system/etc what i want to achieve if my parameter is not exist it will be added for example below:
Code:
xloudwrapper {
path /system/lib/soundfx/libxloudwrapper.so
}
I want to add that parameter under libraries section of audio_effects.conf and below parameter is under effects section.
Code:
xLOUD {
library xloudwrapper
uuid 46af9240-dd14-11df-ae36-0002a5D5c51b
}
It should like the one below audio_effects.conf
Code:
libraries {
bundle {
path /system/lib/soundfx/libbundlewrapper.so
}
reverb {
path /system/lib/soundfx/libreverbwrapper.so
}
visualizer {
path /system/lib/soundfx/libvisualizer.so
}
pre_processing {
path /system/lib/soundfx/libaudiopreprocessing.so
}
SRS {
path /system/lib/soundfx/libsrsfx.so
}
bass_enhancement {
path /system/lib/soundfx/libbeatsbass.so
[B] }
[COLOR="Red"] xloudwrapper {
path /system/lib/soundfx/libxloudwrapper.so
}[/COLOR][/B]
}
effects {
bassboost {
library bundle
uuid 8631f300-72e2-11df-b57e-0002a5d5c51b
}
virtualizer {
library bundle
uuid 1d4033c0-8557-11df-9f2d-0002a5d5c51b
}
volume {
library bundle
uuid 119341a0-8469-11df-81f9-0002a5d5c51b
}
reverb_env_aux {
library reverb
uuid 4a387fc0-8ab3-11df-8bad-0002a5d5c51b
}
reverb_env_ins {
library reverb
uuid c7a511a0-a3bb-11df-860e-0002a5d5c51b
}
reverb_pre_aux {
library reverb
uuid f29a1400-a3bb-11df-8ddc-0002a5d5c51b
}
reverb_pre_ins {
library reverb
uuid 172cdf00-a3bc-11df-a72f-0002a5d5c51b
}
visualizer {
library visualizer
uuid d069d9e0-8329-11df-9168-0002a5d5c51b
}
agc {
library pre_processing
uuid aa8130e0-66fc-11e0-bad0-0002a5d5c51b
}
aec {
library pre_processing
uuid bb392ec0-8d4d-11e0-a896-0002a5d5c51b
}
ns {
library pre_processing
uuid c06c8400-8e06-11e0-9cb6-0002a5d5c51b
}
beats {
library bass_enhancement
uuid b3b43f60-a2f0-11e0-8b5a-0002a5d5c51b
}
[B] [COLOR="Red"]xLOUD {
library xloudwrapper
uuid 46af9240-dd14-11df-ae36-0002a5D5c51b
}[/COLOR][/B]
}
Thanks in advance, appreciate any help.
Any help, really appreciated. TIA
Related
Sorry for x-posting, might other people from here can help me.
I just want to ask someone here about editing audio_effects.conf via sh script that will run in the recovery im not linux expert i just want to a portable app from other device as i dont want to ruin existing audio_effects.conf configuration that will cause problem. Yes I know why not just overwrite with my own audio_effects.conf to other devices, i believe different devices have diff audio setting so i want a generic script that will add the information i want.
As we all know audio_effects.conf is located in /system/etc what i want to achieve if my parameter is not exist it will be added for example below:
Code:
xloudwrapper {
path /system/lib/soundfx/libxloudwrapper.so
}
I want to add that parameter under libraries section of audio_effects.conf and below parameter is under effects section.
Code:
xLOUD {
library xloudwrapper
uuid 46af9240-dd14-11df-ae36-0002a5D5c51b
}
It should like the one below audio_effects.conf
Code:
libraries {
bundle {
path /system/lib/soundfx/libbundlewrapper.so
}
reverb {
path /system/lib/soundfx/libreverbwrapper.so
}
visualizer {
path /system/lib/soundfx/libvisualizer.so
}
pre_processing {
path /system/lib/soundfx/libaudiopreprocessing.so
}
SRS {
path /system/lib/soundfx/libsrsfx.so
}
bass_enhancement {
path /system/lib/soundfx/libbeatsbass.so
[B] }
[COLOR="Red"] xloudwrapper {
path /system/lib/soundfx/libxloudwrapper.so
}[/COLOR][/B]
}
effects {
bassboost {
library bundle
uuid 8631f300-72e2-11df-b57e-0002a5d5c51b
}
virtualizer {
library bundle
uuid 1d4033c0-8557-11df-9f2d-0002a5d5c51b
}
volume {
library bundle
uuid 119341a0-8469-11df-81f9-0002a5d5c51b
}
reverb_env_aux {
library reverb
uuid 4a387fc0-8ab3-11df-8bad-0002a5d5c51b
}
reverb_env_ins {
library reverb
uuid c7a511a0-a3bb-11df-860e-0002a5d5c51b
}
reverb_pre_aux {
library reverb
uuid f29a1400-a3bb-11df-8ddc-0002a5d5c51b
}
reverb_pre_ins {
library reverb
uuid 172cdf00-a3bc-11df-a72f-0002a5d5c51b
}
visualizer {
library visualizer
uuid d069d9e0-8329-11df-9168-0002a5d5c51b
}
agc {
library pre_processing
uuid aa8130e0-66fc-11e0-bad0-0002a5d5c51b
}
aec {
library pre_processing
uuid bb392ec0-8d4d-11e0-a896-0002a5d5c51b
}
ns {
library pre_processing
uuid c06c8400-8e06-11e0-9cb6-0002a5d5c51b
}
beats {
library bass_enhancement
uuid b3b43f60-a2f0-11e0-8b5a-0002a5d5c51b
}
[B] [COLOR="Red"]xLOUD {
library xloudwrapper
uuid 46af9240-dd14-11df-ae36-0002a5D5c51b
}[/COLOR][/B]
}
Thanks in advance, appreciate any help.
These day I want to have 5 kinds of sound effects on my device. My English is poor, so maybe there will be some grammar mistakes. Could you help me to find problems in the audio_effects.conf?
Code:
# List of effect libraries to load. Each library element must contain a "path" element
# giving the full path of the library .so file.
# libraries {
# <lib name> {
# path <lib path>
# }
# }
libraries {
#Beats
proxy {
#path /system/lib/soundfx/libeffectproxy.so
}
libSW {
path /system/lib/soundfx/libswwrapper.so
}
libHW {
path /system/lib/soundfx/libhwwrapper.so
}
bundle {
path /system/lib/soundfx/libbundlewrapper.so
}
reverb {
path /system/lib/soundfx/libreverbwrapper.so
}
visualizer {
path /system/lib/soundfx/libvisualizer.so
}
downmix {
path /system/lib/soundfx/libdownmix.so
}
loudness_enhancer {
path /system/lib/soundfx/libldnhncr.so
}
pre_processing {
path /system/lib/soundfx/libaudiopreprocessing.so
}
am3daudioenhancement {
path /system/lib/soundfx/libam3daudioenhancement.so
}
#Dolby
proxy {
path /system/lib/soundfx/libeffectproxy.so
}
libSW {
path /system/lib/soundfx/libswwrapper.so
}
libHW {
path /system/lib/soundfx/libhwwrapper.so
}
bundle {
path /system/lib/soundfx/libbundlewrapper.so
}
reverb {
path /system/lib/soundfx/libreverbwrapper.so
}
visualizer {
path /system/lib/soundfx/libvisualizer.so
}
downmix {
path /system/lib/soundfx/libdownmix.so
}
loudness_enhancer {
path /system/lib/soundfx/libldnhncr.so
}
ds {
path /system/lib/soundfx/libdseffect.so
}
#DSP+
v4a_fx {
path /system/lib/soundfx/libv4a_fx_ics.so
}
bundle {
path /system/lib/soundfx/libbundlewrapper.so
}
cm {
path /system/lib/soundfx/libcyanogen-dsp.so
}
reverb {
path /system/lib/soundfx/libreverbwrapper.so
}
visualizer {
path /system/lib/soundfx/libvisualizer.so
}
pre_processing {
path /system/lib/soundfx/libaudiopreprocessing.so
}
qcom_pre_processing {
path /system/lib/soundfx/libqcomvoiceprocessing.so
}
downmix {
path /system/lib/soundfx/libdownmix.so
}
loudness_enhancer {
path /system/lib/soundfx/libldnhncr.so
}
#Maxx
proxy {
path /system/lib/soundfx/libeffectproxy.so
}
libSW {
path /system/lib/soundfx/libswwrapper.so
}
libHW {
path /system/lib/soundfx/libhwwrapper.so
}
bundle {
path /system/lib/soundfx/libbundlewrapper.so
}
reverb {
path /system/lib/soundfx/libreverbwrapper.so
}
visualizer {
path /system/lib/soundfx/libvisualizer.so
}
downmix {
path /system/lib/soundfx/libdownmix.so
}
loudness_enhancer {
path /system/lib/soundfx/libldnhncr.so
}
ds_sw {
path /system/vendor/lib/soundfx/libswdap.so
}
ds_hw {
path /system/vendor/lib/soundfx/libhwdap.so
}
#ViPER
v4a_fx {
path /system/lib/soundfx/libv4a_fx_ics.so
}
bundle {
path /system/lib/soundfx/libv4a_fx_ics.so
}
reverb {
path /system/lib/soundfx/libv4a_fx_ics.so
}
visualizer {
path /system/lib/soundfx/libv4a_fx_ics.so
}
downmix {
path /system/lib/soundfx/libv4a_fx_ics.so
}
}
# list of effects to load. Each effect element must contain a "library" and a "uuid" element.
# The value of the "library" element must correspond to the name of one library element in the
# "libraries" element.
# The name of the effect element is indicative, only the value of the "uuid" element
# designates the effect.
# The uuid is the implementation specific UUID as specified by the effect vendor. This is not the
# generic effect type UUID.
# effects {
# <fx name> {
# library <lib name>
# uuid <effect uuid>
# }
# ...
# }
effects {
#Beats
bassboost {
library bundle
uuid 8631f300-72e2-11df-b57e-0002a5d5c51b
}
virtualizer {
library bundle
uuid 1d4033c0-8557-11df-9f2d-0002a5d5c51b
}
equalizer {
library bundle
uuid ce772f20-847d-11df-bb17-0002a5d5c51b
}
volume {
library bundle
uuid 119341a0-8469-11df-81f9-0002a5d5c51b
}
reverb_env_aux {
library reverb
uuid 4a387fc0-8ab3-11df-8bad-0002a5d5c51b
}
reverb_env_ins {
library reverb
uuid c7a511a0-a3bb-11df-860e-0002a5d5c51b
}
reverb_pre_aux {
library reverb
uuid f29a1400-a3bb-11df-8ddc-0002a5d5c51b
}
reverb_pre_ins {
library reverb
uuid 172cdf00-a3bc-11df-a72f-0002a5d5c51b
}
visualizer {
library visualizer
uuid d069d9e0-8329-11df-9168-0002a5d5c51b
}
downmix {
library downmix
uuid 93f04452-e4fe-41cc-91f9-e475b6d1d69f
}
loudness_enhancer {
library loudness_enhancer
uuid fa415329-2034-4bea-b5dc-5b381c8d1e2c
}
agc {
library pre_processing
uuid aa8130e0-66fc-11e0-bad0-0002a5d5c51b
}
aec {
library pre_processing
uuid bb392ec0-8d4d-11e0-a896-0002a5d5c51b
}
ns {
library pre_processing
uuid c06c8400-8e06-11e0-9cb6-0002a5d5c51b
}
am3daudioenhancement {
library am3daudioenhancement
uuid 6723dd80-f0b7-11e0-98a2-0002a5d5c51b
}
#Dolby
bassboost {
library bundle
uuid 8631f300-72e2-11df-b57e-0002a5d5c51b
}
virtualizer {
library bundle
uuid 1d4033c0-8557-11df-9f2d-0002a5d5c51b
}
equalizer {
library bundle
uuid ce772f20-847d-11df-bb17-0002a5d5c51b
}
volume {
library bundle
uuid 119341a0-8469-11df-81f9-0002a5d5c51b
}
reverb_env_aux {
library reverb
uuid 4a387fc0-8ab3-11df-8bad-0002a5d5c51b
}
reverb_env_ins {
library reverb
uuid c7a511a0-a3bb-11df-860e-0002a5d5c51b
}
reverb_pre_aux {
library reverb
uuid f29a1400-a3bb-11df-8ddc-0002a5d5c51b
}
reverb_pre_ins {
library reverb
uuid 172cdf00-a3bc-11df-a72f-0002a5d5c51b
}
visualizer {
library visualizer
uuid d069d9e0-8329-11df-9168-0002a5d5c51b
}
downmix {
library downmix
uuid 93f04452-e4fe-41cc-91f9-e475b6d1d69f
}
loudness_enhancer {
library loudness_enhancer
uuid fa415329-2034-4bea-b5dc-5b381c8d1e2c
}
ds {
library ds
uuid 9d4921da-8225-4f29-aefa-39537a04bcaa
}
#DSP+
v4a_standard_fx {
library v4a_fx
uuid 41d3c987-e6cf-11e3-a88a-11aba5d5c51b
}
compression {
library cm
uuid f27317f4-c984-4de6-9a90-545759495bf2
}
bassboost {
library cm
uuid 42b5cbf5-4dd8-4e79-a5fb-cceb2cb54e13
}
virtualizer {
library cm
uuid 7c6cc5f8-6f34-4449-a282-bed84f1a5b5a
}
equalizer {
library cm
uuid 58bc9000-0d7f-462e-90d2-035eddd8b434
}
volume {
library bundle
uuid 119341a0-8469-11df-81f9-0002a5d5c51b
}
reverb_env_aux {
library reverb
uuid 4a387fc0-8ab3-11df-8bad-0002a5d5c51b
}
reverb_env_ins {
library reverb
uuid c7a511a0-a3bb-11df-860e-0002a5d5c51b
}
reverb_pre_aux {
library reverb
uuid f29a1400-a3bb-11df-8ddc-0002a5d5c51b
}
reverb_pre_ins {
library reverb
uuid 172cdf00-a3bc-11df-a72f-0002a5d5c51b
}
visualizer {
library visualizer
uuid d069d9e0-8329-11df-9168-0002a5d5c51b
}
downmix {
library downmix
uuid 93f04452-e4fe-41cc-91f9-e475b6d1d69f
}
agc {
library pre_processing
uuid aa8130e0-66fc-11e0-bad0-0002a5d5c51b
}
aec {
library qcom_pre_processing
uuid 0f8d0d2a-59e5-45fe-b6e4-248c8a799109
}
loudness_enhancer {
library loudness_enhancer
uuid fa415329-2034-4bea-b5dc-5b381c8d1e2c
}
#Maxx
bassboost {
library bundle
uuid 8631f300-72e2-11df-b57e-0002a5d5c51b
}
virtualizer {
library bundle
uuid 1d4033c0-8557-11df-9f2d-0002a5d5c51b
}
equalizer {
library bundle
uuid ce772f20-847d-11df-bb17-0002a5d5c51b
}
volume {
library bundle
uuid 119341a0-8469-11df-81f9-0002a5d5c51b
}
reverb_env_aux {
library reverb
uuid 4a387fc0-8ab3-11df-8bad-0002a5d5c51b
}
reverb_env_ins {
library reverb
uuid c7a511a0-a3bb-11df-860e-0002a5d5c51b
}
reverb_pre_aux {
library reverb
uuid f29a1400-a3bb-11df-8ddc-0002a5d5c51b
}
reverb_pre_ins {
library reverb
uuid 172cdf00-a3bc-11df-a72f-0002a5d5c51b
}
visualizer {
library visualizer
uuid d069d9e0-8329-11df-9168-0002a5d5c51b
}
downmix {
library downmix
uuid 93f04452-e4fe-41cc-91f9-e475b6d1d69f
}
loudness_enhancer {
library loudness_enhancer
uuid fa415329-2034-4bea-b5dc-5b381c8d1e2c
}
ds {
library proxy
uuid 9d4921da-8225-4f29-aefa-39537a04bcaa
}
libsw {
library ds_sw
uuid 6ab06da4-c516-4611-8166-452799218539
}
libhw {
library ds_hw
uuid a0c30891-8246-4aef-b8ad-d53e26da0253
}
#ViPER
v4a_standard_fx {
library v4a_fx
uuid 41d3c987-e6cf-11e3-a88a-11aba5d5c51b
}
bassboost {
library v4a_fx
uuid 41d3c987-e6cf-11e3-a88a-11aba5d5c51b
}
virtualizer {
library v4a_fx
uuid 41d3c987-e6cf-11e3-a88a-11aba5d5c51b
}
equalizer {
library v4a_fx
uuid 41d3c987-e6cf-11e3-a88a-11aba5d5c51b
}
volume {
library v4a_fx
uuid 41d3c987-e6cf-11e3-a88a-11aba5d5c51b
}
reverb_env_aux {
library v4a_fx
uuid 41d3c987-e6cf-11e3-a88a-11aba5d5c51b
}
reverb_env_ins {
library v4a_fx
uuid 41d3c987-e6cf-11e3-a88a-11aba5d5c51b
}
reverb_pre_aux {
library v4a_fx
uuid 41d3c987-e6cf-11e3-a88a-11aba5d5c51b
}
reverb_pre_ins {
library v4a_fx
uuid 41d3c987-e6cf-11e3-a88a-11aba5d5c51b
}
visualizer {
library v4a_fx
uuid 41d3c987-e6cf-11e3-a88a-11aba5d5c51b
}
downmix {
library v4a_fx
uuid 41d3c987-e6cf-11e3-a88a-11aba5d5c51b
}
}
# Audio preprocessor configurations.
# The pre processor configuration consists in a list of elements each describing
# pre processor settings for a given input source. Valid input source names are:
# "mic", "camcorder", "voice_recognition", "voice_communication"
# Each input source element contains a list of effects elements. The name of the effect
# element must be the name of one of the effects in the "effects" list of the file.
# Each effect element may optionally contain a list of parameters and their
# default value to apply when the pre processor effect is created.
# A parameter is defined by a "param" element and a "value" element. Each of these elements
# consists in one or more elements specifying a type followed by a value.
# The types defined are: "int", "short", "float", "bool" and "string"
# When both "param" and "value" are a single int, a simple form is allowed where just
# the param and value pair is present in the parameter description
# pre_processing {
# <input source name> {
# <fx name> {
# <param 1 name> {
# param {
# int|short|float|bool|string <value>
# [ int|short|float|bool|string <value> ]
# ...
# }
# value {
# int|short|float|bool|string <value>
# [ int|short|float|bool|string <value> ]
# ...
# }
# }
# <param 2 name > {<param> <value>}
# ...
# }
# ...
# }
# ...
# }
#
# TODO: add default audio pre processor configurations after debug and tuning phase
#
When I use it, only v4a still working, the other will FC. First, I make sure that other things are right. Please tell me how to fix it, thx very much!
HI
i converted AospExtended Rom Ported by Mechalikh to flashable firmware using Sp flash tool , this easy way to Repair your Blu vivo v5 phone . and you do not need to flash patch file if you use blu vivio v5 or its clone and i have fixed the Sound problem , All Roms from Mechalikh face sound problem in some Apps . this was fixed in this firmware .
download firmware with sp flash tool
https://mega.nz/file/TElwCCRB#SCKsc_g-82_KxiFlZX1V55B4VX2Hj0lE5VjibICwAzo
for anyone who looking to fix the sound problem in all Nougat Roms from Mechalikh do this
Make backup of your System ................ do not do anything before that ..
Now .use root browser and look for the /system/etc/audio_effects.conf
Edit audio_effects.conf .. Remove every thing inside it and Past this code and restart your phone .
PHP:
# List of effect libraries to load. Each library element must contain a "path" element
# giving the full path of the library .so file.
# libraries {
# <lib name> {
# path <lib path>
# }
# }
libraries {
# This is a proxy library that will be an abstraction for
# the HW and SW effects
#proxy {
#path /system/lib/soundfx/libeffectproxy.so
#}
# This is the SW implementation library of the effect
#libSW {
#path /system/lib/soundfx/libswwrapper.so
#}
# This is the HW implementation library for the effect
#libHW {
#path /system/lib/soundfx/libhwwrapper.so
#}
bundle {
path /system/lib/soundfx/libbundlewrapper.so
}
reverb {
path /system/lib/soundfx/libreverbwrapper.so
}
visualizer {
path /system/lib/soundfx/libvisualizer.so
}
downmix {
path /system/lib/soundfx/libdownmix.so
}
loudness_enhancer {
path /system/lib/soundfx/libldnhncr.so
}
pre_processing {
path /system/lib/soundfx/libaudiopreprocessing.so
}
}
# Default pre-processing library. Add to audio_effect.conf "libraries" section if
# audio HAL implements support for default software audio pre-processing effects
#
# pre_processing {
# path /system/lib/soundfx/libaudiopreprocessing.so
# }
# list of effects to load. Each effect element must contain a "library" and a "uuid" element.
# The value of the "library" element must correspond to the name of one library element in the
# "libraries" element.
# The name of the effect element is indicative, only the value of the "uuid" element
# designates the effect.
# The uuid is the implementation specific UUID as specified by the effect vendor. This is not the
# generic effect type UUID.
# effects {
# <fx name> {
# library <lib name>
# uuid <effect uuid>
# }
# ...
# }
effects {
# additions for the proxy implementation
# Proxy implementation
#effectname {
#library proxy
#uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
# SW implemetation of the effect. Added as a node under the proxy to
# indicate this as a sub effect.
#libsw {
#library libSW
#uuid yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
#} End of SW effect
# HW implementation of the effect. Added as a node under the proxy to
# indicate this as a sub effect.
#libhw {
#library libHW
#uuid zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz
#}End of HW effect
#} End of effect proxy
bassboost {
library bundle
uuid 8631f300-72e2-11df-b57e-0002a5d5c51b
}
virtualizer {
library bundle
uuid 1d4033c0-8557-11df-9f2d-0002a5d5c51b
}
equalizer {
library bundle
uuid ce772f20-847d-11df-bb17-0002a5d5c51b
}
volume {
library bundle
uuid 119341a0-8469-11df-81f9-0002a5d5c51b
}
reverb_env_aux {
library reverb
uuid 4a387fc0-8ab3-11df-8bad-0002a5d5c51b
}
reverb_env_ins {
library reverb
uuid c7a511a0-a3bb-11df-860e-0002a5d5c51b
}
reverb_pre_aux {
library reverb
uuid f29a1400-a3bb-11df-8ddc-0002a5d5c51b
}
reverb_pre_ins {
library reverb
uuid 172cdf00-a3bc-11df-a72f-0002a5d5c51b
}
visualizer {
library visualizer
uuid d069d9e0-8329-11df-9168-0002a5d5c51b
}
downmix {
library downmix
uuid 93f04452-e4fe-41cc-91f9-e475b6d1d69f
}
loudness_enhancer {
library loudness_enhancer
uuid fa415329-2034-4bea-b5dc-5b381c8d1e2c
}
agc {
library pre_processing
uuid aa8130e0-66fc-11e0-bad0-0002a5d5c51b
}
aec {
library pre_processing
uuid bb392ec0-8d4d-11e0-a896-0002a5d5c51b
}
ns {
library pre_processing
uuid c06c8400-8e06-11e0-9cb6-0002a5d5c51b
}
}
# Audio preprocessor configurations.
# The pre processor configuration consists in a list of elements each describing
# pre processor settings for a given input source. Valid input source names are:
# "mic", "camcorder", "voice_recognition", "voice_communication"
# Each input source element contains a list of effects elements. The name of the effect
# element must be the name of one of the effects in the "effects" list of the file.
# Each effect element may optionally contain a list of parameters and their
# default value to apply when the pre processor effect is created.
# A parameter is defined by a "param" element and a "value" element. Each of these elements
# consists in one or more elements specifying a type followed by a value.
# The types defined are: "int", "short", "float", "bool" and "string"
# When both "param" and "value" are a single int, a simple form is allowed where just
# the param and value pair is present in the parameter description
# pre_processing {
# <input source name> {
# <fx name> {
# <param 1 name> {
# param {
# int|short|float|bool|string <value>
# [ int|short|float|bool|string <value> ]
# ...
# }
# value {
# int|short|float|bool|string <value>
# [ int|short|float|bool|string <value> ]
# ...
# }
# }
# <param 2 name > {<param> <value>}
# ...
# }
# ...
# }
# ...
# }
#
# TODO: add default audio pre processor configurations after debug and tuning phase
#
More information like this, you can visit HUAWEI Developer Forum
Original link: https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201334296322460044&fid=0101187876626530001
Introduction
Do you already know Image Kit? If you havent have the opportuniy to use it, Image Kit incorporates intelligent design and animation production functions in your App. Giving us the power of efficient image reproduction while providing image editing for our users.
For this example we will use the Image Render service. This service provides us with basic animation effects and nine advanced ones. In this example we will create an animated Splash Screen where we will apply the Waterfall effect. Without further ado let's see the steps to follow
Steps:
1. Download the Image Render Example code
2. Create an App in AGC
3. Connect our Android project with the App
4. Downloading the necessary repositories
5. Create our Splash Screen
6. Add the necessary assets manifest.xml for our animation
7. Obtain the instance
8. Initialize the Rendering service
9. Run the animation
10. After the execution we launch the Main Activity
Download the Image Render Example code
In order to implement this functionality we must download the source code provided by the developer Huawei, this is the link to the repository.
https://github.com/huaweicodelabs/ImageKit
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
You can git clone or download the zip to your computer. I recommend that you run the app. In my case there were some problems with my version of gradle. In case the same thing happens to you. What I did was download the Gradle version of my project, use the following one and you modify this in the gradle-wrapper.properties file
Code:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Run the app so that you know how the Image Render works.
Create an App in AGC
In order to use this service it will be necessary to have an App in AGC. I share a guide so that you can create an App and when creating an App and a project in AGC you will have the instructions to be able to add the necessary elements to your App.
https://developer.huawei.com/consumer/en/codelab/HMSPreparation/index.html#1
Connect our Android project with the App
To connect them we need to add the following lines
. Configure the Maven repository address and AppGallery Connect plug-in in the project's build.gradle file.
Go to allprojects> repositories and configure the Maven repository address for the HMS Core SDK
Code:
allprojects {
repositories {
maven { url 'https://developer.huawei.com/repo/' }
...
}
}
Go to buildscript > repositories and configure the Maven repository address for the HMS Core SDK.
Code:
buildscript {
repositories {
maven {url 'https://developer.huawei.com/repo/'}
...
}
...
}
Go to buildscript > dependencies and add dependency configurations
Code:
Buildscript {
dependencies {
classpath 'com.huawei.agconnect:agcp:1.3.1.300'
}
}
Configure the dependency package in the app's build.gradle file.
Add a dependency package to the dependencies section in the build.gradle file.
Code:
dependencies {
...
implementation 'com.huawei.hms:image-render:1.0.2.302'
...
}
Downloading the necessary repositories
Configure the dependency package in the app's build.gradle file.
Add a dependency package to the dependencies section in the build.gradle file.
Code:
dependencies {
...
implementation 'com.huawei.hms:image-render:1.0.2.302'
...
}
Configure minSdkVersion
android {
...
defaultConfig {
...
minSdkVersion 26
...
}
...
}
Add the AppGallery Connect plug-in dependency to the file header.
Code:
apply plugin: 'com.huawei.agconnect'
Create our Splash Screen
Create our style
Code:
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash_background</item>
</style>
Add our Activity to the manifest
Code:
<activity android:name="SplashActivity"
android:theme="@style/SplashTheme"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"
/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
We also need to add these permissions
Code:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Splash Activity
For the Splash we need to pause the main thread we declare a time in milliseconds
Code:
private final int DURACION_SPLASH = 8500;
private void onUIThread(){
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
//SplashActivity.this.startActivity(intent);
}
},DURACION_SPLASH);
}
We get the instance
For this I have created a method we call initImageRender () and we call it from onCreate ()
Code:
private void initImageRender() {
// Obtain an ImageRender object.
ImageRender.getInstance(this, new ImageRender.RenderCallBack() {
@Override
public void onSuccess(ImageRenderImpl imageRender) {
Log.i(TAG, "getImageRenderAPI success");
imageRenderAPI = imageRender;
useImageRender();
}
@Override
public void onFailure(int i) {
Log.e(TAG, "getImageRenderAPI failure, errorCode = " + i);
}
});
}
Now we initialize the Service for this We will have to pass it the path of the file that we will use from splash
Code:
private void useImageRender() {
// Initialize the ImageRender object.
if (imageRenderAPI == null) {
Log.e(TAG, "initRemote fail, please check kit version");
return;
}
Log.d(TAG, sourcePath);
int initResult = imageRenderAPI.doInit(sourcePath, getAuthJson());
Log.i(TAG, "DoInit result == " + initResult);
if (initResult == 0) {
// Obtain the rendered view.
RenderView renderView = imageRenderAPI.getRenderView();
if (renderView.getResultCode() == ResultCode.SUCCEED) {
View view = renderView.getView();
if (null != view) {
// Add the rendered view to the layout.
contentView.addView(view);
int playResult = imageRenderAPI.playAnimation();
} else {
Log.w(TAG, "GetRenderView fail, view is null");
}
} else if (renderView.getResultCode() == ResultCode.ERROR_GET_RENDER_VIEW_FAILURE) {
Log.w(TAG, "GetRenderView fail");
} else if (renderView.getResultCode() == ResultCode.ERROR_XSD_CHECK_FAILURE) {
Log.w(TAG, "GetRenderView fail, resource file parameter error, please check resource file.");
} else if (renderView.getResultCode() == ResultCode.ERROR_VIEW_PARSE_FAILURE) {
Log.w(TAG, "GetRenderView fail, resource file parsing failed, please check resource file.");
} else if (renderView.getResultCode() == ResultCode.ERROR_REMOTE) {
Log.w(TAG, "GetRenderView fail, remote call failed, please check HMS service");
} else if (renderView.getResultCode() == ResultCode.ERROR_DOINIT) {
Log.w(TAG, "GetRenderView fail, init failed, please init again");
}
} else {
Log.w(TAG, "Do init fail, errorCode == " + initResult);
}
}
Add the necessary assets manifest.xml for our animation
We need to add to our folder assets manifest.xml file which is the animation.
Obtain the instance
Now we have to get the instance of the ImageRender
Code:
private void initImageRender() {
// Obtain an ImageRender object.
ImageRender.getInstance(this, new ImageRender.RenderCallBack() {
@Override
public void onSuccess(ImageRenderImpl imageRender) {
Log.i(TAG, "getImageRenderAPI success");
imageRenderAPI = imageRender;
useImageRender();
}
@Override
public void onFailure(int i) {
Log.e(TAG, "getImageRenderAPI failure, errorCode = " + i);
}
});
}
If everithing goes well we should get printed in the console the following message
Code:
getImageRenderAPI success
Initialize the Rendering service
Once that the instance has been initialized we can init the service by executing the doInit() method
Code:
Log.d(TAG, sourcePath);
int initResult = imageRenderAPI.doInit(sourcePath, getAuthJson());
Log.i(TAG, "DoInit result == " + initResult);
if (initResult == 0) {
// Obtain the rendered view.
RenderView renderView = imageRenderAPI.getRenderView();
if (renderView.getResultCode() == ResultCode.SUCCEED) {
View view = renderView.getView();
if (null != view) {
// Add the rendered view to the layout.
contentView.addView(view);
int playResult = imageRenderAPI.playAnimation();
} else {
Log.w(TAG, "GetRenderView fail, view is null");
}
} else if (renderView.getResultCode() == ResultCode.ERROR_GET_RENDER_VIEW_FAILURE) {
Log.w(TAG, "GetRenderView fail");
} else if (renderView.getResultCode() == ResultCode.ERROR_XSD_CHECK_FAILURE) {
Log.w(TAG, "GetRenderView fail, resource file parameter error, please check resource file.");
} else if (renderView.getResultCode() == ResultCode.ERROR_VIEW_PARSE_FAILURE) {
Log.w(TAG, "GetRenderView fail, resource file parsing failed, please check resource file.");
} else if (renderView.getResultCode() == ResultCode.ERROR_REMOTE) {
Log.w(TAG, "GetRenderView fail, remote call failed, please check HMS service");
} else if (renderView.getResultCode() == ResultCode.ERROR_DOINIT) {
Log.w(TAG, "GetRenderView fail, init failed, please init again");
}
} else {
Log.w(TAG, "Do init fail, errorCode == " + initResult);
}
Run the animation
Once that we have initialized and init the Image Render is time to play the animation
So Now we have to add a View to our Activity and play the animation
Code:
if (null != imageRenderAPI) {
int playResult = imageRenderAPI.playAnimation();
if (playResult == ResultCode.SUCCEED) {
Log.i(TAG, "Start animation success");
} else {
Log.i(TAG, "Start animation failure");
}
} else {
Log.w(TAG, "Start animation fail, please init first.");
}
Conclusion
With this little example we haver started with the implementation of Image Kit in one project. For further information here you have docs.
https://developer.huawei.com/consumer/en/hms/huawei-imagekit/
Can we do like gif animation using Image kit?
Check this out: Are you bending like this at your desk?
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Well, I am, and if you're like me, maybe we should get up and move around for a little while.
Joking aside, I know COVID-19 forced many of you to work from home. As a result, many of us have started to live a sedentary lifestyle. After reading a bunch of posts shared by my family describing how harmful sitting too long is, I decided to change this habit by developing a function that reminds me to move around, like this:
Development OverviewTo develop such a function, I turned to the mobile context-awareness capabilities from HMS Core Awareness Kit. I used a time awareness capability and behavior awareness capability to create a time barrier and behavior detection barrier respectively, as well as a combination of the barriers.
More specifically, these included:
Time awareness capability: TimeBarrier.duringTimePeriod(long startTimeStamp, long endSecondsMillis); is used to define a time barrier. If the current time is within the range from startTimeStamp to endSecondsMillis, the barrier status is true. Otherwise, it is false.
Behavior awareness capability: BehaviorBarrier.keeping(BehaviorBarrier.BEHAVIOR_STILL); is used to define a behavior detection barrier. If the status of a user is still, the barrier status is true; if the status of a user changes — from being stationary to moving, for example — then the barrier will be triggered, and its status will be false.
Barrier combination: Use and to combine the above two barriers into AwarenessBarrier.and(keepStillBarrier, timePeriodBarrier). When the current time of a user is within the specified time segment, and their status is still, the barrier status will be true. Otherwise, it is false.
It's quite straightforward, right? Let's take a deeper look into how the function is developed.
Development ProcedureMaking Preparations1. Create an Android Studio project. Put agconnect-services.json and the app signing certificate to the app's root directory. If you need to know where to obtain the two files, you can check the References section to get more information.
2. Configure a Maven repository address and import a plugin.
Code:
buildscript {
repositories {
maven { url 'http://szxy1.artifactory.cd-cloud-artifact.tools.huawei.com/artifactory/sz-maven-public/' }
maven { url 'http://dgg.maven.repo.cmc.tools.huawei.com/artifactory/Product-CloudTest-snapshot/' }
maven { url 'http://dgg.maven.repo.cmc.tools.huawei.com/artifactory/Product-cloudserviceSDK-release/' }
maven { url 'http://artifactory.cde.huawei.com/artifactory/Product-Binary-Release/' }
maven { url 'http://language.cloudartifact.dgg.dragon.tools.huawei.com/artifactory/product_maven/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.3'
classpath 'com.huawei.agconnect:agcp:1.0.0.300'
}
}
allprojects {
repositories {
maven { url 'http://szxy1.artifactory.cd-cloud-artifact.tools.huawei.com/artifactory/sz-maven-public/' }
maven { url 'http://dgg.maven.repo.cmc.tools.huawei.com/artifactory/Product-CloudTest-snapshot/' }
maven { url 'http://dgg.maven.repo.cmc.tools.huawei.com/artifactory/Product-cloudserviceSDK-release/' }
maven { url 'http://artifactory.cde.huawei.com/artifactory/Product-Binary-Release/' }
maven { url 'http://language.cloudartifact.dgg.dragon.tools.huawei.com/artifactory/product_maven/' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
3. Open the app-level build.gradle file, add the plugin, configure the signing certificate parameters, and add necessary building dependencies.
Code:
apply plugin: 'com.android.application'
apply plugin: 'com.huawei.agconnect'
android {
compileSdkVersion 31
buildToolsVersion "31.0.0"
defaultConfig {
applicationId "com.huawei.smartlifeassistant"
minSdkVersion 26
targetSdkVersion 31
versionCode 2
versionName "2.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
storeFile file('Awareness.jks')
keyAlias 'testKey'
keyPassword 'lhw123456'
storePassword 'lhw123456'
v1SigningEnabled true
v2SigningEnabled true
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
signingConfig signingConfigs.release
debuggable true
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.huawei.agconnect:agconnect-core:1.5.2.300'
implementation 'com.huawei.hms:awareness:3.1.0.301'
}
4. Make sure that the app package names in agconnect-services.json and the project are the same. Then, compile the project.
Requesting Dynamic Permissions
Code:
private static final int PERMISSION_REQUEST_CODE = 940;
private final String[] mPermissionsOnHigherVersion = new String[]{Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION,
Manifest.permission.ACTIVITY_RECOGNITION,
Manifest.permission.BLUETOOTH_CONNECT};
private final String[] mPermissionsOnLowerVersion = new String[]{Manifest.permission.ACCESS_FINE_LOCATION,
"com.huawei.hms.permission.ACTIVITY_RECOGNITION"};
private void checkAndRequestPermissions() {
List<String> permissionsDoNotGrant = new ArrayList<>();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
for (String permission : mPermissionsOnHigherVersion) {
if (ActivityCompat.checkSelfPermission(this, permission)
!= PackageManager.PERMISSION_GRANTED) {
permissionsDoNotGrant.add(permission);
}
}
} else {
for (String permission : mPermissionsOnLowerVersion) {
if (ActivityCompat.checkSelfPermission(this, permission)
!= PackageManager.PERMISSION_GRANTED) {
permissionsDoNotGrant.add(permission);
}
}
}
if (permissionsDoNotGrant.size() > 0) {
ActivityCompat.requestPermissions(this,
permissionsDoNotGrant.toArray(new String[0]), PERMISSION_REQUEST_CODE);
}
}
Check whether the dynamic permissions are granted in onCreate of the activity.
Code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sedentary_reminder);
setTitle(getString(R.string.life_assistant));
// Check whether the dynamic permissions are granted.
checkAndRequestPermissions();
//...
}
private void checkAndRequestPermissions() {
List<String> permissionsDoNotGrant = new ArrayList<>();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
for (String permission : mPermissionsOnHigherVersion) {
if (ActivityCompat.checkSelfPermission(this, permission)
!= PackageManager.PERMISSION_GRANTED) {
permissionsDoNotGrant.add(permission);
}
}
} else {
for (String permission : mPermissionsOnLowerVersion) {
if (ActivityCompat.checkSelfPermission(this, permission)
!= PackageManager.PERMISSION_GRANTED) {
permissionsDoNotGrant.add(permission);
}
}
}
if (permissionsDoNotGrant.size() > 0) {
ActivityCompat.requestPermissions(this,
permissionsDoNotGrant.toArray(new String[0]), PERMISSION_REQUEST_CODE);
}
}
Using the Broadcast Message to Create PendingIntent Which Is Triggered When the Barrier Status Changes, and Registering a Broadcast Receiver
Code:
final String barrierReceiverAction = getApplication().getPackageName() + "COMBINED_BARRIER_RECEIVER_ACTION";
Intent intent = new Intent(barrierReceiverAction);
// Also, we can use getActivity() or getService() to create PendingIntent.
// This depends on what action you want to be triggered when the barrier status changes.
mPendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT
| PendingIntent.FLAG_MUTABLE);
// Register a broadcast receiver to receive the broadcast when the barrier status changes.
mBarrierReceiver = new CombinedBarrierReceiver();
registerReceiver(mBarrierReceiver, new IntentFilter(barrierReceiverAction));
final class CombinedBarrierReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
BarrierStatus barrierStatus = BarrierStatus.extract(intent);
String label = barrierStatus.getBarrierLabel();
int barrierPresentStatus = barrierStatus.getPresentStatus();
if (label == null) {
return;
}
switch (label) {
case COMBINED_BEHAVIOR_TIME_BARRIER_LABEL:
if (barrierPresentStatus == BarrierStatus.FALSE) {
if (System.currentTimeMillis() - lastTime >= tenSecondsMillis) {
alert.show();
}
updateTimeAwarenessBarrier();
}
break;
default:
break;
}
}
}
Registering or Deleting the Barrier CombinationUse a switch on the UI to register or delete the barrier combination.
Code:
automaticAdjustSwitch = findViewById(R.id.sedentary_reminder_switch);
automaticAdjustSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
startAutomaticAdust(isChecked);
}
});
private void startAutomaticAdust(boolean isChecked) {
if (isChecked) {
addBarriers();
} else {
deleteBarriers();
}
}
private void addBarriers() {
keepStillBarrier = BehaviorBarrier.keeping(BehaviorBarrier.BEHAVIOR_STILL);
updateTimeAwarenessBarrier();
}
@NonNull
private void updateTimeAwarenessBarrier() {
long currentTimeStamp = System.currentTimeMillis();
lastTime = currentTimeStamp;
AwarenessBarrier timePeriodBarrier = TimeBarrier.duringTimePeriod(currentTimeStamp, currentTimeStamp + tenSecondsMillis);
AwarenessBarrier combinedTimeBluetoothBarrier = AwarenessBarrier.and(keepStillBarrier, timePeriodBarrier);
Utils.addBarrier(this, COMBINED_BEHAVIOR_TIME_BARRIER_LABEL,
combinedTimeBluetoothBarrier, mPendingIntent);
}
private void deleteBarriers() {
Utils.deleteBarrier(this, mPendingIntent);
}
Showing the Reminding InformationUse an AlertDialog to remind a user.
Code:
// Initialize Builder.
builder = new AlertDialog.Builder(this);
// Load and configure the custom view.
final LayoutInflater inflater = getLayoutInflater();
View view_custom = inflater.inflate(R.layout.view_dialog_custom, null, false);
builder.setView(view_custom);
builder.setCancelable(false);
alert = builder.create();
view_custom.findViewById(R.id.i_kown).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
alert.dismiss();
}
});
final class CombinedBarrierReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
BarrierStatus barrierStatus = BarrierStatus.extract(intent);
String label = barrierStatus.getBarrierLabel();
int barrierPresentStatus = barrierStatus.getPresentStatus();
if (label == null) {
return;
}
switch (label) {
case COMBINED_BEHAVIOR_TIME_BARRIER_LABEL:
if (barrierPresentStatus == BarrierStatus.FALSE) {
if (System.currentTimeMillis() - lastTime >= tenSecondsMillis) {
alert.show();
}
updateTimeAwarenessBarrier();
}
break;
default:
break;
}
}
}
And just like that, the standing up reminder function is created.
In fact, I've got some more ideas for using mobile context-awareness capabilities, such as developing a sleep reminder using the ambient light awareness capability and the time awareness capability. This reminder can notify users when it is bedtime based on a specified time and when the ambient brightness is lower than a specified value.
A schedule reminder also sounds like a good idea, which uses the time awareness capability to tell a user their schedule for a day at a specified time.
These are just some of my ideas. If you've got some other interesting inspirations for using the context-awareness capabilities, please share them in the comments section below and see how our ideas overlap.
References>>The dangers of sitting
>>What are the risks of sitting too much?[z1]
>>Obtaining agconnect-services.json
>>Obtaining a signing certificate