[Q] Gallery hangs my Defy with CM7 - Android Software/Hacking General [Developers Only]

Hi,
when I open Gallery my Defy hangs.
Looking CPU usage (via ADB) I see that the gallery process takes almost all the CPU.
So I tried with different gallery substitutes (ie Photo Gallery). Same behavior.
So I think it's not gallery fault, but something lower. Maybe some problem with the SD card or the codec for some media file.
I checked the Sd but everything seems fine (anyway I got the problem only when media directory is 'indexed').
I saw some work by szipinf.
Is there a way to trace (maybe via ADB) what is doing the hanging process?
Killing the process doesn't solve the problem (I saw that some system process where closed after sometime).

Same problem but also nowhere on solution.
Send from my gio .
just trying to get a workable flexible phone

I found a workaround!!!!
Connect your device with adb (I use adb over wifi) and verify that your CPU is normal.
Code:
adb connect 192.168.0.3:8000
adb shell
top
The "top" command prints cpu usage every 5 seconds or so.
Scroll up and take a look at the first line.
You should read low values for User and System % (mine is "User 0%, System 5%")
Start gallery on your device, now you should see the cpu usage very high, say over 90% for user.
The first process listed is the one hogging your cpu.
Code:
User 93%, System 5%, IOW 0%, IRQ 0%
User 292 + Nice 0 + Sys 16 + Idle 0 + IOW 0 + IRQ 3 + SIRQ 0 = 311
PID CPU% S #THR VSS RSS PCY UID Name
5243 93% S 12 122920K 31264K fg app_209 com.littlefatfish.photo
The name of the process could vary (say com.cooliris.media).
Write down the PID (in this case 5243).
Hit CTRL+C, adb exit.
Launch adb and take a look at the files held by this process, issuing
Code:
adb shell
ls -l /proc/5243/fd
In the list you should see only one media file, the one that is blocking the gallery!!!
In my case it was
/mnt/sdcard/DoveConviene_icons/[email protected]png
Now you have to remove this file (if is important for you, you should copy elsewhere).
rm /mnt/sdcard/DoveConviene_icons/[email protected]
My gallery now it's back to normality!!!!! (at least till another png will block it)

Related

Presenting Camera, Now with Less Low Battery Dialogs

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.

Numerous unidentified Wakelocks (System_Server, etc)

Good day folks,
I've noticed System_Server and a few other items (below) severely draining the battery on my Galaxy S5 (3-4% per hour, when it's normally .75%/hour). In the past few weeks, the top Kernel Wakelocks and "Process" wake time (reported by BBS) have been:
1) Ipc00000016_Time_Daemon (which I can't find ANY info about, even when just Googling “time_daemon”)
2) WakelockManagerTimeout (likewise - no useful info, literally only SIX (6) results on Google).
3) System_Server (nothing concrete besides "try Wakelock Detector")
4) "IPC_###_Event0"/ “event0-###” every now and then, where ### is a Process ID. When I check the PID via Terminal (Cat /proc/*PID*/cmdline) the PID ends up belonging to "System_Server".
5) Numerous EventXX-### records, where XX is an event number and ### is a Process ID (usually the same PID tied to Event0 as noted above).
6) Numerous Kworkers
To make a Windows comparison, it looks like System_Server is "RunDLL32" or "SVCHost", wherein, numerous processes can "hook" into "System_Server" and are thus disguised behind that process name. Is there any way to dig deeper into "System_Server" to find the ACTUAL process/service that is causing all these wakelocks? I've also tried GSam Battery Monitor (thanks to - this post) and WLD (Wake Lock Detector) but the most granular any of them get is just "System_Server", even when I chase all the other Process IDs. As far as I can tell, this did not start as of newly installed software, but it could certainly be due to an update to an existing program. Whatever the cause, though, I need to find out, because a dead phone is useless
Thank you and Happy New Year

Prevent my phone from being awake while charging

