From 25ba5b6564224dceefa086b5c439ef28dad530ca Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 18 May 2009 15:08:03 -0700 Subject: [PATCH] checkpoint: split libutils into libutils + libbinder --- camera/libcameraservice/Android.mk | 1 + cmds/dumpsys/Android.mk | 4 +- cmds/runtime/Android.mk | 1 + cmds/service/Android.mk | 3 +- cmds/surfaceflinger/Android.mk | 1 + cmds/system_server/Android.mk | 1 + cmds/system_server/library/Android.mk | 1 + core/jni/Android.mk | 1 + include/private/binder/Static.h | 39 ++++++++++++++ .../private/{utils => binder}/binder_module.h | 0 include/private/utils/Static.h | 5 +- libs/audioflinger/Android.mk | 2 + libs/binder/Android.mk | 44 +++++++++++++++ libs/{utils => binder}/Binder.cpp | 0 libs/{utils => binder}/BpBinder.cpp | 0 libs/{utils => binder}/IDataConnection.cpp | 0 libs/{utils => binder}/IInterface.cpp | 0 libs/{utils => binder}/IMemory.cpp | 0 libs/{utils => binder}/IPCThreadState.cpp | 4 +- .../IPermissionController.cpp | 2 +- libs/{utils => binder}/IServiceManager.cpp | 2 +- libs/{utils => binder}/MemoryBase.cpp | 0 libs/{utils => binder}/MemoryDealer.cpp | 0 libs/{utils => binder}/MemoryHeapBase.cpp | 0 libs/{utils => binder}/MemoryHeapPmem.cpp | 0 libs/{utils => binder}/Parcel.cpp | 2 +- libs/{utils => binder}/ProcessState.cpp | 4 +- libs/binder/Static.cpp | 53 +++++++++++++++++++ libs/surfaceflinger/Android.mk | 1 + libs/ui/Android.mk | 1 + libs/utils/Android.mk | 13 ----- libs/utils/Static.cpp | 31 ----------- media/jni/Android.mk | 1 + media/jni/soundpool/Android.mk | 1 + media/libmedia/Android.mk | 2 +- media/libmediaplayerservice/Android.mk | 1 + media/mediaserver/Android.mk | 3 +- opengl/libs/Android.mk | 2 +- ...com_android_server_AlarmManagerService.cpp | 4 +- .../jni/com_android_server_BatteryService.cpp | 4 +- 40 files changed, 172 insertions(+), 62 deletions(-) create mode 100644 include/private/binder/Static.h rename include/private/{utils => binder}/binder_module.h (100%) create mode 100644 libs/binder/Android.mk rename libs/{utils => binder}/Binder.cpp (100%) rename libs/{utils => binder}/BpBinder.cpp (100%) rename libs/{utils => binder}/IDataConnection.cpp (100%) rename libs/{utils => binder}/IInterface.cpp (100%) rename libs/{utils => binder}/IMemory.cpp (100%) rename libs/{utils => binder}/IPCThreadState.cpp (99%) rename libs/{utils => binder}/IPermissionController.cpp (98%) rename libs/{utils => binder}/IServiceManager.cpp (99%) rename libs/{utils => binder}/MemoryBase.cpp (100%) rename libs/{utils => binder}/MemoryDealer.cpp (100%) rename libs/{utils => binder}/MemoryHeapBase.cpp (100%) rename libs/{utils => binder}/MemoryHeapPmem.cpp (100%) rename libs/{utils => binder}/Parcel.cpp (99%) rename libs/{utils => binder}/ProcessState.cpp (99%) create mode 100644 libs/binder/Static.cpp diff --git a/camera/libcameraservice/Android.mk b/camera/libcameraservice/Android.mk index 96cc512dc5d6..be78a6285b14 100644 --- a/camera/libcameraservice/Android.mk +++ b/camera/libcameraservice/Android.mk @@ -42,6 +42,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES:= \ libui \ libutils \ + libbinder \ libcutils \ libmedia diff --git a/cmds/dumpsys/Android.mk b/cmds/dumpsys/Android.mk index 0c623cc319c5..42b1b7365b1b 100644 --- a/cmds/dumpsys/Android.mk +++ b/cmds/dumpsys/Android.mk @@ -5,7 +5,9 @@ LOCAL_SRC_FILES:= \ dumpsys.cpp LOCAL_SHARED_LIBRARIES := \ - libutils + libutils \ + libbinder + ifeq ($(TARGET_OS),linux) LOCAL_CFLAGS += -DXP_UNIX diff --git a/cmds/runtime/Android.mk b/cmds/runtime/Android.mk index 521eb2b2863e..6a72d1070850 100644 --- a/cmds/runtime/Android.mk +++ b/cmds/runtime/Android.mk @@ -10,6 +10,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libutils \ + libbinder \ libandroid_runtime \ libcutils \ libui \ diff --git a/cmds/service/Android.mk b/cmds/service/Android.mk index 8c5005c1fbb1..275bbb2e17be 100644 --- a/cmds/service/Android.mk +++ b/cmds/service/Android.mk @@ -4,8 +4,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ service.cpp -LOCAL_SHARED_LIBRARIES := \ - libutils +LOCAL_SHARED_LIBRARIES := libutils libbinder ifeq ($(TARGET_OS),linux) LOCAL_CFLAGS += -DXP_UNIX diff --git a/cmds/surfaceflinger/Android.mk b/cmds/surfaceflinger/Android.mk index 37c3d942414a..bfa58a1cbf7f 100644 --- a/cmds/surfaceflinger/Android.mk +++ b/cmds/surfaceflinger/Android.mk @@ -6,6 +6,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libsurfaceflinger \ + libbinder \ libutils LOCAL_C_INCLUDES := \ diff --git a/cmds/system_server/Android.mk b/cmds/system_server/Android.mk index 0a684e86b1c7..ad537977d9eb 100644 --- a/cmds/system_server/Android.mk +++ b/cmds/system_server/Android.mk @@ -6,6 +6,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libutils \ + libbinder \ libsystem_server LOCAL_C_INCLUDES := \ diff --git a/cmds/system_server/library/Android.mk b/cmds/system_server/library/Android.mk index 580331a695af..1813d3e5ab0c 100644 --- a/cmds/system_server/library/Android.mk +++ b/cmds/system_server/library/Android.mk @@ -20,6 +20,7 @@ LOCAL_SHARED_LIBRARIES := \ libcameraservice \ libmediaplayerservice \ libutils \ + libbinder \ libcutils LOCAL_MODULE:= libsystem_server diff --git a/core/jni/Android.mk b/core/jni/Android.mk index a99c7e7a14aa..5adadb89c658 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -146,6 +146,7 @@ LOCAL_SHARED_LIBRARIES := \ libnativehelper \ libcutils \ libutils \ + libbinder \ libnetutils \ libui \ libskiagl \ diff --git a/include/private/binder/Static.h b/include/private/binder/Static.h new file mode 100644 index 000000000000..cbdf2928afe5 --- /dev/null +++ b/include/private/binder/Static.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// All static variables go here, to control initialization and +// destruction order in the library. + +#include + +#include +#include +#include +#include +#include + +namespace android { + +// For ProcessState.cpp +extern Mutex gProcessMutex; +extern sp gProcess; + +// For ServiceManager.cpp +extern Mutex gDefaultServiceManagerLock; +extern sp gDefaultServiceManager; +extern sp gPermissionController; + +} // namespace android diff --git a/include/private/utils/binder_module.h b/include/private/binder/binder_module.h similarity index 100% rename from include/private/utils/binder_module.h rename to include/private/binder/binder_module.h diff --git a/include/private/utils/Static.h b/include/private/utils/Static.h index f1439b75dc81..bd591b5f6530 100644 --- a/include/private/utils/Static.h +++ b/include/private/utils/Static.h @@ -20,6 +20,7 @@ #include #include +/* #ifndef LIBUTILS_NATIVE #include #include @@ -27,6 +28,7 @@ #include #include #endif +*/ namespace android { // For TextStream.cpp @@ -41,7 +43,7 @@ extern void initialize_string16(); extern void terminate_string16(); - +/* #ifndef LIBUTILS_NATIVE // For ProcessState.cpp @@ -54,5 +56,6 @@ extern sp gDefaultServiceManager; extern sp gPermissionController; #endif +*/ } // namespace android diff --git a/libs/audioflinger/Android.mk b/libs/audioflinger/Android.mk index 50d516b5616c..874f2c43d3b9 100644 --- a/libs/audioflinger/Android.mk +++ b/libs/audioflinger/Android.mk @@ -11,6 +11,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libcutils \ libutils \ + libbinder \ libmedia \ libhardware_legacy @@ -34,6 +35,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libcutils \ libutils \ + libbinder \ libmedia \ libhardware_legacy diff --git a/libs/binder/Android.mk b/libs/binder/Android.mk new file mode 100644 index 000000000000..c4d695e8d56f --- /dev/null +++ b/libs/binder/Android.mk @@ -0,0 +1,44 @@ +# Copyright (C) 2009 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +# we have the common sources, plus some device-specific stuff +LOCAL_SRC_FILES:= \ + Binder.cpp \ + BpBinder.cpp \ + IInterface.cpp \ + IMemory.cpp \ + IPCThreadState.cpp \ + IPermissionController.cpp \ + IServiceManager.cpp \ + MemoryDealer.cpp \ + MemoryBase.cpp \ + MemoryHeapBase.cpp \ + MemoryHeapPmem.cpp \ + Parcel.cpp \ + ProcessState.cpp \ + Static.cpp + +LOCAL_LDLIBS += -lpthread + +LOCAL_SHARED_LIBRARIES := \ + liblog \ + libcutils \ + libutils + +LOCAL_MODULE:= libbinder + +include $(BUILD_SHARED_LIBRARY) diff --git a/libs/utils/Binder.cpp b/libs/binder/Binder.cpp similarity index 100% rename from libs/utils/Binder.cpp rename to libs/binder/Binder.cpp diff --git a/libs/utils/BpBinder.cpp b/libs/binder/BpBinder.cpp similarity index 100% rename from libs/utils/BpBinder.cpp rename to libs/binder/BpBinder.cpp diff --git a/libs/utils/IDataConnection.cpp b/libs/binder/IDataConnection.cpp similarity index 100% rename from libs/utils/IDataConnection.cpp rename to libs/binder/IDataConnection.cpp diff --git a/libs/utils/IInterface.cpp b/libs/binder/IInterface.cpp similarity index 100% rename from libs/utils/IInterface.cpp rename to libs/binder/IInterface.cpp diff --git a/libs/utils/IMemory.cpp b/libs/binder/IMemory.cpp similarity index 100% rename from libs/utils/IMemory.cpp rename to libs/binder/IMemory.cpp diff --git a/libs/utils/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp similarity index 99% rename from libs/utils/IPCThreadState.cpp rename to libs/binder/IPCThreadState.cpp index 04ae1424e42e..704a48165d73 100644 --- a/libs/utils/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp @@ -23,8 +23,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/libs/utils/IPermissionController.cpp b/libs/binder/IPermissionController.cpp similarity index 98% rename from libs/utils/IPermissionController.cpp rename to libs/binder/IPermissionController.cpp index f01d38fd1a87..6b5dd8e6630f 100644 --- a/libs/utils/IPermissionController.cpp +++ b/libs/binder/IPermissionController.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include namespace android { diff --git a/libs/utils/IServiceManager.cpp b/libs/binder/IServiceManager.cpp similarity index 99% rename from libs/utils/IServiceManager.cpp rename to libs/binder/IServiceManager.cpp index 9beeaddde678..f2d0c27664b1 100644 --- a/libs/utils/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include diff --git a/libs/utils/MemoryBase.cpp b/libs/binder/MemoryBase.cpp similarity index 100% rename from libs/utils/MemoryBase.cpp rename to libs/binder/MemoryBase.cpp diff --git a/libs/utils/MemoryDealer.cpp b/libs/binder/MemoryDealer.cpp similarity index 100% rename from libs/utils/MemoryDealer.cpp rename to libs/binder/MemoryDealer.cpp diff --git a/libs/utils/MemoryHeapBase.cpp b/libs/binder/MemoryHeapBase.cpp similarity index 100% rename from libs/utils/MemoryHeapBase.cpp rename to libs/binder/MemoryHeapBase.cpp diff --git a/libs/utils/MemoryHeapPmem.cpp b/libs/binder/MemoryHeapPmem.cpp similarity index 100% rename from libs/utils/MemoryHeapPmem.cpp rename to libs/binder/MemoryHeapPmem.cpp diff --git a/libs/utils/Parcel.cpp b/libs/binder/Parcel.cpp similarity index 99% rename from libs/utils/Parcel.cpp rename to libs/binder/Parcel.cpp index 4225e67283fa..cea5277d6258 100644 --- a/libs/utils/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include diff --git a/libs/utils/ProcessState.cpp b/libs/binder/ProcessState.cpp similarity index 99% rename from libs/utils/ProcessState.cpp rename to libs/binder/ProcessState.cpp index 4567df60fd78..3a99e24624e4 100644 --- a/libs/utils/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -29,8 +29,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/libs/binder/Static.cpp b/libs/binder/Static.cpp new file mode 100644 index 000000000000..ff2a046e41ec --- /dev/null +++ b/libs/binder/Static.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// All static variables go here, to control initialization and +// destruction order in the library. + +#include + +#include +#include + +namespace android { + +// ------------ ProcessState.cpp + +Mutex gProcessMutex; +sp gProcess; + +class LibUtilsIPCtStatics +{ +public: + LibUtilsIPCtStatics() + { + } + + ~LibUtilsIPCtStatics() + { + IPCThreadState::shutdown(); + } +}; + +static LibUtilsIPCtStatics gIPCStatics; + +// ------------ ServiceManager.cpp + +Mutex gDefaultServiceManagerLock; +sp gDefaultServiceManager; +sp gPermissionController; + +} // namespace android diff --git a/libs/surfaceflinger/Android.mk b/libs/surfaceflinger/Android.mk index 22124361ab3f..b7a464fdaf54 100644 --- a/libs/surfaceflinger/Android.mk +++ b/libs/surfaceflinger/Android.mk @@ -34,6 +34,7 @@ endif LOCAL_SHARED_LIBRARIES := \ libhardware \ libutils \ + libbinder \ libcutils \ libui \ libcorecg \ diff --git a/libs/ui/Android.mk b/libs/ui/Android.mk index f9443579af00..1ebcb545b9ea 100644 --- a/libs/ui/Android.mk +++ b/libs/ui/Android.mk @@ -32,6 +32,7 @@ LOCAL_SHARED_LIBRARIES := \ libcorecg \ libcutils \ libutils \ + libbinder \ libpixelflinger \ libhardware \ libhardware_legacy diff --git a/libs/utils/Android.mk b/libs/utils/Android.mk index 5a1a89b46e30..30b6733decbe 100644 --- a/libs/utils/Android.mk +++ b/libs/utils/Android.mk @@ -103,19 +103,6 @@ include $(CLEAR_VARS) # we have the common sources, plus some device-specific stuff LOCAL_SRC_FILES:= \ $(commonSources) \ - Binder.cpp \ - BpBinder.cpp \ - IInterface.cpp \ - IMemory.cpp \ - IPCThreadState.cpp \ - MemoryDealer.cpp \ - MemoryBase.cpp \ - MemoryHeapBase.cpp \ - MemoryHeapPmem.cpp \ - Parcel.cpp \ - ProcessState.cpp \ - IPermissionController.cpp \ - IServiceManager.cpp \ Unicode.cpp \ backup_data.cpp \ backup_helper_file.cpp diff --git a/libs/utils/Static.cpp b/libs/utils/Static.cpp index 93f7e4f0c476..4dfa57830ce3 100644 --- a/libs/utils/Static.cpp +++ b/libs/utils/Static.cpp @@ -20,7 +20,6 @@ #include #include -#include #include namespace android { @@ -87,34 +86,4 @@ TextOutput& alog(gLogTextOutput); TextOutput& aout(gStdoutTextOutput); TextOutput& aerr(gStderrTextOutput); -#ifndef LIBUTILS_NATIVE - -// ------------ ProcessState.cpp - -Mutex gProcessMutex; -sp gProcess; - -class LibUtilsIPCtStatics -{ -public: - LibUtilsIPCtStatics() - { - } - - ~LibUtilsIPCtStatics() - { - IPCThreadState::shutdown(); - } -}; - -static LibUtilsIPCtStatics gIPCStatics; - -// ------------ ServiceManager.cpp - -Mutex gDefaultServiceManagerLock; -sp gDefaultServiceManager; -sp gPermissionController; - -#endif - } // namespace android diff --git a/media/jni/Android.mk b/media/jni/Android.mk index 8ee0cbdeb1e2..9552aa6d0dd9 100644 --- a/media/jni/Android.mk +++ b/media/jni/Android.mk @@ -18,6 +18,7 @@ LOCAL_SHARED_LIBRARIES := \ libnativehelper \ libcutils \ libutils \ + libbinder \ libmedia \ libsgl \ libui diff --git a/media/jni/soundpool/Android.mk b/media/jni/soundpool/Android.mk index 374ddebd2062..9ff2e243eabd 100644 --- a/media/jni/soundpool/Android.mk +++ b/media/jni/soundpool/Android.mk @@ -9,6 +9,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libcutils \ libutils \ + libbinder \ libandroid_runtime \ libnativehelper \ libmedia diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk index 8020da2b6100..806ef52063fe 100644 --- a/media/libmedia/Android.mk +++ b/media/libmedia/Android.mk @@ -21,7 +21,7 @@ LOCAL_SRC_FILES:= \ JetPlayer.cpp LOCAL_SHARED_LIBRARIES := \ - libui libcutils libutils libsonivox + libui libcutils libutils libbinder libsonivox LOCAL_MODULE:= libmedia diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk index f7f24903e719..0877142e65f6 100644 --- a/media/libmediaplayerservice/Android.mk +++ b/media/libmediaplayerservice/Android.mk @@ -20,6 +20,7 @@ endif LOCAL_SHARED_LIBRARIES := \ libcutils \ libutils \ + libbinder \ libvorbisidec \ libsonivox \ libopencore_player \ diff --git a/media/mediaserver/Android.mk b/media/mediaserver/Android.mk index c6816985357f..a92cea896902 100644 --- a/media/mediaserver/Android.mk +++ b/media/mediaserver/Android.mk @@ -8,7 +8,8 @@ LOCAL_SHARED_LIBRARIES := \ libaudioflinger \ libcameraservice \ libmediaplayerservice \ - libutils + libutils \ + libbinder base := $(LOCAL_PATH)/../.. diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk index 23304d55b336..02dadbb455ca 100644 --- a/opengl/libs/Android.mk +++ b/opengl/libs/Android.mk @@ -11,7 +11,7 @@ LOCAL_SRC_FILES:= \ EGL/gpu.cpp \ # -LOCAL_SHARED_LIBRARIES += libcutils libutils libui +LOCAL_SHARED_LIBRARIES += libcutils libutils libbinder libui LOCAL_LDLIBS := -lpthread -ldl LOCAL_MODULE:= libEGL diff --git a/services/jni/com_android_server_AlarmManagerService.cpp b/services/jni/com_android_server_AlarmManagerService.cpp index 1d66fb11958f..85d63c9dd107 100644 --- a/services/jni/com_android_server_AlarmManagerService.cpp +++ b/services/jni/com_android_server_AlarmManagerService.cpp @@ -19,8 +19,8 @@ #include "JNIHelp.h" #include "jni.h" -#include "utils/Log.h" -#include "utils/misc.h" +#include +#include #include #include diff --git a/services/jni/com_android_server_BatteryService.cpp b/services/jni/com_android_server_BatteryService.cpp index 25249663835a..e4f001fd82e5 100644 --- a/services/jni/com_android_server_BatteryService.cpp +++ b/services/jni/com_android_server_BatteryService.cpp @@ -18,8 +18,8 @@ #include "JNIHelp.h" #include "jni.h" -#include "utils/Log.h" -#include "utils/misc.h" +#include +#include #include #include