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

Commit 8220102f authored by Daulet Zhanguzin's avatar Daulet Zhanguzin Committed by Tobias Thierer
Browse files

Replace com.android.internal.util.Preconditions.checkNotNull with

java.util.Objects.requireNonNull

Bug: 126528330

Test: Treehugger
Exempt-From-Owner-Approval: Global refactoring.
Change-Id: I4167564a5641a1409fc69a2a388701f3b2bedc97
parent 6aefe5f5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import com.android.server.display.utils.Plog;

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Objects;

/**
 * A utility to map from an ambient brightness to a display's "backlight" brightness based on the
@@ -702,7 +703,7 @@ public abstract class BrightnessMappingStrategy {
                    "Nits and backlight arrays must not be empty!");
            Preconditions.checkArgument(nits.length == backlight.length,
                    "Nits and backlight arrays must be the same length!");
            Preconditions.checkNotNull(config);
            Objects.requireNonNull(config);
            Preconditions.checkArrayElementsInRange(nits, 0, Float.MAX_VALUE, "nits");
            Preconditions.checkArrayElementsInRange(backlight,
                    PowerManager.BRIGHTNESS_OFF, PowerManager.BRIGHTNESS_ON, "backlight");
+3 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.internal.util.Preconditions;
import com.android.server.display.utils.History;

import java.io.PrintWriter;
import java.util.Objects;

/**
 * The DisplayWhiteBalanceController uses the AmbientSensor to detect changes in the ambient
@@ -139,8 +140,8 @@ abstract class AmbientSensor {


    private static void validateArguments(Handler handler, SensorManager sensorManager, int rate) {
        Preconditions.checkNotNull(handler, "handler cannot be null");
        Preconditions.checkNotNull(sensorManager, "sensorManager cannot be null");
        Objects.requireNonNull(handler, "handler cannot be null");
        Objects.requireNonNull(sensorManager, "sensorManager cannot be null");
        if (rate <= 0) {
            throw new IllegalArgumentException("rate must be positive");
        }
+6 −5
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.server.display.utils.AmbientFilter;
import com.android.server.display.utils.History;

import java.io.PrintWriter;
import java.util.Objects;

/**
 * The DisplayWhiteBalanceController drives display white-balance (automatically correcting the
@@ -475,13 +476,13 @@ public class DisplayWhiteBalanceController implements
            AmbientSensor.AmbientColorTemperatureSensor colorTemperatureSensor,
            AmbientFilter colorTemperatureFilter,
            DisplayWhiteBalanceThrottler throttler) {
        Preconditions.checkNotNull(brightnessSensor, "brightnessSensor must not be null");
        Preconditions.checkNotNull(brightnessFilter, "brightnessFilter must not be null");
        Preconditions.checkNotNull(colorTemperatureSensor,
        Objects.requireNonNull(brightnessSensor, "brightnessSensor must not be null");
        Objects.requireNonNull(brightnessFilter, "brightnessFilter must not be null");
        Objects.requireNonNull(colorTemperatureSensor,
                "colorTemperatureSensor must not be null");
        Preconditions.checkNotNull(colorTemperatureFilter,
        Objects.requireNonNull(colorTemperatureFilter,
                "colorTemperatureFilter must not be null");
        Preconditions.checkNotNull(throttler, "throttler cannot be null");
        Objects.requireNonNull(throttler, "throttler cannot be null");
    }

    private boolean enable() {
+3 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.server.display.color.ColorDisplayService.ColorDisplayServiceI
import com.android.server.display.whitebalance.DisplayWhiteBalanceController.Callbacks;

import java.io.PrintWriter;
import java.util.Objects;

/**
 * The DisplayWhiteBalanceSettings holds the state of all the settings related to
@@ -144,8 +145,8 @@ public class DisplayWhiteBalanceSettings implements
    }

    private void validateArguments(Context context, Handler handler) {
        Preconditions.checkNotNull(context, "context must not be null");
        Preconditions.checkNotNull(handler, "handler must not be null");
        Objects.requireNonNull(context, "context must not be null");
        Objects.requireNonNull(handler, "handler must not be null");
    }

    private void setEnabled(boolean enabled) {