package android.util.apk;
import android.system.ErrnoException;
+import android.system.Os;
import android.system.OsConstants;
import android.util.ArrayMap;
import android.util.Pair;
import java.util.Map;
import java.util.Set;
-import libcore.io.Libcore;
-import libcore.io.Os;
-
/**
* APK Signature Scheme v2 verifier.
*
* {@link DataSource#feedIntoMessageDigests(MessageDigest[], long, int) feedIntoMessageDigests}.
*/
private static final class MemoryMappedFileDataSource implements DataSource {
- private static final Os OS = Libcore.os;
- private static final long MEMORY_PAGE_SIZE_BYTES = OS.sysconf(OsConstants._SC_PAGESIZE);
+ private static final long MEMORY_PAGE_SIZE_BYTES = Os.sysconf(OsConstants._SC_PAGESIZE);
private final FileDescriptor mFd;
private final long mFilePosition;
long mmapRegionSize = size + dataStartOffsetInMmapRegion;
long mmapPtr = 0;
try {
- mmapPtr = OS.mmap(
+ mmapPtr = Os.mmap(
0, // let the OS choose the start address of the region in memory
mmapRegionSize,
OsConstants.PROT_READ,
} finally {
if (mmapPtr != 0) {
try {
- OS.munmap(mmapPtr, mmapRegionSize);
+ Os.munmap(mmapPtr, mmapRegionSize);
} catch (ErrnoException ignored) {}
}
}
*/
package com.android.internal.os;
+import android.system.Os;
import android.text.TextUtils;
import android.os.StrictMode;
import android.system.OsConstants;
import android.util.Slog;
-import libcore.io.Libcore;
-
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
cpuNumber);
mLastSpeedTimesMs = new long[numSpeedSteps];
mDeltaSpeedTimesMs = new long[numSpeedSteps];
- long jiffyHz = Libcore.os.sysconf(OsConstants._SC_CLK_TCK);
+ long jiffyHz = Os.sysconf(OsConstants._SC_CLK_TCK);
mJiffyMillis = 1000/jiffyHz;
}
import android.os.Process;
import android.os.StrictMode;
import android.os.SystemClock;
+import android.system.Os;
import android.system.OsConstants;
import android.util.Slog;
public ProcessCpuTracker(boolean includeThreads) {
mIncludeThreads = includeThreads;
- long jiffyHz = Libcore.os.sysconf(OsConstants._SC_CLK_TCK);
+ long jiffyHz = Os.sysconf(OsConstants._SC_CLK_TCK);
mJiffyMillis = 1000/jiffyHz;
}
import android.graphics.Rect;
import android.os.ParcelFileDescriptor;
import android.system.ErrnoException;
+import android.system.Os;
import android.system.OsConstants;
import dalvik.system.CloseGuard;
import libcore.io.IoUtils;
final long size;
try {
- Libcore.os.lseek(input.getFileDescriptor(), 0, OsConstants.SEEK_SET);
- size = Libcore.os.fstat(input.getFileDescriptor()).st_size;
+ Os.lseek(input.getFileDescriptor(), 0, OsConstants.SEEK_SET);
+ size = Os.fstat(input.getFileDescriptor()).st_size;
} catch (ErrnoException ee) {
throw new IllegalArgumentException("file descriptor not seekable");
}
import android.graphics.Rect;
import android.os.ParcelFileDescriptor;
import android.system.ErrnoException;
+import android.system.Os;
import android.system.OsConstants;
import com.android.internal.util.Preconditions;
import dalvik.system.CloseGuard;
import libcore.io.IoUtils;
-import libcore.io.Libcore;
import java.io.IOException;
import java.lang.annotation.Retention;
final long size;
try {
- Libcore.os.lseek(input.getFileDescriptor(), 0, OsConstants.SEEK_SET);
- size = Libcore.os.fstat(input.getFileDescriptor()).st_size;
+ Os.lseek(input.getFileDescriptor(), 0, OsConstants.SEEK_SET);
+ size = Os.fstat(input.getFileDescriptor()).st_size;
} catch (ErrnoException ee) {
throw new IllegalArgumentException("file descriptor not seekable");
}
import android.os.SystemProperties;
import android.provider.Settings;
import android.system.ErrnoException;
+import android.system.Os;
import android.system.OsConstants;
import android.util.Log;
import android.util.Pair;
import com.android.internal.util.Preconditions;
import libcore.io.IoBridge;
-import libcore.io.Libcore;
import libcore.io.Streams;
import java.io.ByteArrayOutputStream;
final FileDescriptor dupedFd;
try {
- dupedFd = Libcore.os.dup(fd);
+ dupedFd = Os.dup(fd);
} catch (ErrnoException ex) {
Log.e(TAG, ex.getMessage(), ex);
throw new RuntimeException(ex);
private int addTrack() {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
- Libcore.os.lseek(dupedFd, offset2, OsConstants.SEEK_SET);
+ Os.lseek(dupedFd, offset2, OsConstants.SEEK_SET);
byte[] buffer = new byte[4096];
for (long total = 0; total < length2;) {
int bytesToRead = (int) Math.min(buffer.length, length2 - total);
return MEDIA_INFO_TIMED_TEXT_ERROR;
} finally {
try {
- Libcore.os.close(dupedFd);
+ Os.close(dupedFd);
} catch (ErrnoException e) {
Log.e(TAG, e.getMessage(), e);
}
import com.android.server.pm.PackageInstallerService.PackageInstallObserverAdapter;
import libcore.io.IoUtils;
-import libcore.io.Libcore;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
// TODO: this should delegate to DCS so the system process avoids
// holding open FDs into containers.
- final FileDescriptor targetFd = Libcore.os.open(target.getAbsolutePath(),
+ final FileDescriptor targetFd = Os.open(target.getAbsolutePath(),
O_CREAT | O_WRONLY, 0644);
Os.chmod(target.getAbsolutePath(), 0644);
}
if (offsetBytes > 0) {
- Libcore.os.lseek(targetFd, offsetBytes, OsConstants.SEEK_SET);
+ Os.lseek(targetFd, offsetBytes, OsConstants.SEEK_SET);
}
if (PackageInstaller.ENABLE_REVOCABLE_FD) {
throw new IllegalArgumentException("Invalid name: " + name);
}
final File target = new File(resolveStageDirLocked(), name);
- final FileDescriptor targetFd = Libcore.os.open(target.getAbsolutePath(), O_RDONLY, 0);
+ final FileDescriptor targetFd = Os.open(target.getAbsolutePath(), O_RDONLY, 0);
return new ParcelFileDescriptor(targetFd);
} catch (ErrnoException e) {
throw e.rethrowAsIOException();
import android.os.RemoteException;
import android.os.UserHandle;
import android.system.ErrnoException;
+import android.system.Os;
import android.util.ArraySet;
import android.util.Log;
import android.util.Slog;
*/
public static String realpath(File path) throws IOException {
try {
- return Libcore.os.realpath(path.getAbsolutePath());
+ return Os.realpath(path.getAbsolutePath());
} catch (ErrnoException ee) {
throw ee.rethrowAsIOException();
}
mDescriptor = Os.socket(
OsConstants.AF_NETLINK, OsConstants.SOCK_DGRAM, nlProto);
- Libcore.os.setsockoptInt(
+ Os.setsockoptInt(
mDescriptor, OsConstants.SOL_SOCKET,
OsConstants.SO_RCVBUF, SOCKET_RECV_BUFSIZE);
}