Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to get instance of PowerManagerService?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
macias  
View profile  
 More options Aug 4 2012, 3:40 pm
From: macias <pilichowski.mac...@gmail.com>
Date: Sat, 4 Aug 2012 12:40:49 -0700 (PDT)
Local: Sat, Aug 4 2012 3:40 pm
Subject: How to get instance of PowerManagerService?

Hello all,

  IN SHORT:
I need to get instance of PowerManagerService (in order to call its method
isScreenBright). However I am unable to do it, after reading Android
sources, the closest guess was to get it (via reflection) from
android.os.ServiceManager by calling getService. The problem is the
resulting class name is BinderProxy (the class name of the object which I
get after actual invoke of getService), not PowerManagerService and I am
stuck at this point. The types have to match in order to continue working
with reflection invoking.

  BACKGROUND STORY (safe to skip it):
I try to read real brightness of the screen (not the one that should be
set, but the real one). All top level brightness readers method return
theoretical values (most likely -- from settings), so when phone lowers it
automatically, those top level methods get the same result despite, the
brightness changed. I figured out, I try isScreenBright method, it should
tell me if phone is in normal brightness mode, or in power save mode
(source code which sets this mode look promising anyway).

Thank you in advance.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Murphy  
View profile  
 More options Aug 6 2012, 7:04 am
From: Mark Murphy <mmur...@commonsware.com>
Date: Mon, 6 Aug 2012 07:04:25 -0400
Local: Mon, Aug 6 2012 7:04 am
Subject: Re: [android-developers] How to get instance of PowerManagerService?
AFAIK, this is not possible, outside of a custom build of Android.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.0 Available!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
macias  
View profile  
 More options Aug 6 2012, 3:20 pm
From: macias <pilichowski.mac...@gmail.com>
Date: Mon, 6 Aug 2012 12:20:45 -0700 (PDT)
Local: Mon, Aug 6 2012 3:20 pm
Subject: Re: [android-developers] How to get instance of PowerManagerService?

Bad news, but thank you. I wonder how it is possible, that (according to
Android sources) what is added to services is PowerManagerService, but what
is get is PowerManager (not service) -- when using "legal" methods such as
getSystemService.

Anyway, quite easy task -- for learning Android -- as building custom
screensaver turned out to be paramount problem :-(

Cheers,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dianne Hackborn  
View profile  
 More options Aug 6 2012, 6:09 pm
From: Dianne Hackborn <hack...@android.com>
Date: Mon, 6 Aug 2012 15:09:19 -0700
Local: Mon, Aug 6 2012 6:09 pm
Subject: Re: [android-developers] How to get instance of PowerManagerService?

PowerManager is the public API.  Context.getSystemService() returns public
APIs.

PowerManagerService is private implementation.  More than that, it is
private implementation that does not run in your process, so you can not
directly access in any way.

On Mon, Aug 6, 2012 at 12:20 PM, macias <pilichowski.mac...@gmail.com>wrote:

--
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »