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

Commit b5003545 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Rename Light to LogicalLight to avoid namespace conflicts when adding am: b19593a5

Change-Id: I734544eaed5e6f97175bb53e29ed4225c4784a0f
parents 37de3bd1 b19593a5
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -66,8 +66,8 @@ import com.android.internal.app.IBatteryStats;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.util.DumpUtils;
import com.android.server.am.BatteryStatsService;
import com.android.server.lights.Light;
import com.android.server.lights.LightsManager;
import com.android.server.lights.LogicalLight;

import java.io.File;
import java.io.FileDescriptor;
@@ -1063,7 +1063,7 @@ public final class BatteryService extends SystemService {
    }

    private final class Led {
        private final Light mBatteryLight;
        private final LogicalLight mBatteryLight;

        private final int mBatteryLowARGB;
        private final int mBatteryMediumARGB;
@@ -1098,7 +1098,7 @@ public final class BatteryService extends SystemService {
                    mBatteryLight.setColor(mBatteryLowARGB);
                } else {
                    // Flash red when battery is low and not charging
                    mBatteryLight.setFlashing(mBatteryLowARGB, Light.LIGHT_FLASH_TIMED,
                    mBatteryLight.setFlashing(mBatteryLowARGB, LogicalLight.LIGHT_FLASH_TIMED,
                            mBatteryLedOn, mBatteryLedOff);
                }
            } else if (status == BatteryManager.BATTERY_STATUS_CHARGING
+2 −2
Original line number Diff line number Diff line
@@ -38,8 +38,8 @@ import android.view.Surface;
import android.view.SurfaceControl;

import com.android.server.LocalServices;
import com.android.server.lights.Light;
import com.android.server.lights.LightsManager;
import com.android.server.lights.LogicalLight;

import java.io.PrintWriter;
import java.util.ArrayList;
@@ -160,7 +160,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {

    private final class LocalDisplayDevice extends DisplayDevice {
        private final long mPhysicalDisplayId;
        private final Light mBacklight;
        private final LogicalLight mBacklight;
        private final SparseArray<DisplayModeRecord> mSupportedModes = new SparseArray<>();
        private final ArrayList<Integer> mSupportedColorModes = new ArrayList<>();
        private final boolean mIsInternal;
+4 −1
Original line number Diff line number Diff line
@@ -29,5 +29,8 @@ public abstract class LightsManager {
    public static final int LIGHT_ID_WIFI = Type.WIFI;
    public static final int LIGHT_ID_COUNT = Type.COUNT;

    public abstract Light getLight(int id);
    /**
     * Returns the logical light with the given type.
     */
    public abstract LogicalLight getLight(int id);
}
+2 −2
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ public class LightsService extends SystemService {

    final LightImpl mLights[] = new LightImpl[LightsManager.LIGHT_ID_COUNT];

    private final class LightImpl extends Light {
    private final class LightImpl extends LogicalLight {

        private final IBinder mDisplayToken;
        private final int mSurfaceControlMaximumBrightness;
@@ -231,7 +231,7 @@ public class LightsService extends SystemService {

    private final LightsManager mService = new LightsManager() {
        @Override
        public Light getLight(int id) {
        public LogicalLight getLight(int id) {
            if (0 <= id && id < LIGHT_ID_COUNT) {
                return mLights[id];
            } else {
+39 −1
Original line number Diff line number Diff line
@@ -19,9 +19,24 @@ package com.android.server.lights;
import android.hardware.light.V2_0.Brightness;
import android.hardware.light.V2_0.Flash;

public abstract class Light {
/**
 * Allow control over a logical light of a given type. The mapping of logical lights to physical
 * lights is HAL implementation-dependent.
 */
public abstract class LogicalLight {
    /**
     * Keep the light steady on or off.
     */
    public static final int LIGHT_FLASH_NONE = Flash.NONE;

    /**
     * Flash the light at specified rate.
     */
    public static final int LIGHT_FLASH_TIMED = Flash.TIMED;

    /**
     * Flash the light using hardware assist.
     */
    public static final int LIGHT_FLASH_HARDWARE = Flash.HARDWARE;

    /**
@@ -49,10 +64,33 @@ public abstract class Light {
     */
    public abstract void setBrightness(int brightness, int brightnessMode);

    /**
     * Set the color of a light.
     */
    public abstract void setColor(int color);

    /**
     * Set the color of a light and control flashing.
     */
    public abstract void setFlashing(int color, int mode, int onMS, int offMS);

    /**
     * Pulses the light.
     */
    public abstract void pulse();

    /**
     * Pulses the light with a specified color for a specified duration.
     */
    public abstract void pulse(int color, int onMS);

    /**
     * Turns off the light.
     */
    public abstract void turnOff();

    /**
     * Set the VR mode of a display.
     */
    public abstract void setVrMode(boolean enabled);
}
Loading