美文网首页
Binder.clearCallingIdentity 和 Bi

Binder.clearCallingIdentity 和 Bi

作者: 海在路上 | 来源:发表于2019-05-05 18:42 被阅读0次
进程A, 进程B, 进程B拥有a方法(),b方法()

A—①—> B.a() —②—> B.b();
① 需要提供给PID和UID判断权限。
② 不需要提供PID和UID判断权限。

public void a() {
    //clearCallingIdentity()方法会清除process A的UID和PID,重置为process B的UID和PID。
    final long origId = Binder.clearCallingIdentity(); 
    b();
    //此时仍然处在process A远程调用process B方法的过程中,此时需要restore  process A的UID和PID。
    Binder.restoreCallingIdentity(origId);
}

参考博客

相关文章

网友评论

      本文标题:Binder.clearCallingIdentity 和 Bi

      本文链接:https://www.haomeiwen.com/subject/kxzhoqtx.html