Not using a WakeLock so why does the device stay awake?

by MrChaz » Tue, 13 Apr 2010 17:16:57 GMT


Sponsored Links
 iirc, that flag means the system gets a wake lock for the life of the
activity for you.




--



Not using a WakeLock so why does the device stay awake?

by westmeadboy » Tue, 13 Apr 2010 17:19:20 GMT


 Oh I see.

So if the user presses Home and then uses the power button, then it
*could* fall asleep (in the case where the activity has been killed by
the system)?





--


Sponsored Links


Not using a WakeLock so why does the device stay awake?

by westmeadboy » Wed, 14 Apr 2010 15:45:23 GMT


 Just to confirm: the device is not plugged into USB and I'm not using
any broadcasts or broadcast receivers.

When I do plug in and start the service these are the wake locks:

mLocks.size=3:
  SCREEN_DIM_WAKE_LOCK           'StayOnWhilePluggedIn Screen Dim'
activated (minState=1)
  PARTIAL_WAKE_LOCK              'StayOnWhilePluggedIn Partial'
activated (minState=0)
  SCREEN_BRIGHT_WAKE_LOCK        'KEEP_SCREEN_ON_FLAG' activated
(minState=3)

and then when I homescreen, other app, turn the screen off (as
describe above) but leave the device plugged in, the third one
disappears.

So I would assume that when I unplug the USB, the first two to
disappear also...







> >



Not using a WakeLock so why does the device stay awake?

by THill » Fri, 23 Apr 2010 03:51:12 GMT


 hanks Dianne, that makes sense.

I didn't realize there was essentially one wake lock that the kernel &
applications layer use, so when all apps give up the wake lock, they
will still get awaken when the cpu wakes to handle kernel processes.

This explains why the 1-second timer pops occurred at 1 second
intervals before & after the sleep, and at very erratic intervals
during the sleep.

I saw the same behavior on a similar test case with an AsyncTask
sending messages through a handler to the UI. Neither the task, nor
the handler, was completely frozen during the sleep, but the task was
taking longer to complete during that time.

Unfortunately, my production app has specific power usage constraints
imposed by the manufacturer/carrier (especially with the device
asleep), and it doesn't seem there is a good way to make sure the app
completely goes dormant when the device sleeps. Any suggestions are
welcome.

Cheers
Tim

On Apr 22, 10:58am, Dianne Hackborn <hack...@android.com> wrote:
> >



Other Threads

1. Log in debug only?

Hello,

I write a lot of logs in my program with the class android.util.Log.
Do the log methods (Log.v(), Log.d(), ...) are executed on the phone?
When my program will be finished, I won't like to see it try to output
logs in the release version.

I have seen that to make a conditional compilation (for Debug/Release
version), I can use a class like this:

public final class Debug {
          //set to false to allow compiler to identify and eliminate
          //unreachable code
          public static final boolean ON = false;
        }

and use if to add debug codes:

if (Debug.ON) {
  // Do debug works...
}

If Debug.ON is false, the compiler removes the unreachable parts of
code, i.e. the ones inside this if. Should I do the same for Log
functions to be able to activate and deactivate them?

Thanks.
--~--~---------~--~----~------------~-------~--~----~

2. Button into a Tab error of xml

Hi

I try to add buttons into a tab, but when I run my code. there are en
error in android emulator.

I think my xml file is wrong because it's designed it out of (height
and width) tab but I don't find how to add that into a tab without
error.

my code :

package m.dany.anrdoid.inertfacegraphiquevvm;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class InerfaceGraphiqueVVM extends TabActivity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);

setContentView(R.layout.tab);

final TabHost oTabHost = getTabHost();

TabSpec ts1 = oTabHost.newTabSpec("tab1");
ts1.setIndicator("Voicemail");
ts1.setContent(new Intent(this, Tab1.class));
oTabHost.addTab(ts1);

TabSpec ts2 = oTabHost.newTabSpec("tab2");
ts2.setIndicator("TAB 2");
ts2.setContent(R.id.textview2);
oTabHost.addTab(ts2);

oTabHost.setCurrentTab(0);

}
}


the xml file fot tab and following by xml file for button :


here:

<?xml version="1.0" encoding="utf-8"?>

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

            <TextView
                android:id="@+id/textview1"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" />

             <TextView
                android:id="@+id/textview2"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" />

        </FrameLayout>
    </LinearLayout>
</TabHost>



and here:


<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

                        <Button
                                android:id="@+id/button"
                                android:text="Button">
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                        </Button>

</LinearLayout>

Android Emulator has an error .

I'm really blocked so what the matter ?? please !

Thanks
--~--~---------~--~----~------------~-------~--~----~

3. animated gif over all other elements on the desktop screen.

4. UEvent in linux kernel

5. Helping for UEvent for Battery Service

6. About the NeighboringCellInfo information

7. Calling all Sydney/Australia Android Developers