Loading core/java/android/os/IHardwareService.aidl +0 −6 Original line number Diff line number Diff line Loading @@ -29,12 +29,6 @@ interface IHardwareService void setFlashlightEnabled(boolean on); void enableCameraFlash(int milliseconds); // sets the brightness of the backlights (screen, keyboard, button) 0-255 void setBacklights(int brightness); // enables or disables automatic brightness mode void setAutoBrightness(boolean on); // for the phone void setAttentionLight(boolean on); } Loading core/java/android/os/IPowerManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -31,4 +31,10 @@ interface IPowerManager long getScreenOnTime(); void preventScreenOn(boolean prevent); void setScreenBrightnessOverride(int brightness); // sets the brightness of the backlights (screen, keyboard, button) 0-255 void setBacklightBrightness(int brightness); // enables or disables automatic brightness mode void setAutoBrightness(boolean on); } core/java/android/os/PowerManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -379,6 +379,21 @@ public class PowerManager } } /** * sets the brightness of the backlights (screen, keyboard, button). * * @param brightness value from 0 to 255 * * {@hide} */ public void setBacklightBrightness(int brightness) { try { mService.setBacklightBrightness(brightness); } catch (RemoteException e) { } } /** * Returns the set of flags for {@link #newWakeLock(int, String) newWakeLock()} * that are supported on the device. Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java +5 −5 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ import android.content.IContentService; import android.content.res.Configuration; import android.location.LocationManager; import android.media.AudioManager; import android.os.IHardwareService; import android.os.IPowerManager; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; Loading Loading @@ -94,10 +94,10 @@ public class SettingsHelper { private void setBrightness(int brightness) { try { IHardwareService hardware = IHardwareService.Stub .asInterface(ServiceManager.getService("hardware")); if (hardware != null) { hardware.setBacklights(brightness); IPowerManager power = IPowerManager.Stub.asInterface( ServiceManager.getService("power")); if (power != null) { power.setBacklightBrightness(brightness); } } catch (RemoteException doe) { Loading services/java/com/android/server/HardwareService.java +0 −28 Original line number Diff line number Diff line Loading @@ -269,26 +269,6 @@ public class HardwareService extends IHardwareService.Stub { Hardware.enableCameraFlash(milliseconds); } public void setBacklights(int brightness) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.HARDWARE_TEST) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Requires HARDWARE_TEST permission"); } // Don't let applications turn the screen all the way off brightness = Math.max(brightness, Power.BRIGHTNESS_DIM); setLightBrightness_UNCHECKED(LIGHT_ID_BACKLIGHT, brightness); setLightBrightness_UNCHECKED(LIGHT_ID_KEYBOARD, brightness); setLightBrightness_UNCHECKED(LIGHT_ID_BUTTONS, brightness); long identity = Binder.clearCallingIdentity(); try { mBatteryStats.noteScreenBrightness(brightness); } catch (RemoteException e) { Log.w(TAG, "RemoteException calling noteScreenBrightness on BatteryStatsService", e); } finally { Binder.restoreCallingIdentity(identity); } } void setLightOff_UNCHECKED(int light) { setLight_native(mNativePointer, light, 0, LIGHT_FLASH_NONE, 0, 0); } Loading @@ -307,14 +287,6 @@ public class HardwareService extends IHardwareService.Stub { setLight_native(mNativePointer, light, color, mode, onMS, offMS); } public void setAutoBrightness(boolean on) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.HARDWARE_TEST) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Requires HARDWARE_TEST permission"); } setAutoBrightness_UNCHECKED(on); } void setAutoBrightness_UNCHECKED(boolean on) { if (mAutoBrightnessAvailable) { setAutoBrightness_native(mNativePointer, on); Loading Loading
core/java/android/os/IHardwareService.aidl +0 −6 Original line number Diff line number Diff line Loading @@ -29,12 +29,6 @@ interface IHardwareService void setFlashlightEnabled(boolean on); void enableCameraFlash(int milliseconds); // sets the brightness of the backlights (screen, keyboard, button) 0-255 void setBacklights(int brightness); // enables or disables automatic brightness mode void setAutoBrightness(boolean on); // for the phone void setAttentionLight(boolean on); } Loading
core/java/android/os/IPowerManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -31,4 +31,10 @@ interface IPowerManager long getScreenOnTime(); void preventScreenOn(boolean prevent); void setScreenBrightnessOverride(int brightness); // sets the brightness of the backlights (screen, keyboard, button) 0-255 void setBacklightBrightness(int brightness); // enables or disables automatic brightness mode void setAutoBrightness(boolean on); }
core/java/android/os/PowerManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -379,6 +379,21 @@ public class PowerManager } } /** * sets the brightness of the backlights (screen, keyboard, button). * * @param brightness value from 0 to 255 * * {@hide} */ public void setBacklightBrightness(int brightness) { try { mService.setBacklightBrightness(brightness); } catch (RemoteException e) { } } /** * Returns the set of flags for {@link #newWakeLock(int, String) newWakeLock()} * that are supported on the device. Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java +5 −5 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ import android.content.IContentService; import android.content.res.Configuration; import android.location.LocationManager; import android.media.AudioManager; import android.os.IHardwareService; import android.os.IPowerManager; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; Loading Loading @@ -94,10 +94,10 @@ public class SettingsHelper { private void setBrightness(int brightness) { try { IHardwareService hardware = IHardwareService.Stub .asInterface(ServiceManager.getService("hardware")); if (hardware != null) { hardware.setBacklights(brightness); IPowerManager power = IPowerManager.Stub.asInterface( ServiceManager.getService("power")); if (power != null) { power.setBacklightBrightness(brightness); } } catch (RemoteException doe) { Loading
services/java/com/android/server/HardwareService.java +0 −28 Original line number Diff line number Diff line Loading @@ -269,26 +269,6 @@ public class HardwareService extends IHardwareService.Stub { Hardware.enableCameraFlash(milliseconds); } public void setBacklights(int brightness) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.HARDWARE_TEST) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Requires HARDWARE_TEST permission"); } // Don't let applications turn the screen all the way off brightness = Math.max(brightness, Power.BRIGHTNESS_DIM); setLightBrightness_UNCHECKED(LIGHT_ID_BACKLIGHT, brightness); setLightBrightness_UNCHECKED(LIGHT_ID_KEYBOARD, brightness); setLightBrightness_UNCHECKED(LIGHT_ID_BUTTONS, brightness); long identity = Binder.clearCallingIdentity(); try { mBatteryStats.noteScreenBrightness(brightness); } catch (RemoteException e) { Log.w(TAG, "RemoteException calling noteScreenBrightness on BatteryStatsService", e); } finally { Binder.restoreCallingIdentity(identity); } } void setLightOff_UNCHECKED(int light) { setLight_native(mNativePointer, light, 0, LIGHT_FLASH_NONE, 0, 0); } Loading @@ -307,14 +287,6 @@ public class HardwareService extends IHardwareService.Stub { setLight_native(mNativePointer, light, color, mode, onMS, offMS); } public void setAutoBrightness(boolean on) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.HARDWARE_TEST) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Requires HARDWARE_TEST permission"); } setAutoBrightness_UNCHECKED(on); } void setAutoBrightness_UNCHECKED(boolean on) { if (mAutoBrightnessAvailable) { setAutoBrightness_native(mNativePointer, on); Loading