Presenting Camera, Now with Less Low Battery Dialogs - T-Mobile Sidekick 4G

What it says on the tin.
Info:
Stock deodexed (Kg2) Camera, now with no Low Battery dialog. No longer need to run a second camera app when you are on low battery.
Pro: Obvious Statement is Obvious.
Con: You will have no way knowing what the battery strength is.
Modded for your pleasure.
Install:
Same install process as any regular System App (my preferred adb based method below, you can use root explorer or whatever you are used to). Always Backup originals if you're the sane type.
Code:
adb push /path/to/file/CameraMod.apk /data/local/tmp/CameraMod.apk
adb shell
#su
$ mount -o remount,rw /dev/block/stl9 /system
$ cp /system/app/Camera.apk /system/app/Camera.apk.bu
$ mv /data/local/tmp/CameraMod.apk /system/app/Camera.apk
$ chmod 755 /system/app/Camera.apk
At that point, I say give it a minute or two for the phone to find and scan the apk, or you might get a crash+reboot. Then just open up the camera like normal. Only way to be sure is to wait till you get the system low battery warning (I think it's at 12% that it does it) and if you can use the camera, you can thank me with gold and fine women.
Files:
Screenshot and apk added below.
Future:
I would actually prefer modding the file in a less hacky way. Like changing the dialog that should show up into a dismissible dialog instead. Sure, it might pop up on every battery status update, but its better than nothing.
The other, cleaner option might be to just make it toast "Low Battery" instead.
Thoughts:
Works well. Oddly, had to resign the apk, and it is now 0.3mb smaller than before. Did not zipalign. Not sure if needed. Bit hacky, not sure how the app is handling the basically unexpected method return. Maybe like a code switch that has a missing break statement? No crashes, and logcat shows no exceptions being thrown. Hackyslashy. Oh well. Got what I wanted.
Nice thing about the Camera.apk is that it will exit out after a few minutes, probably connected with your chosen screen timeout. It's not a bug, it's a feature! (No, really, it's a bug in the camera, logcat shows errors when it happens. Samsung ineptitude strikes again.)

I think I found a way to get a dismissable dialog.
in AbstractCameraActivity.smali, in method handleLowBattery(), I'm thinking line 929 should be set to 0x1 (true) instead of 0x0 (false), that should make the low bat popup dismissable?
P.S. Good to know I had to resign it, that was weird. But it works again after resigning, however my battery is too high to test it right now haha.
I'm also looking into enabling the zoom feature, as it looks like everything is there, it just doesn't have the setting to request it.

That was the first thing i tried. No dice. Probably needsa layout change to add a cancel button and code to implement it. I think i left the variable set to 0x1 anyway.

Related

[Q] Terminal Command for Persistent Brightness Setting - Rooted Android Milestone

Hi. This is a question for a rooted Droid /Milestone, but should be applicable to other models as well. I'd like to know if there's a command or any other functionality I can use to "lock" the brightness setting so that other applications can't change it.
I know it's possible, because there's an app in the Market called AdjBrightness (looks like the developer posts here, as well) that is capable of locking it, but I don't quite need all the functionality it provides, and I can't work out how to reverse its home row backlight disabling, which means I ALSO have to run LEDs Hack... I'd like to just write something simple for my specific settings to replace both.
I'm trying to create a very short script I can run with Tasker and set to a widget that will accomplish 3 things: Disable the home row backlights, set the brightness to 2/255, and then "lock" that setting so that other apps can't affect it. I want to run Aldiko for reading in pretty much total darkness, and this is the ideal setting for me.
So far, I can get it set properly using the following:
su
echo 2 > /sys/class/leds/lcd-backlight/brightness
echo 0 > /sys/class/leds/button-backlight/brightness
and with Tasker I can run that as a script and set it to a widget, with another widget to complement it that runs:
su
echo 100 > /sys/class/leds/lcd-backlight/brightness
echo 1 > /sys/class/leds/button-backlight/brightness
which reverses the process and sets everything back to normal.
What I need is to figure out how to lock in that "2" brightness setting, which at this time persists only until some other app affects the brightness. When I run Aldkio, its built-in brightness control feature overrides my setting and lights the thing back up too bright.
So, can this be done with a script? I imagine a chown command that temporarily takes ownership of that function could work, but I'm not smart enough to know how, and I've exhausted Google and the forum search. As I mentioned, this thing would always be run with a complimentary script that could later reverse the chown and give it back to whatever process it ought to belong to... I KNOW it's possible because there's at least one app that does it perfectly; the AdjBrightness setting change persists after I open Aldiko, indeed it persists basically forever; you've got to kill the app or reboot to be able to adjust the brightness with any other means.
Can anyone point me in the right direction?
Bump? Still trying to figure this out.
Bump
Still wondering if there's a way to do this.
+ 1 - if you find a way to lock it via command line, do post back, as will i
i am currently using adjbrightness it to control my button backlights on my dell streak
its great as it locks it on for that session. but after reboot have to manually renable
so i have written an execute entry in tasker to control all or just some of the leds for various notifications
but would love a command line way to lock these as adjbrightness does, i cant find out how its doing that!!!
jdb1981 said:
Hi. This is a question for a rooted Droid /Milestone, but should be applicable to other models as well. I'd like to know if there's a command or any other functionality I can use to "lock" the brightness setting so that other applications can't change it.
I know it's possible, because there's an app in the Market called AdjBrightness (looks like the developer posts here, as well) that is capable of locking it, but I don't quite need all the functionality it provides, and I can't work out how to reverse its home row backlight disabling, which means I ALSO have to run LEDs Hack... I'd like to just write something simple for my specific settings to replace both.
I'm trying to create a very short script I can run with Tasker and set to a widget that will accomplish 3 things: Disable the home row backlights, set the brightness to 2/255, and then "lock" that setting so that other apps can't affect it. I want to run Aldiko for reading in pretty much total darkness, and this is the ideal setting for me.
So far, I can get it set properly using the following:
su
echo 2 > /sys/class/leds/lcd-backlight/brightness
echo 0 > /sys/class/leds/button-backlight/brightness
and with Tasker I can run that as a script and set it to a widget, with another widget to complement it that runs:
su
echo 100 > /sys/class/leds/lcd-backlight/brightness
echo 1 > /sys/class/leds/button-backlight/brightness
which reverses the process and sets everything back to normal.
What I need is to figure out how to lock in that "2" brightness setting, which at this time persists only until some other app affects the brightness. When I run Aldkio, its built-in brightness control feature overrides my setting and lights the thing back up too bright.
So, can this be done with a script? I imagine a chown command that temporarily takes ownership of that function could work, but I'm not smart enough to know how, and I've exhausted Google and the forum search. As I mentioned, this thing would always be run with a complimentary script that could later reverse the chown and give it back to whatever process it ought to belong to... I KNOW it's possible because there's at least one app that does it perfectly; the AdjBrightness setting change persists after I open Aldiko, indeed it persists basically forever; you've got to kill the app or reboot to be able to adjust the brightness with any other means.
Can anyone point me in the right direction?
Click to expand...
Click to collapse
In my device adjbrightness app lock the brightness just by changing the permission of "/sys/.. /brightness" file to 444. So even system can't change the brightness value if requested by any other apps. To unlock the brightness permission of "/sys... /brightness" is restored to previous state, 644.
So in terminal the commands can be "for changing brightness to 2 and lock it"
su
echo 2>/sys/class/leds/lcd-backlight/brightness
chmod 444 /sys/class/leds/lcd-backlight/brightness
"for unlock and restore "
su
chmod 644 /sys/class/leds/lcd-backlight/brightness
echo 100> /sys/class/leds/lcd-backlight/brightness
Same goes for button backlight brightness file
But I found it "not suitable" for my device even with adjbrightness. If I lock brightness using adjbrightness after my screen turns off normally or by using power button , I can't turn it on using power button, so I have to open the battery and reboot the device. Same thing happens if I do it using "commands" or script. So "something" should be done so that the permission of ".. /brightness" file is set to 644 before the screen turns off normally or by other means.And after the screen is on the file permission will be 444 again. I think it may be done using tasker but still don't know how.
Hope someone will help.
Thanks.
Hi
I am not sure why, but I can't turn off screen, with "echo 0 >" into brightness.
It seems that there is some minimum brightness somewhere which I need to configure ?
I really struggle with it.
Any idea how to do that ?
Thanks,
Ranchu

[MOD] Tasker Watchdog & Data Control

Have you ever tried having your phone lay on a table for some time and when you come back to pick it up, it had almost burned through the table because of the battery heat do to an app running the CPU on a constant 100%?
Or have you tried waking up two hours to late for work, because you alarm did not go off do to the phones battery running dry during the night?
Bad applications or problems with some back-end processes is a problem for most people. To get some help with this problem, I have been running the Watchdog app for the last 3 years. It is a great application that will alert you whenever an app or a process is running wild in the background. However there is one issue with this app. It only alerts you when there is a problem. This does not help much if you are to far away from the phone, if your phone is in silent mode or if you are sleeping.
I wrote the developer of the app to see if there was any plans for making a tasker plug-in so that profiles can be made to handle this. I have yet to get an answer. In the mean time, I have made a complete watchdog profile for tasker that does what the watchdog app does, only this profile will auto terminate any wild processes if the screen is turned off. If the screen is on, it will to what the watchdog app does and alert you of the problem. It could be that you was playing a game or running a benchmark, so auto terminate while the screen is on, would not be a good idea.
The profile however, will drain more battery than the watchdog app does. Because of this I have set the check interval for 15 minutes instead of the 5 minutes I used on the app. This reduces the drain to about the same amount.
And to save even more power, I have included a Data control profile that will turn off data/wifi/sync when the screen is off, as long as you are not connected to a power source or if you are downloading, uploading or streaming. In this case the profile will wait until this state changes before turning off anything. And while off, tasker will alow sync (email and such) once every 15 minutes.
Both profiles is included in the attached download below.
Important!
The watchdog profile will need a proper busybox installed with proper symlinks for sed, grep and awk. It will also need a toolbox that supports top and ps with arguments.
You can run the update script from the Busybox Installer thread to make sure that your phone will work with this profile.
Changelog (2012-11-18)
Reduced the time from where the screen turns off, to the time Data/Sync is disabled
Data/Sync will now turn back on when the screen is unlocked rather than turned on. No need to waste power if you just want to check the time or notifications (Which can be done from lock screen in Android 4.x)
Fixed the 15 minutes data check when the screen is off. It only executed once after the screen was turned off
_______________________
Wow! Your watchdog implementation looks great! Will adopt it on my phone over the weekend.
Now I have only one battery-drain-controlling dream left - being able to find out the apps holding the wakelock for too long to kill them automatically. The reason for this is that sometimes I find battery drain to go from usual 1% per hour to 10% per hour just because some badly written app has not released the wakelock.
Alte.78 said:
Wow! Your watchdog implementation looks great! Will adopt it on my phone over the weekend.
Now I have only one battery-drain-controlling dream left - being able to find out the apps holding the wakelock for too long to kill them automatically. The reason for this is that sometimes I find battery drain to go from usual 1% per hour to 10% per hour just because some badly written app has not released the wakelock.
Click to expand...
Click to collapse
Are you talking about BetterBatteryStats? I know that it tells you exactly how long since a point in time (which can be manually customized) that certain programs/tasks hold wakelocks.
But not sure about any kind of specific stratification that displays only programs that hold the lock too long to kill them automatically (assuming that's what you are wanting?).
And OP, these sound great - I'm importing them as we speak :highfive:
dk_zero-cool said:
Important!
The watchdog profile will need a proper busybox installed with proper symlinks for sed, grep and awk. It will also need a toolbox that supports top and ps with arguments.
_______________________
Click to expand...
Click to collapse
I got all excited when reading about this until I read the Important section. After watchdog everything started getting confusing . I know I read somewhere about busybox but the other terms are all new to me...could someone explain it with a little more details on what I have to get/set up in order for this to work??
2am said:
I got all excited when reading about this until I read the Important section. After watchdog everything started getting confusing . I know I read somewhere about busybox but the other terms are all new to me...could someone explain it with a little more details on what I have to get/set up in order for this to work??
Click to expand...
Click to collapse
The profile is using some linux commands to get a list of all current processes and their CPU usage. These commands needs to be available in order for the profile to work.
If you are using a custom ROM, then you are most likely to have all what is needed. Especially if you are using a more current custom ROM.
In order to test this, download a terminal app or enter an ADB shell (Hope you know what this is) and see if the command line
Code:
top -n 1 | sed -e 1,7d | grep -e '[0-9]\+%' | awk '{print $3}'
returns anything. If it does (Except errors), then you will have all that is needed.
Alternatively you could check my Better Busybox Integration thread which will make sure that your phone is setup to work with this.
dk_zero-cool said:
The profile is using some linux commands to get a list of all current processes and their CPU usage. These commands needs to be available in order for the profile to work.
If you are using a custom ROM, then you are most likely to have all what is needed. Especially if you are using a more current custom ROM.
In order to test this, download a terminal app or enter an ADB shell (Hope you know what this is) and see if the command line
Code:
top -n 1 | sed -e 1,7d | grep -e '[0-9]\+%' | awk '{print $3}'
returns anything. If it does (Except errors), then you will have all that is needed.
Alternatively you could check my Better Busybox Integration thread which will make sure that your phone is setup to work with this.
Click to expand...
Click to collapse
well I entered that command and got
invalid argument "-n". and then a bunch of other lines after that...and I checked your other thread and there's even more code language ...ugh, I think this is one of those threads that I need to leave alone because it's too much for me to handle...sucks too cause your set up sounds really awesome...thanx for trying to help me though
2am said:
well I entered that command and got
invalid argument "-n". and then a bunch of other lines after that...and I checked your other thread and there's even more code language ...ugh, I think this is one of those threads that I need to leave alone because it's too much for me to handle...sucks too cause your set up sounds really awesome...thanx for trying to help me though
Click to expand...
Click to collapse
I will make a more simple command fix for you tomorrow that will make your phone work with this without having you enter any code.
dk_zero-cool said:
I will make a more simple command fix for you tomorrow that will make your phone work with this without having you enter any code.
Click to expand...
Click to collapse
ah thank you soo much!!!
2am said:
ah thank you soo much!!!
Click to expand...
Click to collapse
I have updated the Busybox Installer script to make sure that it will work on newer devices other than MTD, and I have added a custom toolbox binary that will contain the proper options for these profiles.
Just check the first post at the buttom in the Important section. Fallow the link, download the installer and run it in your recovery. After that you can import the profiles from this thread into your Tasker application.

[Q] Making permission settings "stick"

I created a simple Python script that brings up a menu to select different brightness levels by way of opening up the /sys/class/leds/backlight/brightness file and writes whatever value that you want to set the level at. An example would be 255 would be the max brightness and of course 1 would be almost no light. I like using this script because it allows me to set the brightness way lower than the stock lowest without use of an app like Screen Filter. There's a couple other scripts I wrote for toggling the keyboard and soft button leds too and I have the same issue with them.
This script will only work if I beforehand goto that specific file in Root Explorer and enable the read and write permissions for Others. Once I reboot the device though, those are always reset to disabled. If I run the script without enabling these of course I'll get a permission denied error.
How would I go about making those settings stick? I'm thinking I might have to incorporate some Java somewhere in the Python to do this but I'm not sure. I haven't learned Java yet
Can anyone give me some advice or some kind of direction? I will greatly appreciate any help and will thank you with hitting the Thanks button
you can write a start-up script that will chmod the file/s when the device is turned on.
chevyowner said:
you can write a start-up script that will chmod the file/s when the device is turned on.
Click to expand...
Click to collapse
Thanks so much for your advice....now I can kill two birds with one stone....not only will I achieve my objective but also learn some about those other scripts you speak of

[root] Any (notification) LED function "programming"

Recently I have been digging all about my LED in Moto X Force (for those who do not know, Motorola did install a LED on the front panel, but didn't enable it for anything usable - some people state that it's on when battery is very low, and then phone does not start, but I have never seen it). This very strange decision of Motorola encouraged me to look how to use it anyways. I have found a few apps that supposedly were in control of it, but none seemed to be nor well written nor even working. So I decided not to use those. But one app did occur to be usable. And only option I liked there was LED blinking every time any IO operation on the SD Card occured. Yet, the app is in two versions. One (free) disallows to "start at boot" so everytime i reboot the phone, I have to manually run it to "blink again".
As I'm a dev, I did little digging and found out that it's really simple to make such functionality by just one command as root (it's basically telling the linux kernel when to trigger the LED - thanks kernel.org people ):
echo mmc0 > /sys/class/leds/charging/trigger
Just one command.
As this applies to ANY device, it's for everybody to see.
Moreover, if you type:
cat /sys/class/leds/charging/trigger
You will see the response like this:
none fg_adc-online MOTOSH-ANTCAP-PSY-DRIVER-online usb-online flash0_trigger torch0_trigger usb-parallel-online wireless-online bms-online battery-charging-or-full battery-charging battery-full battery-charging-blink-full-solid dc-online rfkill0 mmc0 [mmc1] backlight default-on bcl-online rfkill13
You can guess that for example:
- battery-full will light your LED when battery is full
- wireless-online will light when WiFi is on (and possibly have the internet connection - just guessing, test by yourself, it's not the point of this post)
- and so on
The one in square brackets is "active" trigger (in this case mmc1 - external sd card)
If you type:
ls -1 /sys/class/leds/
(or even: ls -1r /sys/class/leds/ for more details)
You will see all the LEDs you can use.
When you use /sys/class/leds/*/trigger the kernel will do all the job for you. If you want to do the job yourself from within your app, you may use /sys/class/leds/*/brightness
To be honest, I really regret I have rooted my phone so late (after warranty) .
Have fun guys
PS. If you are not a dev, you still can use above in tools like Automate or Tasker.
PS2. WARNING: for Moto X Force fiddling with lcd-backlight "LED" can cause reboots (if done at boot, bootloops). Only two "trigger happy" working LEDs are charging and torch-light0 for my phone. Still, lcd-backlight possibly can be done "manually" (brightness)
Hey, this is already years old. But how to undo the changes?

auto-enabling force 90hz refresh rate

I ran diffchecker on the adb system settings output with force 90hz enabled and disabled, and found the setting that switches when you activate "force 90Hz" in the developer settings: "min_refresh_rate=90.0". If you're rooted you can set that with Tasker based on whatever conditions you want, using the shell command function. The code to activate it is "settings put global min_refresh_rate 90.0", and the code to deactivate is "settings delete global min_refresh_rate" (both need "use root" ticked). I've been testing having it triggered on my phone when I'm connected to my home wifi and ambient light is < 15. The home wifi condition is so I don't run into big battery drains when I'm out late at night, and I'm using ambient light rather than screen brightness because as someone pointed out in a Reddit thread, Smooth Display will still run under 75% screen brightness under certain ambient lighting conditions. So far, battery is definitely taking a hit, but it's not a big deal when I'm home and chargers are in easy reach.
tardis_42 said:
I ran diffchecker on the adb system settings output with force 90hz enabled and disabled, and found the setting that switches when you activate "force 90Hz" in the developer settings: "min_refresh_rate=90.0". If you're rooted you can set that with Tasker based on whatever conditions you want, using the shell command function. The code to activate it is "settings put global min_refresh_rate 90.0", and the code to deactivate is "settings delete global min_refresh_rate" (both need "use root" ticked). I've been testing having it triggered on my phone when I'm connected to my home wifi and ambient light is < 15. The home wifi condition is so I don't run into big battery drains when I'm out late at night, and I'm using ambient light rather than screen brightness because as someone pointed out in a Reddit thread, Smooth Display will still run under 75% screen brightness under certain ambient lighting conditions. So far, battery is definitely taking a hit, but it's not a big deal when I'm home and chargers are in easy reach.
Click to expand...
Click to collapse
This is handy, thank you! Quick question though, how do you run an adb system settings output to see the difference when you switch other settings?
TheBobMiller said:
This is handy, thank you! Quick question though, how do you run an adb system settings output to see the difference when you switch other settings?
Click to expand...
Click to collapse
Assuming you have adb running and connecting to your phone fine already, it's pretty easy. Enter adb shell, then run three commands: "settings list global", "settings list system", and "settings list secure". Open up diffchecker.com and copy the results from the shell into one side. Change whatever setting you're interested in on your phone, then run these commands again and copy the output into the other side of the diffchecker window. It'll show you anywhere the output has changed, and that should be your setting - although there might be a couple other differences flagged, eg I think system uptime is in there somewhere.
tardis_42 said:
Assuming you have adb running and connecting to your phone fine already, it's pretty easy. Enter adb shell, then run three commands: "settings list global", "settings list system", and "settings list secure". Open up diffchecker.com and copy the results from the shell into one side. Change whatever setting you're interested in on your phone, then run these commands again and copy the output into the other side of the diffchecker window. It'll show you anywhere the output has changed, and that should be your setting - although there might be a couple other differences flagged, eg I think system uptime is in there somewhere.
Click to expand...
Click to collapse
Thank you so much! I'm not sure how I never knew this but being an avid Tasker user, I should've known this by now. This is gonna really come in so useful for me! Thank you!
How did you find this script <min_refresh_rate> ? Do you max to lock the maximum fps would be <max_refresh_rate>?
Small change to the command; in Android 11 beta 2.5, you have to use "settings put system min_refresh_rate 90.0". Changing the global flag does nothing to the frame rate anymore but changing the system value can force 90hz, even if you have smooth display turned off.
Trixter313 said:
Small change to the command; in Android 11 beta 2.5, you have to use "settings put system min_refresh_rate 90.0". Changing the global flag does nothing to the frame rate anymore but changing the system value can force 90hz, even if you have smooth display turned off.
Click to expand...
Click to collapse
Thank you!
I have been looking for this since beta 2 came out ?

Categories

Resources