{"id":14138,"date":"2024-07-30T15:11:29","date_gmt":"2024-07-30T07:11:29","guid":{"rendered":"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138"},"modified":"2024-08-02T17:36:53","modified_gmt":"2024-08-02T09:36:53","slug":"binder%e6%95%99%e7%a8%8b%e4%b9%8bit%e5%85%88%e6%a3%aecsdn","status":"publish","type":"post","link":"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138","title":{"rendered":"binder\u6559\u7a0b\u4e4b(IT\u5148\u68eeCSDN)"},"content":{"rendered":"<p><a href=\"https:\/\/blog.csdn.net\/tkwxty\/article\/details\/102824924\">https:\/\/blog.csdn.net\/tkwxty\/article\/details\/102824924<\/a><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_16 counter-hierarchy counter-decimal ez-toc-grey\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" style=\"display: none;\"><i class=\"ez-toc-glyphicon ez-toc-icon-toggle\"><\/i><\/a><\/span><\/div>\n<nav><ul class=\"ez-toc-list ez-toc-list-level-1\"><li class=\"ez-toc-page-1 ez-toc-heading-level-1\"><a class=\"ez-toc-link ez-toc-heading-1\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#%E7%AC%AC%E4%B8%80%E7%AF%87%EF%BC%9ABinder%E8%AE%BE%E8%AE%A1%E6%80%9D%E6%83%B3\" title=\"\u7b2c\u4e00\u7bc7\uff1aBinder\u8bbe\u8ba1\u601d\u60f3\">\u7b2c\u4e00\u7bc7\uff1aBinder\u8bbe\u8ba1\u601d\u60f3<\/a><ul class=\"ez-toc-list-level-2\"><li class=\"ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-2\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#%E4%B8%80%E3%80%81Binder%E6%9E%B6%E6%9E%84%E8%A7%A3%E6%9E%90\" title=\"\u4e00\u3001Binder\u67b6\u6784\u89e3\u6790\">\u4e00\u3001Binder\u67b6\u6784\u89e3\u6790<\/a><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-3\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#1%E4%BD%95%E4%B8%BAbinder\" title=\"1.\u4f55\u4e3abinder\">1.\u4f55\u4e3abinder<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-4\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#2binder%E6%A8%A1%E5%9E%8B\" title=\"2.binder\u6a21\u578b\">2.binder\u6a21\u578b<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-5\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#3Binder%E9%A9%B1%E5%8A%A8%E5%AD%98%E5%9C%A8%E7%9A%84%E5%8E%9F%E5%9B%A0%E5%92%8C%E6%84%8F%E4%B9%89\" title=\"3.Binder\u9a71\u52a8\u5b58\u5728\u7684\u539f\u56e0\u548c\u610f\u4e49\">3.Binder\u9a71\u52a8\u5b58\u5728\u7684\u539f\u56e0\u548c\u610f\u4e49<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-6\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#4%E4%B8%BA%E4%BB%80%E4%B9%88%E9%87%87%E7%94%A8Binder%E6%9C%BA%E5%88%B6%EF%BC%8C%E8%80%8C%E4%B8%8D%E6%98%AF%E5%85%B6%E4%BB%96%E7%9A%84IPC%E9%80%9A%E4%BF%A1%E6%96%B9%E5%BC%8F\" title=\"4.\u4e3a\u4ec0\u4e48\u91c7\u7528Binder\u673a\u5236\uff0c\u800c\u4e0d\u662f\u5176\u4ed6\u7684IPC\u901a\u4fe1\u65b9\u5f0f\">4.\u4e3a\u4ec0\u4e48\u91c7\u7528Binder\u673a\u5236\uff0c\u800c\u4e0d\u662f\u5176\u4ed6\u7684IPC\u901a\u4fe1\u65b9\u5f0f<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-7\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#5Binder%E4%B8%AD%E5%90%84%E8%A7%92%E8%89%B2%E4%B9%8B%E9%97%B4%E5%85%B3%E7%B3%BB\" title=\"5.Binder\u4e2d\u5404\u89d2\u8272\u4e4b\u95f4\u5173\u7cfb\">5.Binder\u4e2d\u5404\u89d2\u8272\u4e4b\u95f4\u5173\u7cfb<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-8\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#%E4%BA%8C%E3%80%81Binder%E8%AE%BE%E8%AE%A1%E8%A7%A3%E6%9E%90\" title=\"\u4e8c\u3001Binder\u8bbe\u8ba1\u89e3\u6790\">\u4e8c\u3001Binder\u8bbe\u8ba1\u89e3\u6790<\/a><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-9\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#1Binder%E8%AE%BE%E8%AE%A1\" title=\"1.Binder\u8bbe\u8ba1\">1.Binder\u8bbe\u8ba1<\/a><ul class=\"ez-toc-list-level-4\"><li class=\"ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-10\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#1-1%E5%86%85%E6%A0%B8%E7%A9%BA%E9%97%B4%E7%9A%84Binder%E8%AE%BE%E8%AE%A1\" title=\"1-1)\u5185\u6838\u7a7a\u95f4\u7684Binder\u8bbe\u8ba1\">1-1)\u5185\u6838\u7a7a\u95f4\u7684Binder\u8bbe\u8ba1<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-11\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#1-2%E7%94%A8%E6%88%B7%E7%A9%BA%E9%97%B4%E7%9A%84Binder%E8%AE%BE%E8%AE%A1\" title=\"1-2)\u7528\u6237\u7a7a\u95f4\u7684Binder\u8bbe\u8ba1\">1-2)\u7528\u6237\u7a7a\u95f4\u7684Binder\u8bbe\u8ba1<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-12\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#2Binder%E9%80%9A%E4%BF%A1\" title=\"2.Binder\u901a\u4fe1\">2.Binder\u901a\u4fe1<\/a><ul class=\"ez-toc-list-level-4\"><li class=\"ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-13\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#2-1%EF%BC%89Binder%E9%80%9A%E4%BF%A1%E6%A8%A1%E5%9E%8B\" title=\"2-1\uff09Binder\u901a\u4fe1\u6a21\u578b\">2-1\uff09Binder\u901a\u4fe1\u6a21\u578b<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-14\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#2-2%EF%BC%89Binder%E9%80%9A%E4%BF%A1%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84\" title=\"2-2\uff09Binder\u901a\u4fe1\u6570\u636e\u7ed3\u6784\">2-2\uff09Binder\u901a\u4fe1\u6570\u636e\u7ed3\u6784<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-1\"><a class=\"ez-toc-link ez-toc-heading-15\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#%E7%AC%AC%E4%BA%8C%E7%AF%87%EF%BC%9ABinder%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84\" title=\"\u7b2c\u4e8c\u7bc7\uff1aBinder\u6570\u636e\u7ed3\u6784\">\u7b2c\u4e8c\u7bc7\uff1aBinder\u6570\u636e\u7ed3\u6784<\/a><ul class=\"ez-toc-list-level-2\"><li class=\"ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-16\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#%E4%B8%80%E3%80%81%E5%86%85%E6%A0%B8%E7%A9%BA%E9%97%B4%E7%9A%84Binder%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84\" title=\"\u4e00\u3001\u5185\u6838\u7a7a\u95f4\u7684Binder\u6570\u636e\u7ed3\u6784\">\u4e00\u3001\u5185\u6838\u7a7a\u95f4\u7684Binder\u6570\u636e\u7ed3\u6784<\/a><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-17\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#1binder_proc\" title=\"1.binder_proc\">1.binder_proc<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-18\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#2binder_thread\" title=\"2.binder_thread\">2.binder_thread<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-19\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#3binder_node\" title=\"3.binder_node\">3.binder_node<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-20\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#4binder_ref\" title=\"4.binder_ref\">4.binder_ref<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-21\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#5binder_buffer\" title=\"5.binder_buffer\">5.binder_buffer<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-22\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#6flat_binder_object\" title=\"6.flat_binder_object\">6.flat_binder_object<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-23\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#7binder_write_read\" title=\"7.binder_write_read\">7.binder_write_read<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-24\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#8binder_transaction_data\" title=\"8.binder_transaction_data\">8.binder_transaction_data<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-25\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#9binder_transaction\" title=\"9.binder_transaction\">9.binder_transaction<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-26\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#%E4%BA%8C%E3%80%81%E7%94%A8%E6%88%B7%E7%A9%BA%E9%97%B4%E7%9A%84Binder%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84\" title=\"\u4e8c\u3001\u7528\u6237\u7a7a\u95f4\u7684Binder\u6570\u636e\u7ed3\u6784\">\u4e8c\u3001\u7528\u6237\u7a7a\u95f4\u7684Binder\u6570\u636e\u7ed3\u6784<\/a><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-27\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#1ServiceManager%E5%AE%88%E6%8A%A4%E8%BF%9B%E7%A8%8B%E4%B8%AD%E7%9A%84%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84\" title=\"1.ServiceManager\u5b88\u62a4\u8fdb\u7a0b\u4e2d\u7684\u6570\u636e\u7ed3\u6784\">1.ServiceManager\u5b88\u62a4\u8fdb\u7a0b\u4e2d\u7684\u6570\u636e\u7ed3\u6784<\/a><ul class=\"ez-toc-list-level-4\"><li class=\"ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-28\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#1-1binder_state\" title=\"1-1.binder_state\">1-1.binder_state<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-29\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#1-2binder_io\" title=\"1-2.binder_io\">1-2.binder_io<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-30\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#1-3svcinfo\" title=\"1-3.svcinfo\">1-3.svcinfo<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-31\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#2c%E5%B1%82%E7%9A%84%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84\" title=\"2.c++\u5c42\u7684\u6570\u636e\u7ed3\u6784\">2.c++\u5c42\u7684\u6570\u636e\u7ed3\u6784<\/a><ul class=\"ez-toc-list-level-4\"><li class=\"ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-32\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#2-1Parcel\" title=\"2-1.Parcel\">2-1.Parcel<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-1\"><a class=\"ez-toc-link ez-toc-heading-33\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#%E7%AC%AC%E4%B8%89%E7%AF%87%EF%BC%9ABinder%E6%8E%A5%E5%8F%A3%E5%92%8C%E7%B1%BB\" title=\"\u7b2c\u4e09\u7bc7\uff1aBinder\u63a5\u53e3\u548c\u7c7b\">\u7b2c\u4e09\u7bc7\uff1aBinder\u63a5\u53e3\u548c\u7c7b<\/a><ul class=\"ez-toc-list-level-2\"><li class=\"ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-34\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#1Java%E5%B1%82%E6%AC%A1%E7%9A%84Binder%E6%8E%A5%E5%8F%A3%E5%92%8C%E7%B1%BB\" title=\"1.Java\u5c42\u6b21\u7684Binder\u63a5\u53e3\u548c\u7c7b\">1.Java\u5c42\u6b21\u7684Binder\u63a5\u53e3\u548c\u7c7b<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-35\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#2C%E5%B1%82%E6%AC%A1%E7%9A%84%E7%9B%B8%E5%85%B3%E6%8E%A5%E5%8F%A3%E5%92%8C%E7%B1%BB\" title=\"2.C++\u5c42\u6b21\u7684\u76f8\u5173\u63a5\u53e3\u548c\u7c7b\">2.C++\u5c42\u6b21\u7684\u76f8\u5173\u63a5\u53e3\u548c\u7c7b<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-36\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#3ProcessState\" title=\"3.ProcessState\">3.ProcessState<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-37\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#4IPCThreadState\" title=\"4.IPCThreadState\">4.IPCThreadState<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-1\"><a class=\"ez-toc-link ez-toc-heading-38\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=14138\/#%E7%AC%AC%E5%9B%9B%E7%AF%87%EF%BC%9AParcel%E8%AF%A6%E8%A7%A3%E4%B9%8B%E5%9F%BA%E6%9C%AC%E6%95%B0%E6%8D%AE%E7%9A%84%E8%AF%BB%E5%86%99\" title=\"\u7b2c\u56db\u7bc7\uff1aParcel\u8be6\u89e3\u4e4b\u57fa\u672c\u6570\u636e\u7684\u8bfb\u5199\">\u7b2c\u56db\u7bc7\uff1aParcel\u8be6\u89e3\u4e4b\u57fa\u672c\u6570\u636e\u7684\u8bfb\u5199<\/a><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"%E7%AC%AC%E4%B8%80%E7%AF%87%EF%BC%9ABinder%E8%AE%BE%E8%AE%A1%E6%80%9D%E6%83%B3\"><\/span>\u7b2c\u4e00\u7bc7\uff1aBinder\u8bbe\u8ba1\u601d\u60f3<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p><a href=\"https:\/\/blog.csdn.net\/tkwxty\/article\/details\/102824924\">https:\/\/blog.csdn.net\/tkwxty\/article\/details\/102824924<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E4%B8%80%E3%80%81Binder%E6%9E%B6%E6%9E%84%E8%A7%A3%E6%9E%90\"><\/span>\u4e00\u3001Binder\u67b6\u6784\u89e3\u6790<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"1%E4%BD%95%E4%B8%BAbinder\"><\/span>1.\u4f55\u4e3abinder<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Binder\u7528\u6700\u7b80\u5355\u7684\u8bdd\u6765\u6982\u62ec\u8bf4\u5c31\u662fAndroid\u4e2d\u7684\u4e00\u79cdIPC\u8fdb\u7a0b\u95f4\u901a\u4fe1\u673a\u5236\uff0c\u867d\u7136\u5b83\u662f\u4e00\u79cdIPC\u901a\u4fe1\u673a\u5236\uff0c\u4f46\u662f\u5b83\u53c8\u548cLinux\u7684\u4f20\u7edf\u7684IPC\u673a\u5236\u7ba1\u9053\uff0csystem V IPC\uff0csocket\u7b49\u6709\u6240\u4e0d\u540c(\u8fd9\u4e2a\u4e0d\u540c\u4e3b\u8981\u8868\u73b0\u5176\u5b9e\u73b0\u539f\u7406\u548c\u4f7f\u7528\u573a\u666f)\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"2binder%E6%A8%A1%E5%9E%8B\"><\/span>2.binder\u6a21\u578b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><img src=\"http:\/\/xinyiworld.top\/wordpress_it\/wp-content\/uploads\/2024\/07\/binder\u67b6\u6784\u56fe.png\" alt=\"\" \/><br \/>\n\u4e0a\u56fe\u4e2d\u6d89\u53ca\u5230Binder\u6a21\u578b\u76844\u7c7b\u89d2\u8272\uff1aBinder\u9a71\u52a8\uff0cServiceManager(\u540e\u7eed\u7b80\u79f0SMgr)\uff0cServer\u548cClient\u3002\u5176\u4e2dServer\uff0cClient\uff0cSMgr\u8fd0\u884c\u4e8e\u7528\u6237\u7a7a\u95f4\uff0c\u9a71\u52a8\u8fd0\u884c\u4e8e\u5185\u6838\u7a7a\u95f4\u3002<\/p>\n<ul>\n<li>\n<p>Server<br \/>\n\u52062\u90e8\u5206\uff0cSystemServer\u8fdb\u7a0b\u548c\u5176\u5b83\u8fdb\u7a0b\u3002<br \/>\n1\uff09SystemServer\u8fdb\u7a0b\uff0c\u6240\u6709\u7684\u7cfb\u7edf\u670d\u52a1\u90fd\u662f\u5728\u8fd9\u4e2a\u8fdb\u7a0b\u4e2d\u521b\u5efa\u7684\u3002<br \/>\n2\uff09\u5176\u5b83\u8fdb\u7a0b\uff0c\u4efb\u4f55\u5bf9\u5176\u5b83\u8fdb\u7a0b\u63d0\u4f9bbinder\u670d\u52a1\u7684\u8fdb\u7a0b\u3002<\/p>\n<\/li>\n<li>\n<p>Client<br \/>\n\u4e00\u822c\u6307\u5e94\u7528\u8fdb\u7a0b\u3002Client \u662f\u76f8\u5bf9\u4e8e ServiceManager \u800c\u8a00\u7684\uff0c\u4e00\u4e2a\u8fdb\u7a0b\u6216\u8005\u5e94\u7528\u7a0b\u5e8f\u53ef\u80fd\u662f\u63d0\u4f9b\u670d\u52a1\u7684 Server\uff0c\u4f46\u5bf9\u4e8e ServiceManager \u6765\u8bf4\u5b83\u4ecd\u7136\u662f\u4e2a Client\u3002<\/p>\n<\/li>\n<li>\n<p>ServiceManager<br \/>\n\u662f\u5355\u72ec\u7684\u5b88\u62a4\u8fdb\u7a0b\u3002<br \/>\nServiceManager \u63d0\u4f9b\u7684 Binder \u6bd4\u8f83\u7279\u6b8a\uff0c\u5b83\u6ca1\u6709\u540d\u5b57\u4e5f\u4e0d\u9700\u8981\u6ce8\u518c\u3002\u5f53\u4e00\u4e2a\u8fdb\u7a0b\u4f7f\u7528 BINDERSETCONTEXT_MGR \u547d\u4ee4\u5c06\u81ea\u5df1\u6ce8\u518c\u6210 ServiceManager \u65f6 Binder \u9a71\u52a8\u4f1a\u81ea\u52a8\u4e3a\u5b83\u521b\u5efa Binder \u5b9e\u4f53\uff08\u8fd9\u5c31\u662f\u90a3\u53ea\u9884\u5148\u9020\u597d\u7684\u90a3\u53ea\u9e21\uff09\u3002\u5176\u6b21\u8fd9\u4e2a Binder \u5b9e\u4f53\u7684\u5f15\u7528\u5728\u6240\u6709 Client \u4e2d\u90fd\u56fa\u5b9a\u4e3a 0 \u800c\u65e0\u9700\u901a\u8fc7\u5176\u5b83\u624b\u6bb5\u83b7\u5f97\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u4e00\u4e2a Server \u60f3\u8981\u5411 ServiceManager \u6ce8\u518c\u81ea\u5df1\u7684 Binder \u5c31\u5fc5\u987b\u901a\u8fc7\u8fd9\u4e2a 0 \u53f7\u5f15\u7528\u548c ServiceManager \u7684 Binder \u901a\u4fe1\u3002<\/p>\n<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"3Binder%E9%A9%B1%E5%8A%A8%E5%AD%98%E5%9C%A8%E7%9A%84%E5%8E%9F%E5%9B%A0%E5%92%8C%E6%84%8F%E4%B9%89\"><\/span>3.Binder\u9a71\u52a8\u5b58\u5728\u7684\u539f\u56e0\u548c\u610f\u4e49<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u5e94\u7528\u7a0b\u5e8f\u90fd\u8fd0\u884c\u5728\u7528\u6237\u7a7a\u95f4\uff0c\u6bcf\u4e2a\u5e94\u7528\u7a0b\u5e8f\u90fd\u6709\u5b83\u81ea\u5df1\u72ec\u7acb\u7684\u5185\u5b58\u7a7a\u95f4\uff1b\u82e5\u4e0d\u540c\u7684\u5e94\u7528\u7a0b\u5e8f\u4e4b\u95f4\u6d89\u53ca\u5230\u901a\u4fe1\uff0c\u9700\u8981\u901a\u8fc7\u5185\u6838\u8fdb\u884c\u4e2d\u8f6c\uff0c\u56e0\u4e3a\u9700\u8981\u7528\u5230\u5185\u6838\u7684copy_from_user()\u548ccopy_to_user()\u7b49\u51fd\u6570\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"4%E4%B8%BA%E4%BB%80%E4%B9%88%E9%87%87%E7%94%A8Binder%E6%9C%BA%E5%88%B6%EF%BC%8C%E8%80%8C%E4%B8%8D%E6%98%AF%E5%85%B6%E4%BB%96%E7%9A%84IPC%E9%80%9A%E4%BF%A1%E6%96%B9%E5%BC%8F\"><\/span>4.\u4e3a\u4ec0\u4e48\u91c7\u7528Binder\u673a\u5236\uff0c\u800c\u4e0d\u662f\u5176\u4ed6\u7684IPC\u901a\u4fe1\u65b9\u5f0f<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>\u7b2c\u4e00. Binder\u80fd\u591f\u5f88\u597d\u7684\u5b9e\u73b0Client-Server\u67b6\u6784<\/li>\n<\/ul>\n<p>\u5bf9\u4e8eAndroid\u7cfb\u7edf\uff0cGoogle\u60f3\u63d0\u4f9b\u4e00\u5957\u57fa\u4e8eClient-Server\u7684\u901a\u4fe1\u65b9\u5f0f\u3002<br \/>\n\u4f8b\u5982\uff0c\u5c06&quot;\u7535\u6c60\u4fe1\u606f\/\u9a6c\u8fbe\u63a7\u5236\/wifi\u4fe1\u606f\/\u591a\u5a92\u4f53\u670d\u52a1&quot;\u7b49\u7b49\u4e0d\u540c\u7684\u670d\u52a1\u90fd\u7531\u4e0d\u540c\u7684Server\u63d0\u4f9b\uff0c\u5f53Client\u9700\u8981\u83b7\u53d6\u67d0Server\u7684\u670d\u52a1\u65f6\uff0c\u53ea\u9700\u8981Client\u5411Server\u53d1\u9001\u76f8\u5e94\u7684\u8bf7\u6c42\uff0cServer\u6536\u5230\u8bf7\u6c42\u4e4b\u540e\u8fdb\u884c\u5904\u7406\uff0c\u5904\u7406\u5b8c\u6bd5\u518d\u5c06\u53cd\u9988\u5185\u5bb9\u53d1\u9001\u7ed9Client\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u76ee\u524dLinux\u652f\u6301\u7684&quot;\u4f20\u7edf\u7684\u7ba1\u9053\/\u6d88\u606f\u961f\u5217\/\u5171\u4eab\u5185\u5b58\/\u4fe1\u53f7\u91cf\/Socket\u7b49&quot;IPC\u901a\u4fe1\u624b\u6bb5\u4e2d\uff0c\u53ea\u6709Socket\u662fClient-Server\u7684\u901a\u4fe1\u65b9\u5f0f\u3002\u4f46\u662f\uff0cSocket\u4e3b\u8981\u7528\u4e8e\u7f51\u7edc\u95f4\u901a\u4fe1\u4ee5\u53ca\u672c\u673a\u4e2d\u8fdb\u7a0b\u95f4\u7684\u4f4e\u901f\u901a\u4fe1\uff0c\u5b83\u7684\u4f20\u8f93\u6548\u7387\u592a\u4f4e\u3002<\/p>\n<ul>\n<li>\u7b2c\u4e8c. Binder\u7684\u4f20\u8f93\u6548\u7387\u548c\u53ef\u64cd\u4f5c\u6027\u5f88\u597d<\/li>\n<\/ul>\n<p>\u524d\u9762\u5df2\u7ecf\u8bf4\u4e86\uff0cSocket\u4f20\u8f93\u6548\u7387\u5f88\u4f4e\uff0c\u5df2\u7ecf\u88ab\u6392\u9664\u3002\u800c\u6d88\u606f\u961f\u5217\u548c\u7ba1\u9053\u53c8\u91c7\u7528\u5b58\u50a8-\u8f6c\u53d1\u65b9\u5f0f\uff0c\u4f7f\u7528\u5b83\u4eec\u8fdb\u884cIPC\u901a\u4fe1\u65f6\uff0c\u9700\u8981\u7ecf\u8fc72\u6b21\u5185\u5b58\u62f7\u8d1d\uff01\u6548\u7387\u592a\u4f4e\uff01<\/p>\n<p>\u4e3a\u4ec0\u4e48\u6d88\u606f\u961f\u5217\u548c\u7ba1\u9053\u7684\u6570\u636e\u4f20\u8f93\u9700\u8981\u7ecf\u8fc72\u6b21\u5185\u5b58\u62f7\u8d1d\u5462\uff1f \u9996\u5148\uff0c\u6570\u636e\u5148\u4ece\u53d1\u9001\u65b9\u7684\u7f13\u5b58\u533a(\u5373\uff0cLinux\u4e2d\u7684\u7528\u6237\u5b58\u50a8\u7a7a\u95f4)\u62f7\u8d1d\u5230\u5185\u6838\u5f00\u8f9f\u7684\u7f13\u5b58\u533a(\u5373\uff0cLinux\u4e2d\u7684\u5185\u6838\u5b58\u50a8\u7a7a\u95f4)\u4e2d\uff0c\u662f\u7b2c1\u6b21\u62f7\u8d1d\u3002\u63a5\u7740\uff0c\u518d\u4ece\u5185\u6838\u7f13\u5b58\u533a\u62f7\u8d1d\u5230\u63a5\u6536\u65b9\u7684\u7f13\u5b58\u533a(\u4e5f\u662fLinux\u4e2d\u7684\u7528\u6237\u5b58\u50a8\u7a7a\u95f4)\uff0c\u8fd9\u662f\u7b2c2\u6b21\u62f7\u8d1d\u3002<br \/>\n\u800c\u91c7\u7528Binder\u673a\u5236\u7684\u8bdd\uff0c\u5219\u53ea\u9700\u8981\u7ecf\u8fc71\u6b21\u5185\u5b58\u62f7\u8d1d\u5373\u53ef\uff01 \u5373\uff0c\u4ece\u53d1\u9001\u65b9\u7684\u7f13\u5b58\u533a\u62f7\u8d1d\u5230\u5185\u6838\u7684\u7f13\u5b58\u533a\uff0c\u800c\u63a5\u6536\u65b9\u7684\u7f13\u5b58\u533a\u4e0e\u5185\u6838\u7684\u7f13\u5b58\u533a\u662f\u6620\u5c04\u5230\u540c\u4e00\u5757\u7269\u7406\u5730\u5740\u7684\uff0c\u56e0\u6b64\u53ea\u9700\u89811\u6b21\u62f7\u8d1d\u5373\u53ef\u3002<\/p>\n<p>\u81f3\u4e8e\u5171\u4eab\u5185\u5b58\u5462\uff0c\u867d\u7136\u4f7f\u7528\u5b83\u8fdb\u884cIPC\u901a\u4fe1\u65f6\u8fdb\u884c\u7684\u5185\u5b58\u62f7\u8d1d\u6b21\u6570\u662f0\u3002\u4f46\u662f\uff0c\u5171\u4eab\u5185\u5b58\u64cd\u4f5c\u590d\u6742\uff0c\u4e5f\u5c06\u5b83\u6392\u9664\u3002<br \/>\n\u8fd9\u91cc\u5e76\u4e0d\u662f\u8bf4\u4e0a\u9762\u7684\u5176\u5b83\u8fdb\u7a0b\u95f4\u901a\u4fe1\u65b9\u5f0f\u90fd\u662f\u7cdf\u7c95\uff0c\u53ea\u662f\u5728Binder\u901a\u4fe1\u4e0a\u9762\u4f7f\u7528\u5185\u5b58\u6620\u5c04\u662f\u6700\u5408\u9002\u7684\u3002\u5728Android\u7cfb\u7edf\u4e2dInput\u7cfb\u7edf\u7684\u5b9e\u73b0\u4f9d\u7136\u4f9d\u8d56\u7740Socket\uff0cAndroid\u91cc\u9762\u5c5e\u6027\u7684\u5b9e\u73b0\u4f7f\u7528\u7684\u5c31\u662f\u5171\u4eab\u5185\u5b58\uff0cAndroid Looper\u91cc\u9762\u8fd8\u4f7f\u7528\u7740\u7ba1\u9053\u5462\u3002<\/p>\n<ul>\n<li>\u7b2c\u4e09. Binder\u673a\u5236\u7684\u5b89\u5168\u6027\u5f88\u9ad8<\/li>\n<\/ul>\n<p>\u4f20\u7edfIPC\u6ca1\u6709\u4efb\u4f55\u5b89\u5168\u63aa\u65bd\uff0c\u5b8c\u5168\u4f9d\u8d56\u4e0a\u5c42\u534f\u8bae\u6765\u786e\u4fdd\u3002\u4f20\u7edfIPC\u7684\u63a5\u6536\u65b9\u65e0\u6cd5\u83b7\u5f97\u5bf9\u65b9\u8fdb\u7a0b\u53ef\u9760\u7684UID\/PID(\u7528\u6237ID\/\u8fdb\u7a0bID)\uff0c\u4ece\u800c\u65e0\u6cd5\u9274\u522b\u5bf9\u65b9\u8eab\u4efd\u3002\u800cBinder\u673a\u5236\u5219\u4e3a\u6bcf\u4e2a\u8fdb\u7a0b\u5206\u914d\u4e86UID\/PID\u6765\u4f5c\u4e3a\u9274\u522b\u8eab\u4efd\u7684\u6807\u793a\uff0c\u5e76\u4e14\u5728Binder\u901a\u4fe1\u65f6\u4f1a\u6839\u636eUID\/PID\u8fdb\u884c\u6709\u6548\u6027\u68c0\u6d4b\u3002\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u53ef\u80fd\u4e00\u4e9b\u654f\u611f\u7684\u670d\u52a1\uff0c\u4e0d\u5e0c\u671b\u88ab\u4e71\u7528\u5c31\u53ef\u4ee5\u901a\u8fc7UID\/PID\u9274\u6743\u7684\u65b9\u5f0f\u6765\u9632\u62a4\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"5Binder%E4%B8%AD%E5%90%84%E8%A7%92%E8%89%B2%E4%B9%8B%E9%97%B4%E5%85%B3%E7%B3%BB\"><\/span>5.Binder\u4e2d\u5404\u89d2\u8272\u4e4b\u95f4\u5173\u7cfb<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>\n<p>Binder\u5b9e\u4f53<br \/>\nBinder\u5b9e\u4f53\uff0c\u662f\u5404\u4e2aServer\u4ee5\u53caServiceManager\u5728\u5185\u6838\u4e2d\u7684\u5b58\u5728\u5f62\u5f0f\u3002<br \/>\nBinder\u5b9e\u4f53\u5b9e\u9645\u4e0a\u662f\u5185\u6838\u4e2dbinder_node\u7ed3\u6784\u4f53\u7684\u5bf9\u8c61\uff0c\u5b83\u7684\u4f5c\u7528\u662f\u5728\u5185\u6838\u4e2d\u4fdd\u5b58Server\u548cServiceManager\u7684\u4fe1\u606f(\u4f8b\u5982\uff0cBinder\u5b9e\u4f53\u4e2d\u4fdd\u5b58\u4e86Server\u5bf9\u8c61\u5728\u7528\u6237\u7a7a\u95f4\u7684\u5730\u5740)\u3002\u7b80\u8a00\u4e4b\uff0cBinder\u5b9e\u4f53\u662fServer\u5728Binder\u9a71\u52a8\u4e2d\u7684\u5b58\u5728\u5f62\u5f0f\uff0c\u5185\u6838\u901a\u8fc7Binder\u5b9e\u4f53\u53ef\u4ee5\u627e\u5230\u7528\u6237\u7a7a\u95f4\u7684Server\u5bf9\u8c61\u3002<\/p>\n<\/li>\n<li>\n<p>Binder\u5f15\u7528<br \/>\n\u8bf4\u5230Binder\u5b9e\u4f53\uff0c\u5c31\u4e0d\u5f97\u4e0d\u8bf4&quot;Binder\u5f15\u7528&quot;\u3002\u6240\u8c13Binder\u5f15\u7528\uff0c\u5b9e\u9645\u4e0a\u662f\u5185\u6838\u4e2dbinder_ref\u7ed3\u6784\u4f53\u7684\u5bf9\u8c61\uff0c\u5b83\u7684\u4f5c\u7528\u662f\u5728\u8868\u793a&quot;Binder\u5b9e\u4f53&quot;\u7684\u5f15\u7528\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u6bcf\u4e00\u4e2aBinder\u5f15\u7528\u90fd\u662f\u67d0\u4e00\u4e2aBinder\u5b9e\u4f53\u7684\u5f15\u7528\uff0c\u901a\u8fc7Binder\u5f15\u7528\u53ef\u4ee5\u5728\u5185\u6838\u4e2d\u627e\u5230\u5b83\u5bf9\u5e94\u7684Binder\u5b9e\u4f53\u3002<br \/>\n\u5982\u679c\u5c06Server\u770b\u4f5c\u662fBinder\u5b9e\u4f53\u7684\u8bdd\uff0c\u90a3\u4e48Client\u5c31\u597d\u6bd4Binder\u5f15\u7528\u3002Client\u8981\u548cServer\u901a\u4fe1\uff0c\u5b83\u5c31\u662f\u901a\u8fc7\u4fdd\u5b58\u4e00\u4e2aServer\u5bf9\u8c61\u7684Binder\u5f15\u7528\uff0c\u518d\u901a\u8fc7\u8be5Binder\u5f15\u7528\u5728\u5185\u6838\u4e2d\u627e\u5230\u5bf9\u5e94\u7684Binder\u5b9e\u4f53\uff0c\u8fdb\u800c\u627e\u5230Server\u5bf9\u8c61\uff0c\u7136\u540e\u5c06\u901a\u4fe1\u5185\u5bb9\u53d1\u9001\u7ed9Server\u5bf9\u8c61\u3002<\/p>\n<\/li>\n<\/ul>\n<p>Binder\u5b9e\u4f53\u548cBinder\u5f15\u7528\u90fd\u662f\u5185\u6838(\u5373\uff0cBinder\u9a71\u52a8)\u4e2d\u7684\u6570\u636e\u7ed3\u6784\u3002<strong>\u6bcf\u4e00\u4e2aServer\u5728\u5185\u6838\u4e2d\u5c31\u8868\u73b0\u4e3a\u4e00\u4e2aBinder\u5b9e\u4f53\uff0c\u800c\u6bcf\u4e00\u4e2aClient\u5219\u8868\u73b0\u4e3a\u4e00\u4e2aBinder\u5f15\u7528\u3002\u8fd9\u6837\uff0c\u6bcf\u4e2aBinder\u5f15\u7528\u90fd\u5bf9\u5e94\u4e00\u4e2aBinder\u5b9e\u4f53\uff0c\u800c\u6bcf\u4e2aBinder\u5b9e\u4f53\u5219\u53ef\u4ee5\u591a\u4e2aBinder\u5f15\u7528\u3002<\/strong><\/p>\n<ul>\n<li>\u8fdc\u7a0b\u670d\u52a1 \uff08**\uff09<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"%E4%BA%8C%E3%80%81Binder%E8%AE%BE%E8%AE%A1%E8%A7%A3%E6%9E%90\"><\/span>\u4e8c\u3001Binder\u8bbe\u8ba1\u89e3\u6790<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"1Binder%E8%AE%BE%E8%AE%A1\"><\/span>1.Binder\u8bbe\u8ba1<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"1-1%E5%86%85%E6%A0%B8%E7%A9%BA%E9%97%B4%E7%9A%84Binder%E8%AE%BE%E8%AE%A1\"><\/span>1-1)\u5185\u6838\u7a7a\u95f4\u7684Binder\u8bbe\u8ba1<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>\u91cd\u8981\u7ed3\u6784\u4f53<\/li>\n<\/ul>\n<p>\u5185\u6838\u7a7a\u95f4\u7684Binder\u8bbe\u8ba1\u6d89\u53ca\u52303\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u7ed3\u6784\u4f53\uff1abinder_proc\uff0cbinder_node\u548cbinder_ref\u3002\u7531\u4e8e\u672c\u6587\u7684\u91cd\u70b9\u662f\u4ecb\u7ecdBinder\u673a\u5236\u7684\u7406\u8bba\u77e5\u8bc6\uff0c\u56e0\u6b64\uff0c\u5728\u8fd9\u91cc\u6211\u5e76\u4e0d\u6253\u7b97\u5c55\u5f00\u8fd93\u4e2a\u7ed3\u6784\u4f53\u5bf9\u5b83\u4eec\u8fdb\u884c\u8be6\u7ec6\u4ecb\u7ecd\u3002\u5f53\u7136\uff0c\u540e\u9762\u4f1a\u518d\u64b0\u6587\u5bf9\u8fd9\u4e9b\u7c7b\u8fdb\u884c\u8be6\u7ec6\u8bf4\u660e\u3002\u8fd9\u91cc\u53ea\u9700\u8981\u4e86\u89e3\u4e2a\u5927\u6982\u5373\u53ef\u3002<\/p>\n<p>binder_proc\u662f\u63cf\u8ff0\u8fdb\u7a0b\u4e0a\u4e0b\u6587\u4fe1\u606f\u7684\uff0c\u6bcf\u4e00\u4e2a\u7528\u6237\u7a7a\u95f4\u7684\u8fdb\u7a0b\u90fd\u5bf9\u5e94\u4e00\u4e2abinder_proc\u7ed3\u6784\u4f53\u3002<br \/>\nbinder_node\u662fBinder\u5b9e\u4f53\u5bf9\u5e94\u7684\u7ed3\u6784\u4f53\uff0c\u5b83\u662fServer\u5728Binder\u9a71\u52a8\u4e2d\u7684\u4f53\u73b0\u3002<br \/>\nbinder_ref\u662fBinder\u5f15\u7528\u5bf9\u5e94\u7684\u7ed3\u6784\u4f53\uff0c\u5b83\u662fClient\u5728Binder\u9a71\u52a8\u4e2d\u7684\u4f53\u73b0\u3002<\/p>\n<p>binder_proc\u5305\u542bbinder\u5b9e\u4f53\u4e0ebinder\u5f15\u7528\u7ea2\u9ed1\u6811<\/p>\n<h4><span class=\"ez-toc-section\" id=\"1-2%E7%94%A8%E6%88%B7%E7%A9%BA%E9%97%B4%E7%9A%84Binder%E8%AE%BE%E8%AE%A1\"><\/span>1-2)\u7528\u6237\u7a7a\u95f4\u7684Binder\u8bbe\u8ba1<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<h3><span class=\"ez-toc-section\" id=\"2Binder%E9%80%9A%E4%BF%A1\"><\/span>2.Binder\u901a\u4fe1<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"2-1%EF%BC%89Binder%E9%80%9A%E4%BF%A1%E6%A8%A1%E5%9E%8B\"><\/span>2-1\uff09Binder\u901a\u4fe1\u6a21\u578b<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<h4><span class=\"ez-toc-section\" id=\"2-2%EF%BC%89Binder%E9%80%9A%E4%BF%A1%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84\"><\/span>2-2\uff09Binder\u901a\u4fe1\u6570\u636e\u7ed3\u6784<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<h1><span class=\"ez-toc-section\" id=\"%E7%AC%AC%E4%BA%8C%E7%AF%87%EF%BC%9ABinder%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84\"><\/span>\u7b2c\u4e8c\u7bc7\uff1aBinder\u6570\u636e\u7ed3\u6784<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p><a href=\"https:\/\/blog.csdn.net\/tkwxty\/article\/details\/102843741\">https:\/\/blog.csdn.net\/tkwxty\/article\/details\/102843741<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E4%B8%80%E3%80%81%E5%86%85%E6%A0%B8%E7%A9%BA%E9%97%B4%E7%9A%84Binder%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84\"><\/span>\u4e00\u3001\u5185\u6838\u7a7a\u95f4\u7684Binder\u6570\u636e\u7ed3\u6784<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u9ad8\u901aandroid10\u5185\u6838\u6570\u636e\u7ed3\u6784\u57fa\u672c\u90fd\u5b9a\u4e49\u5728<code>kernel\/drivers\/android\/binder.c<\/code>\u4e2d<\/p>\n<h3><span class=\"ez-toc-section\" id=\"1binder_proc\"><\/span>1.binder_proc<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Binder\u9a71\u52a8\u7684\u6587\u4ef6\u8282\u70b9\u662f&quot;\/dev\/binder&quot;\uff0c\u6bcf\u5f53\u4e00\u4e2a\u7a0b\u5e8f\u6253\u5f00\u8be5\u6587\u4ef6\u8282\u70b9\u65f6\uff1bBinder\u9a71\u52a8\u4e2d\u90fd\u4f1a\u65b0\u5efa\u4e00\u4e2abinder_proc\u5bf9\u8c61\u6765\u4fdd\u5b58\u8be5\u8fdb\u7a0b\u7684\u4e0a\u4e0b\u6587\u4fe1\u606f\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"2binder_thread\"><\/span>2.binder_thread<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>binder_thread\u662f\u5185\u6838\u5c42\u63cf\u8ff0Binder\u7ebf\u7a0b\u7684\u7ed3\u6784\u4f53\uff0c\u5728\u7528\u6237\u5c42\u4e0e\u5176\u76f8\u5bf9\u5e94\u7684\u662fIPCThreadState\u3002binder_proc\u662f\u63cf\u8ff0\u8fdb\u7a0b\u7684\uff0c\u800cbinder_thread\u662f\u63cf\u8ff0\u8fdb\u7a0b\u4e2d\u7684\u7ebf\u7a0b\u3002\u4ece\u4e0a\u9762\u5bf9binder_proc\u7ed3\u6784\u4f53\u7684\u63cf\u8ff0\u6211\u4eec\u53ef\u4ee5\u77e5\u9053binder_proc\u53ef\u4ee5\u540c\u65f6\u5305\u542b\u591a\u4e2abinder_thread\uff0c\u5373\u4e00\u5bf9\u591a\u7684\u5173\u7cfb\u3002<\/p>\n<p>1\uff09 proc\uff0c\u5b83\u662fbinder_proc(\u8fdb\u7a0b\u4e0a\u4e0b\u6587\u4fe1\u606f)\u7ed3\u6784\u4f53\u5bf9\u8c61\u3002\u76ee\u7684\u662f\u4fdd\u5b58\u8be5\u7ebf\u7a0b\u6240\u5c5e\u7684Binder\u8fdb\u7a0b\u3002<br \/>\n2\uff09rb_node\uff0c\u5b83\u662f\u7ea2\u9ed1\u6811\u8282\u70b9\u3002\u901a\u8fc7\u5c06rb_node binder\u5173\u8054\u5230\u6240\u5c5e\u8fdb\u7a0b\u7ea2\u9ed1\u6811proc-&gt;threads\u4e2d\uff0c\u4ece\u800c\u5c06\u8be5\u7ebf\u7a0b\u6dfb\u52a0\u5230\u8fdb\u7a0b\u7684threads\u7ea2\u9ed1\u6811\u4e2d\u8fdb\u884c\u7ba1\u7406\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"3binder_node\"><\/span>3.binder_node<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>binder_node\u662f\u5185\u6838\u5c42\u63cf\u8ff0Binder\u5b9e\u4f53\u7684\u7ed3\u6784\u4f53\uff0c\u7528\u6237\u5c42\u4e0e\u4e4b\u76f8\u5bf9\u5e94\u7684\u662f\u5177\u4f53\u7684Binder Server\u3002<\/p>\n<p>1\uff09rb_node\u548cdead_node\u5c5e\u4e8e\u4e00\u4e2aunion\u3002\u5982\u679c\u8be5Binder\u5b9e\u4f53\u8fd8\u5728\u4f7f\u7528\uff0c\u5219\u901a\u8fc7rb_node\u5c06\u8be5\u8282\u70b9\u94fe\u63a5\u5230proc-&gt;nodes\u7ea2\u9ed1\u6811\u4e2d\uff1b\u5426\u5219\uff0c\u5219\u5c06\u8be5Binder\u5b9e\u4f53\u901a\u8fc7dead_node\u94fe\u63a5\u5230\u5168\u5c40\u54c8\u5e0c\u8868binder_dead_nodes\u4e2d\u3002<br \/>\n2\uff09proc\uff0c\u5b83\u662fbinder_proc(\u8fdb\u7a0b\u4e0a\u4e0b\u6587\u4fe1\u606f)\u7ed3\u6784\u4f53\u5bf9\u8c61\u3002\u76ee\u7684\u662f\u4fdd\u5b58\u8be5Binder\u5b9e\u4f53\u7684\u8fdb\u7a0b\u3002<br \/>\n3\uff09refs\uff0c\u5b83\u662f\u8be5Binder\u5b9e\u4f53\u7684\u6240\u6709\u5f15\u7528\u6240\u7ec4\u6210\u7684\u94fe\u8868\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"4binder_ref\"><\/span>4.binder_ref<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>binder_ref\u662f\u5185\u6838\u5c42\u63cf\u8ff0Binder\u5f15\u7528\u7684\u7ed3\u6784\u4f53\uff0c\u7528\u6237\u5c42\u4e0e\u4e4b\u76f8\u5bf9\u5e94\u7684\u662f\u67d0\u4e2a\u5177\u4f53\u670d\u52a1\u7684\u8fdc\u7a0b\u4ee3\u7406BpBinder\u6216\u8005BinderProxy\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"5binder_buffer\"><\/span>5.binder_buffer<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>binder_buffer\u662f\u63cf\u8ff0Binder\u8fdb\u7a0b\u6240\u7ba1\u7406\u7684\u6bcf\u6bb5\u5185\u5b58\u7684\u7ed3\u6784\u4f53\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"6flat_binder_object\"><\/span>6.flat_binder_object<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>flat_binder_object\u662f\u7528\u6765\u63cf\u8ff0Binder\u4fe1\u606f\u7684\u7ed3\u6784\u4f53\u3002\u5b83\u4e5f\u5c5e\u4e8e\u5185\u6838\u7a7a\u95f4\u548c\u7528\u6237\u7a7a\u95f4\u7684\u901a\u4fe1\u7ed3\u6784\u4f53\u3002<br \/>\n\u603b\u4f53\u6765\u8bf4\uff0c\u5728\u7528\u6237\u7a7a\u95f4\uff0cflat_binder_object\u662f\u63cf\u8ff0\u8be5Binder\u5b9e\u4f53\u5728\u7528\u6237\u7a7a\u95f4\u7684\u5b58\u5728\u5f62\u5f0f\uff1b\u800c\u5728\u5185\u6838\u7a7a\u95f4\u4e2d\uff0cflat_binder_object\u5219\u63cf\u8ff0\u8be5Binder\u5b9e\u4f53\u5728\u5185\u6838\u4e2d\u7684\u5b58\u5728\u5f62\u5f0f\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"7binder_write_read\"><\/span>7.binder_write_read<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>binder_write_read\u662f\u7528\u6765\u63cf\u8ff0Binder\u5728\u9a71\u52a8\u5c42\u548c\u7528\u6237\u5c42\u8fdb\u884c\u6570\u636e\u8bfb\u5199\u4ea4\u4e92\u7684\u7684\u7ed3\u6784\u4f53\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"8binder_transaction_data\"><\/span>8.binder_transaction_data<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>binder_transaction_data\u4f7f\u7528\u6765\u63cf\u8ff0Binder\u4e8b\u52a1\u4ea4\u4e92\u7684\u6570\u636e\u7ed3\u6784\u4f53\u3002\u5b83\u4e5f\u5c5e\u4e8e\u5185\u6838\u7a7a\u95f4\u548c\u7528\u6237\u7a7a\u95f4\u7684\u901a\u4fe1\u7ed3\u6784\u4f53\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"9binder_transaction\"><\/span>9.binder_transaction<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>binder_transaction\u7528\u6765\u63cf\u8ff0\u8fdb\u7a0b\u95f4\u901a\u4fe1\u8fc7\u7a0b\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u53c8\u79f0\u4e3a\u4e00\u4e2a\u4e8b\u52a1\uff0c\u8fdb\u7a0b\u901a\u4fe1\u4e8b\u52a1\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E4%BA%8C%E3%80%81%E7%94%A8%E6%88%B7%E7%A9%BA%E9%97%B4%E7%9A%84Binder%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84\"><\/span>\u4e8c\u3001\u7528\u6237\u7a7a\u95f4\u7684Binder\u6570\u636e\u7ed3\u6784<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"1ServiceManager%E5%AE%88%E6%8A%A4%E8%BF%9B%E7%A8%8B%E4%B8%AD%E7%9A%84%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84\"><\/span>1.ServiceManager\u5b88\u62a4\u8fdb\u7a0b\u4e2d\u7684\u6570\u636e\u7ed3\u6784<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"1-1binder_state\"><\/span>1-1.binder_state<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>binder_state\u5b9a\u4e49\u5728frameworks\/native\/cmds\/servicemanager\/binder.c\u4e2d\uff0c\u5b83\u662fServiceManager\u8c03\u7528binder_open\u540e\u7528\u6765\u63cf\u8ff0\u6253\u5f00\u7684&quot;\/dev\/binder&quot;\u7684\u4fe1\u606f\u7ed3\u6784\u4f53\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"1-2binder_io\"><\/span>1-2.binder_io<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>binder_io\u5b9a\u4e49\u5728frameworks\/native\/cmds\/servicemanager\/binder.h\u4e2d\uff0c\u5b83\u662fServiceManager\u4e2d\u4e0ebinder_transaction_data\u5bf9\u5e94\u7684\u7ed3\u6784\u4f53\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"1-3svcinfo\"><\/span>1-3.svcinfo<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>svcinfo\u5b9a\u4e49\u5728frameworks\/native\/cmds\/servicemanager\/service_manager.c\u4e2d\u3002\u5b83\u662fServiceManager\u5b88\u62a4\u8fdb\u7a0b\u7684\u79c1\u6709\u7ed3\u6784\u4f53\u3002<br \/>\nsvcinfo\u662f\u4fdd\u5b58&quot;\u6ce8\u518c\u5230ServiceManager\u4e2d\u7684\u670d\u52a1&quot;\u7684\u76f8\u5173\u4fe1\u606f\u7684\u7ed3\u6784\u4f53\u3002\u5b83\u662f\u4e00\u4e2a\u5355\u94fe\u8868\uff0c\u5728ServiceManager\u5b88\u62a4\u8fdb\u7a0b\u4e2d\u7684svclist\u662f\u4fdd\u5b58\u6ce8\u518c\u5230ServiceManager\u4e2d\u7684\u670d\u52a1\u7684\u94fe\u8868\uff0c\u5b83\u5c31\u662fstruct info\u7c7b\u578b\u3002svcinfo\u4e2d\u7684next\u662f\u6307\u5411\u4e0b\u4e00\u4e2a\u670d\u52a1\u7684\u8282\u70b9\uff0c\u800cptr\u662f\u8be5\u670d\u52a1\u5728Binder\u9a71\u52a8\u4e2dBinder\u5f15\u7528\u7684\u63cf\u8ff0\u3002name\u5219\u662f\u670d\u52a1\u7684\u540d\u79f0\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"2c%E5%B1%82%E7%9A%84%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84\"><\/span>2.c++\u5c42\u7684\u6570\u636e\u7ed3\u6784<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"2-1Parcel\"><\/span>2-1.Parcel<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Parcel\u662f\u63cf\u8ff0Binder\u5728\u7528\u6237\u5c42\u670d\u52a1\u4ee3\u7406\u7aef\u548c\u670d\u52a1\u7aef\u8fdb\u884c\u901a\u4fe1\u7684\u4fe1\u606f\u7684\u7ed3\u6784\u4f53\u3002<br \/>\nParcel\u5b9a\u4e49\u5728frameworks\/native\/include\/binder\/Parcel.h\u4e2d\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"%E7%AC%AC%E4%B8%89%E7%AF%87%EF%BC%9ABinder%E6%8E%A5%E5%8F%A3%E5%92%8C%E7%B1%BB\"><\/span>\u7b2c\u4e09\u7bc7\uff1aBinder\u63a5\u53e3\u548c\u7c7b<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p><a href=\"https:\/\/blog.csdn.net\/tkwxty\/article\/details\/102970008\">https:\/\/blog.csdn.net\/tkwxty\/article\/details\/102970008<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"1Java%E5%B1%82%E6%AC%A1%E7%9A%84Binder%E6%8E%A5%E5%8F%A3%E5%92%8C%E7%B1%BB\"><\/span>1.Java\u5c42\u6b21\u7684Binder\u63a5\u53e3\u548c\u7c7b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>\n<p>IBinder\u63a5\u53e3<br \/>\nAndroid\u8981\u6c42\u6240\u6709\u7684Binder\u5b9e\u4f53\u90fd\u5fc5\u987b\u5b9e\u73b0IBinder\u63a5\u53e3\uff0c\u5176\u6587\u4ef6\u5728Android\u6e90\u7801\u7684\u8def\u5f84\u662f<code>frameworks\/base\/core\/java\/android\/os\/IBinder.java<\/code><\/p>\n<\/li>\n<li>\n<p>IInterface\u63a5\u53e3<br \/>\nIInterface\u63a5\u53e3\u6bd4\u8f83\u7b80\u5355\uff0c\u5176\u6e90\u7801\u8def\u5f84\u4e3a\u4ec5\u4ec5\u5355\u5355\u5b9a\u4e49\u4e86\u4e00\u4e2a\u65b9\u6cd5\uff0c\u4e0d\u7ba1\u662f\u670d\u52a1\u7aef\u8fd8\u662f\u5ba2\u6237\u7aef\u90fd\u9700\u8981\u5b9e\u73b0\u8be5\u63a5\u53e3<\/p>\n<\/li>\n<li>\n<p>BinderProxy\u7c7b<br \/>\nBinderProxy\u662fIBinder\u7684\u5b50\u7c7b\uff0c\u5ba2\u6237\u7aef\u8fdb\u7a0b\u6301\u6709\u5173\u8054\u7684\u670d\u52a1\u7684\u7684BinderProxy\u5bf9\u8c61\u4ece\u800c\u5b8c\u6210\u76f8\u5173\u7684\u8fdc\u7a0b\u670d\u52a1\u8c03\u7528\uff0c\u5176\u5e95\u5c42\u76f8\u5bf9\u5e94\u7684C++\u5c42\u7684BpBinder\u3002<\/p>\n<\/li>\n<li>\n<p>Binder\u7c7b<br \/>\nBinder\u4e5f\u662fIBinder\u7684\u5b50\u7c7b\uff0cJava\u5c42\u63d0\u4f9b\u670d\u52a1\u7684Server\u8fdb\u7a0b\u6301\u6709\u4e00\u4e2aBinder\u5bf9\u8c61\u4ece\u800c\u5b8c\u6210\u8de8\u8fdb\u7a0b\u95f4\u901a\u4fe1\u3002<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u7c7b\u4e0e\u63a5\u53e3\u5173\u7cfb\u56fe\uff1a<\/p>\n<\/blockquote>\n<p><img src=\"http:\/\/xinyiworld.top\/wordpress_it\/wp-content\/uploads\/2024\/07\/java_binder.png\" alt=\"\" \/><br \/>\n\u5728\u5b9e\u9645\u5f00\u53d1\u4f7f\u7528\u4e2d\uff0c\u6211\u4eec\u5e76\u4e0d\u9700\u8981\u7f16\u5199\u4e0a\u56fe\u7684XXXXNative\u3001XXXXProxy\uff0c\u5b83\u4eec\u4f1a\u7531ADT\u6839\u636e\u6211\u4eec\u7f16\u5199\u7684aidl\u811a\u672c\u81ea\u52a8\u751f\u6210\u3002\u5c31\u7814\u7a76\u8de8\u8fdb\u7a0b\u901a\u4fe1\u800c\u8a00\uff0c\u5176\u5b9e\u8d28\u5185\u5bb9\u57fa\u672c\u4e0a\u90fd\u5728C++\u5c42\u6b21\uff0cJava\u5c42\u6b21\u53ea\u662f\u4e00\u4e2a\u58f3\u800c\u5df2\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"2C%E5%B1%82%E6%AC%A1%E7%9A%84%E7%9B%B8%E5%85%B3%E6%8E%A5%E5%8F%A3%E5%92%8C%E7%B1%BB\"><\/span>2.C++\u5c42\u6b21\u7684\u76f8\u5173\u63a5\u53e3\u548c\u7c7b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>\n<p>RefBase\u7c7b<br \/>\n\u5b83\u5b9a\u4e49\u5728<code>system\/core\/include\/utils\/RefBase.h<\/code>\u4e2d<\/p>\n<\/li>\n<li>\n<p>BpRefBase\u7c7b<br \/>\n\u5b83\u5b9a\u4e49\u5728<code>frameworks\/native\/include\/binder\/Binder.h<\/code>\u4e2d\u3002BpRefBase\u7ee7\u627f\u4e8eRefBase\uff0c\u5b83\u6709\u4e00\u4e2aIBinder*\u7c7b\u578b\u7684\u6210\u5458mRemote\uff0c\u540c\u65f6\u63d0\u4f9b\u4e86\u83b7\u53d6\u8be5mRemote\u7684\u65b9\u6cd5\u3002\u5b9e\u9645\u4e0a\uff0c\u8be5mRemote\u5c31\u662fBpBinder\u5bf9\u8c61\u3002<\/p>\n<\/li>\n<li>\n<p>IInterface\u7c7b<br \/>\n\u5b9a\u4e49\u5728<code>frameworks\/native\/include\/binder\/IInterface.h<\/code>\u4e2d\u3002\u548cRefBase\u7c7b\u4f3c\uff0c\u5b83\u4e5f\u662f\u4e00\u4e2a\u516c\u5171\u7236\u7c7b\uff0cIInterface\u4e2d\u58f0\u660e\u4e86asBinder()\u65b9\u6cd5\uff0c\u7528\u4e8e\u83b7\u53d6\u5bf9\u8c61\u7684IBinder\u5bf9\u8c61\u3002<\/p>\n<\/li>\n<li>\n<p>BpInterface\u548cBnInterface<br \/>\n(1\uff09.BpInterface\uff1a\u5b83\u5b9a\u4e49\u5728<code>frameworks\/native\/include\/binder\/IInterface.h<\/code>\u4e2d\u3002\u5b9e\u9645\u4e0a\uff0cBpInterface\u662f\u4e00\u4e2a\u6a21\u677f\u7c7b\uff0c\u540c\u65f6\u7ee7\u627f\u4e86BpRefBase\u548cINTERFACE\uff0c\u8fd9\u91cc\u7684INTERFACE\u662f\u6a21\u677f\u3002<br \/>\n(2).BnInterface\uff1a\u5b83\u5b9a\u4e49\u5728<code>frameworks\/native\/include\/binder\/IInterface.h<\/code>\u4e2d\u3002\u548cBpInterface\u7c7b\u4f3c\uff0cBnInterface\u4e5f\u662f\u4e00\u4e2a\u6a21\u677f\u7c7b\uff0c\u5b83\u540c\u65f6\u7ee7\u627f\u4e86BBinder\u548cINTERFACE\u3002<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>java\u5c42\u4e0ec++\u5c42\u7684binder\u662f\u5982\u4f55\u5173\u8054\u7684<\/p>\n<\/blockquote>\n<p><img src=\"http:\/\/xinyiworld.top\/wordpress_it\/wp-content\/uploads\/2024\/07\/java_cpp_connect.png\" alt=\"\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"3ProcessState\"><\/span>3.ProcessState<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u5b83\u5b9a\u4e49\u5728frameworks\/native\/libs\/binder\/ProcessState.cpp\u4e2d\uff0c\u5728\u6bcf\u4e2a\u8fdb\u7a0b\u4e2d\uff0c\u4f1a\u6709\u4e00\u4e2a\u5168\u5c40\u7684ProcessState\u5bf9\u8c61\u3002\u8fd9\u4e2a\u5f88\u5bb9\u6613\u7406\u89e3\uff0cProcessState\u7684\u5b57\u9762\u610f\u601d\u4e0d\u5c31\u662f\u201c\u8fdb\u7a0b\u72b6\u6001\u201d\u5417\uff0cProcessState\u7684\u5b9e\u4f8b\u662f\u91c7\u7528\u5355\u4f8b\u6a21\u5f0f\u5b9e\u73b0\u7684\u3002<\/p>\n<p>\u5b83\u62e5\u6709\u4e24\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u6210\u5458\uff1amDriverFD\u548cmHandleToObject\u3002<\/p>\n<ul>\n<li>\n<p>mDriverFD<br \/>\n\u6211\u4eec\u77e5\u9053\uff0cBinder\u5185\u6838\u88ab\u8bbe\u8ba1\u6210\u4e00\u4e2a\u9a71\u52a8\u7a0b\u5e8f\uff0c\u6240\u4ee5ProcessState\u91cc\u4e13\u95e8\u641e\u4e86\u4e2amDriverFD\u57df\uff0c\u6765\u8bb0\u5f55binder\u9a71\u52a8\u5bf9\u5e94\u7684\u53e5\u67c4\u503c\uff0c\u4ee5\u4fbf\u968f\u65f6\u548cbinder\u9a71\u52a8\u901a\u4fe1\u3002ProcessState\u5bf9\u8c61\u91c7\u7528\u4e86\u5178\u578b\u7684\u5355\u4f8b\u6a21\u5f0f\uff0c\u5728\u4e00\u4e2a\u5e94\u7528\u8fdb\u7a0b\u4e2d\uff0c\u53ea\u4f1a\u6709\u552f\u4e00\u7684\u4e00\u4e2aProcessState\u5bf9\u8c61\uff0c\u5b83\u5c06\u88ab\u8fdb\u7a0b\u4e2d\u7684\u591a\u4e2a\u7ebf\u7a0b\u5171\u7528\uff0c\u56e0\u6b64\u6bcf\u4e2a\u8fdb\u7a0b\u91cc\u7684\u7ebf\u7a0b\u5176\u5b9e\u662f\u5171\u7528\u6240\u6253\u5f00\u7684\u90a3\u4e2a\u9a71\u52a8\u53e5\u67c4\uff08mDriverFD\uff09\u7684<\/p>\n<\/li>\n<li>\n<p>mHandleToObject<\/p>\n<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"4IPCThreadState\"><\/span>4.IPCThreadState<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u5b83\u5b9a\u4e49\u5728frameworks\/native\/libs\/binder\/IPCThreadState.cpp\u4e2d\u4e2d\u3002IPCThreadState\u7684\u5b9e\u4f8b\u4e5f\u662f\u91c7\u7528\u5355\u4f8b\u6a21\u5f0f\u5b9e\u73b0\u7684\uff0c\u5b83\u662f\u6b63\u5728\u4e0eBinder\u9a71\u52a8\u8fdb\u884c\u4ea4\u4e92\u7684\u7c7b\uff0c\u548cBinder\u5185\u6838\u5c42\u7684binder_thread\u76f8\u5bf9\u5e94\u3002<\/p>\n<blockquote>\n<p>\u603b\u7ed3\uff1a<\/p>\n<\/blockquote>\n<p>\u5bf9\u4e8e\u4e00\u4e2aServer\u800c\u8a00\uff0c\u5b83\u90fd\u4f1a\u5b58\u5728\u4e00\u4e2a&quot;\u8fdc\u7a0bBpBinder\u5bf9\u8c61&quot;\u548c&quot;\u672c\u5730BBinder\u5bf9\u8c61&quot;\u3002<br \/>\n(01) <strong>\u8fdc\u7a0bBpBinder<\/strong>\u5bf9\u8c61\u7684\u4f5c\u7528\uff1a\u662f\u548cBinder\u9a71\u52a8\u8fdb\u884c\u4ea4\u4e92\u3002\u5177\u4f53\u7684\u65b9\u5f0f\u662f\uff0c\u5f53Client\u7aef\u8981\u5411Binder\u53d1\u8d77\u4e8b\u52a1\u8bf7\u6c42\u65f6\uff0c\u4f1a\u8c03\u7528BpBinder\u7684transact()\u63a5\u53e3\uff0c\u800c\u8be5\u63a5\u53e3\u4f1a\u8c03\u7528\u5230IPCThreadState::transact()\u63a5\u53e3\uff0c\u901a\u8fc7IPCThreadState\u7c7b\u6765\u548cBinder\u9a71\u52a8\u4ea4\u4e92\u3002\u6b64\u5916\uff0c\u8be5BpBinder\u5728Binder\u9a71\u52a8\u4e2d\u7684Binder\u5f15\u7528\u7684\u63cf\u8ff0\u4f1a\u88ab\u4fdd\u5b58\u5230ProcessState\u7684mHandleToObject\u77e2\u91cf\u7f13\u51b2\u6570\u7ec4\u4e2d\u3002<br \/>\n(02) <strong>\u672c\u5730BBinder<\/strong>\u5bf9\u8c61\u7684\u4f5c\u7528:\u662fServer\u54cd\u5e94Client\u8bf7\u6c42\u7684\u7c7b\u3002\u5f53Client\u6709\u8bf7\u6c42\u53d1\u9001\u7ed9Server\u65f6\uff0c\u90fd\u4f1a\u8c03\u7528\u5230BBinder\u7684onTransact()\u51fd\u6570\uff0c\u800c\u6bcf\u4e2aServer\u90fd\u4f1a\u8986\u76d6onTransact()\u51fd\u6570\u3002\u8fd9\u6837\uff0c\u6bcf\u4e2aServer\u5c31\u53ef\u4ee5\u5728onTransact()\u4e2d\u6839\u636e\u81ea\u5df1\u7684\u60c5\u51b5\u5bf9\u8bf7\u6c42\u8fdb\u884c\u5904\u7406\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"%E7%AC%AC%E5%9B%9B%E7%AF%87%EF%BC%9AParcel%E8%AF%A6%E8%A7%A3%E4%B9%8B%E5%9F%BA%E6%9C%AC%E6%95%B0%E6%8D%AE%E7%9A%84%E8%AF%BB%E5%86%99\"><\/span>\u7b2c\u56db\u7bc7\uff1aParcel\u8be6\u89e3\u4e4b\u57fa\u672c\u6570\u636e\u7684\u8bfb\u5199<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p><a href=\"https:\/\/blog.csdn.net\/tkwxty\/article\/details\/107916160\">https:\/\/blog.csdn.net\/tkwxty\/article\/details\/107916160<\/a><\/p>\n<p>Parcel\u6846\u67b6\u56fe\uff1a<br \/>\n<img src=\"http:\/\/xinyiworld.top\/wordpress_it\/wp-content\/uploads\/2024\/07\/parcel_fw.png\" alt=\"\" \/><\/p>\n<button class=\"simplefavorite-button\" data-postid=\"14138\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"\">\u6536\u85cf <i class=\"sf-icon-star-empty\"><\/i><\/button>","protected":false},"excerpt":{"rendered":"<p>https:\/\/blog.csdn.net\/tkwxty\/article\/details\/10282 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1077],"tags":[],"_links":{"self":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/14138"}],"collection":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14138"}],"version-history":[{"count":46,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/14138\/revisions"}],"predecessor-version":[{"id":14215,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/14138\/revisions\/14215"}],"wp:attachment":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14138"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}