Help Modifying keyguard_max_notification_count - Nexus 5 Q&A, Help & Troubleshooting

I am building AOSP and would like to change the maximum number of notifications that are displayed on the Lockscreen.
In /frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
Code:
mKeyguardMaxNotificationCount = res.getInteger(R.integer.keyguard_max_notification_count);
In frameworks/base/packages/SystemUI/res/values/config.xml
Code:
<integer name="keyguard_max_notification_count">4</integer>
No matter what I change the integer value to (1, 6, 20, etc_) the lockscreen still shows a maximum of 4 notifications. If I change the value in the java file, like this:
Code:
mKeyguardMaxNotificationCount = 6;
It works.
Why would changing the integer value from config.xml not be having any effect??

Any ideas?

Maybe there's an overlay which overrides the default setting. Check 'source-dir/device/lge/hammerhead/overlay'.

experience7 said:
Maybe there's an overlay which overrides the default setting. Check 'source-dir/device/lge/hammerhead/overlay'.
Click to expand...
Click to collapse
Thank you for the hint.
I searched through /device/lge/hammerhead/overlay but I did not find the value "keyguard_max_notification_count". This is getting really frustrating!

Related

Display doesn't dim {SOLVED}

Something went wrong with my Vox. It doesn't longer completely dim the display after a given timeout. What could be the problem?
Search this forum maybe?
http://forum.xda-developers.com/showthread.php?t=303778
agentdr8 said:
Search this forum maybe?
http://forum.xda-developers.com/showthread.php?t=303778
Click to expand...
Click to collapse
Thanks for the hint but I couldn't figure out which keys to edit or create. Could you please show me an overview of your keys in "HKEY_Current_User > ControlPanel > Power"?
Thank you in advance.
I found the full version of the tutorial and it worked: http://titourhea.free.fr/site/faq.php?lng=fr&pg=312
Thanks to all
What do they mean with:
"HKEY_Current_User, ControlPanel, Power, faire : Values, Display (cliquer dessus), Value Data par défaut = 60"
Do they mean setting value "Default" in HKCU/ControlPanel/Power ?
(in my case it is unset)
Or do they mean setting value "Display" in HKCU/ControlPanel/Power ?
(in my case "Display" does not exist)
Depending on which registry editor you use, it'll have different means of editing the values for that key's default value.
So if it were arranged as a tree, it would look like this:
Code:
HKCU
\\
ControlPanel
\\
Power <== *** under here, you'd edit its (Default) (or hit Values softkey in PHM) ***
\\
LockLevel <== this is a sub-key of the Power key, which has it's own values
\\
Display <== if this existed, it would be here, as another sub-key of Power
I have still not under stood. I am using resco registry editor but : what to change in what I have somethin " Locklevel" under Power.. nothin else. what to change in this. I am using HTC VOX
jsbutran said:
I have still not under stood. I am using resco registry editor but : what to change in what I have somethin " Locklevel" under Power.. nothin else. what to change in this. I am using HTC VOX
Click to expand...
Click to collapse
I do not understand either:
so you do have to create a value under "Power" that is called "Display" (if - as with my Vox - it is not there) and under that you can enter 60,30 or whatever?
TIA
Here's how I did it using Resco's Registry Editor.
Navigate to HKCU>ControlPanel>Power
There you will find:
Code:
..
LockLevel
(Default)
Display
Click on "Display". Now you will see "DWORD Data". Enter "30" there (stands for seconds).
PS. You DO NOT need to create any new keys, string values or whatever.
In my case after some readings from various forums i've found out my problem was caused by installing the tcpmp player. It created the "display" value in the first place. So the best way is to simply delete the "display" value.
After that on the tcpmp player options > settings > advanced - select the options for " no backlight keepalive for video" and home screen timeout for music".
This solution has worked for me. I just have to manually change the display timeout settings to "never" before playing anything on the player.

Add leading 0 (zero) on lockscreen clock

