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

Commit 369e6eb9 authored by Eric Miao's avatar Eric Miao
Browse files

Use readonly flag of native_metrics for HardwareBuffer

Bug: 368409430
Flag: EXEMPT bugfix

In this CL, we used 'com.android.libcore.readonly.Flags.nativeMetrics()'
instead, this flag is forced-read-only which does not involve I/O, thus
preventing failures such as in "Isolated Process" where I/O permission
is disabled. See ag/29673659.

Change-Id: Ic48c26ba2810c405c7ca0ca93faf23ed04001336
parent ba9dad3d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -283,7 +283,7 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable {
    private static NativeAllocationRegistry getRegistry(long size) {
        final long func = nGetNativeFinalizer();
        final Class cls = HardwareBuffer.class;
        return com.android.libcore.Flags.nativeMetrics()
        return com.android.libcore.readonly.Flags.nativeMetrics()
            ? NativeAllocationRegistry.createNonmalloced(cls, func, size)
            : NativeAllocationRegistry.createNonmalloced(cls.getClassLoader(), func, size);
    }