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

Commit ce069c5e authored by Alexander Dorokhine's avatar Alexander Dorokhine Committed by Android (Google) Code Review
Browse files

Merge "Update framework from Jetpack." into sc-dev

parents 19d9124f 158ffacc
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -208,8 +208,8 @@ package android.app.appsearch {
    ctor public GetByUriRequest.Builder();
    method @NonNull public android.app.appsearch.GetByUriRequest.Builder addProjection(@NonNull String, @NonNull java.lang.String...);
    method @NonNull public android.app.appsearch.GetByUriRequest.Builder addProjection(@NonNull String, @NonNull java.util.Collection<java.lang.String>);
    method @NonNull public android.app.appsearch.GetByUriRequest.Builder addUri(@NonNull java.lang.String...);
    method @NonNull public android.app.appsearch.GetByUriRequest.Builder addUri(@NonNull java.util.Collection<java.lang.String>);
    method @NonNull public android.app.appsearch.GetByUriRequest.Builder addUris(@NonNull java.lang.String...);
    method @NonNull public android.app.appsearch.GetByUriRequest.Builder addUris(@NonNull java.util.Collection<java.lang.String>);
    method @NonNull public android.app.appsearch.GetByUriRequest build();
    method @NonNull public android.app.appsearch.GetByUriRequest.Builder setNamespace(@NonNull String);
  }
