Section 1 libutils Overview
Libutils is the underlying library of Android. This library is implemented in C ++, And the API provided by libutils is also C ++. Android-Based C language programs and libraries are mostly developed based on libutils.
The header file in libutils is as follows:
Frameworks/base/include/utils
Source file of libutils:
Frameworks/base/libs/utils
Library name of libutils:
Libutils. So
This library can be divided into two parts: one is the underlying tool, and the other is the Binder Mechanism that implements IPC (inter-process communication.
Part 2 Overview of Public Libraries
The public libraries in libutils mainly contain the following header files:
Errors. h: Define a macro to indicate the error code.
Endian. h: defines the macro that represents the size.
Misc. h: several functions related to strings and files
Textoutput. h: defines the base class textoutput of text output.
Bufferedtextoutput. h: Class bufferedtextoutput, which is an implementation of textoutput
Pipe. h: Define the pipeline class Pipe
Buffer. h: defines the buffer class in the memory buffer area.
List. h: defines the template class of the linked list.
Sharedbuffer. h: defines sharedbuffer class to indicate shared memory.
String16.h: defines the double-byte string class string16
String8.h: defines the string8 class that represents a single-byte string, and includes the function of converting from string16
Vectorimpl. h: defines the vectorimpl class that represents the vector.
Vector. h: defines the class template vector that inherits vectorimpl and sortedvectorimpl.
Sortedvector. H: The template that defines the sorting vector. sortedvector
Keyedvector. h: defines the keyedvector template using the keyword.
Threads. h: defines thread-related classes, including thread, mutex, condition variable condition, read/write lock readwritelock, etc.
Socket. h: Define socket-related classes
Timers. h: defines time-related functions and Timer class durationtimer.
Zipentry. H, zipfilecro. H, zipfile. H, zipfilero. H, ziputils. h: Class Related to the zip function.
Part 3 binder inter-process communication
As the core of inter-process communication, binder provides portable inter-process communication means for different systems.
Refbase. h:
Reference count, defining the refbase class.
Parcel. h:
Defines containers and classes for data transmitted in IPC.Parcel
Ibinder. h:
The abstract interface of the binder object, which defines the class ibinder.
Binder. h:
Basic functions of the binder object, defining the binder and bprefbase classes
Bpbinder. h:
Function of bpbinder, defining class bpbinder
Iinterface. h:
Define common classes for abstract interfaces that pass through the binder,
Define class iinterface, class template bninterface, class template bpinterface
Processstate. h
Indicates the class of the Process status, and defines the class processstate.
Ipcthreadstate. h
Indicates the status of the IPC thread and defines the classIpcthreadstate
Iservicemanager. h: Indicates the service manager class for other classes that need to construct services.
Ipermissioncontroller. h: Permission control class.
The header files of several memory-related classes are as follows:
Imemory. h: Defines the interface of memory-related classes, indicating the heap memory class imemoryheap and bnmemoryheap, indicating the memory class imemory and bnmemory.
Memoryheapbase. h: Defines the class memoryheapbase and inherits and implements bnmemoryheap.
Memorybase. h: Defines the class memorybase and inherits and implements bnmemory.
In general, memoryheapbase class is usually used to allocate a heap memory (similar to malloc), while memorybase indicates that a part of the heap memory is allocated from one block.
In addition, memory-related functions include the header file memorydealer. h and memoryheappmem. h.