進程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);
}