Merge commit '0ce9c58fe33a3b96219944762adbff99d12212a3' into eclair-mr2-plus-aosp * commit '0ce9c58fe33a3b96219944762adbff99d12212a3': Remove obsolete hardware auto-brightness support. Add documentation for proximity and light sensors.
This commit is contained in:
@@ -46,13 +46,21 @@ public class Sensor {
|
|||||||
|
|
||||||
/** A constant describing a gyroscope sensor type */
|
/** A constant describing a gyroscope sensor type */
|
||||||
public static final int TYPE_GYROSCOPE = 4;
|
public static final int TYPE_GYROSCOPE = 4;
|
||||||
/** A constant describing a light sensor type */
|
/**
|
||||||
|
* A constant describing an light sensor type.
|
||||||
|
* See {@link android.hardware.SensorEvent SensorEvent}
|
||||||
|
* for more details.
|
||||||
|
*/
|
||||||
public static final int TYPE_LIGHT = 5;
|
public static final int TYPE_LIGHT = 5;
|
||||||
/** A constant describing a pressure sensor type */
|
/** A constant describing a pressure sensor type */
|
||||||
public static final int TYPE_PRESSURE = 6;
|
public static final int TYPE_PRESSURE = 6;
|
||||||
/** A constant describing a temperature sensor type */
|
/** A constant describing a temperature sensor type */
|
||||||
public static final int TYPE_TEMPERATURE = 7;
|
public static final int TYPE_TEMPERATURE = 7;
|
||||||
/** A constant describing a proximity sensor type */
|
/**
|
||||||
|
* A constant describing an proximity sensor type.
|
||||||
|
* See {@link android.hardware.SensorEvent SensorEvent}
|
||||||
|
* for more details.
|
||||||
|
*/
|
||||||
public static final int TYPE_PROXIMITY = 8;
|
public static final int TYPE_PROXIMITY = 8;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -115,8 +115,19 @@ public class SensorEvent {
|
|||||||
* <p>{@link android.hardware.Sensor#TYPE_MAGNETIC_FIELD Sensor.TYPE_MAGNETIC_FIELD}:<p>
|
* <p>{@link android.hardware.Sensor#TYPE_MAGNETIC_FIELD Sensor.TYPE_MAGNETIC_FIELD}:<p>
|
||||||
* All values are in micro-Tesla (uT) and measure the ambient magnetic
|
* All values are in micro-Tesla (uT) and measure the ambient magnetic
|
||||||
* field in the X, Y and Z axis.
|
* field in the X, Y and Z axis.
|
||||||
*
|
*
|
||||||
*/
|
* <p>{@link android.hardware.Sensor#TYPE_LIGHT Sensor.TYPE_LIGHT}:<p>
|
||||||
|
*
|
||||||
|
* <p>values[0]: Ambient light level in SI lux units
|
||||||
|
*
|
||||||
|
* <p>{@link android.hardware.Sensor#TYPE_PROXIMITY Sensor.TYPE_PROXIMITY}:<p>
|
||||||
|
*
|
||||||
|
* <p>values[0]: Proximity sensor distance measured in centimeters
|
||||||
|
*
|
||||||
|
* <p> Note that some proximity sensors only support a binary "close" or "far" measurement.
|
||||||
|
* In this case, the sensor should report its maxRange value in the "far" state and a value
|
||||||
|
* less than maxRange in the "near" state.
|
||||||
|
*/
|
||||||
public final float[] values;
|
public final float[] values;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -71,11 +71,6 @@
|
|||||||
the slider can be opened (for example, in a pocket or purse). -->
|
the slider can be opened (for example, in a pocket or purse). -->
|
||||||
<bool name="config_bypass_keyguard_if_slider_open">true</bool>
|
<bool name="config_bypass_keyguard_if_slider_open">true</bool>
|
||||||
|
|
||||||
<!-- Flag indicating whether the device supports automatic brightness mode in hardware.
|
|
||||||
WARNING - DO NOT USE THIS FEATURE
|
|
||||||
Hardware auto brightness support is deprecated and will be removed in the next release. -->
|
|
||||||
<bool name="config_hardware_automatic_brightness_available">false</bool>
|
|
||||||
|
|
||||||
<!-- Flag indicating whether the we should enable the automatic brightness in Settings.
|
<!-- Flag indicating whether the we should enable the automatic brightness in Settings.
|
||||||
Software implementation will be used if config_hardware_auto_brightness_available is not set -->
|
Software implementation will be used if config_hardware_auto_brightness_available is not set -->
|
||||||
<bool name="config_automatic_brightness_available">false</bool>
|
<bool name="config_automatic_brightness_available">false</bool>
|
||||||
|
|||||||
@@ -59,8 +59,6 @@ public class HardwareService extends IHardwareService.Stub {
|
|||||||
private boolean mAttentionLightOn;
|
private boolean mAttentionLightOn;
|
||||||
private boolean mPulsing;
|
private boolean mPulsing;
|
||||||
|
|
||||||
private boolean mAutoBrightnessAvailable;
|
|
||||||
|
|
||||||
private class Vibration implements IBinder.DeathRecipient {
|
private class Vibration implements IBinder.DeathRecipient {
|
||||||
private final IBinder mToken;
|
private final IBinder mToken;
|
||||||
private final long mTimeout;
|
private final long mTimeout;
|
||||||
@@ -131,9 +129,6 @@ public class HardwareService extends IHardwareService.Stub {
|
|||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||||
context.registerReceiver(mIntentReceiver, filter);
|
context.registerReceiver(mIntentReceiver, filter);
|
||||||
|
|
||||||
mAutoBrightnessAvailable = context.getResources().getBoolean(
|
|
||||||
com.android.internal.R.bool.config_hardware_automatic_brightness_available);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void finalize() throws Throwable {
|
protected void finalize() throws Throwable {
|
||||||
@@ -287,12 +282,6 @@ public class HardwareService extends IHardwareService.Stub {
|
|||||||
setLight_native(mNativePointer, light, color, mode, onMS, offMS);
|
setLight_native(mNativePointer, light, color, mode, onMS, offMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAutoBrightness_UNCHECKED(boolean on) {
|
|
||||||
if (mAutoBrightnessAvailable) {
|
|
||||||
setAutoBrightness_native(mNativePointer, on);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAttentionLight(boolean on) {
|
public void setAttentionLight(boolean on) {
|
||||||
// Not worthy of a permission. We shouldn't have a flashlight permission.
|
// Not worthy of a permission. We shouldn't have a flashlight permission.
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
@@ -493,7 +482,6 @@ public class HardwareService extends IHardwareService.Stub {
|
|||||||
private static native int init_native();
|
private static native int init_native();
|
||||||
private static native void finalize_native(int ptr);
|
private static native void finalize_native(int ptr);
|
||||||
|
|
||||||
private static native void setAutoBrightness_native(int ptr, boolean automatic);
|
|
||||||
private static native void setLight_native(int ptr, int light, int color, int mode,
|
private static native void setLight_native(int ptr, int light, int color, int mode,
|
||||||
int onMS, int offMS);
|
int onMS, int offMS);
|
||||||
|
|
||||||
|
|||||||
@@ -218,12 +218,6 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
private int[] mButtonBacklightValues;
|
private int[] mButtonBacklightValues;
|
||||||
private int[] mKeyboardBacklightValues;
|
private int[] mKeyboardBacklightValues;
|
||||||
|
|
||||||
/*
|
|
||||||
* WARNING - DO NOT USE THE HARDWARE AUTO-BRIGHTNESS FEATURE
|
|
||||||
* Hardware auto brightness support is deprecated and will be removed in the next release.
|
|
||||||
*/
|
|
||||||
private boolean mUseHardwareAutoBrightness;
|
|
||||||
|
|
||||||
// Used when logging number and duration of touch-down cycles
|
// Used when logging number and duration of touch-down cycles
|
||||||
private long mTotalTouchDownTime;
|
private long mTotalTouchDownTime;
|
||||||
private long mLastTouchDown;
|
private long mLastTouchDown;
|
||||||
@@ -448,17 +442,6 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
// read settings for auto-brightness
|
// read settings for auto-brightness
|
||||||
mUseSoftwareAutoBrightness = resources.getBoolean(
|
mUseSoftwareAutoBrightness = resources.getBoolean(
|
||||||
com.android.internal.R.bool.config_automatic_brightness_available);
|
com.android.internal.R.bool.config_automatic_brightness_available);
|
||||||
|
|
||||||
/*
|
|
||||||
* WARNING - DO NOT USE THE HARDWARE AUTO-BRIGHTNESS FEATURE
|
|
||||||
* Hardware auto brightness support is deprecated and will be removed in the next release.
|
|
||||||
*/
|
|
||||||
mUseHardwareAutoBrightness = resources.getBoolean(
|
|
||||||
com.android.internal.R.bool.config_hardware_automatic_brightness_available);
|
|
||||||
if (mUseHardwareAutoBrightness) {
|
|
||||||
mUseSoftwareAutoBrightness = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mUseSoftwareAutoBrightness) {
|
if (mUseSoftwareAutoBrightness) {
|
||||||
mAutoBrightnessLevels = resources.getIntArray(
|
mAutoBrightnessLevels = resources.getIntArray(
|
||||||
com.android.internal.R.array.config_autoBrightnessLevels);
|
com.android.internal.R.array.config_autoBrightnessLevels);
|
||||||
@@ -906,7 +889,6 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
pw.println(" mLightSensorEnabled=" + mLightSensorEnabled);
|
pw.println(" mLightSensorEnabled=" + mLightSensorEnabled);
|
||||||
pw.println(" mLightSensorValue=" + mLightSensorValue);
|
pw.println(" mLightSensorValue=" + mLightSensorValue);
|
||||||
pw.println(" mLightSensorPendingValue=" + mLightSensorPendingValue);
|
pw.println(" mLightSensorPendingValue=" + mLightSensorPendingValue);
|
||||||
pw.println(" mUseHardwareAutoBrightness=" + mUseHardwareAutoBrightness);
|
|
||||||
pw.println(" mUseSoftwareAutoBrightness=" + mUseSoftwareAutoBrightness);
|
pw.println(" mUseSoftwareAutoBrightness=" + mUseSoftwareAutoBrightness);
|
||||||
pw.println(" mAutoBrightessEnabled=" + mAutoBrightessEnabled);
|
pw.println(" mAutoBrightessEnabled=" + mAutoBrightessEnabled);
|
||||||
mScreenBrightness.dump(pw, " mScreenBrightness: ");
|
mScreenBrightness.dump(pw, " mScreenBrightness: ");
|
||||||
@@ -2086,16 +2068,9 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
|
|
||||||
private void setScreenBrightnessMode(int mode) {
|
private void setScreenBrightnessMode(int mode) {
|
||||||
boolean enabled = (mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
|
boolean enabled = (mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
|
||||||
if (mAutoBrightessEnabled != enabled) {
|
if (mUseSoftwareAutoBrightness && mAutoBrightessEnabled != enabled) {
|
||||||
mAutoBrightessEnabled = enabled;
|
mAutoBrightessEnabled = enabled;
|
||||||
|
if (screenIsOn()) {
|
||||||
if (mUseHardwareAutoBrightness) {
|
|
||||||
// When setting auto-brightness, must reset the brightness afterwards
|
|
||||||
mHardware.setAutoBrightness_UNCHECKED(enabled);
|
|
||||||
if (screenIsOn()) {
|
|
||||||
setBacklightBrightness((int)mScreenBrightness.curValue);
|
|
||||||
}
|
|
||||||
} else if (mUseSoftwareAutoBrightness && screenIsOn()) {
|
|
||||||
// force recompute of backlight values
|
// force recompute of backlight values
|
||||||
if (mLightSensorValue >= 0) {
|
if (mLightSensorValue >= 0) {
|
||||||
int value = (int)mLightSensorValue;
|
int value = (int)mLightSensorValue;
|
||||||
|
|||||||
@@ -100,18 +100,6 @@ static void finalize_native(JNIEnv *env, jobject clazz, int ptr)
|
|||||||
free(devices);
|
free(devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setAutoBrightness_native(JNIEnv *env, jobject clazz, int ptr,
|
|
||||||
jboolean automatic)
|
|
||||||
{
|
|
||||||
Devices* devices = (Devices*)ptr;
|
|
||||||
|
|
||||||
if (devices->lights[LIGHT_INDEX_BACKLIGHT] == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
devices->lights[LIGHT_INDEX_BACKLIGHT]->set_als_mode(automatic ? 0 : 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setLight_native(JNIEnv *env, jobject clazz, int ptr,
|
static void setLight_native(JNIEnv *env, jobject clazz, int ptr,
|
||||||
int light, int colorARGB, int flashMode, int onMS, int offMS)
|
int light, int colorARGB, int flashMode, int onMS, int offMS)
|
||||||
{
|
{
|
||||||
@@ -146,7 +134,6 @@ static void vibratorOff(JNIEnv *env, jobject clazz)
|
|||||||
static JNINativeMethod method_table[] = {
|
static JNINativeMethod method_table[] = {
|
||||||
{ "init_native", "()I", (void*)init_native },
|
{ "init_native", "()I", (void*)init_native },
|
||||||
{ "finalize_native", "(I)V", (void*)finalize_native },
|
{ "finalize_native", "(I)V", (void*)finalize_native },
|
||||||
{ "setAutoBrightness_native", "(IZ)V", (void*)setAutoBrightness_native },
|
|
||||||
{ "setLight_native", "(IIIIII)V", (void*)setLight_native },
|
{ "setLight_native", "(IIIIII)V", (void*)setLight_native },
|
||||||
{ "vibratorOn", "(J)V", (void*)vibratorOn },
|
{ "vibratorOn", "(J)V", (void*)vibratorOn },
|
||||||
{ "vibratorOff", "()V", (void*)vibratorOff }
|
{ "vibratorOff", "()V", (void*)vibratorOff }
|
||||||
|
|||||||
Reference in New Issue
Block a user