Merge change I707f53cd into eclair-mr2
* changes: LightsService cleanup:
This commit is contained in:
@@ -30,6 +30,9 @@ public class LightsService {
|
|||||||
static final int LIGHT_ID_BATTERY = 3;
|
static final int LIGHT_ID_BATTERY = 3;
|
||||||
static final int LIGHT_ID_NOTIFICATIONS = 4;
|
static final int LIGHT_ID_NOTIFICATIONS = 4;
|
||||||
static final int LIGHT_ID_ATTENTION = 5;
|
static final int LIGHT_ID_ATTENTION = 5;
|
||||||
|
static final int LIGHT_ID_BLUETOOTH = 6;
|
||||||
|
static final int LIGHT_ID_WIFI = 7;
|
||||||
|
static final int LIGHT_ID_COUNT = 8;
|
||||||
|
|
||||||
static final int LIGHT_FLASH_NONE = 0;
|
static final int LIGHT_FLASH_NONE = 0;
|
||||||
static final int LIGHT_FLASH_TIMED = 1;
|
static final int LIGHT_FLASH_TIMED = 1;
|
||||||
@@ -45,13 +48,85 @@ public class LightsService {
|
|||||||
*/
|
*/
|
||||||
static final int BRIGHTNESS_MODE_SENSOR = 1;
|
static final int BRIGHTNESS_MODE_SENSOR = 1;
|
||||||
|
|
||||||
private boolean mAttentionLightOn;
|
private final Light mLights[] = new Light[LIGHT_ID_COUNT];
|
||||||
private boolean mPulsing;
|
|
||||||
|
public final class Light {
|
||||||
|
|
||||||
|
private Light(int id) {
|
||||||
|
mId = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBrightness(int brightness) {
|
||||||
|
setBrightness(brightness, BRIGHTNESS_MODE_USER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBrightness(int brightness, int brightnessMode) {
|
||||||
|
synchronized (this) {
|
||||||
|
int color = brightness & 0x000000ff;
|
||||||
|
color = 0xff000000 | (color << 16) | (color << 8) | color;
|
||||||
|
setLightLocked(color, LIGHT_FLASH_NONE, 0, 0, brightnessMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(int color) {
|
||||||
|
synchronized (this) {
|
||||||
|
setLightLocked(color, LIGHT_FLASH_NONE, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlashing(int color, int mode, int onMS, int offMS) {
|
||||||
|
synchronized (this) {
|
||||||
|
setLightLocked(color, mode, onMS, offMS, BRIGHTNESS_MODE_USER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pulse() {
|
||||||
|
synchronized (this) {
|
||||||
|
if (mColor == 0 && !mFlashing) {
|
||||||
|
setLightLocked(0x00ffffff, LIGHT_FLASH_HARDWARE, 7, 0, BRIGHTNESS_MODE_USER);
|
||||||
|
mH.sendMessageDelayed(Message.obtain(mH, 1, this), 3000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void turnOff() {
|
||||||
|
synchronized (this) {
|
||||||
|
setLightLocked(0, LIGHT_FLASH_NONE, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopFlashing() {
|
||||||
|
synchronized (this) {
|
||||||
|
setLightLocked(mColor, LIGHT_FLASH_NONE, 0, 0, BRIGHTNESS_MODE_USER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setLightLocked(int color, int mode, int onMS, int offMS, int brightnessMode) {
|
||||||
|
if (color != mColor || mode != mMode || onMS != mOnMS || offMS != mOffMS) {
|
||||||
|
mColor = color;
|
||||||
|
mMode = mode;
|
||||||
|
mOnMS = onMS;
|
||||||
|
mOffMS = offMS;
|
||||||
|
setLight_native(mNativePointer, mId, color, mode, onMS, offMS, brightnessMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int mId;
|
||||||
|
private int mColor;
|
||||||
|
private int mMode;
|
||||||
|
private int mOnMS;
|
||||||
|
private int mOffMS;
|
||||||
|
private boolean mFlashing;
|
||||||
|
}
|
||||||
|
|
||||||
LightsService(Context context) {
|
LightsService(Context context) {
|
||||||
|
|
||||||
mNativePointer = init_native();
|
mNativePointer = init_native();
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
|
||||||
|
for (int i = 0; i < LIGHT_ID_COUNT; i++) {
|
||||||
|
mLights[i] = new Light(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void finalize() throws Throwable {
|
protected void finalize() throws Throwable {
|
||||||
@@ -59,65 +134,15 @@ public class LightsService {
|
|||||||
super.finalize();
|
super.finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLightOff(int light) {
|
public Light getLight(int id) {
|
||||||
setLight_native(mNativePointer, light, 0, LIGHT_FLASH_NONE, 0, 0, 0);
|
return mLights[id];
|
||||||
}
|
|
||||||
|
|
||||||
void setLightBrightness(int light, int brightness, int brightnessMode) {
|
|
||||||
int b = brightness & 0x000000ff;
|
|
||||||
b = 0xff000000 | (b << 16) | (b << 8) | b;
|
|
||||||
setLight_native(mNativePointer, light, b, LIGHT_FLASH_NONE, 0, 0, brightnessMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setLightColor(int light, int color) {
|
|
||||||
setLight_native(mNativePointer, light, color, LIGHT_FLASH_NONE, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setLightFlashing(int light, int color, int mode, int onMS, int offMS) {
|
|
||||||
setLight_native(mNativePointer, light, color, mode, onMS, offMS, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAttentionLight(boolean on, int color) {
|
|
||||||
// Not worthy of a permission. We shouldn't have a flashlight permission.
|
|
||||||
synchronized (this) {
|
|
||||||
mAttentionLightOn = on;
|
|
||||||
mPulsing = false;
|
|
||||||
setLight_native(mNativePointer, LIGHT_ID_ATTENTION, color,
|
|
||||||
LIGHT_FLASH_HARDWARE, on ? 3 : 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void pulseBreathingLight() {
|
|
||||||
synchronized (this) {
|
|
||||||
// HACK: Added at the last minute of cupcake -- design this better;
|
|
||||||
// Don't reuse the attention light -- make another one.
|
|
||||||
if (false) {
|
|
||||||
Log.d(TAG, "pulseBreathingLight mAttentionLightOn=" + mAttentionLightOn
|
|
||||||
+ " mPulsing=" + mPulsing);
|
|
||||||
}
|
|
||||||
if (!mAttentionLightOn && !mPulsing) {
|
|
||||||
mPulsing = true;
|
|
||||||
setLight_native(mNativePointer, LIGHT_ID_ATTENTION, 0x00ffffff,
|
|
||||||
LIGHT_FLASH_HARDWARE, 7, 0, 0);
|
|
||||||
mH.sendMessageDelayed(Message.obtain(mH, 1), 3000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Handler mH = new Handler() {
|
private Handler mH = new Handler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
synchronized (this) {
|
Light light = (Light)msg.obj;
|
||||||
if (false) {
|
light.stopFlashing();
|
||||||
Log.d(TAG, "pulse cleanup handler firing mPulsing=" + mPulsing);
|
|
||||||
}
|
|
||||||
if (mPulsing) {
|
|
||||||
mPulsing = false;
|
|
||||||
setLight_native(mNativePointer, LIGHT_ID_ATTENTION,
|
|
||||||
mAttentionLightOn ? 0xffffffff : 0,
|
|
||||||
LIGHT_FLASH_NONE, 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,9 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
private WorkerHandler mHandler;
|
private WorkerHandler mHandler;
|
||||||
private StatusBarService mStatusBarService;
|
private StatusBarService mStatusBarService;
|
||||||
private LightsService mLightsService;
|
private LightsService mLightsService;
|
||||||
|
private LightsService.Light mBatteryLight;
|
||||||
|
private LightsService.Light mNotificationLight;
|
||||||
|
private LightsService.Light mAttentionLight;
|
||||||
|
|
||||||
private NotificationRecord mSoundNotification;
|
private NotificationRecord mSoundNotification;
|
||||||
private AsyncPlayer mSound;
|
private AsyncPlayer mSound;
|
||||||
@@ -376,6 +379,10 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
mStatusBarService = statusBar;
|
mStatusBarService = statusBar;
|
||||||
statusBar.setNotificationCallbacks(mNotificationCallbacks);
|
statusBar.setNotificationCallbacks(mNotificationCallbacks);
|
||||||
|
|
||||||
|
mBatteryLight = lights.getLight(LightsService.LIGHT_ID_BATTERY);
|
||||||
|
mNotificationLight = lights.getLight(LightsService.LIGHT_ID_NOTIFICATIONS);
|
||||||
|
mAttentionLight = lights.getLight(LightsService.LIGHT_ID_ATTENTION);
|
||||||
|
|
||||||
// Don't start allowing notifications until the setup wizard has run once.
|
// Don't start allowing notifications until the setup wizard has run once.
|
||||||
// After that, including subsequent boots, init with notifications turned on.
|
// After that, including subsequent boots, init with notifications turned on.
|
||||||
// This works on the first boot because the setup wizard will toggle this
|
// This works on the first boot because the setup wizard will toggle this
|
||||||
@@ -678,7 +685,7 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
long identity = Binder.clearCallingIdentity();
|
long identity = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
r.statusBarKey = mStatusBarService.addIcon(icon, n);
|
r.statusBarKey = mStatusBarService.addIcon(icon, n);
|
||||||
mLightsService.pulseBreathingLight();
|
mAttentionLight.pulse();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
Binder.restoreCallingIdentity(identity);
|
Binder.restoreCallingIdentity(identity);
|
||||||
@@ -969,24 +976,20 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
// Battery low always shows, other states only show if charging.
|
// Battery low always shows, other states only show if charging.
|
||||||
if (mBatteryLow) {
|
if (mBatteryLow) {
|
||||||
if (mBatteryCharging) {
|
if (mBatteryCharging) {
|
||||||
mLightsService.setLightColor(LightsService.LIGHT_ID_BATTERY,
|
mBatteryLight.setColor(BATTERY_LOW_ARGB);
|
||||||
BATTERY_LOW_ARGB);
|
|
||||||
} else {
|
} else {
|
||||||
// Flash when battery is low and not charging
|
// Flash when battery is low and not charging
|
||||||
mLightsService.setLightFlashing(LightsService.LIGHT_ID_BATTERY,
|
mBatteryLight.setFlashing(BATTERY_LOW_ARGB, LightsService.LIGHT_FLASH_TIMED,
|
||||||
BATTERY_LOW_ARGB, LightsService.LIGHT_FLASH_TIMED,
|
|
||||||
BATTERY_BLINK_ON, BATTERY_BLINK_OFF);
|
BATTERY_BLINK_ON, BATTERY_BLINK_OFF);
|
||||||
}
|
}
|
||||||
} else if (mBatteryCharging) {
|
} else if (mBatteryCharging) {
|
||||||
if (mBatteryFull) {
|
if (mBatteryFull) {
|
||||||
mLightsService.setLightColor(LightsService.LIGHT_ID_BATTERY,
|
mBatteryLight.setColor(BATTERY_FULL_ARGB);
|
||||||
BATTERY_FULL_ARGB);
|
|
||||||
} else {
|
} else {
|
||||||
mLightsService.setLightColor(LightsService.LIGHT_ID_BATTERY,
|
mBatteryLight.setColor(BATTERY_MEDIUM_ARGB);
|
||||||
BATTERY_MEDIUM_ARGB);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mLightsService.setLightOff(LightsService.LIGHT_ID_BATTERY);
|
mBatteryLight.turnOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle notification lights
|
// handle notification lights
|
||||||
@@ -998,10 +1001,9 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mLedNotification == null) {
|
if (mLedNotification == null) {
|
||||||
mLightsService.setLightOff(LightsService.LIGHT_ID_NOTIFICATIONS);
|
mNotificationLight.turnOff();
|
||||||
} else {
|
} else {
|
||||||
mLightsService.setLightFlashing(
|
mNotificationLight.setFlashing(
|
||||||
LightsService.LIGHT_ID_NOTIFICATIONS,
|
|
||||||
mLedNotification.notification.ledARGB,
|
mLedNotification.notification.ledARGB,
|
||||||
LightsService.LIGHT_FLASH_TIMED,
|
LightsService.LIGHT_FLASH_TIMED,
|
||||||
mLedNotification.notification.ledOnMS,
|
mLedNotification.notification.ledOnMS,
|
||||||
|
|||||||
@@ -183,6 +183,10 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
private Intent mScreenOnIntent;
|
private Intent mScreenOnIntent;
|
||||||
private LightsService mLightsService;
|
private LightsService mLightsService;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
private LightsService.Light mLcdLight;
|
||||||
|
private LightsService.Light mButtonLight;
|
||||||
|
private LightsService.Light mKeyboardLight;
|
||||||
|
private LightsService.Light mAttentionLight;
|
||||||
private UnsynchronizedWakeLock mBroadcastWakeLock;
|
private UnsynchronizedWakeLock mBroadcastWakeLock;
|
||||||
private UnsynchronizedWakeLock mStayOnWhilePluggedInScreenDimLock;
|
private UnsynchronizedWakeLock mStayOnWhilePluggedInScreenDimLock;
|
||||||
private UnsynchronizedWakeLock mStayOnWhilePluggedInPartialLock;
|
private UnsynchronizedWakeLock mStayOnWhilePluggedInPartialLock;
|
||||||
@@ -428,6 +432,11 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
mBatteryStats = BatteryStatsService.getService();
|
mBatteryStats = BatteryStatsService.getService();
|
||||||
mBatteryService = battery;
|
mBatteryService = battery;
|
||||||
|
|
||||||
|
mLcdLight = lights.getLight(LightsService.LIGHT_ID_BACKLIGHT);
|
||||||
|
mButtonLight = lights.getLight(LightsService.LIGHT_ID_BUTTONS);
|
||||||
|
mKeyboardLight = lights.getLight(LightsService.LIGHT_ID_KEYBOARD);
|
||||||
|
mAttentionLight = lights.getLight(LightsService.LIGHT_ID_ATTENTION);
|
||||||
|
|
||||||
mHandlerThread = new HandlerThread("PowerManagerService") {
|
mHandlerThread = new HandlerThread("PowerManagerService") {
|
||||||
@Override
|
@Override
|
||||||
protected void onLooperPrepared() {
|
protected void onLooperPrepared() {
|
||||||
@@ -1362,13 +1371,8 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
enableLightSensor(on);
|
enableLightSensor(on);
|
||||||
if (!on) {
|
if (!on) {
|
||||||
// make sure button and key backlights are off too
|
// make sure button and key backlights are off too
|
||||||
int brightnessMode = (mUseSoftwareAutoBrightness
|
mButtonLight.turnOff();
|
||||||
? LightsService.BRIGHTNESS_MODE_SENSOR
|
mKeyboardLight.turnOff();
|
||||||
: LightsService.BRIGHTNESS_MODE_USER);
|
|
||||||
mLightsService.setLightBrightness(LightsService.LIGHT_ID_BUTTONS, 0,
|
|
||||||
brightnessMode);
|
|
||||||
mLightsService.setLightBrightness(LightsService.LIGHT_ID_KEYBOARD, 0,
|
|
||||||
brightnessMode);
|
|
||||||
// clear current value so we will update based on the new conditions
|
// clear current value so we will update based on the new conditions
|
||||||
// when the sensor is reenabled.
|
// when the sensor is reenabled.
|
||||||
mLightSensorValue = -1;
|
mLightSensorValue = -1;
|
||||||
@@ -1723,19 +1727,13 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
? LightsService.BRIGHTNESS_MODE_SENSOR
|
? LightsService.BRIGHTNESS_MODE_SENSOR
|
||||||
: LightsService.BRIGHTNESS_MODE_USER);
|
: LightsService.BRIGHTNESS_MODE_USER);
|
||||||
if ((mask & SCREEN_BRIGHT_BIT) != 0) {
|
if ((mask & SCREEN_BRIGHT_BIT) != 0) {
|
||||||
mLightsService.setLightBrightness(LightsService.LIGHT_ID_BACKLIGHT, value,
|
mLcdLight.setBrightness(value, brightnessMode);
|
||||||
brightnessMode);
|
|
||||||
}
|
}
|
||||||
brightnessMode = (mUseSoftwareAutoBrightness
|
|
||||||
? LightsService.BRIGHTNESS_MODE_SENSOR
|
|
||||||
: LightsService.BRIGHTNESS_MODE_USER);
|
|
||||||
if ((mask & BUTTON_BRIGHT_BIT) != 0) {
|
if ((mask & BUTTON_BRIGHT_BIT) != 0) {
|
||||||
mLightsService.setLightBrightness(LightsService.LIGHT_ID_BUTTONS, value,
|
mButtonLight.setBrightness(value);
|
||||||
brightnessMode);
|
|
||||||
}
|
}
|
||||||
if ((mask & KEYBOARD_BRIGHT_BIT) != 0) {
|
if ((mask & KEYBOARD_BRIGHT_BIT) != 0) {
|
||||||
mLightsService.setLightBrightness(LightsService.LIGHT_ID_KEYBOARD, value,
|
mKeyboardLight.setBrightness(value);
|
||||||
brightnessMode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2083,8 +2081,7 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
int brightnessMode = (mAutoBrightessEnabled
|
int brightnessMode = (mAutoBrightessEnabled
|
||||||
? LightsService.BRIGHTNESS_MODE_SENSOR
|
? LightsService.BRIGHTNESS_MODE_SENSOR
|
||||||
: LightsService.BRIGHTNESS_MODE_USER);
|
: LightsService.BRIGHTNESS_MODE_USER);
|
||||||
mLightsService.setLightBrightness(LightsService.LIGHT_ID_BACKLIGHT,
|
mLcdLight.setBrightness(lcdValue, brightnessMode);
|
||||||
lcdValue, brightnessMode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mButtonBrightnessOverride < 0) {
|
if (mButtonBrightnessOverride < 0) {
|
||||||
@@ -2095,11 +2092,7 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
startAnimation = true;
|
startAnimation = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int brightnessMode = (mUseSoftwareAutoBrightness
|
mButtonLight.setBrightness(buttonValue);
|
||||||
? LightsService.BRIGHTNESS_MODE_SENSOR
|
|
||||||
: LightsService.BRIGHTNESS_MODE_USER);
|
|
||||||
mLightsService.setLightBrightness(LightsService.LIGHT_ID_BUTTONS,
|
|
||||||
buttonValue, brightnessMode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mButtonBrightnessOverride < 0 || !mKeyboardVisible) {
|
if (mButtonBrightnessOverride < 0 || !mKeyboardVisible) {
|
||||||
@@ -2110,11 +2103,7 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
startAnimation = true;
|
startAnimation = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int brightnessMode = (mUseSoftwareAutoBrightness
|
mKeyboardLight.setBrightness(keyboardValue);
|
||||||
? LightsService.BRIGHTNESS_MODE_SENSOR
|
|
||||||
: LightsService.BRIGHTNESS_MODE_USER);
|
|
||||||
mLightsService.setLightBrightness(LightsService.LIGHT_ID_KEYBOARD,
|
|
||||||
keyboardValue, brightnessMode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (startAnimation) {
|
if (startAnimation) {
|
||||||
@@ -2443,12 +2432,9 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
|
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
|
||||||
// Don't let applications turn the screen all the way off
|
// Don't let applications turn the screen all the way off
|
||||||
brightness = Math.max(brightness, Power.BRIGHTNESS_DIM);
|
brightness = Math.max(brightness, Power.BRIGHTNESS_DIM);
|
||||||
mLightsService.setLightBrightness(LightsService.LIGHT_ID_BACKLIGHT, brightness,
|
mLcdLight.setBrightness(brightness);
|
||||||
LightsService.BRIGHTNESS_MODE_USER);
|
mKeyboardLight.setBrightness(mKeyboardVisible ? brightness : 0);
|
||||||
mLightsService.setLightBrightness(LightsService.LIGHT_ID_KEYBOARD,
|
mButtonLight.setBrightness(brightness);
|
||||||
(mKeyboardVisible ? brightness : 0), LightsService.BRIGHTNESS_MODE_USER);
|
|
||||||
mLightsService.setLightBrightness(LightsService.LIGHT_ID_BUTTONS, brightness,
|
|
||||||
LightsService.BRIGHTNESS_MODE_USER);
|
|
||||||
long identity = Binder.clearCallingIdentity();
|
long identity = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
mBatteryStats.noteScreenBrightness(brightness);
|
mBatteryStats.noteScreenBrightness(brightness);
|
||||||
@@ -2478,7 +2464,7 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
|
|
||||||
public void setAttentionLight(boolean on, int color) {
|
public void setAttentionLight(boolean on, int color) {
|
||||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
|
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
|
||||||
mLightsService.setAttentionLight(on, color);
|
mAttentionLight.setFlashing(color, LightsService.LIGHT_FLASH_HARDWARE, (on ? 3 : 0), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProximityLockLocked() {
|
private void enableProximityLockLocked() {
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ enum {
|
|||||||
LIGHT_INDEX_BATTERY = 3,
|
LIGHT_INDEX_BATTERY = 3,
|
||||||
LIGHT_INDEX_NOTIFICATIONS = 4,
|
LIGHT_INDEX_NOTIFICATIONS = 4,
|
||||||
LIGHT_INDEX_ATTENTION = 5,
|
LIGHT_INDEX_ATTENTION = 5,
|
||||||
|
LIGHT_INDEX_BLUETOOTH = 6,
|
||||||
|
LIGHT_INDEX_WIFI = 7,
|
||||||
LIGHT_COUNT
|
LIGHT_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -80,6 +82,10 @@ static jint init_native(JNIEnv *env, jobject clazz)
|
|||||||
= get_device(module, LIGHT_ID_NOTIFICATIONS);
|
= get_device(module, LIGHT_ID_NOTIFICATIONS);
|
||||||
devices->lights[LIGHT_INDEX_ATTENTION]
|
devices->lights[LIGHT_INDEX_ATTENTION]
|
||||||
= get_device(module, LIGHT_ID_ATTENTION);
|
= get_device(module, LIGHT_ID_ATTENTION);
|
||||||
|
devices->lights[LIGHT_INDEX_BLUETOOTH]
|
||||||
|
= get_device(module, LIGHT_ID_BLUETOOTH);
|
||||||
|
devices->lights[LIGHT_INDEX_WIFI]
|
||||||
|
= get_device(module, LIGHT_ID_WIFI);
|
||||||
} else {
|
} else {
|
||||||
memset(devices, 0, sizeof(Devices));
|
memset(devices, 0, sizeof(Devices));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user