diff options
author | 2011-07-13 11:06:57 -0400 | |
---|---|---|
committer | 2011-07-13 19:45:44 -0400 | |
commit | c1b9bbb21c8ad5109978a4e9e770cd18b0257434 (patch) | |
tree | bfb7dd2272e5fe29d3c0fc4f22ca708e00bc10be | |
parent | b6e5e7a740bf595a1a5d32b28549e5d579a04ee3 (diff) |
Remove some #ifdef HAVE_ANDROID_OS that were needed for the simulator build
Change-Id: I13d9f251f86c05ae5405f37adbf6b8e9660935ba
Signed-off-by: Mike Lockwood <lockwood@android.com>
-rw-r--r-- | cmds/system_server/system_main.cpp | 5 | ||||
-rw-r--r-- | core/jni/AndroidRuntime.cpp | 7 | ||||
-rw-r--r-- | core/jni/android_net_TrafficStats.cpp | 8 | ||||
-rw-r--r-- | core/jni/android_os_Debug.cpp | 6 | ||||
-rw-r--r-- | core/jni/android_os_FileUtils.cpp | 15 | ||||
-rw-r--r-- | core/jni/android_os_Power.cpp | 8 | ||||
-rw-r--r-- | core/jni/android_util_Log.cpp | 4 | ||||
-rw-r--r-- | core/jni/android_util_Process.cpp | 8 | ||||
-rw-r--r-- | core/jni/com_android_internal_os_ZygoteInit.cpp | 8 | ||||
-rw-r--r-- | include/private/binder/binder_module.h | 115 | ||||
-rw-r--r-- | libs/binder/ProcessState.cpp | 12 | ||||
-rw-r--r-- | media/jni/android_mtp_MtpDatabase.cpp | 11 | ||||
-rw-r--r-- | media/jni/android_mtp_MtpDevice.cpp | 45 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 3 | ||||
-rw-r--r-- | services/jni/com_android_server_AlarmManagerService.cpp | 17 | ||||
-rw-r--r-- | services/jni/com_android_server_BatteryService.cpp | 3 |
16 files changed, 1 insertions, 274 deletions
diff --git a/cmds/system_server/system_main.cpp b/cmds/system_server/system_main.cpp index 543f650a4d22..d67329d63f17 100644 --- a/cmds/system_server/system_main.cpp +++ b/cmds/system_server/system_main.cpp @@ -52,10 +52,5 @@ int main(int argc, const char* const argv[]) LOGW("*** Current priority: %d\n", getpriority(PRIO_PROCESS, 0)); setpriority(PRIO_PROCESS, 0, -1); - #if HAVE_ANDROID_OS - //setgid(GID_SYSTEM); - //setuid(UID_SYSTEM); - #endif - system_init(); } diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index a61217a1ef38..23c6da7a1b59 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -623,16 +623,9 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) } /* enable debugging; set suspend=y to pause during VM init */ -#ifdef HAVE_ANDROID_OS /* use android ADB transport */ opt.optionString = "-agentlib:jdwp=transport=dt_android_adb,suspend=n,server=y"; -#else - /* use TCP socket; address=0 means start at port 8000 and probe up */ - LOGI("Using TCP socket for JDWP\n"); - opt.optionString = - "-agentlib:jdwp=transport=dt_socket,suspend=n,server=y,address=0"; -#endif mOptions.add(opt); char enableDPBuf[sizeof("-Xdeadlockpredict:") + PROPERTY_VALUE_MAX]; diff --git a/core/jni/android_net_TrafficStats.cpp b/core/jni/android_net_TrafficStats.cpp index d54981e18d15..c22b07138ca3 100644 --- a/core/jni/android_net_TrafficStats.cpp +++ b/core/jni/android_net_TrafficStats.cpp @@ -44,7 +44,6 @@ enum Tcp_Udp { // Returns an ASCII decimal number read from the specified file, -1 on error. static jlong readNumber(char const* filename) { -#ifdef HAVE_ANDROID_OS char buf[80]; int fd = open(filename, O_RDONLY); if (fd < 0) { @@ -62,9 +61,6 @@ static jlong readNumber(char const* filename) { close(fd); buf[len] = '\0'; return atoll(buf); -#else // Simulator - return -1; -#endif } static const char* mobile_iface_list[] = { @@ -101,7 +97,6 @@ static jlong getAll(const char** iface_list, const char* what) { // Returns the sum of numbers from the specified path under /sys/class/net/*, // -1 if no such file exists. static jlong readTotal(char const* suffix) { -#ifdef HAVE_ANDROID_OS char filename[PATH_MAX] = "/sys/class/net/"; DIR *dir = opendir(filename); if (dir == NULL) { @@ -123,9 +118,6 @@ static jlong readTotal(char const* suffix) { closedir(dir); return total; -#else // Simulator - return -1; -#endif } // Mobile stats get accessed a lot more often than total stats. diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp index 2297834ee681..a4432c38c32a 100644 --- a/core/jni/android_os_Debug.cpp +++ b/core/jni/android_os_Debug.cpp @@ -278,7 +278,6 @@ jint android_os_Debug_getProxyObjectCount(JNIEnv* env, jobject clazz); jint android_os_Debug_getDeathObjectCount(JNIEnv* env, jobject clazz); -#ifdef HAVE_ANDROID_OS /* pulled out of bionic */ extern "C" void get_malloc_leak_info(uint8_t** info, size_t* overallSize, size_t* infoSize, size_t* totalMemory, size_t* backtraceSize); @@ -414,7 +413,6 @@ static void dumpNativeHeap(FILE* fp) fprintf(fp, "END\n"); } -#endif /*HAVE_ANDROID_OS*/ /* * Dump the native heap, writing human-readable output to the specified @@ -449,13 +447,9 @@ static void android_os_Debug_dumpNativeHeap(JNIEnv* env, jobject clazz, return; } -#ifdef HAVE_ANDROID_OS LOGD("Native heap dump starting...\n"); dumpNativeHeap(fp); LOGD("Native heap dump complete.\n"); -#else - fprintf(fp, "Native heap dump not available on this platform\n"); -#endif fclose(fp); } diff --git a/core/jni/android_os_FileUtils.cpp b/core/jni/android_os_FileUtils.cpp index 89dce8987364..8d65cbcf74a7 100644 --- a/core/jni/android_os_FileUtils.cpp +++ b/core/jni/android_os_FileUtils.cpp @@ -28,11 +28,8 @@ #include <sys/types.h> #include <fcntl.h> #include <signal.h> - -#if HAVE_ANDROID_OS #include <sys/ioctl.h> #include <linux/msdos_fs.h> -#endif namespace android { @@ -53,7 +50,6 @@ jint android_os_FileUtils_setPermissions(JNIEnv* env, jobject clazz, jstring file, jint mode, jint uid, jint gid) { - #if HAVE_ANDROID_OS const jchar* str = env->GetStringCritical(file, 0); String8 file8; if (str) { @@ -70,15 +66,11 @@ jint android_os_FileUtils_setPermissions(JNIEnv* env, jobject clazz, } } return chmod(file8.string(), mode) == 0 ? 0 : errno; - #else - return ENOSYS; - #endif } jint android_os_FileUtils_getPermissions(JNIEnv* env, jobject clazz, jstring file, jintArray outArray) { - #if HAVE_ANDROID_OS const jchar* str = env->GetStringCritical(file, 0); String8 file8; if (str) { @@ -107,9 +99,6 @@ jint android_os_FileUtils_getPermissions(JNIEnv* env, jobject clazz, } env->ReleasePrimitiveArrayCritical(outArray, array, 0); return 0; - #else - return ENOSYS; - #endif } jint android_os_FileUtils_setUMask(JNIEnv* env, jobject clazz, jint mask) @@ -119,7 +108,6 @@ jint android_os_FileUtils_setUMask(JNIEnv* env, jobject clazz, jint mask) jint android_os_FileUtils_getFatVolumeId(JNIEnv* env, jobject clazz, jstring path) { - #if HAVE_ANDROID_OS if (path == NULL) { jniThrowException(env, "java/lang/IllegalArgumentException", NULL); return -1; @@ -137,9 +125,6 @@ jint android_os_FileUtils_getFatVolumeId(JNIEnv* env, jobject clazz, jstring pat env->ReleaseStringUTFChars(path, pathStr); return result; - #else - return -1; - #endif } jboolean android_os_FileUtils_getFileStatus(JNIEnv* env, jobject clazz, jstring path, jobject fileStatus) { diff --git a/core/jni/android_os_Power.cpp b/core/jni/android_os_Power.cpp index 9ae4a6318778..dc1699089e38 100644 --- a/core/jni/android_os_Power.cpp +++ b/core/jni/android_os_Power.cpp @@ -70,16 +70,11 @@ setScreenState(JNIEnv *env, jobject clazz, jboolean on) static void android_os_Power_shutdown(JNIEnv *env, jobject clazz) { -#ifdef HAVE_ANDROID_OS android_reboot(ANDROID_RB_POWEROFF, 0, 0); -#else - sync(); -#endif } static void android_os_Power_reboot(JNIEnv *env, jobject clazz, jstring reason) { -#ifdef HAVE_ANDROID_OS if (reason == NULL) { android_reboot(ANDROID_RB_RESTART, 0, 0); } else { @@ -88,9 +83,6 @@ static void android_os_Power_reboot(JNIEnv *env, jobject clazz, jstring reason) env->ReleaseStringUTFChars(reason, chars); // In case it fails. } jniThrowIOException(env, errno); -#else - sync(); -#endif } static JNINativeMethod method_table[] = { diff --git a/core/jni/android_util_Log.cpp b/core/jni/android_util_Log.cpp index 0fbe0e7c13c7..2c7bb8466b41 100644 --- a/core/jni/android_util_Log.cpp +++ b/core/jni/android_util_Log.cpp @@ -58,9 +58,6 @@ static int toLevel(const char* value) static jboolean android_util_Log_isLoggable(JNIEnv* env, jobject clazz, jstring tag, jint level) { -#ifndef HAVE_ANDROID_OS - return false; -#else /* HAVE_ANDROID_OS */ int len; char key[PROPERTY_KEY_MAX]; char buf[PROPERTY_VALUE_MAX]; @@ -93,7 +90,6 @@ static jboolean android_util_Log_isLoggable(JNIEnv* env, jobject clazz, jstring len = property_get(key, buf, ""); int logLevel = toLevel(buf); return (logLevel >= 0 && level >= logLevel) ? true : false; -#endif /* HAVE_ANDROID_OS */ } /* diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index d1ba2d13499e..47d343a1fcd2 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -352,20 +352,12 @@ void android_os_Process_setArgV0(JNIEnv* env, jobject clazz, jstring name) jint android_os_Process_setUid(JNIEnv* env, jobject clazz, jint uid) { - #if HAVE_ANDROID_OS return setuid(uid) == 0 ? 0 : errno; - #else - return ENOSYS; - #endif } jint android_os_Process_setGid(JNIEnv* env, jobject clazz, jint uid) { - #if HAVE_ANDROID_OS return setgid(uid) == 0 ? 0 : errno; - #else - return ENOSYS; - #endif } static int pid_compare(const void* v1, const void* v2) diff --git a/core/jni/com_android_internal_os_ZygoteInit.cpp b/core/jni/com_android_internal_os_ZygoteInit.cpp index 86fd9cb94bba..7e5dedecbdc6 100644 --- a/core/jni/com_android_internal_os_ZygoteInit.cpp +++ b/core/jni/com_android_internal_os_ZygoteInit.cpp @@ -27,13 +27,11 @@ #include <JNIHelp.h> #include "android_runtime/AndroidRuntime.h" -#ifdef HAVE_ANDROID_OS #include <linux/capability.h> #include <linux/prctl.h> #include <sys/prctl.h> extern "C" int capget(cap_user_header_t hdrp, cap_user_data_t datap); extern "C" int capset(cap_user_header_t hdrp, const cap_user_data_t datap); -#endif namespace android { @@ -168,7 +166,6 @@ static void com_android_internal_os_ZygoteInit_setCloseOnExec (JNIEnv *env, static void com_android_internal_os_ZygoteInit_setCapabilities (JNIEnv *env, jobject clazz, jlong permitted, jlong effective) { -#ifdef HAVE_ANDROID_OS struct __user_cap_header_struct capheader; struct __user_cap_data_struct capdata; int err; @@ -190,15 +187,11 @@ static void com_android_internal_os_ZygoteInit_setCapabilities (JNIEnv *env, jniThrowIOException(env, errno); return; } -#endif /* HAVE_ANDROID_OS */ } static jlong com_android_internal_os_ZygoteInit_capgetPermitted (JNIEnv *env, jobject clazz, jint pid) { -#ifndef HAVE_ANDROID_OS - return (jlong)0; -#else struct __user_cap_header_struct capheader; struct __user_cap_data_struct capdata; int err; @@ -217,7 +210,6 @@ static jlong com_android_internal_os_ZygoteInit_capgetPermitted (JNIEnv *env, } return (jlong) capdata.permitted; -#endif /* HAVE_ANDROID_OS */ } static jint com_android_internal_os_ZygoteInit_selectReadable ( diff --git a/include/private/binder/binder_module.h b/include/private/binder/binder_module.h index fdf327e1c5d3..a8dd64f235bb 100644 --- a/include/private/binder/binder_module.h +++ b/include/private/binder/binder_module.h @@ -21,126 +21,11 @@ namespace android { #endif -#if defined(HAVE_ANDROID_OS) - /* obtain structures and constants from the kernel header */ #include <sys/ioctl.h> #include <linux/binder.h> -#else - -/* Some parts of the simulator need fake versions of this - * stuff in order to compile. Really this should go away - * entirely... - */ - -#define BINDER_CURRENT_PROTOCOL_VERSION 7 - -#define BINDER_TYPE_BINDER 1 -#define BINDER_TYPE_WEAK_BINDER 2 -#define BINDER_TYPE_HANDLE 3 -#define BINDER_TYPE_WEAK_HANDLE 4 -#define BINDER_TYPE_FD 5 - -struct flat_binder_object { - unsigned long type; - unsigned long flags; - union { - void *binder; - signed long handle; - }; - void *cookie; -}; - -struct binder_write_read { - signed long write_size; - signed long write_consumed; - unsigned long write_buffer; - signed long read_size; - signed long read_consumed; - unsigned long read_buffer; -}; - -struct binder_transaction_data { - union { - size_t handle; - void *ptr; - } target; - void *cookie; - unsigned int code; - - unsigned int flags; - pid_t sender_pid; - uid_t sender_euid; - size_t data_size; - size_t offsets_size; - - union { - struct { - const void *buffer; - const void *offsets; - } ptr; - uint8_t buf[8]; - } data; -}; - -enum transaction_flags { - TF_ONE_WAY = 0x01, - TF_ROOT_OBJECT = 0x04, - TF_STATUS_CODE = 0x08, - TF_ACCEPT_FDS = 0x10, -}; - - -enum { - FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff, - FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100, -}; - -enum BinderDriverReturnProtocol { - BR_ERROR, - BR_OK, - BR_TRANSACTION, - BR_REPLY, - BR_ACQUIRE_RESULT, - BR_DEAD_REPLY, - BR_TRANSACTION_COMPLETE, - BR_INCREFS, - BR_ACQUIRE, - BR_RELEASE, - BR_DECREFS, - BR_ATTEMPT_ACQUIRE, - BR_NOOP, - BR_SPAWN_LOOPER, - BR_FINISHED, - BR_DEAD_BINDER, - BR_CLEAR_DEATH_NOTIFICATION_DONE, - BR_FAILED_REPLY, -}; - -enum BinderDriverCommandProtocol { - BC_TRANSACTION, - BC_REPLY, - BC_ACQUIRE_RESULT, - BC_FREE_BUFFER, - BC_INCREFS, - BC_ACQUIRE, - BC_RELEASE, - BC_DECREFS, - BC_INCREFS_DONE, - BC_ACQUIRE_DONE, - BC_ATTEMPT_ACQUIRE, - BC_REGISTER_LOOPER, - BC_ENTER_LOOPER, - BC_EXIT_LOOPER, - BC_REQUEST_DEATH_NOTIFICATION, - BC_CLEAR_DEATH_NOTIFICATION, - BC_DEAD_BINDER_DONE, -}; - -#endif - #ifdef __cplusplus } // namespace android #endif diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 7264ac40867c..f5288c8c3ead 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -154,11 +154,7 @@ bool ProcessState::becomeContextManager(context_check_func checkFunc, void* user mBinderContextUserData = userData; int dummy = 0; -#if defined(HAVE_ANDROID_OS) status_t result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR, &dummy); -#else - status_t result = INVALID_OPERATION; -#endif if (result == 0) { mManagesContexts = true; } else if (result == -1) { @@ -304,12 +300,7 @@ static int open_driver() if (fd >= 0) { fcntl(fd, F_SETFD, FD_CLOEXEC); int vers; -#if defined(HAVE_ANDROID_OS) status_t result = ioctl(fd, BINDER_VERSION, &vers); -#else - status_t result = -1; - errno = EPERM; -#endif if (result == -1) { LOGE("Binder ioctl to obtain version failed: %s", strerror(errno)); close(fd); @@ -320,14 +311,11 @@ static int open_driver() close(fd); fd = -1; } -#if defined(HAVE_ANDROID_OS) size_t maxThreads = 15; result = ioctl(fd, BINDER_SET_MAX_THREADS, &maxThreads); if (result == -1) { LOGE("Binder ioctl to set max threads failed: %s", strerror(errno)); } -#endif - } else { LOGW("Opening '/dev/binder' failed: %s\n", strerror(errno)); } diff --git a/media/jni/android_mtp_MtpDatabase.cpp b/media/jni/android_mtp_MtpDatabase.cpp index 0f3c063bedae..4dbcb90435d5 100644 --- a/media/jni/android_mtp_MtpDatabase.cpp +++ b/media/jni/android_mtp_MtpDatabase.cpp @@ -79,7 +79,6 @@ MtpDatabase* getMtpDatabase(JNIEnv *env, jobject database) { return (MtpDatabase *)env->GetIntField(database, field_context); } -#ifdef HAVE_ANDROID_OS // ---------------------------------------------------------------------------- class MyMtpDatabase : public MtpDatabase { @@ -1066,42 +1065,32 @@ void MyMtpDatabase::sessionEnded() { checkAndClearExceptionFromCallback(env, __FUNCTION__); } -#endif // HAVE_ANDROID_OS - // ---------------------------------------------------------------------------- static void android_mtp_MtpDatabase_setup(JNIEnv *env, jobject thiz) { -#ifdef HAVE_ANDROID_OS MyMtpDatabase* database = new MyMtpDatabase(env, thiz); env->SetIntField(thiz, field_context, (int)database); checkAndClearExceptionFromCallback(env, __FUNCTION__); -#endif } static void android_mtp_MtpDatabase_finalize(JNIEnv *env, jobject thiz) { -#ifdef HAVE_ANDROID_OS MyMtpDatabase* database = (MyMtpDatabase *)env->GetIntField(thiz, field_context); database->cleanup(env); delete database; env->SetIntField(thiz, field_context, 0); checkAndClearExceptionFromCallback(env, __FUNCTION__); -#endif } static jstring android_mtp_MtpPropertyGroup_format_date_time(JNIEnv *env, jobject thiz, jlong seconds) { -#ifdef HAVE_ANDROID_OS char date[20]; formatDateTime(seconds, date, sizeof(date)); return env->NewStringUTF(date); -#else - return NULL; -#endif } // ---------------------------------------------------------------------------- diff --git a/media/jni/android_mtp_MtpDevice.cpp b/media/jni/android_mtp_MtpDevice.cpp index 40bbaa321baa..6b73f6c9b4e9 100644 --- a/media/jni/android_mtp_MtpDevice.cpp +++ b/media/jni/android_mtp_MtpDevice.cpp @@ -85,8 +85,6 @@ static jfieldID field_objectInfo_dateCreated; static jfieldID field_objectInfo_dateModified; static jfieldID field_objectInfo_keywords; -#ifdef HAVE_ANDROID_OS - MtpDevice* get_device_from_object(JNIEnv* env, jobject javaDevice) { return (MtpDevice*)env->GetIntField(javaDevice, field_context); @@ -100,15 +98,11 @@ static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodNa } } -#endif // HAVE_ANDROID_OS - // ---------------------------------------------------------------------------- static jboolean android_mtp_MtpDevice_open(JNIEnv *env, jobject thiz, jstring deviceName, jint fd) { -#ifdef HAVE_ANDROID_OS - LOGD("open\n"); const char *deviceNameStr = env->GetStringUTFChars(deviceName, NULL); if (deviceNameStr == NULL) { return false; @@ -120,27 +114,22 @@ android_mtp_MtpDevice_open(JNIEnv *env, jobject thiz, jstring deviceName, jint f if (device) env->SetIntField(thiz, field_context, (int)device); return (device != NULL); -#endif } static void android_mtp_MtpDevice_close(JNIEnv *env, jobject thiz) { -#ifdef HAVE_ANDROID_OS - LOGD("close\n"); MtpDevice* device = get_device_from_object(env, thiz); if (device) { device->close(); delete device; env->SetIntField(thiz, field_context, 0); } -#endif } static jobject android_mtp_MtpDevice_get_device_info(JNIEnv *env, jobject thiz) { -#ifdef HAVE_ANDROID_OS MtpDevice* device = get_device_from_object(env, thiz); if (!device) { LOGD("android_mtp_MtpDevice_get_device_info device is null"); @@ -173,15 +162,11 @@ android_mtp_MtpDevice_get_device_info(JNIEnv *env, jobject thiz) delete deviceInfo; return info; -#else - return NULL; -#endif } static jintArray android_mtp_MtpDevice_get_storage_ids(JNIEnv *env, jobject thiz) { -#ifdef HAVE_ANDROID_OS MtpDevice* device = get_device_from_object(env, thiz); if (!device) return NULL; @@ -196,15 +181,11 @@ android_mtp_MtpDevice_get_storage_ids(JNIEnv *env, jobject thiz) delete storageIDs; return array; -#else - return NULL; -#endif } static jobject android_mtp_MtpDevice_get_storage_info(JNIEnv *env, jobject thiz, jint storageID) { -#ifdef HAVE_ANDROID_OS MtpDevice* device = get_device_from_object(env, thiz); if (!device) return NULL; @@ -234,16 +215,12 @@ android_mtp_MtpDevice_get_storage_info(JNIEnv *env, jobject thiz, jint storageID delete storageInfo; return info; -#else - return NULL; -#endif } static jintArray android_mtp_MtpDevice_get_object_handles(JNIEnv *env, jobject thiz, jint storageID, jint format, jint objectID) { -#ifdef HAVE_ANDROID_OS MtpDevice* device = get_device_from_object(env, thiz); if (!device) return NULL; @@ -258,15 +235,11 @@ android_mtp_MtpDevice_get_object_handles(JNIEnv *env, jobject thiz, delete handles; return array; -#else - return NULL; -#endif } static jobject android_mtp_MtpDevice_get_object_info(JNIEnv *env, jobject thiz, jint objectID) { -#ifdef HAVE_ANDROID_OS MtpDevice* device = get_device_from_object(env, thiz); if (!device) return NULL; @@ -324,9 +297,6 @@ android_mtp_MtpDevice_get_object_info(JNIEnv *env, jobject thiz, jint objectID) delete objectInfo; return info; -#else - return NULL; -#endif } struct get_object_callback_data { @@ -344,7 +314,6 @@ static bool get_object_callback(void* data, int offset, int length, void* client static jbyteArray android_mtp_MtpDevice_get_object(JNIEnv *env, jobject thiz, jint objectID, jint objectSize) { -#ifdef HAVE_ANDROID_OS MtpDevice* device = get_device_from_object(env, thiz); if (!device) return NULL; @@ -361,14 +330,12 @@ android_mtp_MtpDevice_get_object(JNIEnv *env, jobject thiz, jint objectID, jint if (device->readObject(objectID, get_object_callback, objectSize, &data)) return array; -#endif return NULL; } static jbyteArray android_mtp_MtpDevice_get_thumbnail(JNIEnv *env, jobject thiz, jint objectID) { -#ifdef HAVE_ANDROID_OS MtpDevice* device = get_device_from_object(env, thiz); if (!device) return NULL; @@ -382,51 +349,41 @@ android_mtp_MtpDevice_get_thumbnail(JNIEnv *env, jobject thiz, jint objectID) free(thumbnail); return array; -#else - return NULL; -#endif } static jboolean android_mtp_MtpDevice_delete_object(JNIEnv *env, jobject thiz, jint object_id) { -#ifdef HAVE_ANDROID_OS MtpDevice* device = get_device_from_object(env, thiz); if (device) return device->deleteObject(object_id); else - #endif return NULL; } static jlong android_mtp_MtpDevice_get_parent(JNIEnv *env, jobject thiz, jint object_id) { -#ifdef HAVE_ANDROID_OS MtpDevice* device = get_device_from_object(env, thiz); if (device) return device->getParent(object_id); else -#endif return -1; } static jlong android_mtp_MtpDevice_get_storage_id(JNIEnv *env, jobject thiz, jint object_id) { - #ifdef HAVE_ANDROID_OS MtpDevice* device = get_device_from_object(env, thiz); if (device) return device->getStorageID(object_id); else -#endif return -1; } static jboolean android_mtp_MtpDevice_import_file(JNIEnv *env, jobject thiz, jint object_id, jstring dest_path) { -#ifdef HAVE_ANDROID_OS MtpDevice* device = get_device_from_object(env, thiz); if (device) { const char *destPathStr = env->GetStringUTFChars(dest_path, NULL); @@ -438,7 +395,7 @@ android_mtp_MtpDevice_import_file(JNIEnv *env, jobject thiz, jint object_id, jst env->ReleaseStringUTFChars(dest_path, destPathStr); return result; } -#endif + return false; } diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index 47ca3a03c7dc..8e16d944356d 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -48,9 +48,6 @@ static const int kDumpLockRetries = 50; static const int kDumpLockSleep = 20000; static bool checkPermission() { -#ifndef HAVE_ANDROID_OS - return true; -#endif if (getpid() == IPCThreadState::self()->getCallingPid()) return true; bool ok = checkCallingPermission(String16("android.permission.MODIFY_AUDIO_SETTINGS")); if (!ok) LOGE("Request requires android.permission.MODIFY_AUDIO_SETTINGS"); diff --git a/services/jni/com_android_server_AlarmManagerService.cpp b/services/jni/com_android_server_AlarmManagerService.cpp index c9a702a515bb..e80dd042123b 100644 --- a/services/jni/com_android_server_AlarmManagerService.cpp +++ b/services/jni/com_android_server_AlarmManagerService.cpp @@ -32,17 +32,13 @@ #include <stdlib.h> #include <errno.h> #include <unistd.h> - -#ifdef HAVE_ANDROID_OS #include <linux/ioctl.h> #include <linux/android_alarm.h> -#endif namespace android { static jint android_server_AlarmManagerService_setKernelTimezone(JNIEnv* env, jobject obj, jint fd, jint minswest) { -#ifdef HAVE_ANDROID_OS struct timezone tz; tz.tz_minuteswest = minswest; @@ -57,30 +53,20 @@ static jint android_server_AlarmManagerService_setKernelTimezone(JNIEnv* env, jo } return 0; -#else - return -ENOSYS; -#endif } static jint android_server_AlarmManagerService_init(JNIEnv* env, jobject obj) { -#ifdef HAVE_ANDROID_OS return open("/dev/alarm", O_RDWR); -#else - return -1; -#endif } static void android_server_AlarmManagerService_close(JNIEnv* env, jobject obj, jint fd) { -#ifdef HAVE_ANDROID_OS close(fd); -#endif } static void android_server_AlarmManagerService_set(JNIEnv* env, jobject obj, jint fd, jint type, jlong seconds, jlong nanoseconds) { -#ifdef HAVE_ANDROID_OS struct timespec ts; ts.tv_sec = seconds; ts.tv_nsec = nanoseconds; @@ -90,12 +76,10 @@ static void android_server_AlarmManagerService_set(JNIEnv* env, jobject obj, jin { LOGE("Unable to set alarm to %lld.%09lld: %s\n", seconds, nanoseconds, strerror(errno)); } -#endif } static jint android_server_AlarmManagerService_waitForAlarm(JNIEnv* env, jobject obj, jint fd) { -#ifdef HAVE_ANDROID_OS int result = 0; do @@ -110,7 +94,6 @@ static jint android_server_AlarmManagerService_waitForAlarm(JNIEnv* env, jobject } return result; -#endif } static JNINativeMethod sMethods[] = { diff --git a/services/jni/com_android_server_BatteryService.cpp b/services/jni/com_android_server_BatteryService.cpp index 98d0d92b69e4..b9f2c1f182d1 100644 --- a/services/jni/com_android_server_BatteryService.cpp +++ b/services/jni/com_android_server_BatteryService.cpp @@ -32,10 +32,7 @@ #include <errno.h> #include <unistd.h> #include <dirent.h> - -#ifdef HAVE_ANDROID_OS #include <linux/ioctl.h> -#endif namespace android { |