[Q] Braces around scalar initializer for type 'const char*' - Android Q&A, Help & Troubleshooting

Hey all,
I was trying to build CM12 when i got the following error:
Code:
sensors.cpp:80:1: error: braces around scalar initializer for type 'const char*'
};
^
The code affected:
Code:
static const struct sensor_t sSensorList[] = {
{ "BMA22 Acceleration Sensor",
"Bosch",
1, SENSORS_ACCELERATION_HANDLE,
SENSOR_TYPE_ACCELEROMETER, RANGE_A, RESOLUTION_A, 0.2f, 10000, 0, 0, { } },
{ "MS-3C Magnetic Sensor",
"Yamaha",
1, SENSORS_MAGNETIC_FIELD_HANDLE,
SENSOR_TYPE_MAGNETIC_FIELD, RANGE_M, RESOLUTION_M, 4.0f, 10000, 0, 0,{ } },
{ "MS-3C Orientation Sensor",
"Yamaha",
1, SENSORS_ORIENTATION_HANDLE,
SENSOR_TYPE_ORIENTATION, RANGE_O, RESOLUTION_O, 4.2f, 10000, 0, 0, { } },
{ "GP2A Light sensor",
"Sharp",
1, SENSORS_LIGHT_HANDLE,
SENSOR_TYPE_LIGHT, 11000.0f, 1.0f, 0.75f, 0, 0, 0, { } },
{ "GP2A Proximity sensor",
"Sharp",
1, SENSORS_PROXIMITY_HANDLE,
SENSOR_TYPE_PROXIMITY, 5.0f, 5.0f, 0.75f, 0, 0, 0, { } },
};
Can anyone please help?
Cheers!
-Technohacker

Related

[Q] acpuclock-7x30.c modification wont boot.

hello so recently i decided to compile a custom over-clocked kernel for the mecha the first modification was to change some of the cpu frequency's but after doing so and compiling when i try to boot with the kernel installed my phone just seems to lock up and never boot. the code seems good to me but i figure ill let you all have a look.
Code:
static struct cpufreq_frequency_table freq_table[] = {
{ 0, 250000 },
{ 1, 350000 },
{ 2, 450000 },
{ 3, 550000 },
{ 4, 650000 },
{ 5, 750000 },
{ 6, 850000 },
{ 7, 950000 },
{ 8, 1050000 },
{ 9, 1150000 },
{ 10, 1250000 },
{ 11, 1350000 },
{ 12, 1450000 },
{ 13, 1550000 },
{ 14, 1650000 },
{ 15, 1750000 },
{ 16, 1850000 },
{ 17, 1950000 },
{ 16, CPUFREQ_TABLE_END },
};
/* Use negative numbers for sources that can't be enabled/disabled */
#define SRC_LPXO (-2)
#define SRC_AXI (-1)
static struct clkctl_acpu_speed acpu_freq_tbl[] = {
{ 24576, SRC_LPXO, 0, 0, 30720, 900, VDD_RAW(900) },
{ 61440, PLL_3, 5, 11, 61440, 900, VDD_RAW(900) },
{ 122880, PLL_3, 5, 5, 61440, 900, VDD_RAW(900) },
{ 184320, PLL_3, 5, 4, 61440, 900, VDD_RAW(900) },
{ MAX_AXI_KHZ, SRC_AXI, 1, 0, 61440, 900, VDD_RAW(900) },
{ 250000, PLL_3, 5, 2, 122500, 900, VDD_RAW(900) },
{ 350000, PLL_3, 5, 1, 192000, 950, VDD_RAW(950) },
{ 450000, PLL_1, 2, 0, 192000, 950, VDD_RAW(950) },
{ 550000, PLL_3, 5, 1, 192000, 975, VDD_RAW(975) },
{ 650000, PLL_2, 3, 0, 192000, 1000, VDD_RAW(1000) },
{ 750000, PLL_2, 3, 0, 192000, 1025, VDD_RAW(1025) },
{ 850000, PLL_2, 3, 0, 192000, 1050, VDD_RAW(1050) },
{ 950000, PLL_2, 3, 0, 192000, 1050, VDD_RAW(1050) },
{ 1050000, PLL_2, 3, 0, 192000, 1100, VDD_RAW(1100) },
{ 1150000, PLL_2, 3, 0, 192000, 1150, VDD_RAW(1150) },
{ 1250000, PLL_2, 3, 0, 192000, 1175, VDD_RAW(1175) },
{ 1350000, PLL_2, 3, 0, 192000, 1225, VDD_RAW(1225) },
{ 1450000, PLL_2, 3, 0, 192000, 1300, VDD_RAW(1300) },
{ 1550000, PLL_2, 3, 0, 192000, 1400, VDD_RAW(1400) },
{ 1650000, PLL_2, 3, 0, 192000, 1400, VDD_RAW(1400) },
{ 1750000, PLL_2, 3, 0, 192000, 1450, VDD_RAW(1450) },
{ 1850000, PLL_2, 3, 0, 192000, 1450, VDD_RAW(1450) },
{ 1950000, PLL_2, 3, 0, 192000, 1450, VDD_RAW(1450) },
{ 0 }
};
before I modified this area the kernel booted fine.
the rest of the code is a clone of adrynalyne's master source.
Adryn's new kernel supports changing that information on the fly. Also, why would you want so many frequencies? That would actually make it less effiecent.
I wanted to test certain speeds/voltages on my phone still why won't it boot up the voltages and clock speeds as so.
Sent from my ADR6400L using XDA App

