Don't want your android to sleep soon!!!


Hi friend,

I got another one interesting task in my project.  The task is by default the sleep time in Android ICS was 1 min, we want to set to 30 minutes as default.

If you check in Settings > display > sleep, it will display as 1 minute as default and there will not be any never option.

So now if we want to change the default sleep value while customizing the android, just follow the following steps…

Step 1: open the following xml file… android/frameworks/base/packages/SettingsProvider/res/values/defaults.xml.

Step 2: change the default sleep time value in the line,
<"integer name="def_screen_off_timeout">60000<"/integer">… I changed it to 1800000 (30 minutes)…
Now, if you check in Settings > display > sleep, it will display as 30 minutes as default…

And if you don’t want timeout, set it to ‘-1’ …
Now, if you check in Settings > display > sleep, it won’t show any time out value… :)


ANOTHER METHOD: Editing the sleep time in the Settings source…

Step 1: open the file, android/packages/apps/Settings/src/com/android/settings/DisplaySettings.java

Step 2: Add the line, “Settings.System.putInt(getContentResolver(), SCREEN_OFF_TIMEOUT, -1);” before the line “ final long currentTimeout = Settings.System.getLong(resolver, SCREEN_OFF_TIMEOUT,               FALLBACK_SCREEN_TIMEOUT_VALUE);”

Now, if you check in Settings > display > sleep, it won’t show any time out value… :)

DO REBUILD THE ANDROID AFTER THE CHANGES!!! DON’T FORGET!!!

Task Completed :) :) :)

Out of Memory - dalvikvm-heap error

Hi friend,

Recently in our project SystemUI was crashing, saying that “Unfortunately, SystemUI has stopped”. I was supposed to fix it, so went through logcat and for found error as follow…

D/dalvikvm( 2120): GC_FOR_ALLOC freed 10K, 7% free 14024K/14983K, paused 10ms
I/dalvikvm-heap( 2120): Forcing collection of SoftReferences for 1587212-byte allocation
D/dalvikvm( 2120): GC_BEFORE_OOM freed 14K, 7% free 14009K/14983K, paused 0ms
E/dalvikvm-heap( 2120): Out of memory on a 1587212-byte allocation.
I/dalvikvm( 2120): "main" prio=5 tid=1 RUNNABLE
………………………………………………………………………………………..……………………………………………..
D/AndroidRuntime( 2120): Shutting down VM
W/dalvikvm( 2120): threadid=1: thread exiting with uncaught exception (group=0xb598b180)
E/AndroidRuntime( 2120): FATAL EXCEPTION: main
E/AndroidRuntime( 2120): java.lang.OutOfMemoryError
…………………………………………………………………………………………………………………………………………
E/AndroidRuntime( 2120):        at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 1682):   Force finishing activity 

SOLUTION

The error is the default heap size was not enough, so we need to increase the heap size or decrease the data in the heap to overcome this problem. We planned to increase the heap size. So we mounted the system image and edited the build.prop file in it, and then the problem was solved.

The solution is to increase the dalvik heap size by entering the one line in the build.prop script inside the system folder.

Step 1: use a file explore and open the build.prop file inside the system folder.
Step 2: enter the dalvik.vm.heapsize=32m. (I needed 32 MB of heap, so I specified it as 32… you can modify it as per your need)
Step 3: Restart your android.
The problem solved :)

If you are working with android source code…if you are customizing the android… and you want to solve in the source code… follow the following steps…

Step 1: open the main.mk in the folder android/build/core.
Step 2: enter the line ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.heapsize=32m (I needed 32 MB of heap, so I specified it as 32… you can modify it as per your need) after the line ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-file=/data/anr/traces.txt.
Step 3: save it and rebuilt it… 

The problem solved :)

From that time, I’m following the same, whenever I get out of memory problem ;)

Newer Posts Older Posts Home

About Me

My photo
Hi everyone,myself Alagappan...electronic and communication engg. student... living in madurai... interested in everything... want to achieve something great in my lifetime...

Followers


Recent Comments