IActivityManager ActivityManagerNative ActivityManagerService之间如何进行工作
2016-12-21 15:59
543 查看
总结:IActivityManager调用函数最终会调用ActivityManagerService中的对应实现
IActivityManager 定义的接口。 app侧的proxy <—->ActivityManagerProxy
比如IActivityManager定义接口startActivityFromRecents
ActivityManagerNative的声明
onTransact中的处理
ActivityManagerService的声明
真正的实现代码
因此通过IActivityManager调用函数最终会调用ActivityManagerService中的对应实现
IActivityManager 定义的接口。 app侧的proxy <—->ActivityManagerProxy
比如IActivityManager定义接口startActivityFromRecents
class ActivityManagerProxy implements IActivityManager { public ActivityManagerProxy(IBinder remote) { mRemote = remote; } public IBinder asBinder() { return mRemote; } mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
ActivityManagerNative的声明
public abstract class ActivityManagerNative extends Binder implements IActivityManager
onTransact中的处理
case START_ACTIVITY_FROM_RECENTS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); final int taskId = data.readInt(); final Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data); final int result = startActivityFromRecents(taskId, options); reply.writeNoException(); reply.writeInt(result); return true; }
ActivityManagerService的声明
ActivityManagerService extends ActivityManagerNative
真正的实现代码
@Override public final int startActivityFromRecents(int taskId, Bundle bOptions) { if (checkCallingPermission(START_TASKS_FROM_RECENTS) != PackageManager.PERMISSION_GRANTED) { String msg = "Permission Denial: startActivityFromRecents called without " + START_TASKS_FROM_RECENTS; Slog.w(TAG, msg); throw new SecurityException(msg); } final long origId = Binder.clearCallingIdentity(); try { synchronized (this) { return mStackSupervisor.startActivityFromRecentsInner(taskId, bOptions); } } finally { Binder.restoreCallingIdentity(origId); } }
因此通过IActivityManager调用函数最终会调用ActivityManagerService中的对应实现
相关文章推荐
- IActivityManager ,ActivityManagerNative,ActivityManagerService之间如何进行工作
- activity和service之间如何进行通信?
- ActivityManager、ActivityManagerService、ActivityManagerNative、ActivityManagerProxy的关系(and5.1)
- 如何打开ActivityManagerService的debug开关?
- ------------------------------利用BroadcastReceiver进行Activity和Service之间的通信(留着自己参考用)
- android内核剖析学习笔记:AMS(ActivityManagerService)内部原理和工作机制
- Delphi Android ActivityManager(提供了接口, 利用它可以方便的对Memory, Processes, Task, Service 等进行管)
- 在Activity和Service之间使用Binder和回调接口进行通信
- Android如何在Activity和Service之间传递数据
- activity、service、BroadcastReceive之间如何互相通讯,并取回相应的结果
- Android Framework------之ActivityManagerService与Activity之间的通信
- Android如何在Activity和Service之间传递数据
- 使用Messenger进行Activity与Service之间的双向通信
- ActivityManagerService native crash处理流程
- ActivityManager、ActivityManagerService、ActivityManagerNative、ActivityManagerProxy的关系(and5.1)
- android基础---如何使用sharedPreference进行多个Activity之间的读写操作
- [Android新手学习笔记05]-如何进行活动Activity之间的跳转以及数据传递
- Activity ActivityManagerService以及WindowManagerService之间的关系
- 如何:在各种字符串类型之间进行转换
- ABAP--如何进行sap的金额数据存储和显示之间的转换(CURRENCY_AMOUNT_DISPLAY_TO_SAP)