1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.lights; 18 19 import android.hardware.light.V2_0.Brightness; 20 import android.hardware.light.V2_0.Flash; 21 22 /** 23 * Allow control over a logical light of a given type. The mapping of logical lights to physical 24 * lights is HAL implementation-dependent. 25 */ 26 public abstract class LogicalLight { 27 /** 28 * Keep the light steady on or off. 29 */ 30 public static final int LIGHT_FLASH_NONE = Flash.NONE; 31 32 /** 33 * Flash the light at specified rate. 34 */ 35 public static final int LIGHT_FLASH_TIMED = Flash.TIMED; 36 37 /** 38 * Flash the light using hardware assist. 39 */ 40 public static final int LIGHT_FLASH_HARDWARE = Flash.HARDWARE; 41 42 /** 43 * Light brightness is managed by a user setting. 44 */ 45 public static final int BRIGHTNESS_MODE_USER = Brightness.USER; 46 47 /** 48 * Light brightness is managed by a light sensor. 49 */ 50 public static final int BRIGHTNESS_MODE_SENSOR = Brightness.SENSOR; 51 52 /** 53 * Low-persistence light mode. 54 */ 55 public static final int BRIGHTNESS_MODE_LOW_PERSISTENCE = Brightness.LOW_PERSISTENCE; 56 57 /** 58 * Set the brightness of a display. 59 */ setBrightness(float brightness)60 public abstract void setBrightness(float brightness); 61 62 /** 63 * Set the brightness and mode of a display. 64 */ setBrightness(float brightness, int brightnessMode)65 public abstract void setBrightness(float brightness, int brightnessMode); 66 67 /** 68 * Set the color of a light. 69 */ setColor(int color)70 public abstract void setColor(int color); 71 72 /** 73 * Set the color of a light and control flashing. 74 */ setFlashing(int color, int mode, int onMS, int offMS)75 public abstract void setFlashing(int color, int mode, int onMS, int offMS); 76 77 /** 78 * Pulses the light. 79 */ pulse()80 public abstract void pulse(); 81 82 /** 83 * Pulses the light with a specified color for a specified duration. 84 */ pulse(int color, int onMS)85 public abstract void pulse(int color, int onMS); 86 87 /** 88 * Turns off the light. 89 */ turnOff()90 public abstract void turnOff(); 91 92 /** 93 * Set the VR mode of a display. 94 */ setVrMode(boolean enabled)95 public abstract void setVrMode(boolean enabled); 96 } 97