Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e51b6e1c authored by Robin Lee's avatar Robin Lee
Browse files

Rename LightsManager.setLights to requestLights

Per API feedback on clarifying that while we strive our best to provide
excellent service to our customers, we cannot fulfil all of their orders
at once.

Fix: 150332011
Change-Id: Iac156ea5cb312cce16fbaf10fc1f8bcd6743d377
parent bc55a100
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2938,7 +2938,7 @@ package android.hardware.lights {
  public final class LightsManager.LightsSession implements java.lang.AutoCloseable {
    method @RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_LIGHTS) public void close();
    method @RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_LIGHTS) public void setLights(@NonNull android.hardware.lights.LightsRequest);
    method @RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_LIGHTS) public void requestLights(@NonNull android.hardware.lights.LightsRequest);
  }
  public final class LightsRequest {
+1 −1
Original line number Diff line number Diff line
@@ -1278,7 +1278,7 @@ package android.hardware.lights {

  public final class LightsManager.LightsSession implements java.lang.AutoCloseable {
    method @RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_LIGHTS) public void close();
    method @RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_LIGHTS) public void setLights(@NonNull android.hardware.lights.LightsRequest);
    method @RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_LIGHTS) public void requestLights(@NonNull android.hardware.lights.LightsRequest);
  }

  public final class LightsRequest {
+21 −6
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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 {
+1 −1
Original line number Diff line number Diff line
@@ -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);
Loading