Merge "Track libcore.os' move to android.system."
This commit is contained in:
@ -19,6 +19,9 @@ package android.app;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.FileUtils;
|
||||
import android.os.Looper;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.system.StructStat;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.collect.Maps;
|
||||
@ -44,10 +47,7 @@ import java.util.WeakHashMap;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import libcore.io.ErrnoException;
|
||||
import libcore.io.IoUtils;
|
||||
import libcore.io.Libcore;
|
||||
import libcore.io.StructStat;
|
||||
|
||||
final class SharedPreferencesImpl implements SharedPreferences {
|
||||
private static final String TAG = "SharedPreferencesImpl";
|
||||
@ -111,7 +111,7 @@ final class SharedPreferencesImpl implements SharedPreferences {
|
||||
Map map = null;
|
||||
StructStat stat = null;
|
||||
try {
|
||||
stat = Libcore.os.stat(mFile.getPath());
|
||||
stat = Os.stat(mFile.getPath());
|
||||
if (mFile.canRead()) {
|
||||
BufferedInputStream str = null;
|
||||
try {
|
||||
@ -173,7 +173,7 @@ final class SharedPreferencesImpl implements SharedPreferences {
|
||||
* violation, but we explicitly want this one.
|
||||
*/
|
||||
BlockGuard.getThreadPolicy().onReadFromDisk();
|
||||
stat = Libcore.os.stat(mFile.getPath());
|
||||
stat = Os.stat(mFile.getPath());
|
||||
} catch (ErrnoException e) {
|
||||
return true;
|
||||
}
|
||||
@ -600,7 +600,7 @@ final class SharedPreferencesImpl implements SharedPreferences {
|
||||
str.close();
|
||||
ContextImpl.setFilePermissionsFromMode(mFile.getPath(), mMode, 0);
|
||||
try {
|
||||
final StructStat stat = Libcore.os.stat(mFile.getPath());
|
||||
final StructStat stat = Os.stat(mFile.getPath());
|
||||
synchronized (this) {
|
||||
mStatTimestamp = stat.st_mtime;
|
||||
mStatSize = stat.st_size;
|
||||
|
@ -29,6 +29,10 @@ import android.os.Looper;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.system.OsConstants;
|
||||
import android.system.StructStat;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
@ -38,11 +42,6 @@ import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import libcore.io.ErrnoException;
|
||||
import libcore.io.Libcore;
|
||||
import libcore.io.OsConstants;
|
||||
import libcore.io.StructStat;
|
||||
|
||||
/**
|
||||
* Provides the central interface between an
|
||||
* application and Android's data backup infrastructure. An application that wishes
|
||||
@ -191,7 +190,7 @@ public abstract class BackupAgent extends ContextWrapper {
|
||||
* the key supplied as part of the entity. Writing an entity with a negative
|
||||
* data size instructs the transport to delete whatever entity currently exists
|
||||
* under that key from the remote data set.
|
||||
*
|
||||
*
|
||||
* @param oldState An open, read-only ParcelFileDescriptor pointing to the
|
||||
* last backup state provided by the application. May be
|
||||
* <code>null</code>, in which case no prior state is being
|
||||
@ -222,7 +221,7 @@ public abstract class BackupAgent extends ContextWrapper {
|
||||
* onRestore() throws an exception, the OS will assume that the
|
||||
* application's data may now be in an incoherent state, and will clear it
|
||||
* before proceeding.
|
||||
*
|
||||
*
|
||||
* @param data A structured wrapper around an open, read-only
|
||||
* file descriptor pointing to a full snapshot of the
|
||||
* application's data. The application should consume every
|
||||
@ -412,7 +411,7 @@ public abstract class BackupAgent extends ContextWrapper {
|
||||
}
|
||||
|
||||
// If it's a directory, enqueue its contents for scanning.
|
||||
StructStat stat = Libcore.os.lstat(filePath);
|
||||
StructStat stat = Os.lstat(filePath);
|
||||
if (OsConstants.S_ISLNK(stat.st_mode)) {
|
||||
if (DEBUG) Log.i(TAG, "Symlink (skipping)!: " + file);
|
||||
continue;
|
||||
|
@ -20,6 +20,8 @@ import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
@ -27,9 +29,6 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import libcore.io.ErrnoException;
|
||||
import libcore.io.Libcore;
|
||||
|
||||
/**
|
||||
* Global constant definitions et cetera related to the full-backup-to-fd
|
||||
* binary format. Nothing in this namespace is part of any API; it's all
|
||||
@ -150,7 +149,7 @@ public class FullBackup {
|
||||
try {
|
||||
// explicitly prevent emplacement of files accessible by outside apps
|
||||
mode &= 0700;
|
||||
Libcore.os.chmod(outFile.getPath(), (int)mode);
|
||||
Os.chmod(outFile.getPath(), (int)mode);
|
||||
} catch (ErrnoException e) {
|
||||
e.rethrowAsIOException();
|
||||
}
|
||||
|
@ -24,13 +24,13 @@ import java.net.InetAddress;
|
||||
import java.net.InterfaceAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import static libcore.io.OsConstants.IFA_F_DADFAILED;
|
||||
import static libcore.io.OsConstants.IFA_F_DEPRECATED;
|
||||
import static libcore.io.OsConstants.IFA_F_TENTATIVE;
|
||||
import static libcore.io.OsConstants.RT_SCOPE_HOST;
|
||||
import static libcore.io.OsConstants.RT_SCOPE_LINK;
|
||||
import static libcore.io.OsConstants.RT_SCOPE_SITE;
|
||||
import static libcore.io.OsConstants.RT_SCOPE_UNIVERSE;
|
||||
import static android.system.OsConstants.IFA_F_DADFAILED;
|
||||
import static android.system.OsConstants.IFA_F_DEPRECATED;
|
||||
import static android.system.OsConstants.IFA_F_TENTATIVE;
|
||||
import static android.system.OsConstants.RT_SCOPE_HOST;
|
||||
import static android.system.OsConstants.RT_SCOPE_LINK;
|
||||
import static android.system.OsConstants.RT_SCOPE_SITE;
|
||||
import static android.system.OsConstants.RT_SCOPE_UNIVERSE;
|
||||
|
||||
/**
|
||||
* Identifies an IP address on a network link.
|
||||
|
@ -22,9 +22,9 @@ import java.io.InputStream;
|
||||
import java.io.FileDescriptor;
|
||||
import java.net.SocketOptions;
|
||||
|
||||
import libcore.io.ErrnoException;
|
||||
import libcore.io.Libcore;
|
||||
import libcore.io.OsConstants;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.system.OsConstants;
|
||||
|
||||
/**
|
||||
* Socket implementation used for android.net.LocalSocket and
|
||||
@ -248,7 +248,7 @@ class LocalSocketImpl
|
||||
throw new IllegalStateException("unknown sockType");
|
||||
}
|
||||
try {
|
||||
fd = Libcore.os.socket(OsConstants.AF_UNIX, osType, 0);
|
||||
fd = Os.socket(OsConstants.AF_UNIX, osType, 0);
|
||||
mFdCreatedInternally = true;
|
||||
} catch (ErrnoException e) {
|
||||
e.rethrowAsIOException();
|
||||
@ -268,7 +268,7 @@ class LocalSocketImpl
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Libcore.os.close(fd);
|
||||
Os.close(fd);
|
||||
} catch (ErrnoException e) {
|
||||
e.rethrowAsIOException();
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import java.net.Inet4Address;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.NoSuchElementException;
|
||||
import static libcore.io.OsConstants.*;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@ -32,6 +31,7 @@ import android.os.IBinder;
|
||||
import android.os.Parcel;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import static android.system.OsConstants.*;
|
||||
|
||||
/**
|
||||
* Used for accessing the android common time service's common clock and receiving notifications
|
||||
|
@ -20,7 +20,7 @@ import java.net.Inet4Address;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Locale;
|
||||
import static libcore.io.OsConstants.*;
|
||||
import static android.system.OsConstants.*;
|
||||
|
||||
class CommonTimeUtils {
|
||||
/**
|
||||
|
@ -16,13 +16,13 @@
|
||||
|
||||
package android.os;
|
||||
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.system.OsConstants;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
|
||||
import libcore.io.ErrnoException;
|
||||
import libcore.io.IoUtils;
|
||||
import libcore.io.Libcore;
|
||||
import libcore.io.OsConstants;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -87,7 +87,7 @@ public class FileUtils {
|
||||
*/
|
||||
public static int setPermissions(String path, int mode, int uid, int gid) {
|
||||
try {
|
||||
Libcore.os.chmod(path, mode);
|
||||
Os.chmod(path, mode);
|
||||
} catch (ErrnoException e) {
|
||||
Slog.w(TAG, "Failed to chmod(" + path + "): " + e);
|
||||
return e.errno;
|
||||
@ -95,7 +95,7 @@ public class FileUtils {
|
||||
|
||||
if (uid >= 0 || gid >= 0) {
|
||||
try {
|
||||
Libcore.os.chown(path, uid, gid);
|
||||
Os.chown(path, uid, gid);
|
||||
} catch (ErrnoException e) {
|
||||
Slog.w(TAG, "Failed to chown(" + path + "): " + e);
|
||||
return e.errno;
|
||||
@ -115,7 +115,7 @@ public class FileUtils {
|
||||
*/
|
||||
public static int setPermissions(FileDescriptor fd, int mode, int uid, int gid) {
|
||||
try {
|
||||
Libcore.os.fchmod(fd, mode);
|
||||
Os.fchmod(fd, mode);
|
||||
} catch (ErrnoException e) {
|
||||
Slog.w(TAG, "Failed to fchmod(): " + e);
|
||||
return e.errno;
|
||||
@ -123,7 +123,7 @@ public class FileUtils {
|
||||
|
||||
if (uid >= 0 || gid >= 0) {
|
||||
try {
|
||||
Libcore.os.fchown(fd, uid, gid);
|
||||
Os.fchown(fd, uid, gid);
|
||||
} catch (ErrnoException e) {
|
||||
Slog.w(TAG, "Failed to fchown(): " + e);
|
||||
return e.errno;
|
||||
@ -138,7 +138,7 @@ public class FileUtils {
|
||||
*/
|
||||
public static int getUid(String path) {
|
||||
try {
|
||||
return Libcore.os.stat(path).st_uid;
|
||||
return Os.stat(path).st_uid;
|
||||
} catch (ErrnoException e) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -16,24 +16,24 @@
|
||||
|
||||
package android.os;
|
||||
|
||||
import static libcore.io.OsConstants.AF_UNIX;
|
||||
import static libcore.io.OsConstants.SEEK_SET;
|
||||
import static libcore.io.OsConstants.SOCK_STREAM;
|
||||
import static libcore.io.OsConstants.S_ISLNK;
|
||||
import static libcore.io.OsConstants.S_ISREG;
|
||||
import static android.system.OsConstants.AF_UNIX;
|
||||
import static android.system.OsConstants.SEEK_SET;
|
||||
import static android.system.OsConstants.SOCK_STREAM;
|
||||
import static android.system.OsConstants.S_ISLNK;
|
||||
import static android.system.OsConstants.S_ISREG;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentProvider;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.system.OsConstants;
|
||||
import android.system.StructStat;
|
||||
import android.util.Log;
|
||||
|
||||
import dalvik.system.CloseGuard;
|
||||
|
||||
import libcore.io.ErrnoException;
|
||||
import libcore.io.IoUtils;
|
||||
import libcore.io.Libcore;
|
||||
import libcore.io.Memory;
|
||||
import libcore.io.OsConstants;
|
||||
import libcore.io.StructStat;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
@ -261,7 +261,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {
|
||||
*/
|
||||
public static ParcelFileDescriptor dup(FileDescriptor orig) throws IOException {
|
||||
try {
|
||||
final FileDescriptor fd = Libcore.os.dup(orig);
|
||||
final FileDescriptor fd = Os.dup(orig);
|
||||
return new ParcelFileDescriptor(fd);
|
||||
} catch (ErrnoException e) {
|
||||
throw e.rethrowAsIOException();
|
||||
@ -297,7 +297,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {
|
||||
original.setInt$(fd);
|
||||
|
||||
try {
|
||||
final FileDescriptor dup = Libcore.os.dup(original);
|
||||
final FileDescriptor dup = Os.dup(original);
|
||||
return new ParcelFileDescriptor(dup);
|
||||
} catch (ErrnoException e) {
|
||||
throw e.rethrowAsIOException();
|
||||
@ -359,7 +359,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {
|
||||
*/
|
||||
public static ParcelFileDescriptor[] createPipe() throws IOException {
|
||||
try {
|
||||
final FileDescriptor[] fds = Libcore.os.pipe();
|
||||
final FileDescriptor[] fds = Os.pipe();
|
||||
return new ParcelFileDescriptor[] {
|
||||
new ParcelFileDescriptor(fds[0]),
|
||||
new ParcelFileDescriptor(fds[1]) };
|
||||
@ -381,7 +381,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {
|
||||
public static ParcelFileDescriptor[] createReliablePipe() throws IOException {
|
||||
try {
|
||||
final FileDescriptor[] comm = createCommSocketPair();
|
||||
final FileDescriptor[] fds = Libcore.os.pipe();
|
||||
final FileDescriptor[] fds = Os.pipe();
|
||||
return new ParcelFileDescriptor[] {
|
||||
new ParcelFileDescriptor(fds[0], comm[0]),
|
||||
new ParcelFileDescriptor(fds[1], comm[1]) };
|
||||
@ -398,7 +398,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {
|
||||
try {
|
||||
final FileDescriptor fd0 = new FileDescriptor();
|
||||
final FileDescriptor fd1 = new FileDescriptor();
|
||||
Libcore.os.socketpair(AF_UNIX, SOCK_STREAM, 0, fd0, fd1);
|
||||
Os.socketpair(AF_UNIX, SOCK_STREAM, 0, fd0, fd1);
|
||||
return new ParcelFileDescriptor[] {
|
||||
new ParcelFileDescriptor(fd0),
|
||||
new ParcelFileDescriptor(fd1) };
|
||||
@ -421,7 +421,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {
|
||||
final FileDescriptor[] comm = createCommSocketPair();
|
||||
final FileDescriptor fd0 = new FileDescriptor();
|
||||
final FileDescriptor fd1 = new FileDescriptor();
|
||||
Libcore.os.socketpair(AF_UNIX, SOCK_STREAM, 0, fd0, fd1);
|
||||
Os.socketpair(AF_UNIX, SOCK_STREAM, 0, fd0, fd1);
|
||||
return new ParcelFileDescriptor[] {
|
||||
new ParcelFileDescriptor(fd0, comm[0]),
|
||||
new ParcelFileDescriptor(fd1, comm[1]) };
|
||||
@ -434,7 +434,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {
|
||||
try {
|
||||
final FileDescriptor comm1 = new FileDescriptor();
|
||||
final FileDescriptor comm2 = new FileDescriptor();
|
||||
Libcore.os.socketpair(AF_UNIX, SOCK_STREAM, 0, comm1, comm2);
|
||||
Os.socketpair(AF_UNIX, SOCK_STREAM, 0, comm1, comm2);
|
||||
IoUtils.setBlocking(comm1, false);
|
||||
IoUtils.setBlocking(comm2, false);
|
||||
return new FileDescriptor[] { comm1, comm2 };
|
||||
@ -520,7 +520,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {
|
||||
return mWrapped.getStatSize();
|
||||
} else {
|
||||
try {
|
||||
final StructStat st = Libcore.os.fstat(mFd);
|
||||
final StructStat st = Os.fstat(mFd);
|
||||
if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
|
||||
return st.st_size;
|
||||
} else {
|
||||
@ -543,7 +543,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {
|
||||
return mWrapped.seekTo(pos);
|
||||
} else {
|
||||
try {
|
||||
return Libcore.os.lseek(mFd, pos, SEEK_SET);
|
||||
return Os.lseek(mFd, pos, SEEK_SET);
|
||||
} catch (ErrnoException e) {
|
||||
throw e.rethrowAsIOException();
|
||||
}
|
||||
@ -695,7 +695,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {
|
||||
writePtr += len;
|
||||
}
|
||||
|
||||
Libcore.os.write(mCommFd, buf, 0, writePtr);
|
||||
Os.write(mCommFd, buf, 0, writePtr);
|
||||
} catch (ErrnoException e) {
|
||||
// Reporting status is best-effort
|
||||
Log.w(TAG, "Failed to report status: " + e);
|
||||
@ -712,7 +712,7 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {
|
||||
|
||||
private static Status readCommStatus(FileDescriptor comm, byte[] buf) {
|
||||
try {
|
||||
final int n = Libcore.os.read(comm, buf, 0, buf.length);
|
||||
final int n = Os.read(comm, buf, 0, buf.length);
|
||||
if (n == 0) {
|
||||
// EOF means they're dead
|
||||
return new Status(Status.DEAD);
|
||||
|
@ -18,6 +18,7 @@ package android.os;
|
||||
|
||||
import android.net.LocalSocket;
|
||||
import android.net.LocalSocketAddress;
|
||||
import android.system.Os;
|
||||
import android.util.Log;
|
||||
import com.android.internal.os.Zygote;
|
||||
import java.io.BufferedWriter;
|
||||
@ -28,7 +29,6 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import libcore.io.Libcore;
|
||||
|
||||
/*package*/ class ZygoteStartFailedEx extends Exception {
|
||||
/**
|
||||
@ -741,7 +741,7 @@ public class Process {
|
||||
* {@link #killProcess} and {@link #sendSignal}.
|
||||
*/
|
||||
public static final int myPid() {
|
||||
return Libcore.os.getpid();
|
||||
return Os.getpid();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -749,7 +749,7 @@ public class Process {
|
||||
* @hide
|
||||
*/
|
||||
public static final int myPpid() {
|
||||
return Libcore.os.getppid();
|
||||
return Os.getppid();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -757,7 +757,7 @@ public class Process {
|
||||
* {@link #setThreadPriority(int, int)}.
|
||||
*/
|
||||
public static final int myTid() {
|
||||
return Libcore.os.gettid();
|
||||
return Os.gettid();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -767,7 +767,7 @@ public class Process {
|
||||
* a uid identifies a specific app sandbox in a specific user.
|
||||
*/
|
||||
public static final int myUid() {
|
||||
return Libcore.os.getuid();
|
||||
return Os.getuid();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,9 +16,9 @@
|
||||
|
||||
package android.os;
|
||||
|
||||
import libcore.io.ErrnoException;
|
||||
import libcore.io.Libcore;
|
||||
import libcore.io.StructStatVfs;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.system.StructStatVfs;
|
||||
|
||||
/**
|
||||
* Retrieve overall information about the space on a filesystem. This is a
|
||||
@ -41,7 +41,7 @@ public class StatFs {
|
||||
|
||||
private static StructStatVfs doStat(String path) {
|
||||
try {
|
||||
return Libcore.os.statvfs(path);
|
||||
return Os.statvfs(path);
|
||||
} catch (ErrnoException e) {
|
||||
throw new IllegalArgumentException("Invalid path: " + path, e);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
package android.provider;
|
||||
|
||||
import static android.net.TrafficStats.KB_IN_BYTES;
|
||||
import static libcore.io.OsConstants.SEEK_SET;
|
||||
import static android.system.OsConstants.SEEK_SET;
|
||||
|
||||
import android.content.ContentProviderClient;
|
||||
import android.content.ContentResolver;
|
||||
@ -38,11 +38,11 @@ import android.os.OperationCanceledException;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.ParcelFileDescriptor.OnCloseListener;
|
||||
import android.os.RemoteException;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.util.Log;
|
||||
|
||||
import libcore.io.ErrnoException;
|
||||
import libcore.io.IoUtils;
|
||||
import libcore.io.Libcore;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
@ -699,7 +699,7 @@ public final class DocumentsContract {
|
||||
// optimal decode path; otherwise fall back to buffering.
|
||||
BufferedInputStream is = null;
|
||||
try {
|
||||
Libcore.os.lseek(fd, offset, SEEK_SET);
|
||||
Os.lseek(fd, offset, SEEK_SET);
|
||||
} catch (ErrnoException e) {
|
||||
is = new BufferedInputStream(new FileInputStream(fd), THUMBNAIL_BUFFER_SIZE);
|
||||
is.mark(THUMBNAIL_BUFFER_SIZE);
|
||||
@ -725,7 +725,7 @@ public final class DocumentsContract {
|
||||
bitmap = BitmapFactory.decodeStream(is, null, opts);
|
||||
} else {
|
||||
try {
|
||||
Libcore.os.lseek(fd, offset, SEEK_SET);
|
||||
Os.lseek(fd, offset, SEEK_SET);
|
||||
} catch (ErrnoException e) {
|
||||
e.rethrowAsIOException();
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
package android.content.pm;
|
||||
|
||||
import static libcore.io.OsConstants.*;
|
||||
import static android.system.OsConstants.*;
|
||||
|
||||
import com.android.frameworks.coretests.R;
|
||||
import com.android.internal.content.PackageHelper;
|
||||
@ -46,6 +46,9 @@ import android.os.storage.StorageManager;
|
||||
import android.os.storage.StorageResultCode;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.SettingNotFoundException;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os
|
||||
import android.system.StructStat;
|
||||
import android.test.AndroidTestCase;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
@ -60,10 +63,6 @@ import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import libcore.io.ErrnoException;
|
||||
import libcore.io.Libcore;
|
||||
import libcore.io.StructStat;
|
||||
|
||||
public class PackageManagerTests extends AndroidTestCase {
|
||||
private static final boolean localLOGV = true;
|
||||
|
||||
@ -501,7 +500,7 @@ public class PackageManagerTests extends AndroidTestCase {
|
||||
final StructStat stat;
|
||||
|
||||
try {
|
||||
stat = Libcore.os.lstat(path);
|
||||
stat = Os.lstat(path);
|
||||
} catch (ErrnoException e) {
|
||||
throw new AssertionError(reason + "\n" + "Got: " + path + " does not exist");
|
||||
}
|
||||
|
@ -32,13 +32,13 @@ import android.os.Parcel;
|
||||
import android.test.AndroidTestCase;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
|
||||
import static libcore.io.OsConstants.IFA_F_DEPRECATED;
|
||||
import static libcore.io.OsConstants.IFA_F_PERMANENT;
|
||||
import static libcore.io.OsConstants.IFA_F_TENTATIVE;
|
||||
import static libcore.io.OsConstants.RT_SCOPE_HOST;
|
||||
import static libcore.io.OsConstants.RT_SCOPE_LINK;
|
||||
import static libcore.io.OsConstants.RT_SCOPE_SITE;
|
||||
import static libcore.io.OsConstants.RT_SCOPE_UNIVERSE;
|
||||
import static android.system.OsConstants.IFA_F_DEPRECATED;
|
||||
import static android.system.OsConstants.IFA_F_PERMANENT;
|
||||
import static android.system.OsConstants.IFA_F_TENTATIVE;
|
||||
import static android.system.OsConstants.RT_SCOPE_HOST;
|
||||
import static android.system.OsConstants.RT_SCOPE_LINK;
|
||||
import static android.system.OsConstants.RT_SCOPE_SITE;
|
||||
import static android.system.OsConstants.RT_SCOPE_UNIVERSE;
|
||||
|
||||
/**
|
||||
* Tests for {@link LinkAddress}.
|
||||
|
@ -18,14 +18,13 @@ package android.net;
|
||||
|
||||
import android.net.LinkProperties;
|
||||
import android.net.RouteInfo;
|
||||
import android.system.OsConstants;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import libcore.io.OsConstants;
|
||||
|
||||
public class LinkPropertiesTest extends TestCase {
|
||||
private static InetAddress ADDRV4 = NetworkUtils.numericToInetAddress("75.208.6.1");
|
||||
private static InetAddress ADDRV6 = NetworkUtils.numericToInetAddress(
|
||||
|
@ -44,6 +44,8 @@ import android.provider.Settings;
|
||||
import android.sax.Element;
|
||||
import android.sax.ElementListener;
|
||||
import android.sax.RootElement;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
@ -59,9 +61,6 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
|
||||
import libcore.io.ErrnoException;
|
||||
import libcore.io.Libcore;
|
||||
|
||||
/**
|
||||
* Internal service helper that no-one should use directly.
|
||||
*
|
||||
@ -1129,7 +1128,7 @@ public class MediaScanner
|
||||
if (path != null && path.startsWith("/")) {
|
||||
boolean exists = false;
|
||||
try {
|
||||
exists = Libcore.os.access(path, libcore.io.OsConstants.F_OK);
|
||||
exists = Os.access(path, android.system.OsConstants.F_OK);
|
||||
} catch (ErrnoException e1) {
|
||||
}
|
||||
if (!exists && !MtpConstants.isAbstractObject(format)) {
|
||||
|
@ -41,6 +41,9 @@ import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.StatFs;
|
||||
import android.provider.Settings;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.system.StructStatVfs;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Slog;
|
||||
|
||||
@ -66,11 +69,8 @@ import javax.crypto.CipherInputStream;
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
|
||||
import libcore.io.ErrnoException;
|
||||
import libcore.io.IoUtils;
|
||||
import libcore.io.Libcore;
|
||||
import libcore.io.Streams;
|
||||
import libcore.io.StructStatVfs;
|
||||
|
||||
/*
|
||||
* This service copies a downloaded apk to a file passed in as
|
||||
@ -245,7 +245,7 @@ public class DefaultContainerService extends IntentService {
|
||||
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
|
||||
|
||||
try {
|
||||
final StructStatVfs stat = Libcore.os.statvfs(path);
|
||||
final StructStatVfs stat = Os.statvfs(path);
|
||||
final long totalSize = stat.f_blocks * stat.f_bsize;
|
||||
final long availSize = stat.f_bavail * stat.f_bsize;
|
||||
return new long[] { totalSize, availSize };
|
||||
@ -379,7 +379,7 @@ public class DefaultContainerService extends IntentService {
|
||||
}
|
||||
|
||||
try {
|
||||
Libcore.os.chmod(resFile.getAbsolutePath(), 0640);
|
||||
Os.chmod(resFile.getAbsolutePath(), 0640);
|
||||
} catch (ErrnoException e) {
|
||||
Slog.e(TAG, "Could not chown APK: " + e.getMessage());
|
||||
PackageHelper.destroySdDir(newCid);
|
||||
@ -401,7 +401,7 @@ public class DefaultContainerService extends IntentService {
|
||||
}
|
||||
|
||||
try {
|
||||
Libcore.os.chmod(publicZipFile.getAbsolutePath(), 0644);
|
||||
Os.chmod(publicZipFile.getAbsolutePath(), 0644);
|
||||
} catch (ErrnoException e) {
|
||||
Slog.e(TAG, "Could not chown public resource file: " + e.getMessage());
|
||||
PackageHelper.destroySdDir(newCid);
|
||||
|
@ -23,13 +23,13 @@ import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
||||
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED;
|
||||
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER;
|
||||
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
|
||||
import static android.system.OsConstants.S_IRWXU;
|
||||
import static android.system.OsConstants.S_IRGRP;
|
||||
import static android.system.OsConstants.S_IXGRP;
|
||||
import static android.system.OsConstants.S_IROTH;
|
||||
import static android.system.OsConstants.S_IXOTH;
|
||||
import static com.android.internal.util.ArrayUtils.appendInt;
|
||||
import static com.android.internal.util.ArrayUtils.removeInt;
|
||||
import static libcore.io.OsConstants.S_IRWXU;
|
||||
import static libcore.io.OsConstants.S_IRGRP;
|
||||
import static libcore.io.OsConstants.S_IXGRP;
|
||||
import static libcore.io.OsConstants.S_IROTH;
|
||||
import static libcore.io.OsConstants.S_IXOTH;
|
||||
|
||||
import com.android.internal.app.IMediaContainerService;
|
||||
import com.android.internal.app.ResolverActivity;
|
||||
@ -117,6 +117,9 @@ import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.security.KeyStore;
|
||||
import android.security.SystemKeyStore;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.system.StructStat;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.EventLog;
|
||||
@ -156,10 +159,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import libcore.io.ErrnoException;
|
||||
import libcore.io.IoUtils;
|
||||
import libcore.io.Libcore;
|
||||
import libcore.io.StructStat;
|
||||
|
||||
import com.android.internal.R;
|
||||
|
||||
@ -4534,7 +4534,7 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
if (dataPath.exists()) {
|
||||
int currentUid = 0;
|
||||
try {
|
||||
StructStat stat = Libcore.os.stat(dataPath.getPath());
|
||||
StructStat stat = Os.stat(dataPath.getPath());
|
||||
currentUid = stat.st_uid;
|
||||
} catch (ErrnoException e) {
|
||||
Slog.e(TAG, "Couldn't stat path " + dataPath.getPath(), e);
|
||||
@ -5250,8 +5250,7 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
}
|
||||
|
||||
try {
|
||||
Libcore.os.chmod(nativeLibraryDir.getPath(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH
|
||||
| S_IXOTH);
|
||||
Os.chmod(nativeLibraryDir.getPath(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
|
||||
} catch (ErrnoException e) {
|
||||
throw new IOException("Cannot chmod native library directory "
|
||||
+ nativeLibraryDir.getPath(), e);
|
||||
|
@ -20,6 +20,8 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.SystemProperties;
|
||||
import android.provider.Settings;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.util.Base64;
|
||||
import android.util.Slog;
|
||||
|
||||
@ -28,9 +30,7 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import libcore.io.ErrnoException;
|
||||
import libcore.io.IoUtils;
|
||||
import libcore.io.Libcore;
|
||||
|
||||
public class SELinuxPolicyInstallReceiver extends ConfigUpdateInstallReceiver {
|
||||
|
||||
@ -110,16 +110,16 @@ public class SELinuxPolicyInstallReceiver extends ConfigUpdateInstallReceiver {
|
||||
File update = new File(updateDir.getParentFile(), "update");
|
||||
File tmp = new File(updateDir.getParentFile(), "tmp");
|
||||
if (current.exists()) {
|
||||
Libcore.os.symlink(updateDir.getPath(), update.getPath());
|
||||
Libcore.os.rename(update.getPath(), current.getPath());
|
||||
Os.symlink(updateDir.getPath(), update.getPath());
|
||||
Os.rename(update.getPath(), current.getPath());
|
||||
} else {
|
||||
Libcore.os.symlink(updateDir.getPath(), current.getPath());
|
||||
Os.symlink(updateDir.getPath(), current.getPath());
|
||||
}
|
||||
contexts.mkdirs();
|
||||
backupContexts(contexts);
|
||||
copyUpdate(contexts);
|
||||
Libcore.os.symlink(contexts.getPath(), tmp.getPath());
|
||||
Libcore.os.rename(tmp.getPath(), current.getPath());
|
||||
Os.symlink(contexts.getPath(), tmp.getPath());
|
||||
Os.rename(tmp.getPath(), current.getPath());
|
||||
SystemProperties.set("selinux.reload_policy", "1");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user