Loading core/java/android/os/ParcelFileDescriptor.java +10 −53 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ import android.content.ContentResolver; import android.net.Uri; import android.os.MessageQueue.OnFileDescriptorEventListener; import android.ravenwood.annotation.RavenwoodKeepWholeClass; import android.ravenwood.annotation.RavenwoodNativeSubstitutionClass; import android.ravenwood.annotation.RavenwoodReplace; import android.ravenwood.annotation.RavenwoodThrow; import android.system.ErrnoException; Loading Loading @@ -77,8 +76,6 @@ import java.nio.ByteOrder; * you to close it when done with it. */ @RavenwoodKeepWholeClass @RavenwoodNativeSubstitutionClass( "com.android.platform.test.ravenwood.nativesubstitution.ParcelFileDescriptor_host") public class ParcelFileDescriptor implements Parcelable, Closeable { private static final String TAG = "ParcelFileDescriptor"; Loading Loading @@ -206,11 +203,11 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { } mWrapped = null; mFd = fd; setFdOwner(mFd); IoUtils.setFdOwner(mFd, this); mCommFd = commChannel; if (mCommFd != null) { setFdOwner(mCommFd); IoUtils.setFdOwner(mCommFd, this); } mGuard.open("close"); Loading Loading @@ -298,7 +295,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { public static @NonNull ParcelFileDescriptor wrap(@NonNull ParcelFileDescriptor pfd, @NonNull Handler handler, @NonNull OnCloseListener listener) throws IOException { final FileDescriptor original = new FileDescriptor(); setFdInt(original, pfd.detachFd()); original.setInt$(pfd.detachFd()); return fromFd(original, handler, listener); } Loading Loading @@ -363,18 +360,10 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { } } @RavenwoodReplace private static void closeInternal(FileDescriptor fd) { IoUtils.closeQuietly(fd); } private static void closeInternal$ravenwood(FileDescriptor fd) { try { Os.close(fd); } catch (ErrnoException ignored) { } } /** * Create a new ParcelFileDescriptor that is a dup of an existing * FileDescriptor. This obeys standard POSIX semantics, where the Loading @@ -385,7 +374,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { try { final FileDescriptor fd = new FileDescriptor(); int intfd = Os.fcntlInt(orig, (isAtLeastQ() ? F_DUPFD_CLOEXEC : F_DUPFD), 0); setFdInt(fd, intfd); fd.setInt$(intfd); return new ParcelFileDescriptor(fd); } catch (ErrnoException e) { throw e.rethrowAsIOException(); Loading Loading @@ -418,12 +407,12 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { */ public static ParcelFileDescriptor fromFd(int fd) throws IOException { final FileDescriptor original = new FileDescriptor(); setFdInt(original, fd); original.setInt$(fd); try { final FileDescriptor dup = new FileDescriptor(); int intfd = Os.fcntlInt(original, (isAtLeastQ() ? F_DUPFD_CLOEXEC : F_DUPFD), 0); setFdInt(dup, intfd); dup.setInt$(intfd); return new ParcelFileDescriptor(dup); } catch (ErrnoException e) { throw e.rethrowAsIOException(); Loading @@ -446,7 +435,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { */ public static ParcelFileDescriptor adoptFd(int fd) { final FileDescriptor fdesc = new FileDescriptor(); setFdInt(fdesc, fd); fdesc.setInt$(fd); return new ParcelFileDescriptor(fdesc); } Loading Loading @@ -703,7 +692,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { @RavenwoodThrow(reason = "Os.readlink() and Os.stat()") public static File getFile(FileDescriptor fd) throws IOException { try { final String path = Os.readlink("/proc/self/fd/" + getFdInt(fd)); final String path = Os.readlink("/proc/self/fd/" + fd.getInt$()); if (OsConstants.S_ISREG(Os.stat(path).st_mode) || OsConstants.S_ISCHR(Os.stat(path).st_mode)) { return new File(path); Loading Loading @@ -783,7 +772,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { if (mClosed) { throw new IllegalStateException("Already closed"); } return getFdInt(mFd); return mFd.getInt$(); } } Loading @@ -805,7 +794,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { if (mClosed) { throw new IllegalStateException("Already closed"); } int fd = acquireRawFd(mFd); int fd = IoUtils.acquireRawFd(mFd); writeCommStatusAndClose(Status.DETACHED, null); mClosed = true; mGuard.close(); Loading Loading @@ -1265,38 +1254,6 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { } } private static native void setFdInt$ravenwood(FileDescriptor fd, int fdInt); private static native int getFdInt$ravenwood(FileDescriptor fd); @RavenwoodReplace private static void setFdInt(FileDescriptor fd, int fdInt) { fd.setInt$(fdInt); } @RavenwoodReplace private static int getFdInt(FileDescriptor fd) { return fd.getInt$(); } @RavenwoodReplace private void setFdOwner(FileDescriptor fd) { IoUtils.setFdOwner(fd, this); } private void setFdOwner$ravenwood(FileDescriptor fd) { // FD owners currently unsupported under Ravenwood; ignored } @RavenwoodReplace private int acquireRawFd(FileDescriptor fd) { return IoUtils.acquireRawFd(fd); } private int acquireRawFd$ravenwood(FileDescriptor fd) { // FD owners currently unsupported under Ravenwood; return FD directly return getFdInt(fd); } @RavenwoodReplace private static boolean isAtLeastQ() { return (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.Q); Loading core/java/android/os/Process.java +1 −6 Original line number Diff line number Diff line Loading @@ -838,16 +838,11 @@ public class Process { /** * Returns true if the current process is a 64-bit runtime. */ @android.ravenwood.annotation.RavenwoodReplace @android.ravenwood.annotation.RavenwoodKeep public static final boolean is64Bit() { return VMRuntime.getRuntime().is64Bit(); } /** @hide */ public static final boolean is64Bit$ravenwood() { return "amd64".equals(System.getProperty("os.arch")); } private static volatile ThreadLocal<SomeArgs> sIdentity$ravenwood; /** @hide */ Loading core/java/android/util/LruCache.java +0 −7 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.util; import android.compat.annotation.UnsupportedAppUsage; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; Loading Loading @@ -226,16 +225,10 @@ public class LruCache<K, V> { } } @android.ravenwood.annotation.RavenwoodReplace private Map.Entry<K, V> eldest() { return map.eldest(); } private Map.Entry<K, V> eldest$ravenwood() { final Iterator<Map.Entry<K, V>> it = map.entrySet().iterator(); return it.hasNext() ? it.next() : null; } /** * Removes the entry for {@code key} if it exists. * Loading core/java/com/android/internal/util/ArrayUtils.java +0 −40 Original line number Diff line number Diff line Loading @@ -49,81 +49,41 @@ public class ArrayUtils { private ArrayUtils() { /* cannot be instantiated */ } @android.ravenwood.annotation.RavenwoodReplace public static byte[] newUnpaddedByteArray(int minLen) { return (byte[])VMRuntime.getRuntime().newUnpaddedArray(byte.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace public static char[] newUnpaddedCharArray(int minLen) { return (char[])VMRuntime.getRuntime().newUnpaddedArray(char.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public static int[] newUnpaddedIntArray(int minLen) { return (int[])VMRuntime.getRuntime().newUnpaddedArray(int.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace public static boolean[] newUnpaddedBooleanArray(int minLen) { return (boolean[])VMRuntime.getRuntime().newUnpaddedArray(boolean.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace public static long[] newUnpaddedLongArray(int minLen) { return (long[])VMRuntime.getRuntime().newUnpaddedArray(long.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace public static float[] newUnpaddedFloatArray(int minLen) { return (float[])VMRuntime.getRuntime().newUnpaddedArray(float.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace public static Object[] newUnpaddedObjectArray(int minLen) { return (Object[])VMRuntime.getRuntime().newUnpaddedArray(Object.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) @SuppressWarnings("unchecked") public static <T> T[] newUnpaddedArray(Class<T> clazz, int minLen) { return (T[])VMRuntime.getRuntime().newUnpaddedArray(clazz, minLen); } public static byte[] newUnpaddedByteArray$ravenwood(int minLen) { return new byte[minLen]; } public static char[] newUnpaddedCharArray$ravenwood(int minLen) { return new char[minLen]; } public static int[] newUnpaddedIntArray$ravenwood(int minLen) { return new int[minLen]; } public static boolean[] newUnpaddedBooleanArray$ravenwood(int minLen) { return new boolean[minLen]; } public static long[] newUnpaddedLongArray$ravenwood(int minLen) { return new long[minLen]; } public static float[] newUnpaddedFloatArray$ravenwood(int minLen) { return new float[minLen]; } public static Object[] newUnpaddedObjectArray$ravenwood(int minLen) { return new Object[minLen]; } public static <T> T[] newUnpaddedArray$ravenwood(Class<T> clazz, int minLen) { return (T[]) Array.newInstance(clazz, minLen); } /** * Checks if the beginnings of two byte arrays are equal. * Loading ravenwood/runtime-helper-src/libcore-fake/android/system/Os.java +1 −1 Original line number Diff line number Diff line Loading @@ -15,8 +15,8 @@ */ package android.system; import com.android.ravenwood.RavenwoodRuntimeNative; import com.android.ravenwood.common.JvmWorkaround; import com.android.ravenwood.common.RavenwoodRuntimeNative; import java.io.FileDescriptor; import java.io.FileInputStream; Loading Loading
core/java/android/os/ParcelFileDescriptor.java +10 −53 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ import android.content.ContentResolver; import android.net.Uri; import android.os.MessageQueue.OnFileDescriptorEventListener; import android.ravenwood.annotation.RavenwoodKeepWholeClass; import android.ravenwood.annotation.RavenwoodNativeSubstitutionClass; import android.ravenwood.annotation.RavenwoodReplace; import android.ravenwood.annotation.RavenwoodThrow; import android.system.ErrnoException; Loading Loading @@ -77,8 +76,6 @@ import java.nio.ByteOrder; * you to close it when done with it. */ @RavenwoodKeepWholeClass @RavenwoodNativeSubstitutionClass( "com.android.platform.test.ravenwood.nativesubstitution.ParcelFileDescriptor_host") public class ParcelFileDescriptor implements Parcelable, Closeable { private static final String TAG = "ParcelFileDescriptor"; Loading Loading @@ -206,11 +203,11 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { } mWrapped = null; mFd = fd; setFdOwner(mFd); IoUtils.setFdOwner(mFd, this); mCommFd = commChannel; if (mCommFd != null) { setFdOwner(mCommFd); IoUtils.setFdOwner(mCommFd, this); } mGuard.open("close"); Loading Loading @@ -298,7 +295,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { public static @NonNull ParcelFileDescriptor wrap(@NonNull ParcelFileDescriptor pfd, @NonNull Handler handler, @NonNull OnCloseListener listener) throws IOException { final FileDescriptor original = new FileDescriptor(); setFdInt(original, pfd.detachFd()); original.setInt$(pfd.detachFd()); return fromFd(original, handler, listener); } Loading Loading @@ -363,18 +360,10 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { } } @RavenwoodReplace private static void closeInternal(FileDescriptor fd) { IoUtils.closeQuietly(fd); } private static void closeInternal$ravenwood(FileDescriptor fd) { try { Os.close(fd); } catch (ErrnoException ignored) { } } /** * Create a new ParcelFileDescriptor that is a dup of an existing * FileDescriptor. This obeys standard POSIX semantics, where the Loading @@ -385,7 +374,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { try { final FileDescriptor fd = new FileDescriptor(); int intfd = Os.fcntlInt(orig, (isAtLeastQ() ? F_DUPFD_CLOEXEC : F_DUPFD), 0); setFdInt(fd, intfd); fd.setInt$(intfd); return new ParcelFileDescriptor(fd); } catch (ErrnoException e) { throw e.rethrowAsIOException(); Loading Loading @@ -418,12 +407,12 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { */ public static ParcelFileDescriptor fromFd(int fd) throws IOException { final FileDescriptor original = new FileDescriptor(); setFdInt(original, fd); original.setInt$(fd); try { final FileDescriptor dup = new FileDescriptor(); int intfd = Os.fcntlInt(original, (isAtLeastQ() ? F_DUPFD_CLOEXEC : F_DUPFD), 0); setFdInt(dup, intfd); dup.setInt$(intfd); return new ParcelFileDescriptor(dup); } catch (ErrnoException e) { throw e.rethrowAsIOException(); Loading @@ -446,7 +435,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { */ public static ParcelFileDescriptor adoptFd(int fd) { final FileDescriptor fdesc = new FileDescriptor(); setFdInt(fdesc, fd); fdesc.setInt$(fd); return new ParcelFileDescriptor(fdesc); } Loading Loading @@ -703,7 +692,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { @RavenwoodThrow(reason = "Os.readlink() and Os.stat()") public static File getFile(FileDescriptor fd) throws IOException { try { final String path = Os.readlink("/proc/self/fd/" + getFdInt(fd)); final String path = Os.readlink("/proc/self/fd/" + fd.getInt$()); if (OsConstants.S_ISREG(Os.stat(path).st_mode) || OsConstants.S_ISCHR(Os.stat(path).st_mode)) { return new File(path); Loading Loading @@ -783,7 +772,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { if (mClosed) { throw new IllegalStateException("Already closed"); } return getFdInt(mFd); return mFd.getInt$(); } } Loading @@ -805,7 +794,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { if (mClosed) { throw new IllegalStateException("Already closed"); } int fd = acquireRawFd(mFd); int fd = IoUtils.acquireRawFd(mFd); writeCommStatusAndClose(Status.DETACHED, null); mClosed = true; mGuard.close(); Loading Loading @@ -1265,38 +1254,6 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { } } private static native void setFdInt$ravenwood(FileDescriptor fd, int fdInt); private static native int getFdInt$ravenwood(FileDescriptor fd); @RavenwoodReplace private static void setFdInt(FileDescriptor fd, int fdInt) { fd.setInt$(fdInt); } @RavenwoodReplace private static int getFdInt(FileDescriptor fd) { return fd.getInt$(); } @RavenwoodReplace private void setFdOwner(FileDescriptor fd) { IoUtils.setFdOwner(fd, this); } private void setFdOwner$ravenwood(FileDescriptor fd) { // FD owners currently unsupported under Ravenwood; ignored } @RavenwoodReplace private int acquireRawFd(FileDescriptor fd) { return IoUtils.acquireRawFd(fd); } private int acquireRawFd$ravenwood(FileDescriptor fd) { // FD owners currently unsupported under Ravenwood; return FD directly return getFdInt(fd); } @RavenwoodReplace private static boolean isAtLeastQ() { return (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.Q); Loading
core/java/android/os/Process.java +1 −6 Original line number Diff line number Diff line Loading @@ -838,16 +838,11 @@ public class Process { /** * Returns true if the current process is a 64-bit runtime. */ @android.ravenwood.annotation.RavenwoodReplace @android.ravenwood.annotation.RavenwoodKeep public static final boolean is64Bit() { return VMRuntime.getRuntime().is64Bit(); } /** @hide */ public static final boolean is64Bit$ravenwood() { return "amd64".equals(System.getProperty("os.arch")); } private static volatile ThreadLocal<SomeArgs> sIdentity$ravenwood; /** @hide */ Loading
core/java/android/util/LruCache.java +0 −7 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.util; import android.compat.annotation.UnsupportedAppUsage; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; Loading Loading @@ -226,16 +225,10 @@ public class LruCache<K, V> { } } @android.ravenwood.annotation.RavenwoodReplace private Map.Entry<K, V> eldest() { return map.eldest(); } private Map.Entry<K, V> eldest$ravenwood() { final Iterator<Map.Entry<K, V>> it = map.entrySet().iterator(); return it.hasNext() ? it.next() : null; } /** * Removes the entry for {@code key} if it exists. * Loading
core/java/com/android/internal/util/ArrayUtils.java +0 −40 Original line number Diff line number Diff line Loading @@ -49,81 +49,41 @@ public class ArrayUtils { private ArrayUtils() { /* cannot be instantiated */ } @android.ravenwood.annotation.RavenwoodReplace public static byte[] newUnpaddedByteArray(int minLen) { return (byte[])VMRuntime.getRuntime().newUnpaddedArray(byte.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace public static char[] newUnpaddedCharArray(int minLen) { return (char[])VMRuntime.getRuntime().newUnpaddedArray(char.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public static int[] newUnpaddedIntArray(int minLen) { return (int[])VMRuntime.getRuntime().newUnpaddedArray(int.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace public static boolean[] newUnpaddedBooleanArray(int minLen) { return (boolean[])VMRuntime.getRuntime().newUnpaddedArray(boolean.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace public static long[] newUnpaddedLongArray(int minLen) { return (long[])VMRuntime.getRuntime().newUnpaddedArray(long.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace public static float[] newUnpaddedFloatArray(int minLen) { return (float[])VMRuntime.getRuntime().newUnpaddedArray(float.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace public static Object[] newUnpaddedObjectArray(int minLen) { return (Object[])VMRuntime.getRuntime().newUnpaddedArray(Object.class, minLen); } @android.ravenwood.annotation.RavenwoodReplace @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) @SuppressWarnings("unchecked") public static <T> T[] newUnpaddedArray(Class<T> clazz, int minLen) { return (T[])VMRuntime.getRuntime().newUnpaddedArray(clazz, minLen); } public static byte[] newUnpaddedByteArray$ravenwood(int minLen) { return new byte[minLen]; } public static char[] newUnpaddedCharArray$ravenwood(int minLen) { return new char[minLen]; } public static int[] newUnpaddedIntArray$ravenwood(int minLen) { return new int[minLen]; } public static boolean[] newUnpaddedBooleanArray$ravenwood(int minLen) { return new boolean[minLen]; } public static long[] newUnpaddedLongArray$ravenwood(int minLen) { return new long[minLen]; } public static float[] newUnpaddedFloatArray$ravenwood(int minLen) { return new float[minLen]; } public static Object[] newUnpaddedObjectArray$ravenwood(int minLen) { return new Object[minLen]; } public static <T> T[] newUnpaddedArray$ravenwood(Class<T> clazz, int minLen) { return (T[]) Array.newInstance(clazz, minLen); } /** * Checks if the beginnings of two byte arrays are equal. * Loading
ravenwood/runtime-helper-src/libcore-fake/android/system/Os.java +1 −1 Original line number Diff line number Diff line Loading @@ -15,8 +15,8 @@ */ package android.system; import com.android.ravenwood.RavenwoodRuntimeNative; import com.android.ravenwood.common.JvmWorkaround; import com.android.ravenwood.common.RavenwoodRuntimeNative; import java.io.FileDescriptor; import java.io.FileInputStream; Loading