宝塔服务器面板,一键全能部署及管理,送你10850元礼包,点我领取

这篇文章主要介绍“ServiceManagerProxy中mRemote变量指的什么”,在日常操作中,相信很多人在ServiceManagerProxy中mRemote变量指的什么问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”ServiceManagerProxy中mRemote变量指的什么”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

首先标红的代码Binder.allowBlocking(BinderInternal.getContextObject()),实际上返回的是BinderProxy对象实例

 sServiceManager = ServiceManagerNative
                .asInterface(Binder.allowBlocking(BinderInternal.getContextObject()));

  static public IServiceManager asInterface(IBinder obj)
    {
        if (obj == null) {
            return null;
        }
        IServiceManager in =
            (IServiceManager)obj.queryLocalInterface(descriptor);
        if (in != null) {
            return in;
        }
        
        return new ServiceManagerProxy(obj);
    }

然后继续ServiceManagerProxy,从下面来看,很显然了。

class ServiceManagerProxy implements IServiceManager {
     public ServiceManagerProxy(IBinder remote) {
       
mRemote = remote;
    }

    。。。

    。。。

}

}