rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | diff --git a/Makefile.am b/Makefile.am |
| 2 | new file mode 100644 |
| 3 | index 0000000..28276e6 |
| 4 | --- /dev/null |
| 5 | +++ b/Makefile.am |
| 6 | @@ -0,0 +1,12 @@ |
| 7 | +SUBDIRS = \ |
| 8 | + frameworks/native/include \ |
| 9 | + hardware/libhardware_legacy/include \ |
| 10 | + system/core/base/include \ |
| 11 | + system/core/include \ |
| 12 | + system/core/liblog \ |
| 13 | + system/core/libcutils \ |
| 14 | + hardware/libhardware_legacy \ |
| 15 | + system/core/libnetutils \ |
| 16 | + system/core/libnetutils/include \ |
| 17 | + system/core/libutils \ |
| 18 | + frameworks/native/libs/binder |
| 19 | diff --git a/configure.ac b/configure.ac |
| 20 | new file mode 100644 |
| 21 | index 0000000..60f5e48 |
| 22 | --- /dev/null |
| 23 | +++ b/configure.ac |
| 24 | @@ -0,0 +1,21 @@ |
| 25 | +AC_INIT([platform-libs], [1.0]) |
| 26 | +AM_INIT_AUTOMAKE([foreign]) |
| 27 | +AC_PROG_CXX |
| 28 | +AC_ENABLE_SHARED |
| 29 | +AC_DISABLE_STATIC |
| 30 | +LT_INIT |
| 31 | +AC_CONFIG_FILES([ |
| 32 | + Makefile |
| 33 | + frameworks/native/include/Makefile |
| 34 | + frameworks/native/libs/binder/Makefile |
| 35 | + hardware/libhardware_legacy/Makefile |
| 36 | + hardware/libhardware_legacy/include/Makefile |
| 37 | + system/core/base/include/Makefile |
| 38 | + system/core/include/Makefile |
| 39 | + system/core/libcutils/Makefile |
| 40 | + system/core/liblog/Makefile |
| 41 | + system/core/libnetutils/Makefile |
| 42 | + system/core/libnetutils/include/Makefile |
| 43 | + system/core/libutils/Makefile |
| 44 | +]) |
| 45 | +AC_OUTPUT |
| 46 | diff --git a/frameworks/native/include/Makefile.am b/frameworks/native/include/Makefile.am |
| 47 | new file mode 100644 |
| 48 | index 0000000..0a3bd94 |
| 49 | --- /dev/null |
| 50 | +++ b/frameworks/native/include/Makefile.am |
| 51 | @@ -0,0 +1,2 @@ |
| 52 | +nobase_include_HEADERS = \ |
| 53 | + binder/Parcel.h |
| 54 | diff --git a/frameworks/native/include/binder/Parcel.h b/frameworks/native/include/binder/Parcel.h |
| 55 | index 97a3376..cc8ed09 100644 |
| 56 | --- a/frameworks/native/include/binder/Parcel.h |
| 57 | +++ b/frameworks/native/include/binder/Parcel.h |
| 58 | @@ -21,20 +21,31 @@ |
| 59 | #include <vector> |
| 60 | |
| 61 | #include <android-base/unique_fd.h> |
| 62 | +#if 0 |
| 63 | #include <cutils/native_handle.h> |
| 64 | +#endif |
| 65 | #include <utils/Errors.h> |
| 66 | +#if 0 |
| 67 | #include <utils/RefBase.h> |
| 68 | +#endif |
| 69 | #include <utils/String16.h> |
| 70 | +#if 0 |
| 71 | #include <utils/Vector.h> |
| 72 | #include <utils/Flattenable.h> |
| 73 | #include <linux/binder.h> |
| 74 | |
| 75 | #include <binder/IInterface.h> |
| 76 | #include <binder/Parcelable.h> |
| 77 | +#endif |
| 78 | +#include <limits> |
| 79 | +#include <memory> |
| 80 | +typedef size_t binder_size_t; |
| 81 | +typedef uintptr_t binder_uintptr_t; |
| 82 | |
| 83 | // --------------------------------------------------------------------------- |
| 84 | namespace android { |
| 85 | |
| 86 | +#if 0 |
| 87 | template <typename T> class Flattenable; |
| 88 | template <typename T> class LightFlattenable; |
| 89 | class IBinder; |
| 90 | @@ -42,6 +53,7 @@ class IPCThreadState; |
| 91 | class ProcessState; |
| 92 | class String8; |
| 93 | class TextOutput; |
| 94 | +#endif |
| 95 | |
| 96 | class Parcel { |
| 97 | friend class IPCThreadState; |
| 98 | @@ -73,6 +85,7 @@ public: |
| 99 | |
| 100 | bool hasFileDescriptors() const; |
| 101 | |
| 102 | +#if 0 |
| 103 | // Writes the RPC header. |
| 104 | status_t writeInterfaceToken(const String16& interface); |
| 105 | |
| 106 | @@ -86,6 +99,7 @@ public: |
| 107 | bool enforceInterface(const String16& interface, |
| 108 | IPCThreadState* threadState = NULL) const; |
| 109 | bool checkInterface(IBinder*) const; |
| 110 | +#endif |
| 111 | |
| 112 | void freeData(); |
| 113 | |
| 114 | @@ -108,12 +122,18 @@ public: |
| 115 | status_t writeFloat(float val); |
| 116 | status_t writeDouble(double val); |
| 117 | status_t writeCString(const char* str); |
| 118 | +#if 0 |
| 119 | status_t writeString8(const String8& str); |
| 120 | +#endif |
| 121 | status_t writeString16(const String16& str); |
| 122 | +#if 0 |
| 123 | status_t writeString16(const std::unique_ptr<String16>& str); |
| 124 | +#endif |
| 125 | status_t writeString16(const char16_t* str, size_t len); |
| 126 | +#if 0 |
| 127 | status_t writeStrongBinder(const sp<IBinder>& val); |
| 128 | status_t writeWeakBinder(const wp<IBinder>& val); |
| 129 | +#endif |
| 130 | status_t writeInt32Array(size_t len, const int32_t *val); |
| 131 | status_t writeByteArray(size_t len, const uint8_t *val); |
| 132 | status_t writeBool(bool val); |
| 133 | @@ -140,13 +160,16 @@ public: |
| 134 | status_t writeBoolVector(const std::vector<bool>& val); |
| 135 | status_t writeCharVector(const std::unique_ptr<std::vector<char16_t>>& val); |
| 136 | status_t writeCharVector(const std::vector<char16_t>& val); |
| 137 | +#if 0 |
| 138 | status_t writeString16Vector( |
| 139 | const std::unique_ptr<std::vector<std::unique_ptr<String16>>>& val); |
| 140 | status_t writeString16Vector(const std::vector<String16>& val); |
| 141 | +#endif |
| 142 | status_t writeUtf8VectorAsUtf16Vector( |
| 143 | const std::unique_ptr<std::vector<std::unique_ptr<std::string>>>& val); |
| 144 | status_t writeUtf8VectorAsUtf16Vector(const std::vector<std::string>& val); |
| 145 | |
| 146 | +#if 0 |
| 147 | status_t writeStrongBinderVector(const std::unique_ptr<std::vector<sp<IBinder>>>& val); |
| 148 | status_t writeStrongBinderVector(const std::vector<sp<IBinder>>& val); |
| 149 | |
| 150 | @@ -214,6 +237,7 @@ public: |
| 151 | // Currently the native implementation doesn't do any of the StrictMode |
| 152 | // stack gathering and serialization that the Java implementation does. |
| 153 | status_t writeNoException(); |
| 154 | +#endif |
| 155 | |
| 156 | void remove(size_t start, size_t amt); |
| 157 | |
| 158 | @@ -245,11 +269,16 @@ public: |
| 159 | status_t readUtf8FromUtf16(std::unique_ptr<std::string>* str) const; |
| 160 | |
| 161 | const char* readCString() const; |
| 162 | +#if 0 |
| 163 | String8 readString8() const; |
| 164 | +#endif |
| 165 | String16 readString16() const; |
| 166 | +#if 0 |
| 167 | status_t readString16(String16* pArg) const; |
| 168 | status_t readString16(std::unique_ptr<String16>* pArg) const; |
| 169 | +#endif |
| 170 | const char16_t* readString16Inplace(size_t* outLen) const; |
| 171 | +#if 0 |
| 172 | sp<IBinder> readStrongBinder() const; |
| 173 | status_t readStrongBinder(sp<IBinder>* val) const; |
| 174 | status_t readNullableStrongBinder(sp<IBinder>* val) const; |
| 175 | @@ -274,6 +303,7 @@ public: |
| 176 | |
| 177 | status_t readStrongBinderVector(std::unique_ptr<std::vector<sp<IBinder>>>* val) const; |
| 178 | status_t readStrongBinderVector(std::vector<sp<IBinder>>* val) const; |
| 179 | +#endif |
| 180 | |
| 181 | status_t readByteVector(std::unique_ptr<std::vector<int8_t>>* val) const; |
| 182 | status_t readByteVector(std::vector<int8_t>* val) const; |
| 183 | @@ -291,13 +321,16 @@ public: |
| 184 | status_t readBoolVector(std::vector<bool>* val) const; |
| 185 | status_t readCharVector(std::unique_ptr<std::vector<char16_t>>* val) const; |
| 186 | status_t readCharVector(std::vector<char16_t>* val) const; |
| 187 | +#if 0 |
| 188 | status_t readString16Vector( |
| 189 | std::unique_ptr<std::vector<std::unique_ptr<String16>>>* val) const; |
| 190 | status_t readString16Vector(std::vector<String16>* val) const; |
| 191 | +#endif |
| 192 | status_t readUtf8VectorFromUtf16Vector( |
| 193 | std::unique_ptr<std::vector<std::unique_ptr<std::string>>>* val) const; |
| 194 | status_t readUtf8VectorFromUtf16Vector(std::vector<std::string>* val) const; |
| 195 | |
| 196 | +#if 0 |
| 197 | template<typename T> |
| 198 | status_t read(Flattenable<T>& val) const; |
| 199 | |
| 200 | @@ -341,6 +374,7 @@ public: |
| 201 | |
| 202 | // Explicitly close all file descriptors in the parcel. |
| 203 | void closeFileDescriptors(); |
| 204 | +#endif |
| 205 | |
| 206 | // Debugging: get metrics on current allocations. |
| 207 | static size_t getGlobalAllocSize(); |
| 208 | @@ -352,6 +386,7 @@ private: |
| 209 | const binder_size_t* objects, size_t objectsSize, |
| 210 | void* cookie); |
| 211 | |
| 212 | +#if 0 |
| 213 | uintptr_t ipcData() const; |
| 214 | size_t ipcDataSize() const; |
| 215 | uintptr_t ipcObjects() const; |
| 216 | @@ -362,6 +397,7 @@ private: |
| 217 | |
| 218 | public: |
| 219 | void print(TextOutput& to, uint32_t flags = 0) const; |
| 220 | +#endif |
| 221 | |
| 222 | private: |
| 223 | Parcel(const Parcel& o); |
| 224 | @@ -378,7 +414,9 @@ private: |
| 225 | uintptr_t readPointer() const; |
| 226 | void freeDataNoInit(); |
| 227 | void initState(); |
| 228 | +#if 0 |
| 229 | void scanForFds() const; |
| 230 | +#endif |
| 231 | |
| 232 | template<class T> |
| 233 | status_t readAligned(T *pArg) const; |
| 234 | @@ -388,8 +426,10 @@ private: |
| 235 | template<class T> |
| 236 | status_t writeAligned(T val); |
| 237 | |
| 238 | +#if 0 |
| 239 | status_t writeRawNullableParcelable(const Parcelable* |
| 240 | parcelable); |
| 241 | +#endif |
| 242 | |
| 243 | template<typename T, typename U> |
| 244 | status_t unsafeReadTypedVector(std::vector<T>* val, |
| 245 | @@ -453,6 +493,7 @@ private: |
| 246 | bool mMutable; |
| 247 | }; |
| 248 | |
| 249 | +#if 0 |
| 250 | class FlattenableHelperInterface { |
| 251 | protected: |
| 252 | ~FlattenableHelperInterface() { } |
| 253 | @@ -485,6 +526,7 @@ private: |
| 254 | }; |
| 255 | status_t write(const FlattenableHelperInterface& val); |
| 256 | status_t read(FlattenableHelperInterface& val) const; |
| 257 | +#endif |
| 258 | |
| 259 | public: |
| 260 | class ReadableBlob : public Blob { |
| 261 | @@ -511,6 +553,7 @@ public: |
| 262 | |
| 263 | // --------------------------------------------------------------------------- |
| 264 | |
| 265 | +#if 0 |
| 266 | template<typename T> |
| 267 | status_t Parcel::write(const Flattenable<T>& val) { |
| 268 | const FlattenableHelper<T> helper(val); |
| 269 | @@ -591,6 +634,7 @@ status_t Parcel::readNullableStrongBinder(sp<T>* val) const { |
| 270 | } |
| 271 | } |
| 272 | } |
| 273 | +#endif |
| 274 | |
| 275 | template<typename T, typename U> |
| 276 | status_t Parcel::unsafeReadTypedVector( |
| 277 | @@ -706,6 +750,7 @@ status_t Parcel::writeNullableTypedVector(const std::unique_ptr<std::vector<T>>& |
| 278 | return unsafeWriteTypedVector(*val, write_func); |
| 279 | } |
| 280 | |
| 281 | +#if 0 |
| 282 | template<typename T> |
| 283 | status_t Parcel::readParcelableVector(std::vector<T>* val) const { |
| 284 | return unsafeReadTypedVector<T, Parcelable>(val, &Parcel::readParcelable); |
| 285 | @@ -800,6 +845,7 @@ status_t unflatten_binder(const sp<ProcessState>& proc, |
| 286 | const flat_binder_object& flat, sp<IBinder>* out); |
| 287 | status_t unflatten_binder(const sp<ProcessState>& proc, |
| 288 | const flat_binder_object& flat, wp<IBinder>* out); |
| 289 | +#endif |
| 290 | |
| 291 | }; // namespace android |
| 292 | |
| 293 | diff --git a/frameworks/native/libs/binder/Makefile.am b/frameworks/native/libs/binder/Makefile.am |
| 294 | new file mode 100644 |
| 295 | index 0000000..b1eb2c2 |
| 296 | --- /dev/null |
| 297 | +++ b/frameworks/native/libs/binder/Makefile.am |
| 298 | @@ -0,0 +1,16 @@ |
| 299 | +lib_LTLIBRARIES = libbinder.la |
| 300 | + |
| 301 | +libbinder_la_SOURCES = \ |
| 302 | + Parcel.cpp |
| 303 | + |
| 304 | +libbinder_la_CPPFLAGS = \ |
| 305 | + -I$(top_srcdir)/frameworks/native/include \ |
| 306 | + -I$(top_srcdir)/system/core/include \ |
| 307 | + -I$(top_srcdir)/system/core/base/include |
| 308 | + |
| 309 | +libbinder_la_CXXFLAGS = -std=gnu++14 |
| 310 | + |
| 311 | +libbinder_la_LIBADD = \ |
| 312 | + $(top_builddir)/system/core/liblog/liblog.la \ |
| 313 | + $(top_builddir)/system/core/libcutils/libcutils.la \ |
| 314 | + $(top_builddir)/system/core/libutils/libutils.la |
| 315 | diff --git a/frameworks/native/libs/binder/Parcel.cpp b/frameworks/native/libs/binder/Parcel.cpp |
| 316 | index 6fd6ddc..a6aad09 100644 |
| 317 | --- a/frameworks/native/libs/binder/Parcel.cpp |
| 318 | +++ b/frameworks/native/libs/binder/Parcel.cpp |
| 319 | @@ -29,24 +29,39 @@ |
| 320 | #include <sys/types.h> |
| 321 | #include <unistd.h> |
| 322 | |
| 323 | +#if 0 |
| 324 | #include <binder/Binder.h> |
| 325 | #include <binder/BpBinder.h> |
| 326 | #include <binder/IPCThreadState.h> |
| 327 | +#endif |
| 328 | #include <binder/Parcel.h> |
| 329 | +#if 0 |
| 330 | #include <binder/ProcessState.h> |
| 331 | #include <binder/Status.h> |
| 332 | #include <binder/TextOutput.h> |
| 333 | |
| 334 | #include <cutils/ashmem.h> |
| 335 | +#endif |
| 336 | #include <utils/Debug.h> |
| 337 | +#if 0 |
| 338 | #include <utils/Flattenable.h> |
| 339 | #include <utils/Log.h> |
| 340 | +#endif |
| 341 | #include <utils/misc.h> |
| 342 | +#if 0 |
| 343 | #include <utils/String8.h> |
| 344 | #include <utils/String16.h> |
| 345 | |
| 346 | #include <private/binder/binder_module.h> |
| 347 | #include <private/binder/Static.h> |
| 348 | +#endif |
| 349 | +#include <limits.h> |
| 350 | +#include <string.h> |
| 351 | +#include <utils/Unicode.h> |
| 352 | +#define ALOGE printf |
| 353 | +#define ALOGV printf |
| 354 | +#define LOG_ALWAYS_FATAL printf |
| 355 | +#define SIZE_T_MAX ULONG_MAX |
| 356 | |
| 357 | #ifndef INT32_MAX |
| 358 | #define INT32_MAX ((int32_t)(2147483647)) |
| 359 | @@ -123,6 +138,7 @@ static dev_t ashmem_rdev() |
| 360 | return rdev; |
| 361 | } |
| 362 | |
| 363 | +#if 0 |
| 364 | void acquire_object(const sp<ProcessState>& proc, |
| 365 | const flat_binder_object& obj, const void* who, size_t* outAshmemSize) |
| 366 | { |
| 367 | @@ -371,6 +387,7 @@ status_t unflatten_binder(const sp<ProcessState>& proc, |
| 368 | } |
| 369 | return BAD_TYPE; |
| 370 | } |
| 371 | +#endif |
| 372 | |
| 373 | // --------------------------------------------------------------------------- |
| 374 | |
| 375 | @@ -487,6 +504,7 @@ status_t Parcel::setData(const uint8_t* buffer, size_t len) |
| 376 | return err; |
| 377 | } |
| 378 | |
| 379 | +#if 0 |
| 380 | status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len) |
| 381 | { |
| 382 | const sp<ProcessState> proc(ProcessState::self()); |
| 383 | @@ -650,6 +668,7 @@ bool Parcel::enforceInterface(const String16& interface, |
| 384 | return false; |
| 385 | } |
| 386 | } |
| 387 | +#endif |
| 388 | |
| 389 | const binder_size_t* Parcel::objects() const |
| 390 | { |
| 391 | @@ -925,6 +944,7 @@ status_t Parcel::writeCharVector(const std::unique_ptr<std::vector<char16_t>>& v |
| 392 | return writeNullableTypedVector(val, &Parcel::writeChar); |
| 393 | } |
| 394 | |
| 395 | +#if 0 |
| 396 | status_t Parcel::writeString16Vector(const std::vector<String16>& val) |
| 397 | { |
| 398 | return writeTypedVector(val, &Parcel::writeString16); |
| 399 | @@ -935,6 +955,7 @@ status_t Parcel::writeString16Vector( |
| 400 | { |
| 401 | return writeNullableTypedVector(val, &Parcel::writeString16); |
| 402 | } |
| 403 | +#endif |
| 404 | |
| 405 | status_t Parcel::writeUtf8VectorAsUtf16Vector( |
| 406 | const std::unique_ptr<std::vector<std::unique_ptr<std::string>>>& val) { |
| 407 | @@ -1049,6 +1070,7 @@ status_t Parcel::writeCString(const char* str) |
| 408 | return write(str, strlen(str)+1); |
| 409 | } |
| 410 | |
| 411 | +#if 0 |
| 412 | status_t Parcel::writeString8(const String8& str) |
| 413 | { |
| 414 | status_t err = writeInt32(str.bytes()); |
| 415 | @@ -1074,6 +1096,7 @@ status_t Parcel::writeString16(const String16& str) |
| 416 | { |
| 417 | return writeString16(str.string(), str.size()); |
| 418 | } |
| 419 | +#endif |
| 420 | |
| 421 | status_t Parcel::writeString16(const char16_t* str, size_t len) |
| 422 | { |
| 423 | @@ -1093,6 +1116,7 @@ status_t Parcel::writeString16(const char16_t* str, size_t len) |
| 424 | return err; |
| 425 | } |
| 426 | |
| 427 | +#if 0 |
| 428 | status_t Parcel::writeStrongBinder(const sp<IBinder>& val) |
| 429 | { |
| 430 | return flatten_binder(ProcessState::self(), val, this); |
| 431 | @@ -1350,6 +1374,7 @@ status_t Parcel::writeNoException() |
| 432 | binder::Status status; |
| 433 | return status.writeToParcel(this); |
| 434 | } |
| 435 | +#endif |
| 436 | |
| 437 | void Parcel::remove(size_t /*start*/, size_t /*amt*/) |
| 438 | { |
| 439 | @@ -1600,6 +1625,7 @@ status_t Parcel::readCharVector(std::vector<char16_t>* val) const { |
| 440 | return readTypedVector(val, &Parcel::readChar); |
| 441 | } |
| 442 | |
| 443 | +#if 0 |
| 444 | status_t Parcel::readString16Vector( |
| 445 | std::unique_ptr<std::vector<std::unique_ptr<String16>>>* val) const { |
| 446 | return readNullableTypedVector(val, &Parcel::readString16); |
| 447 | @@ -1608,6 +1634,7 @@ status_t Parcel::readString16Vector( |
| 448 | status_t Parcel::readString16Vector(std::vector<String16>* val) const { |
| 449 | return readTypedVector(val, &Parcel::readString16); |
| 450 | } |
| 451 | +#endif |
| 452 | |
| 453 | status_t Parcel::readUtf8VectorFromUtf16Vector( |
| 454 | std::unique_ptr<std::vector<std::unique_ptr<std::string>>>* val) const { |
| 455 | @@ -1832,6 +1859,7 @@ const char* Parcel::readCString() const |
| 456 | return NULL; |
| 457 | } |
| 458 | |
| 459 | +#if 0 |
| 460 | String8 Parcel::readString8() const |
| 461 | { |
| 462 | int32_t size = readInt32(); |
| 463 | @@ -1887,6 +1915,7 @@ status_t Parcel::readString16(String16* pArg) const |
| 464 | return UNEXPECTED_NULL; |
| 465 | } |
| 466 | } |
| 467 | +#endif |
| 468 | |
| 469 | const char16_t* Parcel::readString16Inplace(size_t* outLen) const |
| 470 | { |
| 471 | @@ -1903,6 +1932,7 @@ const char16_t* Parcel::readString16Inplace(size_t* outLen) const |
| 472 | return NULL; |
| 473 | } |
| 474 | |
| 475 | +#if 0 |
| 476 | status_t Parcel::readStrongBinder(sp<IBinder>* val) const |
| 477 | { |
| 478 | status_t status = readNullableStrongBinder(val); |
| 479 | @@ -2240,9 +2270,11 @@ void Parcel::print(TextOutput& to, uint32_t /*flags*/) const |
| 480 | |
| 481 | to << ")"; |
| 482 | } |
| 483 | +#endif |
| 484 | |
| 485 | void Parcel::releaseObjects() |
| 486 | { |
| 487 | +#if 0 |
| 488 | const sp<ProcessState> proc(ProcessState::self()); |
| 489 | size_t i = mObjectsSize; |
| 490 | uint8_t* const data = mData; |
| 491 | @@ -2253,10 +2285,12 @@ void Parcel::releaseObjects() |
| 492 | = reinterpret_cast<flat_binder_object*>(data+objects[i]); |
| 493 | release_object(proc, *flat, this, &mOpenAshmemSize); |
| 494 | } |
| 495 | +#endif |
| 496 | } |
| 497 | |
| 498 | void Parcel::acquireObjects() |
| 499 | { |
| 500 | +#if 0 |
| 501 | const sp<ProcessState> proc(ProcessState::self()); |
| 502 | size_t i = mObjectsSize; |
| 503 | uint8_t* const data = mData; |
| 504 | @@ -2267,6 +2301,7 @@ void Parcel::acquireObjects() |
| 505 | = reinterpret_cast<flat_binder_object*>(data+objects[i]); |
| 506 | acquire_object(proc, *flat, this, &mOpenAshmemSize); |
| 507 | } |
| 508 | +#endif |
| 509 | } |
| 510 | |
| 511 | void Parcel::freeData() |
| 512 | @@ -2447,6 +2482,7 @@ status_t Parcel::continueWrite(size_t desired) |
| 513 | |
| 514 | } else if (mData) { |
| 515 | if (objectsSize < mObjectsSize) { |
| 516 | +#if 0 |
| 517 | // Need to release refs on any objects we are dropping. |
| 518 | const sp<ProcessState> proc(ProcessState::self()); |
| 519 | for (size_t i=objectsSize; i<mObjectsSize; i++) { |
| 520 | @@ -2458,6 +2494,7 @@ status_t Parcel::continueWrite(size_t desired) |
| 521 | } |
| 522 | release_object(proc, *flat, this, &mOpenAshmemSize); |
| 523 | } |
| 524 | +#endif |
| 525 | binder_size_t* objects = |
| 526 | (binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t)); |
| 527 | if (objects) { |
| 528 | @@ -2544,6 +2581,7 @@ void Parcel::initState() |
| 529 | mOpenAshmemSize = 0; |
| 530 | } |
| 531 | |
| 532 | +#if 0 |
| 533 | void Parcel::scanForFds() const |
| 534 | { |
| 535 | bool hasFds = false; |
| 536 | @@ -2558,6 +2596,7 @@ void Parcel::scanForFds() const |
| 537 | mHasFds = hasFds; |
| 538 | mFdsKnown = true; |
| 539 | } |
| 540 | +#endif |
| 541 | |
| 542 | size_t Parcel::getBlobAshmemSize() const |
| 543 | { |
| 544 | diff --git a/hardware/libhardware_legacy/Makefile.am b/hardware/libhardware_legacy/Makefile.am |
| 545 | new file mode 100644 |
| 546 | index 0000000..1c2c55e |
| 547 | --- /dev/null |
| 548 | +++ b/hardware/libhardware_legacy/Makefile.am |
| 549 | @@ -0,0 +1,8 @@ |
| 550 | +lib_LTLIBRARIES = libpower.la |
| 551 | + |
| 552 | +libpower_la_SOURCES = \ |
| 553 | + power/power.c |
| 554 | + |
| 555 | +libpower_la_CPPFLAGS = \ |
| 556 | + -I$(top_srcdir)/hardware/libhardware_legacy/include \ |
| 557 | + -I$(top_srcdir)/system/core/include |
| 558 | diff --git a/hardware/libhardware_legacy/include/Makefile.am b/hardware/libhardware_legacy/include/Makefile.am |
| 559 | new file mode 100644 |
| 560 | index 0000000..f38e70b |
| 561 | --- /dev/null |
| 562 | +++ b/hardware/libhardware_legacy/include/Makefile.am |
| 563 | @@ -0,0 +1,2 @@ |
| 564 | +nobase_include_HEADERS = \ |
| 565 | + hardware_legacy/power.h |
| 566 | diff --git a/system/core/base/include/Makefile.am b/system/core/base/include/Makefile.am |
| 567 | new file mode 100644 |
| 568 | index 0000000..d22d479 |
| 569 | --- /dev/null |
| 570 | +++ b/system/core/base/include/Makefile.am |
| 571 | @@ -0,0 +1,2 @@ |
| 572 | +nobase_include_HEADERS = \ |
| 573 | + android-base/unique_fd.h |
| 574 | diff --git a/system/core/include/Makefile.am b/system/core/include/Makefile.am |
| 575 | new file mode 100644 |
| 576 | index 0000000..e2ca17b |
| 577 | --- /dev/null |
| 578 | +++ b/system/core/include/Makefile.am |
| 579 | @@ -0,0 +1,18 @@ |
| 580 | +nobase_include_HEADERS = \ |
| 581 | + cutils/jstring.h \ |
| 582 | + cutils/record_stream.h \ |
| 583 | + cutils/sockets.h \ |
| 584 | + utils/Compat.h \ |
| 585 | + utils/Errors.h \ |
| 586 | + utils/KeyedVector.h \ |
| 587 | + utils/RefBase.h \ |
| 588 | + utils/SortedVector.h \ |
| 589 | + utils/String8.h \ |
| 590 | + utils/String16.h \ |
| 591 | + utils/SystemClock.h \ |
| 592 | + utils/Timers.h \ |
| 593 | + utils/TypeHelpers.h \ |
| 594 | + utils/Unicode.h \ |
| 595 | + utils/Vector.h \ |
| 596 | + utils/VectorImpl.h \ |
| 597 | + utils/threads.h |
| 598 | diff --git a/system/core/include/cutils/atomic.h b/system/core/include/cutils/atomic.h |
| 599 | index ded972a..fb83e77 100644 |
| 600 | --- a/system/core/include/cutils/atomic.h |
| 601 | +++ b/system/core/include/cutils/atomic.h |
| 602 | @@ -19,7 +19,12 @@ |
| 603 | |
| 604 | #include <stdint.h> |
| 605 | #include <sys/types.h> |
| 606 | +#ifdef __cplusplus |
| 607 | +#include <atomic> |
| 608 | +using namespace std; |
| 609 | +#else |
| 610 | #include <stdatomic.h> |
| 611 | +#endif |
| 612 | |
| 613 | #ifndef ANDROID_ATOMIC_INLINE |
| 614 | #define ANDROID_ATOMIC_INLINE static inline |
| 615 | diff --git a/system/core/libcutils/Makefile.am b/system/core/libcutils/Makefile.am |
| 616 | new file mode 100644 |
| 617 | index 0000000..51dadb4 |
| 618 | --- /dev/null |
| 619 | +++ b/system/core/libcutils/Makefile.am |
| 620 | @@ -0,0 +1,19 @@ |
| 621 | +lib_LTLIBRARIES = libcutils.la |
| 622 | + |
| 623 | +libcutils_la_SOURCES = \ |
| 624 | + socket_inaddr_any_server_unix.c \ |
| 625 | + socket_local_client_unix.c \ |
| 626 | + socket_local_server_unix.c \ |
| 627 | + socket_loopback_client_unix.c \ |
| 628 | + socket_loopback_server_unix.c \ |
| 629 | + socket_network_client_unix.c \ |
| 630 | + sockets_unix.cpp \ |
| 631 | + strdup16to8.c \ |
| 632 | + strdup8to16.c |
| 633 | + |
| 634 | +libcutils_la_CPPFLAGS = \ |
| 635 | + -I$(top_srcdir)/system/core/include |
| 636 | + |
| 637 | +libcutils_la_CFLAGS = -std=gnu90 |
| 638 | + |
| 639 | +libcutils_la_LIBADD = $(top_builddir)/system/core/liblog/liblog.la |
| 640 | diff --git a/system/core/liblog/Makefile.am b/system/core/liblog/Makefile.am |
| 641 | new file mode 100644 |
| 642 | index 0000000..1c3443c |
| 643 | --- /dev/null |
| 644 | +++ b/system/core/liblog/Makefile.am |
| 645 | @@ -0,0 +1,20 @@ |
| 646 | +lib_LTLIBRARIES = liblog.la |
| 647 | + |
| 648 | +liblog_la_SOURCES = \ |
| 649 | + config_write.c \ |
| 650 | + event_tag_map.c \ |
| 651 | + fake_log_device.c \ |
| 652 | + fake_writer.c \ |
| 653 | + log_event_list.c \ |
| 654 | + log_event_write.c \ |
| 655 | + logger_lock.c \ |
| 656 | + logger_name.c \ |
| 657 | + logger_write.c |
| 658 | + |
| 659 | +liblog_la_CFLAGS = -Werror -fvisibility=hidden |
| 660 | + |
| 661 | +liblog_la_CPPFLAGS = \ |
| 662 | + -DFAKE_LOG_DEVICE=1 \ |
| 663 | + -DLIBLOG_LOG_TAG=1005 \ |
| 664 | + -DSNET_EVENT_LOG_TAG=1397638484 \ |
| 665 | + -I$(top_srcdir)/system/core/include |
| 666 | diff --git a/system/core/libnetutils/Makefile.am b/system/core/libnetutils/Makefile.am |
| 667 | new file mode 100644 |
| 668 | index 0000000..a4a73ce |
| 669 | --- /dev/null |
| 670 | +++ b/system/core/libnetutils/Makefile.am |
| 671 | @@ -0,0 +1,11 @@ |
| 672 | +lib_LTLIBRARIES = libnetutils.la |
| 673 | + |
| 674 | +libnetutils_la_SOURCES = \ |
| 675 | + ifc_utils.c |
| 676 | + |
| 677 | +libnetutils_la_CPPFLAGS = \ |
| 678 | + -I$(top_srcdir)/system/core/libnetutils/include |
| 679 | + |
| 680 | +libnetutils_la_LIBADD = \ |
| 681 | + $(top_builddir)/bionic/libc/libc_dns.la |
| 682 | +# $(top_builddir)/system/core/liblog/liblog.la |
| 683 | diff --git a/system/core/libnetutils/ifc_utils.c b/system/core/libnetutils/ifc_utils.c |
| 684 | index f9f62f8..f637939 100644 |
| 685 | --- a/system/core/libnetutils/ifc_utils.c |
| 686 | +++ b/system/core/libnetutils/ifc_utils.c |
| 687 | @@ -25,7 +25,9 @@ |
| 688 | #include <sys/types.h> |
| 689 | #include <netinet/in.h> |
| 690 | #include <arpa/inet.h> |
| 691 | +#ifdef ANDROID |
| 692 | #include <net/if.h> |
| 693 | +#endif |
| 694 | #include <netdb.h> |
| 695 | |
| 696 | #include <linux/if.h> |
| 697 | @@ -47,6 +49,7 @@ |
| 698 | #include <stdio.h> |
| 699 | #include <string.h> |
| 700 | #define ALOGD printf |
| 701 | +#define ALOGE printf |
| 702 | #define ALOGW printf |
| 703 | #endif |
| 704 | |
| 705 | @@ -57,7 +60,11 @@ |
| 706 | |
| 707 | static int ifc_ctl_sock = -1; |
| 708 | static int ifc_ctl_sock6 = -1; |
| 709 | +#ifdef ANDROID |
| 710 | void printerr(char *fmt, ...); |
| 711 | +#else |
| 712 | +#define printerr printf |
| 713 | +#endif |
| 714 | |
| 715 | #define DBG 0 |
| 716 | #define INET_ADDRLEN 4 |
| 717 | @@ -678,6 +685,7 @@ int ifc_remove_default_route(const char *ifname) |
| 718 | return result; |
| 719 | } |
| 720 | |
| 721 | +#ifdef ANDROID |
| 722 | int |
| 723 | ifc_configure(const char *ifname, |
| 724 | in_addr_t address, |
| 725 | @@ -720,3 +728,4 @@ ifc_configure(const char *ifname, |
| 726 | |
| 727 | return 0; |
| 728 | } |
| 729 | +#endif |
| 730 | diff --git a/system/core/libnetutils/include/Makefile.am b/system/core/libnetutils/include/Makefile.am |
| 731 | new file mode 100644 |
| 732 | index 0000000..fc71a47 |
| 733 | --- /dev/null |
| 734 | +++ b/system/core/libnetutils/include/Makefile.am |
| 735 | @@ -0,0 +1,2 @@ |
| 736 | +nobase_include_HEADERS = \ |
| 737 | + netutils/ifc.h |
| 738 | diff --git a/system/core/libutils/Makefile.am b/system/core/libutils/Makefile.am |
| 739 | new file mode 100644 |
| 740 | index 0000000..2bbf615 |
| 741 | --- /dev/null |
| 742 | +++ b/system/core/libutils/Makefile.am |
| 743 | @@ -0,0 +1,18 @@ |
| 744 | +lib_LTLIBRARIES = libutils.la |
| 745 | + |
| 746 | +libutils_la_SOURCES = \ |
| 747 | + Looper.cpp \ |
| 748 | + RefBase.cpp \ |
| 749 | + SharedBuffer.cpp \ |
| 750 | + SystemClock.cpp \ |
| 751 | + Timers.cpp \ |
| 752 | + Unicode.cpp \ |
| 753 | + VectorImpl.cpp |
| 754 | + |
| 755 | +libutils_la_CPPFLAGS = \ |
| 756 | + -I$(top_srcdir)/external/safe-iop/include \ |
| 757 | + -I$(top_srcdir)/system/core/include |
| 758 | + |
| 759 | +libutils_la_CXXFLAGS = -std=gnu++14 |
| 760 | + |
| 761 | +libutils_la_LIBADD = $(top_builddir)/system/core/liblog/liblog.la |