Hi guys - Happy New Year.
Can anyone tell me how to add a leading '0' (zero) to the lockscreen clock?
I have used a large number of lockscreens, NONE of them have a leading zero. I am using 24hour time. I have the leading zero on the home tab, and on the top taskbar menu. I cannot seem to get it on the lockscreen.
eg: Lockscreen shows 8:00. I want 08:00.
Thanks in advance.
PS - I can get the zero with lockscreen widgets in CHT2. BUT I want it without any widget add ons.
Try Start-Settings-System-Regional Settings-Time [Page]-Time style HH:mm:ss
hgalanos said:
Hi guys - Happy New Year.
Can anyone tell me how to add a leading '0' (zero) to the lockscreen clock?
I have used a large number of lockscreens, NONE of them have a leading zero. I am using 24hour time. I have the leading zero on the home tab, and on the top taskbar menu. I cannot seem to get it on the lockscreen.
eg: Lockscreen shows 8:00. I want 08:00.
Thanks in advance.
PS - I can get the zero with lockscreen widgets in CHT2. BUT I want it without any widget add ons.
Click to expand...
Click to collapse
Thanks for your reply. I have changed the regional settings to:
hh:mm:ss and also
HH:mm:ss
Nothing happens. The flip clock stays without a zero.
If you are looking for lockscreen with leading zero try manals Windows LockScreen V4 http://forum.xda-developers.com/showthread.php?t=854047
with settings below it have leading zero for sure. (This is standard windows lockscreen modification, not CHT)
hgalanos said:
Thanks for your reply. I have changed the regional settings to:
hh:mm:ss and also
HH:mm:ss
Nothing happens. The flip clock stays without a zero.
Click to expand...
Click to collapse
The Touch x 24 hours clock fixes the alarm and lockscreen so they now appear as 08:00.
However nothing I have tried works for the home screen flip clock.
Anyone?
Try reg:
[HKEY_LOCAL_MACHINE\nls\overrides]
"STFmt"="HH:mm:ss tt" // (Ex: 08:00 AM or 20:00 PM)
"SSDte"="dd-MM-yyyy" // (Ex: 08-01-2011)
Yep, already tried/checked that. It is as you wrote it.
ALL clocks are showing leading zero, just not Manila home flip clock. Very strange.
Surely there is a way to change it.
hgalanos said:
Yep, already tried/checked that. It is as you wrote it.
ALL clocks are showing leading zero, just not Manila home flip clock. Very strange.
Surely there is a way to change it.
Click to expand...
Click to collapse
It will be controlled by the LUA script for the CHT main clock (assuming it is the main one with various flip/analog/weather options. I'll have a look over the weekend if you like?
Would I be safe in assuming you've already gone to the manila settings tab, date & time and then ticked 24-hour format?
Swarvey said:
Would I be safe in assuming you've already gone to the manila settings tab, date & time and then ticked 24-hour format?
Click to expand...
Click to collapse
Yes you would be safe in assuming this.
As per the ealier threads, time format, local settings have all been checked and changed. Even the registry. Nothing changes the flip clock have a leading zero.
Depending on what version of cht or sense you have it will be in the lua. There should be a statement near the top that says "shouldhideleadingzeros = true" you just need to change it to false and recompile.
EDIT:
Looked into it a little more for you and the file is 5fa4d4b7_manila from your stock sense.
Code:
-- Decompiled using luadec 3.2.2beta -- Tue Jan 11 10:19:35 2011
-- File name: 5fa4d4b7_manila
trace("Loaded digital clock\n")
TabHalf = {Tab = nil, HighDigit = nil, LowDigit = nil}
UV = {UP = 0.26171875, DOWN = 0.5234375}
TabHalf.new = function(l_1_0, l_1_1)
if not l_1_1 then
l_1_1 = {}
end
setmetatable(l_1_1, l_1_0)
l_1_0.__index = l_1_0
return l_1_1
end
TabFlip = {Time = 0, TimeDifference = 0, ShowingTime = 0, WrapAroundNumber = 0, StartValue = 0, [B][COLOR="Red"][B]ShouldHideLeadingZeros = true[/B][/COLOR][/B], TopTab = nil, TopTabFlip = nil, BottomTab = nil, BottomTabFlip = nil, LastDuration = -1, UseAltTiming = false, rotatecount = 1, getDuration = function(l_2_0)
if l_2_0.UseAltTiming then
Wow, I have stock version of 1.72 WWE ROM.
It sound like you are on a winner.
I will check this out tonight when I get home and see what I can do.
Thank you for the information, I will be sure to let you know what happens.
mrhayami said:
Depending on what version of cht or sense you have it will be in the lua. There should be a statement near the top that says "shouldhideleadingzeros = true" you just need to change it to false and recompile.
EDIT:
Looked into it a little more for you and the file is 5fa4d4b7_manila from your stock sense.
Code:
-- Decompiled using luadec 3.2.2beta -- Tue Jan 11 10:19:35 2011
-- File name: 5fa4d4b7_manila
trace("Loaded digital clock\n")
TabHalf = {Tab = nil, HighDigit = nil, LowDigit = nil}
UV = {UP = 0.26171875, DOWN = 0.5234375}
TabHalf.new = function(l_1_0, l_1_1)
if not l_1_1 then
l_1_1 = {}
end
setmetatable(l_1_1, l_1_0)
l_1_0.__index = l_1_0
return l_1_1
end
TabFlip = {Time = 0, TimeDifference = 0, ShowingTime = 0, WrapAroundNumber = 0, StartValue = 0, [B][COLOR="Red"][B]ShouldHideLeadingZeros = true[/B][/COLOR][/B], TopTab = nil, TopTabFlip = nil, BottomTab = nil, BottomTabFlip = nil, LastDuration = -1, UseAltTiming = false, rotatecount = 1, getDuration = function(l_2_0)
if l_2_0.UseAltTiming then
Click to expand...
Click to collapse
ok so I couldn't wait and though I would give it a go now. I have found the same Manila file you have listed, I also downloaded lua utility. How doesn this work, I ran it on my pc and nothing happens.
How can I edit the file?
hgalanos said:
ok so I couldn't wait and though I would give it a go now. I have found the same Manila file you have listed, I also downloaded lua utility. How doesn this work, I ran it on my pc and nothing happens.
How can I edit the file?
Click to expand...
Click to collapse
Well I suggest downloading the manila kitchen by 12 and kilaireg found here:
Thread
It will tell you how to run everything you need but the down and dirty is this.
Copy the manila file into this directory "kitchen>_source>file>xxxx_manila
then use the command prompt link and drag the file manilatool.cmd into the cmd window.
your main commands are going to be as followed in order:
-oem:2.5
-mnf:2.5
-dec
(now that it is decompiled you will be edit the lua in notepad save and then move to the next step.)
Notice: not all files will decompile correctly and you may have to tweak it to get it to decompile correctly.
-cmp (only if it does not fully decompile aka. you have the file in your incomplete folder.)
-rec (will recompile the file which you can then put on your device and enjoy)
I know it isn't much but as I said they have detailed info in the pack.
In case anyone is still trying to figure this out.
I installed the latest 314 WWE ROM and it supports a leading zero on the original manila clock.
Awesome.
hgalanos said:
Hi guys - Happy New Year.
Can anyone tell me how to add a leading '0' (zero) to the lockscreen clock?
I have used a large number of lockscreens, NONE of them have a leading zero. I am using 24hour time. I have the leading zero on the home tab, and on the top taskbar menu. I cannot seem to get it on the lockscreen.
...
Click to expand...
Click to collapse
If you set PocketShield clock display to 24h it will display the leading 0
NO fix as yet.
Guys,
I have to apologise, I don't know what planet I was on, but the new 314 ROM, does NOT fix this issue. There is still no leading zero for manila flip clock.
Anyway have a fix that works?
I have no idea how to edit manila files, and have not been successful is doing so.
I will have to rely on someone generous enough to do it for me.
Thank you in advance to anyone willing to help.

Android - setting style programmatically to dynamicly created compound components?

Im posting it here I cannot post in android developers forum.
I have following problem:
I have created compound component for irrelevant to the question purpose. I have also made a pretty nice style for it. While I apply the style in xml (using style="(at)style/xxx") it works flawlessly...
The problem starts when I need to dynamically create list of those compound components... simple call to:
new SubClassOfRelativeLayout(getContext(),null,R.style.xxx) does not give ANY effect.
So my question is as follows: do you, by any chance, know how to apply style (defined in xml resource file) to compound (custom) components that are subclass of RelativeLayout dynamically?
I started using
Code:
TypedArray array = getContext().obtainStyledAttributes(styleID, attributeIDArray);
and applying style manually - it is pain in *** but I have no idea how to do it other way ;/.
AzrealNimer said:
I started using
Code:
TypedArray array = getContext().obtainStyledAttributes(styleID, attributeIDArray);
and applying style manually - it is pain in *** but I have no idea how to do it other way ;/.
Click to expand...
Click to collapse
An old thread, but if you need to get that attributeIDArray, you can do it like this:
Code:
XmlPullParser parser = getResources().getLayout(R.layout.view_layout);
AttributeSet attributes = Xml.asAttributeSet(parser);

[MOD/FIX] Enable all light sensor levels in Sense Kernels and Frameworks

This MOD/FIX is only for Sense Kernels and ROMs/Frameworks
This is only for Kernel and ROM developers. (And maybe some framework tweakers.)
If you wan't to make use out of it, ask your favorite ROM and7or kernel developer.
The mod I describe here, should work with GB as well as Froyo (Desire/Bravo of course).
At first, big thanks to snq- for implementing the kernel mod and making it available for testing and further development.
Thanks to Leedroid for his great ROM in which I am using this MOD/FIX.
Further, thanks to anderl78 for pointing me to adjust the autobrighness in the framework and to sloppy for providing the howto on how to actually change the brightness in the framework.
Big thanks to ivicask who actually patched services.jar to make autobrightness together with the fixed/improved sensor driver work like a charm (see here and here)
If I forgot someone, just let me now.
So as many of you who like to use the autobrightness setting to automatically get the best brighness setting in every light condition I was not quite happy with the way HTC implemented it. Reason for that is, that the autobrightness in the stock framework was at far too high levels leading in to bright screens and unnecessary battery drain.
I will describe both changes in the Kernel and one (optional but recommended) mod in android itself - namely services.jar.
Let's start with the Kernel:
Kernel Mod:
While adjusting the values in the framework and during some testing I realized that not all sensor levels stated in the framework are reported by the lightsensor driver. Most importantly, Level 0 (which refers to absolutely darkness) was never reported by the driver. This made me look into the kernel sources and I finally found a solution.
I will not go into detail and explain the code for you. Every kernel developer should be able to understand and to follow the changes I provide.
First of all, the lightsensor driver uses a loop to report lightlevels for a range of sensor raw data. The lightsensor driver can be found in drivers/input/misc/cm3602_lightsensor_microp.c. In order to make the mod work, there would actually no need in changing the driver itself. But snq- provided a change that makes it even more simple.
Original Code: (drivers/input/misc/cm3602_lightsensor_microp.c)
Code:
static int get_ls_adc_level(uint8_t *data)
{
[B]...[/B]
for (i = 0; i < 10; i++) {
if (adc_value <=
li->ls_config->levels[i]) {
adc_level = i;
[I][B]if (li->ls_config->levels[i])
break;[/B][/I]
}
}
ILS("ALS value: 0x%X, level: %d #\n",
adc_value, adc_level);
data[2] = adc_level;
}
[B]...[/B]
}
Changed Code: (drivers/input/misc/cm3602_lightsensor_microp.c)
Code:
static int get_ls_adc_level(uint8_t *data)
{
[B]...[/B]
for (i = 0; i < 10; i++) {
if (adc_value <=
li->ls_config->levels[i]) {
adc_level = i;
[I][B]break;[/B][/I]
}
}
ILS("ALS value: 0x%X, level: %d #\n",
adc_value, adc_level);
data[2] = adc_level;
}
[B]...[/B]
}
Now for the "real" kernel tweak:
The lightsensor values are stored in the bravo board file: arch/arm/mach-msm/board-bravo.c
Original Code: (arch/arm/mach-msm/board-bravo.c)
Code:
static struct microp_function_config microp_lightsensor_function = {
.name = "light_sensor",
.category = MICROP_FUNCTION_LSENSOR,
[B][I].levels = { 0, 0x21, 0x4D, 0xDC, 0x134, 0x18D, 0x1E5, 0x3FF, 0x3FF, 0x3FF },[/I][/B]
.channel = 6,
.int_pin = 1 << 9,
.golden_adc = 0xC0,
.ls_power = capella_cm3602_power,
};
Changed Code: (arch/arm/mach-msm/board-bravo.c)
Code:
static struct microp_function_config microp_lightsensor_function = {
.name = "light_sensor",
.category = MICROP_FUNCTION_LSENSOR,
[B][I].levels = { 0x04, 0x21, 0x4D, 0xDC, 0x134, 0x18D, 0x1E5, 0x280, 0x340, 0x3FF },[/I][/B]
.channel = 6,
.int_pin = 1 << 9,
.golden_adc = 0xC0,
.ls_power = capella_cm3602_power,
};
I changed the values again (just took the ones from bravoc which has all levels defined) to the following - which is working great:
Code:
static struct microp_function_config microp_lightsensor_function = {
.name = "light_sensor",
.category = MICROP_FUNCTION_LSENSOR,
[B][I].levels = { 0, 10, 15, 21, 60, 209, 362, 488, 560, 0x3FF },[/I][/B]
.channel = 6,
.int_pin = 1 << 9,
.golden_adc = 0xC0,
.ls_power = capella_cm3602_power,
};
the final code - especially the lightsensor driver - looks a little bit different (few more tweaks).
They are implemented in snq-'s current kernel and from what I've seen even in bananacakes and tristans...
Those changes enable level 0 (since it is no longer skipped from the driver) and enables levels 7 to 9 (since 0x3FF is the last one and the previous ones are adjusted to lower values).
So, if you have a kernel with the changes implemented you can easily verify with
Code:
cat /sys/devices/i2c-0/0-0066/ls_adc
(and proper light conditions) all sensor levels from 0 to 9 are reported. You can even use a sensor app to verify that all light levels are reported (in lux within those apps).
Here comes the first and (in my opinion) only downside:
I have no idea if HTC implemented the driver the way they did by purpose. And I have no idea if the new reported sensor values in any way report the "right" lux values for the environment brightness. But I actually do not care about that, because I can adjust the framework and do not rely on exactly reported lux values (which is anyway only possible in a quite large range between the levels).
Framework:
Now for the framework / android:
I was quite happy to have all sensor levels enabled. And with proper adjusted autobrightness levels in the framework (framework-res.apk) it works quite well.
I adjusted my framework to tweak the values a little bit further (especially to have the screen quite dimmed in low light conditions). I tried to verify my changes with simply logging sensor data and screen brightness. I do this with a simple script:
Code:
#!/bin/bash
#
while :
do
sleep 1
echo.
adb shell cat /sys/class/leds/lcd-backlight/brightness
adb shell cat /sys/devices/i2c-0/0-0066/ls_adc
done
The script showed me, that even with all levels being reported, the value I set for the lowest level was not applied if you wake up the screen. On screen wakeup, what I saw was either the value for level one, or the maximum brightness (this only happens if you turn off and on again very quickly using the power button). Further, without changines in the environmental light conditions, no new values were applied. This is still annoying if you get max brightness in the middle of the night. Fortunately I was not the only one with that experience. The solution seems to be the (maybe poorly implemented) services.jar in the desire rom. So ivicask patched services.jar with the PowerManager related stuff from the Sensation to make autobrightness together with the fixed/improved sensor driver work like a charm (see here and here).
I flashed this on on my LeeDrOiD 3.3.3 (HD Mod) and it works perfectly.
With those changes in the services.jar (and the "config_autoBrightnessLcdBacklightValues" etc) adjusted accordingly, I now get all levels and the corresponding brightness which feels good and will hopefully add some highly appreciated hours to my battery life.
So, that's all in short. If you have any specific (development related) questions, just let me know.
Please do not ask how to implement it or where to get it - since despite the references below - I have no information on who has implemented or ever will implement this. Use the search function or ask your ROM/Kernel developer.
Update: Information for Brightness / Gamma settings for Amoled (not SLCD)
- max brightness value is 250
- min value is 10 but anything <31 will be set to 20
- gamma steps are 30 and there are actually 9 levels. But that doesn't matter. any value between 30 an 250 should be (more or less).
So if you take those "restrictions" into account while changing your framework, it could add a bit of smoothness (yet not sure about it).
References:
I do not know of any ROM with the mod applied. I personally use
LeeDrOiD HD V3.3.3-Port-R5
snq-'s kernel thread where we tried and made sure it works. I currently use 110918-lsmod1
HowTo change Autobrightness in framework:
Desire HD (Ace) (where I learned to tweak it) Lower Auto-Brightness Settings for DEODEXED FROYO / GINGERBREAD Sense ROMs
Classic Desire specific (Bravo) [How to] Adjust auto-brightness on GB Sense ROM
Question:
Has anyone been successfull to do the same for the hardware button backlights? (meaning to turn them off at higher levels). Seems the changes I applied so far do not work like I expect it.
So, I hope that this mod is of any use for Sense Rom's and kernels. I am more than happy with it and just wanted to share it with you.
Best regards,
Toby
Finally, if any mod thinks this is the wrong section or has no reason to be here, just let me know.
tobi01001 said:
The script showed me, that even with all levels being reported, the value I set for the lowest level was never applied. (Maybe someone can confirm).
Click to expand...
Click to collapse
I can confirm to have seen this behaviour. I could see in the log that the lower level in "config_autoBrightnessLcdBacklightValues" was being applied when no ambient light, but I couldn't see any change in my screen light...
Thanks a lot for your effort. I'm sure anderl78 will take note and adapt his modified frameworks with this 10er value.
If I'm right, currently snq- kernel is up to date with this info (from 110918-lsmod1). I don't really know about bananacakes and others.
bye!
Since this thread deals with brightness level, I'm hoping someone can look at this and shed some light...
Re-posting my post from the orher thread...
Delete it if it's not cool to post this here...
Nice guide...
Did you find a way to adjust Camera's backlight..?
Every time the Camera app launches, the screen's backlight always turn up the brightness substantially...
If this can be adjusted, then it will be a perfect complimentary...
Click to expand...
Click to collapse
Some follow-up...
I didn't find anything in the framework...
But decompiling HTCCamera.apk, and looking at smali's did show something...
It seems that it call's setMaxBrightness (), in almost all activity...
I always felt it increases the backlight, but quite surprised that it's set at MAX...
So...
Anyone experienced in smali's..?
Which line is save to delete/edit to prevent this backlight maxing out..?
Thanx in advance...
Click to expand...
Click to collapse
i just see 1 problem with your framework-res.apk values.
light sensor value can only reach to 10240 so adding 10241 value is useless.
adc reads these values :
- 10
- 40
- 90
- 160
- 225
- 320
- 640
- 1280
- 2600
- 10280
and in framework we have :
- 11
- 41
- 91
- 161
- 226
- 321
- 641
- 1281
- 2601
so all 10 levels (0 to 9) are already presents as you can see :
(level 0 : lower than 11 so 10 indeed)
- 11
(level 1 : from 11 to 40)
- 41
(level 2 : from 41 to 90)
- 91
(level 3 : from 91 to 160 )
- 161
(level 4 : from 161 to 225)
- 226
(level 5 : from 226 to 320 )
- 321
(level 6 : from 321 to 640)
- 641
(level 7 : from 641 to 1280)
- 1281
(level 8 : from 1281 to 2600 )
- 2601
(level 9 : from 2601 to 10280)
so IMOH it's useless to add the last level.
if i didn't understand something please can you explain to us
That's exactly what I thought it should work. Unfortunately the lowest value was never set. So I just added the (rather useless) last value. Now all works like it should and like you described.
So even if it seems useless (and I would agree to that), this is the way it worked out for me...
Sent from my HTC Desire using xda premium
strange, it worked good for me without any other changes than "backlightvalues" in arrays.xml.
probably it depends on rom you use.
NeoEpsilon said:
Since this thread deals with brightness level, I'm hoping someone can look at this and shed some light...
Re-posting my post from the orher thread...
Delete it if it's not cool to post this here...
Click to expand...
Click to collapse
Here's autobrightness fix for HTCCamera
Change
HTCCamera.smali, HTCSnapbooth.smali
Code:
const-string v2, "com.android.settings.request.BRIGHTNESS_[COLOR="Red"]MAX[/COLOR]"
Into
Code:
const-string v2, "com.android.settings.request.BRIGHTNESS_[COLOR="red"]NORMAL[/COLOR]"
Now when you start camera app screen wont go to MAX but standard android autobrightness will work for camera app.
Here's Camera apk for michaelm_007 Sense2.1+3ROM
View attachment HTCCamera.apk
Or give me you apk so ill mod it for you so you can test.
tobi01001 said:
So, if you have a kernel with the changes implemented you can easily verify with
Code:
cat /sys/devices/i2c-0/0-0066/ls_adc
(and proper light conditions) all sensor levels from 0 to 9 are reported. You can even use a sensor app to verify that all light levels are reported (in lux within those apps).
Click to expand...
Click to collapse
cat /sys/devices/i2c-0/0-0066/ls_adc
ADC[0x0EC] => level 4
Presumably this means it's not working in tristans kernel?
Bit confused by => level 4
ivicask said:
Here's autobrightness fix for HTCCamera
Change
HTCCamera.smali, HTCSnapbooth.smali
Code:
const-string v2, "com.android.settings.request.BRIGHTNESS_[COLOR="Red"]MAX[/COLOR]"
Into
Code:
const-string v2, "com.android.settings.request.BRIGHTNESS_[COLOR="red"]NORMAL[/COLOR]"
Now when you start camera app screen wont go to MAX but standard android autobrightness will work for camera app.
Here's Camera apk for michaelm_007 Sense2.1+3ROM
View attachment 731562
Or give me you apk so ill mod it for you so you can test.
Click to expand...
Click to collapse
Thanx...
I've already edited mine exactly like that...
Haven't tried it yet though...
Glad to see the same solution...
Currently looking for a way to enable auto-brightness when launching HTCCamera...
Just in case the phone is set to manual brightness...
t-minik said:
strange, it worked good for me without any other changes than "backlightvalues" in arrays.xml.
probably it depends on rom you use.
Click to expand...
Click to collapse
Are you sure that you've seen all levels and the according screen brightness values? Level 0 and level 1 were always the same for me...
Sent from my HTC Desire using xda premium
NeoEpsilon said:
Thanx...
I've already edited mine exactly like that...
Haven't tried it yet though...
Glad to see the same solution...
Currently looking for a way to enable auto-brightness when launching HTCCamera...
Just in case the phone is set to manual brightness...
Click to expand...
Click to collapse
With the above fix camera is on auto-brightness all the time, theres no manual setting...
ziggy1001 said:
cat /sys/devices/i2c-0/0-0066/ls_adc
ADC[0x0EC] => level 4
Presumably this means it's not working in tristans kernel?
Bit confused by => level 4
Click to expand...
Click to collapse
How can you come to such conclusion? The level you see will depend on the light that is on the sensor... That's the whole meaning about it..
And make sure the screen is one. Otherwise what you get from the sensor is everything but the light level.
Sent from my HTC Desire using xda premium
ivicask said:
With the above fix camera is on auto-brightness all the time, theres no manual setting...
Click to expand...
Click to collapse
Seriously..?
I'm under impression that if my phone uses manual brightness, then the above fix will also use the same manual setting...
So whatever setting my brightness is, it HTCCamera will always use auto..?
Will try this later...
---------- Post added at 09:04 PM ---------- Previous post was at 09:00 PM ----------
tobi01001 said:
How can you come to such conclusion? The level you see will depend on the light that is on the sensor... That's the whole meaning about it..
And make sure the screen is one. Otherwise what you get from the sensor is everything but the light level.
Sent from my HTC Desire using xda premium
Click to expand...
Click to collapse
@tobi01001
tobi...
In a normally lighted bedroom, what level is your Desire set to..?
My Desire never set the level above 2...
To push it to level 4, I need to blast it with a flashlight...
Just curious about the sensitivity...
NeoEpsilon said:
Seriously..?
I'm under impression that if my phone uses manual brightness, then the above fix will also use the same manual setting...
So whatever setting my brightness is, it HTCCamera will always use auto..?
Will try this later...
Click to expand...
Click to collapse
If you turn off automatic brightness in your phone and put it manualy to the max Camera will be also at max.
If you put it on middle..camera will be middle
If you put it to Auto, camera will be auto
thats it
tobi01001 said:
Are you sure that you've seen all levels and the according screen brightness values? Level 0 and level 1 were always the same for me...
Sent from my HTC Desire using xda premium
Click to expand...
Click to collapse
i'm sure
as i set level 0 is 41 and level 1 is 55 all others are working.
i just saw a thing that can help.
for me when screen is off, adc level is set to 5.
so when you lit up screen adc can read a value between 0 and 9 and screen brightness change to desired value.
but when adc level go up brightness setting used seems to be those :
<integer-array name="config_autoBrightnessLcdBacklightValuesUp">
when adc level go down it's the same with :
<integer-array name="config_autoBrightnessLcdBacklightValuesDown">
if values for a same level are higher than in <integer-array name="config_autoBrightnessLcdBacklightValues">, when adc level returns to 0 backlight will never go down to the normal value but go to the "config_autoBrightnessLcdBacklightValuesDown" for exemple.
so extreme personally I set the same extreme values for the 3 lists.
EDIT // do you think adc level 0 can be set to 20 instead of 10 for a slightly less sensibility ?
Here are my values, and so far working perfectly, minimum and maximum values and everything... (gingercakes-0.7c) .
Code:
<integer-array name="config_autoBrightnessLevels">
<item>11</item>
<item>41</item>
<item>91</item>
<item>161</item>
<item>226</item>
<item>321</item>
<item>641</item>
<item>1281</item>
<item>2601</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>33</item>
<item>51</item>
<item>81</item>
<item>115</item>
<item>133</item>
<item>153</item>
<item>186</item>
<item>208</item>
<item>230</item>
<item>254</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValuesUp">
<item>31</item>
<item>51</item>
<item>81</item>
<item>115</item>
<item>133</item>
<item>153</item>
<item>186</item>
<item>209</item>
<item>231</item>
<item>255</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValuesDown">
<item>32</item>
<item>52</item>
<item>82</item>
<item>115</item>
<item>133</item>
<item>153</item>
<item>186</item>
<item>207</item>
<item>229</item>
<item>253</item>
What's your opinion?
t-minik said:
i'm sure
as i set level 0 is 41 and level 1 is 55 all others are working.
i just saw a thing that can help.
for me when screen is off, adc level is set to 5.
so when you lit up screen adc can read a value between 0 and 9 and screen brightness change to desired value.
but when adc level go up brightness setting used seems to be those :
<integer-array name="config_autoBrightnessLcdBacklightValuesUp">
when adc level go down it's the same with :
<integer-array name="config_autoBrightnessLcdBacklightValuesDown">
if values for a same level are higher than in <integer-array name="config_autoBrightnessLcdBacklightValues">, when adc level returns to 0 backlight will never go down to the normal value but go to the "config_autoBrightnessLcdBacklightValuesDown" for exemple.
so extreme personally I set the same extreme values for the 3 lists.
Click to expand...
Click to collapse
Well, I've never seen the values in up and down. I set them different by purpose. But at least for me, it turns out they are never set.
EDIT // do you think adc level 0 can be set to 20 instead of 10 for a slightly less sensibility ?
Click to expand...
Click to collapse
Short answer: maybe, but with little use.
Well, at the moment it is possible to adjust the table in the bravo board file. Those represent somehow the raw values and are then set as light levels.
I do not know how to change the 10 to a 20. But that would make not that much sense since the driver will set the same levels. Android (the sensor manager) would only see a 20 instead of a 10 - but the environmental light conditions didn't change.
However, it would be possible to increase the value, which represents level 0 - so the span for level 0 would be a bit wider. Actually, I already proposed this with using 4 instead of 1...
Further:
I just found, that if you turn on the screen in absolutely brightness then the screen brighness is still set to the value of level 1 (40 in my framework). In this case it does somehow not go down to the value of level 0. There is a change to a brighter value needed first.
I will investigate a bit more and play with different settings as soon as I have time to do so.
NeoEpsilon said:
Seriously..?
I'm under impression that if my phone uses manual brightness, then the above fix will also use the same manual setting...
So whatever setting my brightness is, it HTCCamera will always use auto..?
Will try this later...
---------- Post added at 09:04 PM ---------- Previous post was at 09:00 PM ----------
@tobi01001
tobi...
In a normally lighted bedroom, what level is your Desire set to..?
My Desire never set the level above 2...
To push it to level 4, I need to blast it with a flashlight...
Just curious about the sensitivity...
Click to expand...
Click to collapse
In my bedrom is totally darkness... at least when I intend to sleep. So level 0. With common indoor light it is usually level 1 to 3. Level 4 to 5 in some cloudy sky and or in the shadow. The upper levels need more or less sunlight.
Do you have a case or something covering the lightsensor maybe?
ivicask said:
Here are my values, and so far working perfectly, minimum and maximum values and everything... (gingercakes-0.7c) .
Code:
<integer-array name="config_autoBrightnessLevels">
<item>11</item>
<item>41</item>
<item>91</item>
<item>161</item>
<item>226</item>
<item>321</item>
<item>641</item>
<item>1281</item>
<item>2601</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>33</item>
<item>51</item>
<item>81</item>
<item>115</item>
<item>133</item>
<item>153</item>
<item>186</item>
<item>208</item>
<item>230</item>
<item>254</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValuesUp">
<item>31</item>
<item>51</item>
<item>81</item>
<item>115</item>
<item>133</item>
<item>153</item>
<item>186</item>
<item>209</item>
<item>231</item>
<item>255</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValuesDown">
<item>32</item>
<item>52</item>
<item>82</item>
<item>115</item>
<item>133</item>
<item>153</item>
<item>186</item>
<item>207</item>
<item>229</item>
<item>253</item>
What's your opinion?
Click to expand...
Click to collapse
So you are using 9 values (stock ones of course) in
Code:
<integer-array name="config_autoBrightnessLevels">
as well.
Could you maybe confirm that you see Level 0 and the corresponding screen brightness (33 in your case)... If so, I may have been totally wrong in my assumptions about the framework.
I do not understand the slight differences in the up/down lists and my personal feeling is that those have no impact on what you actually see.
I have them set totally different and as already mentioned, I never saw the screen brightness set to any of them.
this is how I set my values in the framework, but thats personal feeling anyway:
Code:
<integer-array name="config_autoBrightnessLevels">
<item>21</item>
<item>41</item>
<item>91</item>
<item>161</item>
<item>226</item>
<item>321</item>
<item>641</item>
<item>1281</item>
<item>2601</item>
<item>10241</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>21</item>
<item>40</item>
<item>50</item>
<item>70</item>
<item>80</item>
<item>90</item>
<item>120</item>
<item>160</item>
<item>200</item>
<item>255</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValuesUp">
<item>21</item>
<item>28</item>
<item>45</item>
<item>60</item>
<item>75</item>
<item>85</item>
<item>105</item>
<item>140</item>
<item>180</item>
<item>228</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValuesDown">
<item>28</item>
<item>45</item>
<item>60</item>
<item>75</item>
<item>85</item>
<item>105</item>
<item>140</item>
<item>180</item>
<item>228</item>
<item>255</item>
</integer-array>
I'm pretty sure it works perfectly on 10 levels without adding any level in framework.
values, valuesip and valuesdown are very close and it should work perfectly.
for me, values, valuesip and valuesdown are the same and it's perfect on BravoS V7

Rounding down a float two decimal places

I have an equation that gives a decimal value. However I would like the final value to be rounded down only showing the first two decimal places. What would be the best function to achieve this.
Code:
String number,percentage;
Float calc;
percentage = ABV.getText().toString();
number = quantity.getText().toString();
calc = Float.parseFloat(number)* drinkType * Float.parseFloat(percentage)/1000;
units.setText(calc.toString());
MattD00 said:
I have an equation that gives a decimal value. However I would like the final value to be rounded down only showing the first two decimal places. What would be the best function to achieve this.
Code:
String number,percentage;
Float calc;
percentage = ABV.getText().toString();
number = quantity.getText().toString();
calc = Float.parseFloat(number)* drinkType * Float.parseFloat(percentage)/1000;
units.setText(calc.toString());
Click to expand...
Click to collapse
This can be achieved in several ways..
--- First thing that comes to mind:
calc = calc * 100;
calc = Math.round(calc);
calc = calc / 100;
It should be the simplest and cpu-saving solution.
--- A different way, format your output string:
String output = String.format("%.01f", calc);
units.setText(output);
This is good if you need to leave untouched your float value (but note, 2nd digit may be rounded)
Btw, you should post in the proper section
MattD00 said:
I have an equation that gives a decimal value. However I would like the final value to be rounded down only showing the first two decimal places. What would be the best function to achieve this.
Code:
String number,percentage;
Float calc;
percentage = ABV.getText().toString();
number = quantity.getText().toString();
calc = Float.parseFloat(number)* drinkType * Float.parseFloat(percentage)/1000;
units.setText(calc.toString());
Click to expand...
Click to collapse
Where should I write this code? I am a Newbie. Please bear. Thanks in advance.

Categories

Resources