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

Commit c4a819f5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

Merge "Replace com.android.internal.util.Preconditions.checkNotNull with java.util.Objects.requireNonNull"
parents 58a3e64b 0eb0a776
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -50,8 +50,6 @@ import android.util.Size;
import android.util.SparseArray;
import android.view.Surface;

import com.android.internal.util.Preconditions;

import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.Collection;
@@ -60,6 +58,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -2482,7 +2481,7 @@ public class CameraDeviceImpl extends CameraDevice
        private final Handler mHandler;

        public CameraHandlerExecutor(@NonNull Handler handler) {
            mHandler = Preconditions.checkNotNull(handler);
            mHandler = Objects.requireNonNull(handler);
        }

        @Override
+2 −3
Original line number Diff line number Diff line
@@ -73,14 +73,13 @@ import android.util.Log;
import android.util.Range;
import android.util.Size;

import com.android.internal.util.Preconditions;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;

/**
 * Implementation of camera metadata marshal/unmarshal across Binder to
@@ -432,7 +431,7 @@ public class CameraMetadataNative implements Parcelable {
     * @return the field corresponding to the {@code key}, or {@code null} if no value was set
     */
    public <T> T get(Key<T> key) {
        Preconditions.checkNotNull(key, "key must not be null");
        Objects.requireNonNull(key, "key must not be null");

        // Check if key has been overridden to use a wrapper class on the java side.
        GetCommand g = sGetCommandMap.get(key);
+2 −3
Original line number Diff line number Diff line
@@ -16,9 +16,8 @@

package android.hardware.camera2.params;

import static com.android.internal.util.Preconditions.checkNotNull;

import java.util.Arrays;
import java.util.Objects;

/**
 * Immutable class to store a 4-element vector of integers corresponding to a 2x2 pattern
@@ -88,7 +87,7 @@ public final class BlackLevelPattern {
     * @throws NullPointerException if the destination is null.
     */
    public void copyTo(int[] destination, int offset) {
        checkNotNull(destination, "destination must not be null");
        Objects.requireNonNull(destination, "destination must not be null");
        if (offset < 0) {
            throw new IllegalArgumentException("Null offset passed to copyTo");
        }
+3 −3
Original line number Diff line number Diff line
@@ -25,12 +25,12 @@ import static android.hardware.camera2.params.RggbChannelVector.RED;
import static com.android.internal.util.Preconditions.checkArgumentNonnegative;
import static com.android.internal.util.Preconditions.checkArgumentPositive;
import static com.android.internal.util.Preconditions.checkArrayElementsInRange;
import static com.android.internal.util.Preconditions.checkNotNull;

import android.hardware.camera2.CaptureResult;
import android.hardware.camera2.utils.HashCodeHelpers;

import java.util.Arrays;
import java.util.Objects;

/**
 * Immutable class for describing a {@code 4 x N x M} lens shading map of floats.
@@ -70,7 +70,7 @@ public final class LensShadingMap {

        mRows = checkArgumentPositive(rows, "rows must be positive");
        mColumns = checkArgumentPositive(columns, "columns must be positive");
        mElements = checkNotNull(elements, "elements must not be null");
        mElements = Objects.requireNonNull(elements, "elements must not be null");

        if (elements.length != getGainFactorCount()) {
            throw new IllegalArgumentException("elements must be " + getGainFactorCount() +
@@ -203,7 +203,7 @@ public final class LensShadingMap {
     */
    public void copyGainFactors(final float[] destination, final int offset) {
        checkArgumentNonnegative(offset, "offset must not be negative");
        checkNotNull(destination, "destination must not be null");
        Objects.requireNonNull(destination, "destination must not be null");
        if (destination.length + offset < getGainFactorCount()) {
            throw new ArrayIndexOutOfBoundsException("destination too small to fit elements");
        }
+3 −4
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.hardware.camera2.params;

import static com.android.internal.util.Preconditions.checkArrayElementsNotNull;
import static com.android.internal.util.Preconditions.checkNotNull;

import android.graphics.ImageFormat;
import android.graphics.PixelFormat;
@@ -491,7 +490,7 @@ public final class StreamConfigurationMap {
     * @see #isOutputSupportedFor(Surface)
     */
    public static <T> boolean isOutputSupportedFor(Class<T> klass) {
        checkNotNull(klass, "klass must not be null");
        Objects.requireNonNull(klass, "klass must not be null");

        if (klass == android.media.ImageReader.class) {
            return true;
@@ -548,7 +547,7 @@ public final class StreamConfigurationMap {
     * @see #isOutputSupportedFor(Class)
     */
    public boolean isOutputSupportedFor(Surface surface) {
        checkNotNull(surface, "surface must not be null");
        Objects.requireNonNull(surface, "surface must not be null");

        Size surfaceSize = SurfaceUtils.getSurfaceSize(surface);
        int surfaceFormat = SurfaceUtils.getSurfaceFormat(surface);
@@ -897,7 +896,7 @@ public final class StreamConfigurationMap {
     * @see PixelFormat
     */
    public long getOutputMinFrameDuration(int format, Size size) {
        checkNotNull(size, "size must not be null");
        Objects.requireNonNull(size, "size must not be null");
        checkArgumentFormatSupported(format, /*output*/true);

        return getInternalFormatDuration(imageFormatToInternal(format),
Loading