Hello everyone,
I have used so many times the XDA forums to find some answers and I have found mostly all the answers I needed on other threads. But for once, I might have a more complicated problem to submit to the experts on this forum.
My use case is to create the lightest app that can do a job (namely taking a picture) on a regular interval of time and consume the least battery possible to be able to run for the most time without external power source (that is to say, the phone plugged in a wall outlet).
From what I experienced so far, I managed to have my application run for about 10 straight days doing the job every 10 minutes on a rooted Moto G5 phone. To achieve this, I force the phone to go in Doze mode at the beggining, by calling :
Code:
dumpsys deviceidle force-idle
Doing that, I schedule my jobs using the AlarmManager with the "setExactAndAllowWhileIdle" method thus respecting the super-9 minutes window my alarms should respect in order to be triggered correctly while the phone gets in deep sleep (following the official documentation).
For the moment, this is working as expected, because when I make a bugreport and import it into the Battery Historian tool, I can see that the phone is awake only when my job is running (for around 1 minute) and all the rest of the time, the device is sleeping and even better when I look in logcat, the phone suspends the CPU's for most of the time, which is great to consume less battery when not needed.
Now comes my problem, in order to make the app run for a longer period of time without having a wall outlet nearby, AND without touching the phone, I want to extend my battery life by using an external power bank plugged into my phone. My problem is that I cannot manage to make the phone not be awake while charging the phone. I guess that the phone is keeping some kind of wakelock when charging, so the USB connection keeps the phone awake and make my phone consume 3x more than when it goes in deep sleep, suspending the CPUs and is not awake. I tried to put some flags in a lot of files in order to trick the phone to think nothing is connected to the USB port but it didn't work. I tried those files:
Code:
"echo 0 > /sys/class/power_supply/battery/charging_enabled"
"echo 0 > /sys/devices/virtual/android_usb/android0/enable"
"echo 0 > /sys/class/power_supply/usb/present"
"echo 0 > /sys/class/power_supply/usb/ch_present"
"echo 0 > /sys/class/power_supply/usb/online"
"echo 0 > /sys/class/android_usb/android0/enable"
"echo 0 > /sys/class/android_usb/android0/remote_wakeup"
The only thing that stops the charge is when I put a 0 in the following file:
Code:
"echo 0 > /sys/class/power_supply/battery/charging_enabled"
It effectively stops the charge but the CPUs are still in an "awake" state, meaning there is probably still a wakelock being kept.
Do you have any idea how can I do, only using software, other than what I tried to stop the phone from being awake while having a charger plugged in (even if not charging) ?
Thanks a lot in advance for your answers.
Hi,
I am Aurelien, a colleague of Rafouuuuuu. Some precisions:
We use a "always-on" battery.
Phone awake = cpu is not stopped.
According to the historian report, the wakeup reason is "unknown".
These lines:
Code:
"echo 0 > /sys/class/power_supply/usb/present"
"echo 0 > /sys/class/power_supply/usb/ch_present"
"echo 0 > /sys/class/power_supply/usb/online"
"echo 0 > /sys/class/android_usb/android0/enable"
disable usb connection and charge but the cpu is always on.
We try to stop adbd service (if adbd get a wakelock if usb plugged)
We try to disable developer option.

Running phone without battery

Hi,
I have a question about runnig my old Samsung (XCover 3 - SM-G388F) without battery.
I have connected wires (usb cable connected to charger) dierctly to pins under cover and it works fine. The problem is that system counts the battery load percentage down and when it reaches 0% the phone is shutting down. When I boot it up system shows again 100% and counts down.
Is there a way to bypass this (phone is rooted if it helps)? I need it runnig 24/7.
ok, my mistake
I was trying to serach an answear before I posted and didn't find anything.
But when I posted this question I got "suggested" thread with answear
"Here's how to fix the battery percentage going down:
-You have to be rooted
-Use the terminal emulator app
-Type SU (switches from $ to #)
-Type this command to keep the phone at 100%
dumpsys battery set level 100
-Type this command to tell the phone that the charger is plugged in
dumpsys battery set usb 1
Everytime you reboot it reverts to stock settings. So I use a tasker script that runs the above commands on every boot."
I leave it here for other
Chears
wouldnt it be possible to keep the battery in and just prevent it from charging ?
I tried that with an app called "Battery Charge Limit" but from time to time the phone was shutting down.

Is there a way to get any kind of log activity from a rooted android?

I mean like when the power button was pressed or when it went to sleep or when an app was used any kind of log activity really
As long it's not turned off Android logs each activity, where it doesn't matter whether Android is rooted or not: you can view the log via performing a LOGCAT.
xXx yYy said:
As long it's not turned off Android logs each activity, where it doesn't matter whether Android is rooted or not: you can view the log via performing a LOGCAT.
Click to expand...
Click to collapse
When I open a logcat app it shows the logcat from the moment I opened the app forward. I want to see it a few hours backwards.
Then you need to enable "Developer Oprions" (search around these forums for a HowTo, it's been documented enough), increase the size of the log buffer and enable the trace(s) you need. Fair warning, it's not for the "just-being-curious/nosy" amateur kind of people, it's best to do your homework before you jump into the deep end.
Size of a logcat's ring-buffer ( main, system, crash ) is determined by the kernel, found in */drivers/staging/android/logger.c.
To temporarily set the size of all buffers you e.g. would run
Code:
adb logcat -G 16M
​
If you need to change the value by the Android shell in a way that survives a reboot, you can use the property persist.logd.size like this
Code:
adb shell "setprop persist.logd.size 16M"
what requires Android is got rooted

Categories

Resources