[aospa 4.4.2 kvt49l] paranoidandroid 4.3+ GEEB [05/20]

{
"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"
}
AOSPA 4.3+ PARANOIDANDROID
Kitkat 4.4.2 KVT49L android-4.4.2_r2.1
Download ROMS from DOWNLOAD HERE
1. DOWNLOAD YOUR ROM
2. DOWNLOAD THE LATEST PA GAPPS PACKAGE - always check/use up to date Gapps unless otherwise noted
http://goo.gl/mYKmfL - RECOMMEND mini modular PA Gapps
or BANKS - if having issues with PA Gapps
Wipe Fresh Clean Install (you all know the procedure)
3. COMPLETE CLEAN WIPE - *includes system*
4. FLASH ROM & GAPPS
5. WIPE CACHE & DALVIK
5. RUN INITIAL SETUP & REBOOT
Let boot take as much time as needed. This will help avoid boot issues.
GIT
GERRIT
FAQ + HELP
BUG TRACKER
COMMUNITY + CHANGELOGS​
Disclaimer / Warning!: I'm not responsible for any reason should you bork your phone
Donations
If you want to donate, feel free to do so otherwise don't forget to hit thanks and show your appreciation for all the hard work that goes into this.
My Github Sources
Please stick to development here!!! Take all questions to Q&A thread - thanks Pony Express!!!
RULES
You must read the OP & Installation Instructions before installing this ROM or posting in this thread
If you don't like how I run this thread. Leave. You do not have to be here and you are not forced to read it. You are doing so on your own free will.
Search before posting here. You are most likely not the only one to have the question/issue.
Have fun in this thread. I don't mind if we have some fun, joke around, or whatever. As long as it's fun.
If you're going to post here, keep it to this ROM and this ROM only (unless its fun as mentioned above). It is useless to compare to Stock ROMs, CM10 ROMS, ect...
Please watch the 2 videos provided below before posting in this thread. thanks
Thank g33k3r for TOT file or whoever else involved in getting it.. You can go to HIS THREAD HERE to get the official lg image..
This is an paste from Harsh from his thread here
Well, our cpu are made at some quality standards. We have 4 different quality of cpu for apq8064 from Qualcomm. so depending on which one is on your phone it selects frequency table from slow, nominal, fast and faster.
Google kernel source have same frequency table for fast and faster. So those with faster are not getting their extra advantage
You can identify you CPU chip by below command in terminal.
adb shell dmesg | grep PVS
It will give you some output as given example below
Click to expand...
Click to collapse
Code:
adb shell dmesg | grep PVS
[ 0.873920] acpuclk-8064 acpuclk-8064: ACPU PVS: FAST
And faster binned CPU has lot to do with UV, when you look as frequency table of faster, it is already preconfigured to have lower voltages than fast, and lot lower than slow binned.
Phones with faster binned should have better battery than slower binned phone out of box without any other configuration.
And for UV its already hardcoded and can be adjusted by System Tuner app further. And OC I am not willing to add. ( I don't think there's any gain in running our phones hotter with higher voltages by OC'ing)
Click to expand...
Click to collapse
default voltages for SLOW:
{ 1, { 384000, PLL_8, 0, 2, 0x00 }, L2(0), 950000 },
{ 0, { 432000, HFPLL, 2, 0, 0x20 }, L2(6), 975000 },
{ 1, { 486000, HFPLL, 2, 0, 0x24 }, L2(6), 975000 },
{ 0, { 540000, HFPLL, 2, 0, 0x28 }, L2(6), 1000000 },
{ 1, { 594000, HFPLL, 1, 0, 0x16 }, L2(6), 1000000 },
{ 0, { 648000, HFPLL, 1, 0, 0x18 }, L2(6), 1025000 },
{ 1, { 702000, HFPLL, 1, 0, 0x1A }, L2(6), 1025000 },
{ 0, { 756000, HFPLL, 1, 0, 0x1C }, L2(6), 1075000 },
{ 1, { 810000, HFPLL, 1, 0, 0x1E }, L2(6), 1075000 },
{ 0, { 864000, HFPLL, 1, 0, 0x20 }, L2(6), 1100000 },
{ 1, { 918000, HFPLL, 1, 0, 0x22 }, L2(6), 1100000 },
{ 0, { 972000, HFPLL, 1, 0, 0x24 }, L2(6), 1125000 },
{ 1, { 1026000, HFPLL, 1, 0, 0x26 }, L2(6), 1125000 },
{ 0, { 1080000, HFPLL, 1, 0, 0x28 }, L2(15), 1175000 },
{ 1, { 1134000, HFPLL, 1, 0, 0x2A }, L2(15), 1175000 },
{ 0, { 1188000, HFPLL, 1, 0, 0x2C }, L2(15), 1200000 },
{ 1, { 1242000, HFPLL, 1, 0, 0x2E }, L2(15), 1200000 },
{ 0, { 1296000, HFPLL, 1, 0, 0x30 }, L2(15), 1225000 },
{ 1, { 1350000, HFPLL, 1, 0, 0x32 }, L2(15), 1225000 },
{ 0, { 1404000, HFPLL, 1, 0, 0x34 }, L2(15), 1237500 },
{ 1, { 1458000, HFPLL, 1, 0, 0x36 }, L2(15), 1237500 },
{ 1, { 1512000, HFPLL, 1, 0, 0x38 }, L2(15), 1250000 },
default voltages for NORM:
{ 1, { 384000, PLL_8, 0, 2, 0x00 }, L2(0), 900000 },
{ 0, { 432000, HFPLL, 2, 0, 0x20 }, L2(6), 925000 },
{ 1, { 486000, HFPLL, 2, 0, 0x24 }, L2(6), 925000 },
{ 0, { 540000, HFPLL, 2, 0, 0x28 }, L2(6), 950000 },
{ 1, { 594000, HFPLL, 1, 0, 0x16 }, L2(6), 950000 },
{ 0, { 648000, HFPLL, 1, 0, 0x18 }, L2(6), 975000 },
{ 1, { 702000, HFPLL, 1, 0, 0x1A }, L2(6), 975000 },
{ 0, { 756000, HFPLL, 1, 0, 0x1C }, L2(6), 1025000 },
{ 1, { 810000, HFPLL, 1, 0, 0x1E }, L2(6), 1025000 },
{ 0, { 864000, HFPLL, 1, 0, 0x20 }, L2(6), 1050000 },
{ 1, { 918000, HFPLL, 1, 0, 0x22 }, L2(6), 1050000 },
{ 0, { 972000, HFPLL, 1, 0, 0x24 }, L2(6), 1075000 },
{ 1, { 1026000, HFPLL, 1, 0, 0x26 }, L2(6), 1075000 },
{ 0, { 1080000, HFPLL, 1, 0, 0x28 }, L2(15), 1125000 },
{ 1, { 1134000, HFPLL, 1, 0, 0x2A }, L2(15), 1125000 },
{ 0, { 1188000, HFPLL, 1, 0, 0x2C }, L2(15), 1150000 },
{ 1, { 1242000, HFPLL, 1, 0, 0x2E }, L2(15), 1150000 },
{ 0, { 1296000, HFPLL, 1, 0, 0x30 }, L2(15), 1175000 },
{ 1, { 1350000, HFPLL, 1, 0, 0x32 }, L2(15), 1175000 },
{ 0, { 1404000, HFPLL, 1, 0, 0x34 }, L2(15), 1187500 },
{ 1, { 1458000, HFPLL, 1, 0, 0x36 }, L2(15), 1187500 },
{ 1, { 1512000, HFPLL, 1, 0, 0x38 }, L2(15), 1200000 },
default voltages for FAST & FASTER:
{ 1, { 384000, PLL_8, 0, 2, 0x00 }, L2(0), 850000 },
{ 0, { 432000, HFPLL, 2, 0, 0x20 }, L2(6), 875000 },
{ 1, { 486000, HFPLL, 2, 0, 0x24 }, L2(6), 875000 },
{ 0, { 540000, HFPLL, 2, 0, 0x28 }, L2(6), 900000 },
{ 1, { 594000, HFPLL, 1, 0, 0x16 }, L2(6), 900000 },
{ 0, { 648000, HFPLL, 1, 0, 0x18 }, L2(6), 925000 },
{ 1, { 702000, HFPLL, 1, 0, 0x1A }, L2(6), 925000 },
{ 0, { 756000, HFPLL, 1, 0, 0x1C }, L2(6), 975000 },
{ 1, { 810000, HFPLL, 1, 0, 0x1E }, L2(6), 975000 },
{ 0, { 864000, HFPLL, 1, 0, 0x20 }, L2(6), 1000000 },
{ 1, { 918000, HFPLL, 1, 0, 0x22 }, L2(6), 1000000 },
{ 0, { 972000, HFPLL, 1, 0, 0x24 }, L2(6), 1025000 },
{ 1, { 1026000, HFPLL, 1, 0, 0x26 }, L2(6), 1025000 },
{ 0, { 1080000, HFPLL, 1, 0, 0x28 }, L2(15), 1075000 },
{ 1, { 1134000, HFPLL, 1, 0, 0x2A }, L2(15), 1075000 },
{ 0, { 1188000, HFPLL, 1, 0, 0x2C }, L2(15), 1100000 },
{ 1, { 1242000, HFPLL, 1, 0, 0x2E }, L2(15), 1100000 },
{ 0, { 1296000, HFPLL, 1, 0, 0x30 }, L2(15), 1125000 },
{ 1, { 1350000, HFPLL, 1, 0, 0x32 }, L2(15), 1125000 },
{ 0, { 1404000, HFPLL, 1, 0, 0x34 }, L2(15), 1137500 },
{ 1, { 1458000, HFPLL, 1, 0, 0x36 }, L2(15), 1137500 },
{ 1, { 1512000, HFPLL, 1, 0, 0x38 }, L2(15), 1150000 },
So glad to see this here, houstonn! Excellent job my friend.
:good: :highfive:
Sent from my Optimus G using xda app-developers app
Agreed. I'm still rocking the 3/29 build haha
Pie Control works fine for me. It only gave me issues when I flashed the build from 4/2
____
Sent from my LG Original Gangsta
And here we go! Comm. take off time!:crying:I'm so happy!!!
Wow for a moment I was confused whether I was looking at N4 forums...
Great work Devs! You guys are awesome!
Sent from my LG-E970 using xda premium
This is awesome, I'm loving it. Thanks to all the devs involved, great work.
Sent from my Optimus G using xda app-developers app
Curious as to why it will not let me lower min frequency. I lower it but it always puts it right back at 1026....killing my battery.
Sent from my Optimus G using xda app-developers app
Look at cpu spy, I think you will find it actually is going below and just not reporting correctly.
Edit: I just looked at cpu spy and you are in fact correct. Holding steady at 1026+...getting great deep sleep though!
Sent from my Optimus G using xda app-developers app
Jank4AU said:
Look at cpu spy, I think you will find it actually is going below and just not reporting correctly.
Edit: I just looked at cpu spy and you are in fact correct. Holding steady at 1026+...getting great deep sleep though!
Sent from my Optimus G using xda app-developers app
Click to expand...
Click to collapse
Deep sleep is good here as well. Seems like it would be amazing if it would allow itself to clock down. Nothing I do will get my settings to persist. Neither in built in performance control or when I tried setcpu.
Sent from my Optimus G using xda app-developers app
pfoxdizzle said:
Deep sleep is good here as well. Seems like it would be amazing if it would allow itself to clock down. Nothing I do will get my settings to persist. Neither in built in performance control or when I tried setcpu.
Sent from my Optimus G using xda app-developers app
Click to expand...
Click to collapse
Blame Google. Its called touch boost
Sent from my Nexus 7 using xda app-developers app
Never heard of this and found nothing on the internet. Would appreciate a pm if you get the chance.
Sent from my Optimus G using xda app-developers app
pfoxdizzle said:
Never heard of this and found nothing on the internet. Would appreciate a pm if you get the chance.
Sent from my Optimus G using xda app-developers app
Click to expand...
Click to collapse
Chad explained it to me. Its built in to boost up the CPU upon touches to prevent lag. Found it in some n4 threads too
Sent from my Nexus 7 using xda app-developers app
It states that this comes with a modded
Faux kernel. Use fauxclock to disable mpdecision and you'll be able to go below 1GHz. Hopefully the intellidemand governor is present or all 4 cores might be forced online by this.
Sent from my LG-E970 using xda premium
pfoxdizzle said:
Deep sleep is good here as well. Seems like it would be amazing if it would allow itself to clock down. Nothing I do will get my settings to persist. Neither in built in performance control or when I tried setcpu.
Sent from my Optimus G using xda app-developers app
Click to expand...
Click to collapse
What governor are you using? After experimenting with it a little, it appears that Conservative is locked to a low of 1026, but the others like Wheatley and OnDemand behave normally...
Jank4AU said:
What governor are you using? After experimenting with it a little, it appears that Conservative is locked to a low of 1026, but the others like Wheatley and OnDemand behave normally...
Click to expand...
Click to collapse
I tried all the governors. Was also sent to the glorious demigod screen after a reboot so reverting back to my CM backup for now.
Sent from my Nexus 4 using xda app-developers app
Hmm idk about this build, but I'm on the 3/29 build and I'm running the interactive governor clocked to a max of 1512 and min of 288
Deep sleep over night was around 7 hours and 35 minutes out of 7 hours and 38 minutes or something.
blenkows said:
Hmm idk about this build, but I'm on the 3/29 build and I'm running the interactive governor clocked to a max of 1512 and min of 288
Deep sleep over night was around 7 hours and 35 minutes out of 7 hours and 38 minutes or something.
Click to expand...
Click to collapse
It goes down to 288. Just a display bug in apps. The phone scales down.
Sent from my Nexus 4 using xda app-developers app
nygfan760 said:
It goes down to 288. Just a display bug in apps. The phone scales down.
Sent from my Nexus 4 using xda app-developers app
Click to expand...
Click to collapse
Edit: I shouldn't be posting here yet. I'm still on the 0404 build and running the 0408 kernel so I don't know if everything is the same kernel-wise. So excuse me while I bow out for a bit until I'm up to date.
Sent from my Optimus G using xda app-developers app

[Q] property_set and property_get usage

Hi,
I'm trying to set and retrieve properties in my native code using property_get and property_set but it doesn't seem to be working. I tried adding debug logs but they don't show up too. I'm not sure if I'm doing it all wrong but here's what I did,
I have
Code:
property_set("dm.scheme",value);
in a function in one file and
Code:
char value[PROPERTY_VALUE_MAX];
property_get("dm.scheme",value,"0");
in another file.
I modified property_service.c to this
Code:
/* White list of permissions for setting property services. */
struct {
const char *prefix;
unsigned int uid;
unsigned int gid;
} property_perms[] = {
{ "net.rmnet0.", AID_RADIO, 0 },
...
{ "service.adb.tcp.port", AID_SHELL, 0 },
{ "persist.sys.", AID_SYSTEM, 0 },
{ "persist.service.", AID_SYSTEM, 0 },
{ "persist.security.", AID_SYSTEM, 0 },
{ "dm.", AID_SYSTEM, 0},
{ NULL, 0, 0 }
};
Am I missing anything here?

how to oc kernel samsung

What I need to do oclocking gpu
/* clk,vol,abb,min,max,down stay, time, pm_qos mem,
pm_qos int, pm_qos cpu_kfc_min, pm_qos cpu_egl_max */
static gpu_dvfs_info gpu_dvfs_table_default[] = {
{667, 1168750, 0, 99, 100, 1, 0, 666000, 275000, 897000, 1500000},
{533, 1062500, 0, 98, 99, 1, 0, 559000, 275000, 897000, 1500000},
{350, 900000, 0, 90, 98, 1, 0, 413000, 275000, 507000, 1500000},
{266, 900000, 0, 78, 95, 1, 0, 413000, 275000, 507000, 1500000},
{160, 900000, 0, 10, 20, 1, 0, 413000, 275000, 507000, 1500000},
};
static int mif_min_table[] = {
200000, 273000, 338000, 413000, 559000, 666000,
};
static gpu_attribute gpu_config_attributes[] = {
{GPU_MAX_CLOCK, 667},
{GPU_MAX_CLOCK_LIMIT, 667},
{GPU_MIN_CLOCK, 160},
{GPU_DVFS_START_CLOCK, 160},
{GPU_DVFS_BL_CONFIG_CLOCK, 160},
{GPU_GOVERNOR_TYPE, G3D_DVFS_GOVERNOR_INTERACTIVE},
{GPU_GOVERNOR_START_CLOCK_DEFAULT, 160},
{GPU_GOVERNOR_START_CLOCK_INTERACTIVE, 160},
{GPU_GOVERNOR_START_CLOCK_STATIC, 160},
{GPU_GOVERNOR_START_CLOCK_BOOSTER, 160},
{GPU_GOVERNOR_TABLE_DEFAULT, (uintptr_t)&gpu_dvfs_table_default},
{GPU_GOVERNOR_TABLE_INTERACTIVE, (uintptr_t)&gpu_dvfs_table_default},
{GPU_GOVERNOR_TABLE_STATIC, (uintptr_t)&gpu_dvfs_table_default},
{GPU_GOVERNOR_TABLE_BOOSTER, (uintptr_t)&gpu_dvfs_table_default},
{GPU_GOVERNOR_TABLE_SIZE_DEFAULT, GPU_DVFS_TABLE_LIST_SIZE(gpu_dvfs_table_default)},
{GPU_GOVERNOR_TABLE_SIZE_INTERACTIVE, GPU_DVFS_TABLE_LIST_SIZE(gpu_dvfs_table_default)},
{GPU_GOVERNOR_TABLE_SIZE_STATIC, GPU_DVFS_TABLE_LIST_SIZE(gpu_dvfs_table_default)},
{GPU_GOVERNOR_TABLE_SIZE_BOOSTER, GPU_DVFS_TABLE_LIST_SIZE(gpu_dvfs_table_default)},
{GPU_GOVERNOR_INTERACTIVE_HIGHSPEED_CLOCK, 440},
{GPU_GOVERNOR_INTERACTIVE_HIGHSPEED_LOAD, 95},
{GPU_GOVERNOR_INTERACTIVE_HIGHSPEED_DELAY, 0},
{GPU_DEFAULT_VOLTAGE, 975000},
{GPU_COLD_MINIMUM_VOL, 0},
{GPU_VOLTAGE_OFFSET_MARGIN, 37500},
{GPU_TMU_CONTROL, 0},
{GPU_TEMP_THROTTLING1, 600},
{GPU_TEMP_THROTTLING2, 533},
{GPU_TEMP_THROTTLING3, 440},
{GPU_TEMP_THROTTLING4, 350},
{GPU_TEMP_TRIPPING, 266},
{GPU_POWER_COEFF, 46}, /* all core on param */
{GPU_DVFS_TIME_INTERVAL, 5},
{GPU_DEFAULT_WAKEUP_LOCK, 1},
{GPU_BUS_DEVFREQ, 0},
{GPU_DYNAMIC_ABB, 0},
{GPU_EARLY_CLK_GATING, 0},
{GPU_DVS, 0},
#ifdef MALI_SEC_HWCNT
{GPU_HWCNT_GATHERING, 1},
{GPU_HWCNT_GPR, 1},
{GPU_HWCNT_DUMP_PERIOD, 50}, /* ms */
{GPU_HWCNT_CHOOSE_JM , 0},
{GPU_HWCNT_CHOOSE_SHADER , 0xF8},
{GPU_HWCNT_CHOOSE_TILER , 0},
{GPU_HWCNT_CHOOSE_L3_CACHE , 0},
{GPU_HWCNT_CHOOSE_MMU_L2 , 0},
#endif
{GPU_RUNTIME_PM_DELAY_TIME, 50},
{GPU_DVFS_POLLING_TIME, 30},
{GPU_PERF_GATHERING, 0},
{GPU_PMQOS_INT_DISABLE, 0},
{GPU_PMQOS_MIF_MAX_CLOCK, 666000},
{GPU_PMQOS_MIF_MAX_CLOCK_BASE, 667},
#ifdef CONFIG_EXYNOS_CL_DVFS_G3D
{GPU_CL_DVFS_START_BASE, 600},
#endif
{GPU_DEBUG_LEVEL, DVFS_WARNING},
{GPU_TRACE_LEVEL, TRACE_ALL},
};
Sorry about the english

What Should I Do If a HUAWEI Quick App Freezes When the canvas Component Draws an Image Using setInterval?

Symptom: In a quick app, the setInterval function is used to cyclically execute the code for using canvas. However, the quick app freezes when rendering an image on a Huawei phone.
The code where the exception occurs is as follows:
JavaScript:
click0() {
this.speed = 0.3
let ctx = this.$element('canvas').getContext('2d')
setInterval(() => {
this.num0 += 2
this.noise = Math.min(0.5, 1) * this.MAX
this._draw(ctx)
this.MAX <= 200 && (this.MAX += 4)
}, 20)
},
_draw(ctx) {
this.phase = (this.phase + this.speed) % (Math.PI * 64)
ctx.clearRect(0, 0, this.width, this.height)
this._drawLine(ctx, -2, 'rgba(0, 194, 255, 0.2)')
this._drawLine(ctx, -6, 'rgba(0, 194, 255, 0.4)')
this._drawLine(ctx, 4, 'rgba(0, 194, 255, 0.6)')
this._drawLine(ctx, 2, 'rgba(0, 194, 255, 0.8)')
this._drawLine(ctx, 1, 'rgba(0, 194, 255, 1)', 4)
},
Cause Analysis:
The canvas drawing in the this._draw() method takes a long time, at least 100 ms. However, the time interval is only 20 ms. Huawei Quick App Loader will execute the code again after 20 ms, which is much shorter than 100 ms, causing the drawing to stutter.
Solution:
You can first obtain the service provider by calling the API for querying device information to determine whether the quick app is supported by Huawei Quick App Loader. If so, set the time interval to longer than 100 ms. The sample code is as follows (please refer to the red portions):
JavaScript:
onShow: function () {
var that = this
device.getInfo({
success: function (ret) {
console.log("handling success:", JSON.stringify(ret));
that.engineProvider = ret.engineProvider;
},
fail: function (erromsg, errocode) {
console.log("message:", erromsg, errocode);
}
})
},
click0() {
var that = this
this.speed = 0.3
console.log(that.engineProvider)
let ctx = this.$element('canvas').getContext('2d')
if (that.engineProvider === "huawei") {
setInterval(() => {
this.num0 += 2
this.noise = Math.min(0.5, 1) * this.MAX
this._draw(ctx)
this.MAX <= 200 && (this.MAX += 4)
}, 120)
} else {
setInterval(() => {
this.num0 += 2
this.noise = Math.min(0.5, 1) * this.MAX
this._draw(ctx)
this.MAX <= 200 && (this.MAX += 4)
}, 20)
}
},
_draw(ctx) {
this.phase = (this.phase + this.speed) % (Math.PI * 64)
ctx.clearRect(0, 0, this.width, this.height)
this._drawLine(ctx, -2, 'rgba(0, 194, 255, 0.2)')
this._drawLine(ctx, -6, 'rgba(0, 194, 255, 0.4)')
this._drawLine(ctx, 4, 'rgba(0, 194, 255, 0.6)')
this._drawLine(ctx, 2, 'rgba(0, 194, 255, 0.8)')
this._drawLine(ctx, 1, 'rgba(0, 194, 255, 1)', 4)
},
_drawLine(ctx, attenuation, color, width) {
ctx.save()
ctx.moveTo(0, 0);
ctx.beginPath();
ctx.strokeStyle = color;
ctx.lineWidth = width || 1;
var x, y;
for (var i = -this.K; i <= this.K; i += 0.01) {
x = this.width * ((i + this.K) / (this.K * 2))
y = this.height / 2 + this.noise * this._globalAttenuationFn(i) * (1 / attenuation) * Math.sin(this.F * i - this.phase)
ctx.lineTo(x, y)
}
ctx.stroke()
ctx.restore()
},
References:
Introduction to the canvas API:
https://developer.huawei.com/consumer/en/doc/development/quickApp-References/quickapp-api-canvas
Quick app materials: https://developer.huawei.com/consumer/en/doc/development/quickApp-Guides/quickapp-whitepaper

Categories

Resources