@@ -243,8 +243,8 @@ package android.app.appsearch {

  public static final class RemoveByUriRequest.Builder {
    ctor public RemoveByUriRequest.Builder();
    method @NonNull public android.app.appsearch.RemoveByUriRequest.Builder addUri(@NonNull java.lang.String...);
    method @NonNull public android.app.appsearch.RemoveByUriRequest.Builder addUri(@NonNull java.util.Collection<java.lang.String>);
    method @NonNull public android.app.appsearch.RemoveByUriRequest.Builder addUris(@NonNull java.lang.String...);
    method @NonNull public android.app.appsearch.RemoveByUriRequest.Builder addUris(@NonNull java.util.Collection<java.lang.String>);
    method @NonNull public android.app.appsearch.RemoveByUriRequest build();
    method @NonNull public android.app.appsearch.RemoveByUriRequest.Builder setNamespace(@NonNull String);
  }
+3 −3
Original line number Diff line number Diff line
@@ -122,14 +122,14 @@ public final class GetByUriRequest {

        /** Adds one or more URIs to the request. */
        @NonNull
        public Builder addUri(@NonNull String... uris) {
        public Builder addUris(@NonNull String... uris) {
            Preconditions.checkNotNull(uris);
            return addUri(Arrays.asList(uris));
            return addUris(Arrays.asList(uris));
        }

        /** Adds one or more URIs to the request. */
        @NonNull
        public Builder addUri(@NonNull Collection<String> uris) {
        public Builder addUris(@NonNull Collection<String> uris) {
            Preconditions.checkState(!mBuilt, "Builder has already been used");
            Preconditions.checkNotNull(uris);
            mUris.addAll(uris);
+3 −3
Original line number Diff line number Diff line
@@ -73,14 +73,14 @@ public final class RemoveByUriRequest {

        /** Adds one or more URIs to the request. */
        @NonNull
        public Builder addUri(@NonNull String... uris) {
        public Builder addUris(@NonNull String... uris) {
            Preconditions.checkNotNull(uris);
            return addUri(Arrays.asList(uris));
            return addUris(Arrays.asList(uris));
        }

        /** Adds one or more URIs to the request. */
        @NonNull
        public Builder addUri(@NonNull Collection<String> uris) {
        public Builder addUris(@NonNull Collection<String> uris) {
            Preconditions.checkState(!mBuilt, "Builder has already been used");
            Preconditions.checkNotNull(uris);
            mUris.addAll(uris);
+3 −3
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ public class SetSchemaResponse {

        /** Adds deletedTypes to the list of deleted schema types. */
        @NonNull
        public Builder addDeletedType(@NonNull Collection<String> deletedTypes) {
        public Builder addDeletedTypes(@NonNull Collection<String> deletedTypes) {
            Preconditions.checkState(!mBuilt, "Builder has already been used");
            mDeletedTypes.addAll(Preconditions.checkNotNull(deletedTypes));
            return this;
@@ -171,7 +171,7 @@ public class SetSchemaResponse {

        /** Adds incompatibleTypes to the list of incompatible schema types. */
        @NonNull
        public Builder addIncompatibleType(@NonNull Collection<String> incompatibleTypes) {
        public Builder addIncompatibleTypes(@NonNull Collection<String> incompatibleTypes) {
            Preconditions.checkState(!mBuilt, "Builder has already been used");
            mIncompatibleTypes.addAll(Preconditions.checkNotNull(incompatibleTypes));
            return this;
@@ -179,7 +179,7 @@ public class SetSchemaResponse {

        /** Adds migratedTypes to the list of migrated schema types. */
        @NonNull
        public Builder addMigratedType(@NonNull Collection<String> migratedTypes) {
        public Builder addMigratedTypes(@NonNull Collection<String> migratedTypes) {
            Preconditions.checkState(!mBuilt, "Builder has already been used");
            mMigratedTypes.addAll(Preconditions.checkNotNull(migratedTypes));
            return this;
+24 −18
Original line number Diff line number Diff line
@@ -147,35 +147,41 @@ public final class BundleUtil {
        if (bundle == null) {
            return 0;
        }
        int[] hashCodes = new int[bundle.size()];
        int i = 0;
        int[] hashCodes = new int[bundle.size() + 1];
        int hashCodeIdx = 0;
        // Bundle inherit its hashCode() from Object.java, which only relative to their memory
        // address. Bundle doesn't have an order, so we should iterate all keys and combine
        // their value's hashcode into an array. And use the hashcode of the array to be
        // the hashcode of the bundle.
        for (String key : bundle.keySet()) {
            Object value = bundle.get(key);
        // Because bundle.keySet() doesn't guarantee any particular order, we need to sort the keys
        // in case the iteration order varies from run to run.
        String[] keys = bundle.keySet().toArray(new String[0]);
        Arrays.sort(keys);
        // Hash the keys so we can detect key-only differences
        hashCodes[hashCodeIdx++] = Arrays.hashCode(keys);
        for (int keyIdx = 0; keyIdx < keys.length; keyIdx++) {
            Object value = bundle.get(keys[keyIdx]);
            if (value instanceof Bundle) {
                hashCodes[i++] = deepHashCode((Bundle) value);
                hashCodes[hashCodeIdx++] = deepHashCode((Bundle) value);
            } else if (value instanceof int[]) {
                hashCodes[i++] = Arrays.hashCode((int[]) value);
                hashCodes[hashCodeIdx++] = Arrays.hashCode((int[]) value);
            } else if (value instanceof byte[]) {
                hashCodes[i++] = Arrays.hashCode((byte[]) value);
                hashCodes[hashCodeIdx++] = Arrays.hashCode((byte[]) value);
            } else if (value instanceof char[]) {
                hashCodes[i++] = Arrays.hashCode((char[]) value);
                hashCodes[hashCodeIdx++] = Arrays.hashCode((char[]) value);
            } else if (value instanceof long[]) {
                hashCodes[i++] = Arrays.hashCode((long[]) value);
                hashCodes[hashCodeIdx++] = Arrays.hashCode((long[]) value);
            } else if (value instanceof float[]) {
                hashCodes[i++] = Arrays.hashCode((float[]) value);
                hashCodes[hashCodeIdx++] = Arrays.hashCode((float[]) value);
            } else if (value instanceof short[]) {
                hashCodes[i++] = Arrays.hashCode((short[]) value);
                hashCodes[hashCodeIdx++] = Arrays.hashCode((short[]) value);
            } else if (value instanceof double[]) {
                hashCodes[i++] = Arrays.hashCode((double[]) value);
                hashCodes[hashCodeIdx++] = Arrays.hashCode((double[]) value);
            } else if (value instanceof boolean[]) {
                hashCodes[i++] = Arrays.hashCode((boolean[]) value);
                hashCodes[hashCodeIdx++] = Arrays.hashCode((boolean[]) value);
            } else if (value instanceof String[]) {
                // Optimization to avoid Object[] handler creating an inner array for common cases
                hashCodes[i++] = Arrays.hashCode((String[]) value);
                hashCodes[hashCodeIdx++] = Arrays.hashCode((String[]) value);
            } else if (value instanceof Object[]) {
                Object[] array = (Object[]) value;
                int[] innerHashCodes = new int[array.length];
@@ -186,7 +192,7 @@ public final class BundleUtil {
                        innerHashCodes[j] = array[j].hashCode();
                    }
                }
                hashCodes[i++] = Arrays.hashCode(innerHashCodes);
                hashCodes[hashCodeIdx++] = Arrays.hashCode(innerHashCodes);
            } else if (value instanceof ArrayList) {
                ArrayList<?> list = (ArrayList<?>) value;
                int[] innerHashCodes = new int[list.size()];
@@ -198,7 +204,7 @@ public final class BundleUtil {
                        innerHashCodes[j] = item.hashCode();
                    }
                }
                hashCodes[i++] = Arrays.hashCode(innerHashCodes);
                hashCodes[hashCodeIdx++] = Arrays.hashCode(innerHashCodes);
            } else if (value instanceof SparseArray) {
                SparseArray<?> array = (SparseArray<?>) value;
                int[] innerHashCodes = new int[array.size() * 2];
@@ -211,9 +217,9 @@ public final class BundleUtil {
                        innerHashCodes[j * 2 + 1] = item.hashCode();
                    }
                }
                hashCodes[i++] = Arrays.hashCode(innerHashCodes);
                hashCodes[hashCodeIdx++] = Arrays.hashCode(innerHashCodes);
            } else {
                hashCodes[i++] = value.hashCode();
                hashCodes[hashCodeIdx++] = value.hashCode();
            }
        }
        return Arrays.hashCode(hashCodes);
Loading