Expose PowerManager.isScreenOn in the public api.
Change-Id: I6ccd2ebcbf3f8ad9ffa4b86a9c037cb0c25a7b78
This commit is contained in:
committed by
Mike Lockwood
parent
9eaff61adf
commit
322591cb4b
@@ -31,6 +31,7 @@ interface IPowerManager
|
||||
long getScreenOnTime();
|
||||
void preventScreenOn(boolean prevent);
|
||||
void setScreenBrightnessOverride(int brightness);
|
||||
boolean isScreenOn();
|
||||
|
||||
// sets the brightness of the backlights (screen, keyboard, button) 0-255
|
||||
void setBacklightBrightness(int brightness);
|
||||
|
||||
@@ -420,6 +420,26 @@ public class PowerManager
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the screen is currently on. The screen could be bright
|
||||
* or dim.
|
||||
*
|
||||
* {@samplecode
|
||||
* PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
* boolean isScreenOn = pm.isScreenOn();
|
||||
* }
|
||||
*
|
||||
* @return whether the screen is on (bright or dim).
|
||||
*/
|
||||
public boolean isScreenOn()
|
||||
{
|
||||
try {
|
||||
return mService.isScreenOn();
|
||||
} catch (RemoteException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private PowerManager()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user