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

Commit 204b5e15 authored by Alec Mouri's avatar Alec Mouri
Browse files

Remove exposed hidden apis in Point.java

Point is moving into the UI/graphics module, so hidden apis need to be
cleaned up:
* printShortString is now publicly exposed and renamed to Point#dump, to
mirror already public APIs such as TokenWatcher#dump
* The two convert methods have very few users and their implementations
are both trivial and only rely on the existing public API, so they are
in-lined directly in the callers.
* Introduce a GraphicsProtos utility class living outside of the module
that just converts Graphics parcelables into protobuf objects. Currently
WindowManager and the view system dump protobuf representations for
debugging. Accordingly GraphicsProtos is a hidden public class, as the
protobuf representation of the graphics classes are not publicly
exposed and should be considered an implementation detail of the system.

Bug: 152804266
Test: boots, builds
Change-Id: I5e25dbbe47b3c690d7d763a0082beb8d8a9c86d3
parent 9161b022
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -15276,6 +15276,7 @@ package android.graphics {
    ctor public Point(int, int);
    ctor public Point(@NonNull android.graphics.Point);
    method public int describeContents();
    method public final void dump(@NonNull java.io.PrintWriter);
    method public final boolean equals(int, int);
    method public final void negate();
    method public final void offset(int, int);
+1 −1
Original line number Diff line number Diff line
@@ -4013,7 +4013,7 @@ public abstract class ContentResolver implements ContentInterface {

        // Convert to Point, since that's what the API is defined as
        final Bundle opts = new Bundle();
        opts.putParcelable(EXTRA_SIZE, Point.convert(size));
        opts.putParcelable(EXTRA_SIZE, new Point(size.getWidth(), size.getHeight()));
        final Int32Ref orientation = new Int32Ref(0);

        Bitmap bitmap = ImageDecoder.decodeBitmap(ImageDecoder.createSource(() -> {
+3 −2
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import android.os.ParcelableException;
import android.os.RemoteException;
import android.os.UserHandle;
import android.util.Log;
import android.util.Size;

import com.android.internal.util.Preconditions;

@@ -1341,8 +1342,8 @@ public final class DocumentsContract {
            @NonNull Uri documentUri, @NonNull Point size, @Nullable CancellationSignal signal)
            throws FileNotFoundException {
        try {
            return ContentResolver.loadThumbnail(content, documentUri, Point.convert(size), signal,
                    ImageDecoder.ALLOCATOR_SOFTWARE);
            return ContentResolver.loadThumbnail(content, documentUri, new Size(size.x, size.y),
                    signal, ImageDecoder.ALLOCATOR_SOFTWARE);
        } catch (Exception e) {
            if (!(e instanceof OperationCanceledException)) {
                Log.w(TAG, "Failed to load thumbnail for " + documentUri + ": " + e);
+3 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view;

import static android.graphics.GraphicsProtos.dumpPointProto;
import static android.view.RemoteAnimationTargetProto.CLIP_RECT;
import static android.view.RemoteAnimationTargetProto.CONTENT_INSETS;
import static android.view.RemoteAnimationTargetProto.IS_TRANSLUCENT;
@@ -255,7 +256,7 @@ public class RemoteAnimationTarget implements Parcelable {
        pw.print(" clipRect="); clipRect.printShortString(pw);
        pw.print(" contentInsets="); contentInsets.printShortString(pw);
        pw.print(" prefixOrderIndex="); pw.print(prefixOrderIndex);
        pw.print(" position="); position.printShortString(pw);
        pw.print(" position="); position.dump(pw);
        pw.print(" sourceContainerBounds="); sourceContainerBounds.printShortString(pw);
        pw.print(" screenSpaceBounds="); screenSpaceBounds.printShortString(pw);
        pw.print(" localBounds="); localBounds.printShortString(pw);
@@ -273,7 +274,7 @@ public class RemoteAnimationTarget implements Parcelable {
        clipRect.dumpDebug(proto, CLIP_RECT);
        contentInsets.dumpDebug(proto, CONTENT_INSETS);
        proto.write(PREFIX_ORDER_INDEX, prefixOrderIndex);
        position.dumpDebug(proto, POSITION);
        dumpPointProto(position, proto, POSITION);
        sourceContainerBounds.dumpDebug(proto, SOURCE_CONTAINER_BOUNDS);
        screenSpaceBounds.dumpDebug(proto, SCREEN_SPACE_BOUNDS);
        localBounds.dumpDebug(proto, LOCAL_BOUNDS);
+2 −1
Original line number Diff line number Diff line
@@ -201,7 +201,8 @@ public class ImageUtils {

        try (ContentProviderClient client = resolver.acquireContentProviderClient(uri)) {
            final Bundle opts = new Bundle();
            opts.putParcelable(ContentResolver.EXTRA_SIZE, Point.convert(size));
            opts.putParcelable(ContentResolver.EXTRA_SIZE,
                    new Point(size.getWidth(), size.getHeight()));

            return ImageDecoder.decodeBitmap(ImageDecoder.createSource(() -> {
                return client.openTypedAssetFile(uri, "image/*", opts, null);
Loading