summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/hardware/lights/Light.java27
-rw-r--r--core/java/android/hardware/lights/LightsManager.java2
-rw-r--r--core/java/android/hardware/lights/LightsRequest.java2
3 files changed, 23 insertions, 8 deletions
diff --git a/core/java/android/hardware/lights/Light.java b/core/java/android/hardware/lights/Light.java
index c5cb8037d4db..e90b57cdc7b4 100644
--- a/core/java/android/hardware/lights/Light.java
+++ b/core/java/android/hardware/lights/Light.java
@@ -37,7 +37,8 @@ public final class Light implements Parcelable {
/**
* Creates a new light with the given data.
*
- * @hide */
+ * @hide
+ */
public Light(int id, int ordinal, int type) {
mId = id;
mOrdinal = ordinal;
@@ -76,8 +77,24 @@ public final class Light implements Parcelable {
}
};
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Light) {
+ Light light = (Light) obj;
+ return mId == light.mId && mOrdinal == light.mOrdinal && mType == light.mType;
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return mId;
+ }
+
/**
* Returns the id of the light.
+ *
+ * <p>This is an opaque value used as a unique identifier for the light.
*/
public int getId() {
return mId;
@@ -86,11 +103,9 @@ public final class Light implements Parcelable {
/**
* Returns the ordinal of the light.
*
- * <p>This represents the physical order of the lights on the device. The exact values are
- * device-dependent, but for example, if there are lights in a row, sorting the Light objects
- * by ordinal should match the order in which they appear on the device. If the device has
- * 4 lights, the ordinals could be [1, 2, 3, 4] or [0, 10, 20, 30] or any other values that
- * have the same sort order.
+ * <p>This is a sort key that represents the physical order of lights on the device with the
+ * same type. In the case of multiple lights arranged in a line, for example, the ordinals
+ * could be [1, 2, 3, 4], or [0, 10, 20, 30], or any other values that have the same sort order.
*/
public int getOrdinal() {
return mOrdinal;
diff --git a/core/java/android/hardware/lights/LightsManager.java b/core/java/android/hardware/lights/LightsManager.java
index 1bc051b977a8..8cd231224472 100644
--- a/core/java/android/hardware/lights/LightsManager.java
+++ b/core/java/android/hardware/lights/LightsManager.java
@@ -161,7 +161,7 @@ public final class LightsManager {
* @param request the settings for lights that should change
*/
@RequiresPermission(Manifest.permission.CONTROL_DEVICE_LIGHTS)
- public void setLights(@NonNull LightsRequest request) {
+ public void requestLights(@NonNull LightsRequest request) {
Preconditions.checkNotNull(request);
if (!mClosed) {
try {
diff --git a/core/java/android/hardware/lights/LightsRequest.java b/core/java/android/hardware/lights/LightsRequest.java
index a36da4c7d85d..5c4fc6707e96 100644
--- a/core/java/android/hardware/lights/LightsRequest.java
+++ b/core/java/android/hardware/lights/LightsRequest.java
@@ -86,7 +86,7 @@ public final class LightsRequest {
* Create a LightsRequest object used to override lights on the device.
*
* <p>The generated {@link LightsRequest} should be used in
- * {@link LightsManager.Session#setLights(LightsLightsRequest).
+ * {@link LightsManager.Session#requestLights(LightsLightsRequest).
*/
public @NonNull LightsRequest build() {
return new LightsRequest(mChanges);