将数据打包,跨进程传输(通过Binder).看看这货究竟是啥玩意: Parcel.java : public final class Parcel { private static final boolean DEBUG_RECYCLE = false; private static final String TAG = "Parcel"; @SuppressWarnings({"UnusedDeclaration"}) private int mNativePtr…
分析Java层的ServiceManager,看看Binder在Java层是如何实现的. public final class ServiceManager { private static final String TAG = "ServiceManager"; private static IServiceManager sServiceManager;//IserviceManager是一个接口,定义了通用(公共)方法. private static HashMap<Str…
保存文件到sd卡需要判断sd卡的大小,通过查看android系统的自带应用的源代码,得到方法,sdk下面的source是sdk的源代码,包含的是android.Jar下面的所有class的源代码.在android系统源代码中有ndk(java调c),dalvik虚拟机等,里面packages/apps/settings是设置的源代码. 导入一个源代码,import ==> general ==> existing projects into workspace 选择完root目录后会报错(no…
Serialize是java原生就自带的东西,我们可以看到android的源码 所以看看android是如何实现parcel的,这对我们自己代码设计有什么启发. Parcel: 在android中,parcel的源码如下: Frameworks/base/core/java/android/os/Parcel.java /** * Write an integer value into the parcel at the current dataPosition(), * growing dat…
Using self-defined Parcelable objects during an Android AIDL RPC / IPC call In my previous post “Using the Android Interface Definition Language (AIDL) to make a Remote Procedure Call (RPC) in Android” I’ve explained the basics on how inter-process c…