{"id":33,"date":"2024-06-17T10:48:30","date_gmt":"2024-06-17T02:48:30","guid":{"rendered":"https:\/\/www.swreader.com\/?p=33"},"modified":"2024-06-17T10:53:21","modified_gmt":"2024-06-17T02:53:21","slug":"android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\/","title":{"rendered":"Android Vendor SELinux Policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790"},"content":{"rendered":"<p>\u81ea\u4eceAndroid 8\u5f15\u5165Treble\u6846\u67b6\u540e\uff0cAndroid\u5c06System\u548cVendor\u5206\u4e3a\u4e24\u4e2a\u90e8\u5206\uff0c\u5141\u8bb8\u72ec\u7acb\u5347\u7ea7system\u548cvendor\uff0c\u968f\u540e\u5f15\u5165\u4e86Product\u3001ODM\u7b49\u5206\u533a\u3002\u5728\u8fd9\u6837\u7684\u80cc\u666f\u4e0b\uff0cSELinux\u89c4\u5219\u4e5f\u88ab\u5212\u5206\u4e3aplatform\uff08system\uff09\u3001system_ext\u3001product\u3001vendor\u548codm\u51e0\u4e2a\u90e8\u5206\u3002<\/p>\n<p>\u672c\u6587\u4ee5Vendor\u5206\u533a\u4e3a\u4f8b\uff0c\u8be6\u7ec6\u5206\u6790\u4e86\u5982\u4f55\u5c06sepolicy\u6587\u4ef6\u5305\u542b\u5230Android\u7f16\u8bd1\u7cfb\u7edf\u4e2d\uff0c\u4ee5\u53caAndroid.mk\u7684\u53d8\u91cf\u5982\u4f55\u4f20\u9012\u5230Soong\u7f16\u8bd1\u7cfb\u7edf\uff0c\u5e76\u6700\u7ec8\u5982\u4f55\u4e0eAndroid.bp\u4e2d\u7684\u6a21\u5757\u548c\u53d8\u91cf\u76f8\u5bf9\u5e94\u3002<\/p>\n<h2>1. Android Makefile\u4e2d include SELinux policy\u6587\u4ef6<\/h2>\n<p>\u9996\u5148\uff0cVendor\u7684SELinux\u7b56\u7565\u6587\u4ef6\u901a\u8fc7 <code>BOARD_VENDOR_SEPOLICY_DIRS<\/code> \u6216\u8005 <code>BOARD_SEPOLICY_DIRS<\/code> \u53d8\u91cf\u6dfb\u52a0\u5230Android\u7684\u7f16\u8bd1\u7cfb\u7edf\u4e2d\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code class=\"language-makefile\">BOARD_VENDOR_SEPOLICY_DIRS += vendor\/xx\/featureA\/sepolicy<\/code><\/pre>\n<h2>2. Android Makefile\u53d8\u91cf\u4f20\u9012\u7ed9Soong<\/h2>\n<p>\u8fd9\u4e9bMakefile\u53d8\u91cf\u901a\u8fc7 <code>soong_config.mk<\/code> \u88ab\u8f6c\u6362\u4e3aJSON\u683c\u5f0f\uff0c\u7136\u540e\u4f20\u9012\u7ed9Soong\u7f16\u8bd1\u7cfb\u7edf\uff0c\u6307\u5b9a\u76f8\u5e94\u7684Go\u8bed\u8a00\u53d8\u91cf\uff08\u4f8b\u5982 <code>BoardVendorSepolicyDirs<\/code>\uff09\u3002<\/p>\n<pre><code class=\"language-makefile\">.\/build\/make\/core\/soong_config.mk:203: $(call add_json_list, BoardVendorSepolicyDirs, $(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_SEPOLICY_DIRS))<\/code><\/pre>\n<h2>3. Soong\u4e2d\u53d8\u91cf\u7684\u58f0\u660e<\/h2>\n<p>\u5728Soong\u7684 <code>variable.go<\/code> \u6587\u4ef6\u4e2d\uff0c\u5b9a\u4e49\u4e86\u5b58\u50a8Vendor SELinux\u7b56\u7565\u6587\u4ef6\u8def\u5f84\u7684\u53d8\u91cf\u3002<\/p>\n<pre><code class=\"language-go\">.\/build\/soong\/android\/variable.go:355: BoardVendorSepolicyDirs []string `json:&quot;,omitempty&quot;`<\/code><\/pre>\n<h2>4. \u83b7\u53d6Vendor\u7b56\u7565\u8def\u5f84\u7684\u63a5\u53e3<\/h2>\n<p>Soong\u63d0\u4f9b\u4e86\u63a5\u53e3\u6765\u83b7\u53d6Vendor\u7b56\u7565\u6587\u4ef6\u7684\u8def\u5f84\u5217\u8868\u3002<\/p>\n<pre><code class=\"language-go\">func (c *deviceConfig) VendorSepolicyDirs() []string {\n    return c.config.productVariables.BoardVendorSepolicyDirs\n}<\/code><\/pre>\n<h2>5. Android.bp\u4e2d\u53d8\u91cf\u4e0eMakefile\u4e2dSELinux\u53d8\u91cf\u7684\u5bf9\u5e94\u5173\u7cfb<\/h2>\n<p>\u5728Android\u7f16\u8bd1\u7cfb\u7edf\u7684 <code>build\/soong\/build_files.go<\/code> \u6587\u4ef6\u4e2d\uff0c\u5b9e\u73b0\u4e86Android.bp\u4e2d\u53d8\u91cf\u4e0eMakefile\u4e2dSELinux\u53d8\u91cf\u7684\u6620\u5c04\u5173\u7cfb\u3002<\/p>\n<pre><code class=\"language-go\">func (b *buildFiles) GenerateAndroidBuildActions(ctx android.ModuleContext) {\n    b.srcs = make(map[string]android.Paths)\n    b.srcs[&quot;.reqd_mask&quot;] = b.findSrcsInDirs(ctx, filepath.Join(ctx.ModuleDir(), &quot;reqd_mask&quot;))\n    b.srcs[&quot;.plat_public&quot;] = b.findSrcsInDirs(ctx, filepath.Join(ctx.ModuleDir(), &quot;public&quot;))\n    b.srcs[&quot;.plat_private&quot;] = b.findSrcsInDirs(ctx, filepath.Join(ctx.ModuleDir(), &quot;private&quot;))\n    b.srcs[&quot;.plat_vendor&quot;] = b.findSrcsInDirs(ctx, filepath.Join(ctx.ModuleDir(), &quot;vendor&quot;))\n    b.srcs[&quot;.system_ext_public&quot;] = b.findSrcsInDirs(ctx, ctx.DeviceConfig().SystemExtPublicSepolicyDirs()...)\n    b.srcs[&quot;.system_ext_private&quot;] = b.findSrcsInDirs(ctx, ctx.DeviceConfig().SystemExtPrivateSepolicyDirs()...)\n    b.srcs[&quot;.product_public&quot;] = b.findSrcsInDirs(ctx, ctx.Config().ProductPublicSepolicyDirs()...)\n    b.srcs[&quot;.product_private&quot;] = b.findSrcsInDirs(ctx, ctx.Config().ProductPrivateSepolicyDirs()...)\n    b.srcs[&quot;.vendor&quot;] = b.findSrcsInDirs(ctx, ctx.DeviceConfig().VendorSepolicyDirs()...)\n    b.srcs[&quot;.odm&quot;] = b.findSrcsInDirs(ctx, ctx.DeviceConfig().OdmSepolicyDirs()...)\n\n    if ctx.DeviceConfig().PlatformSepolicyVersion() == ctx.DeviceConfig().BoardSepolicyVers() {\n        \/\/ vendor uses the same source with plat policy\n        b.srcs[&quot;.reqd_mask_for_vendor&quot;] = b.srcs[&quot;.reqd_mask&quot;]\n        b.srcs[&quot;.plat_vendor_for_vendor&quot;] = b.srcs[&quot;.plat_vendor&quot;]\n        b.srcs[&quot;.plat_public_for_vendor&quot;] = b.srcs[&quot;.plat_public&quot;]\n        b.srcs[&quot;.plat_private_for_vendor&quot;] = b.srcs[&quot;.plat_private&quot;]\n        b.srcs[&quot;.system_ext_public_for_vendor&quot;] = b.srcs[&quot;.system_ext_public&quot;]\n        b.srcs[&quot;.system_ext_private_for_vendor&quot;] = b.srcs[&quot;.system_ext_private&quot;]\n        b.srcs[&quot;.product_public_for_vendor&quot;] = b.srcs[&quot;.product_public&quot;]\n        b.srcs[&quot;.product_private_for_vendor&quot;] = b.srcs[&quot;.product_private&quot;]\n    } else {\n        \/\/ use vendor-supplied plat prebuilts\n        b.srcs[&quot;.reqd_mask_for_vendor&quot;] = b.findSrcsInDirs(ctx, ctx.DeviceConfig().BoardReqdMaskPolicy()...)\n        b.srcs[&quot;.plat_vendor_for_vendor&quot;] = b.findSrcsInDirs(ctx, ctx.DeviceConfig().BoardPlatVendorPolicy()...)\n        b.srcs[&quot;.plat_public_for_vendor&quot;] = b.findSrcsInDirs(ctx, filepath.Join(ctx.ModuleDir(), &quot;prebuilts&quot;, &quot;api&quot;, ctx.DeviceConfig().BoardSepolicyVers(), &quot;public&quot;))\n        b.srcs[&quot;.plat_private_for_vendor&quot;] = b.findSrcsInDirs(ctx, filepath.Join(ctx.ModuleDir(), &quot;prebuilts&quot;, &quot;api&quot;, ctx.DeviceConfig().BoardSepolicyVers(), &quot;private&quot;))\n        b.srcs[&quot;.system_ext_public_for_vendor&quot;] = b.findSrcsInDirs(ctx, ctx.DeviceConfig().BoardSystemExtPublicPrebuiltDirs()...)\n        b.srcs[&quot;.system_ext_private_for_vendor&quot;] = b.findSrcsInDirs(ctx, ctx.DeviceConfig().BoardSystemExtPrivatePrebuiltDirs()...)\n        b.srcs[&quot;.product_public_for_vendor&quot;] = b.findSrcsInDirs(ctx, ctx.DeviceConfig().BoardProductPublicPrebuiltDirs()...)\n        b.srcs[&quot;.product_private_for_vendor&quot;] = b.findSrcsInDirs(ctx, ctx.DeviceConfig().BoardProductPrivatePrebuiltDirs()...)\n    }\n}<\/code><\/pre>\n<p>\u5728\u4e0a\u8ff0\u4ee3\u7801\u4e2d\uff0c <code>b.srcs[xxx]<\/code> \u4e2d\u7684 <code>xxx<\/code> \u662fAndroid.bp\u4e2d\u7684\u53d8\u91cf\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728Android.bp\u6587\u4ef6\u4e2d\u4f7f\u7528\u3002\u56e0\u6b64\uff0c\u603b\u7ed3\u5982\u4e0b\u8868\u6240\u793a\uff0c\u5176\u4e2d\u524d\u56db\u4e2a\u53d8\u91cf\u662fAndroid\u5e73\u53f0\u9ed8\u8ba4\u63d0\u4f9b\u7684\uff0cVendor\u5382\u5546\u65e0\u6cd5\u5b9a\u5236\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>Android.bp<\/th>\n<th>\u5bf9\u5e94\u7684Android.mk\u53d8\u91cf\u6216\u4ee3\u7801\u76ee\u5f55<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>.reqd_mask<\/td>\n<td>system\/sepolicy\/reqd_mask<\/td>\n<\/tr>\n<tr>\n<td>.plat_public<\/td>\n<td>system\/sepolicy\/public<\/td>\n<\/tr>\n<tr>\n<td>.plat_private<\/td>\n<td>system\/sepolicy\/private<\/td>\n<\/tr>\n<tr>\n<td>.plat_vendor<\/td>\n<td>system\/sepolicy\/vendor<\/td>\n<\/tr>\n<tr>\n<td>.system_ext_public<\/td>\n<td>$(SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS) $(BOARD_PLAT_PUBLIC_SEPOLICY_DIR)<\/td>\n<\/tr>\n<tr>\n<td>.system_ext_private<\/td>\n<td>$(SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS) $(BOARD_PLAT_PRIVATE_SEPOLICY_DIR)<\/td>\n<\/tr>\n<tr>\n<td>.product_public<\/td>\n<td>$(PRODUCT_PUBLIC_SEPOLICY_DIRS)<\/td>\n<\/tr>\n<tr>\n<td>.product_private<\/td>\n<td>$(PRODUCT_PRIVATE_SEPOLICY_DIRS)<\/td>\n<\/tr>\n<tr>\n<td>.vendor<\/td>\n<td>$(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_SEPOLICY_DIRS)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5982\u679c <code>BOARD_SEPOLICY_VERS<\/code> \u548c <code>PLATFORM_SEPOLICY_VERSION<\/code> \u76f8\u7b49\uff0c\u8868\u793aVendor\u4f7f\u7528\u5f53\u524d\u5e73\u53f0\u7684SELinux\u89c4\u5219\uff1b\u5426\u5219\u4f7f\u7528 <code>BOARD_SEPOLICY_VERS<\/code> \u6307\u5b9a\u7684SELinux\u89c4\u5219\u3002\u5728\u76f8\u7b49\u60c5\u51b5\u4e0b\uff0c\u76f8\u5173Android.bp\u4e2d\u7684SELinux\u7b56\u7565\u53d8\u91cf\u53ef\u4ee5\u7b80\u5316\u4e3a\u4ee5\u4e0b\u5f62\u5f0f\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>Android.bp<\/th>\n<th>\u53d6\u503c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>.reqd_mask_for_vendor<\/td>\n<td>.reqd_mask<\/td>\n<\/tr>\n<tr>\n<td>.plat_public_for_vendor<\/td>\n<td>.plat_public<\/td>\n<\/tr>\n<tr>\n<td>.plat_private_for_vendor<\/td>\n<td>.plat_private<\/td>\n<\/tr>\n<tr>\n<td>.plat_vendor_for_vendor<\/td>\n<td>.plat_vendor<\/td>\n<\/tr>\n<tr>\n<td>.system_ext_public_for_vendor<\/td>\n<td>.system_ext_public<\/td>\n<\/tr>\n<tr>\n<td>.system_ext_private_for_vendor<\/td>\n<td>.system_ext_private<\/td>\n<\/tr>\n<tr>\n<td>.product_public_for_vendor<\/td>\n<td>.product_public<\/td>\n<\/tr>\n<tr>\n<td>.product_private_for_vendor<\/td>\n<td>.product_private<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>6. plat_policy_for_vendor \u6a21\u5757\u7684\u7f16\u8bd1<\/h2>\n<p>plat_policy_for_vendor\u7684\u6700\u7ec8\u7f16\u8bd1\u751f\u6210\u662fplat_policy_for_vendor.cli\u6587\u4ef6\uff0cplat_policy_for_vendor.cli\u6587\u4ef6\u4f9d\u8d56plat_policy_for_vendor.conf\u6587\u4ef6\uff0c plat_policy_for_vendor.conf\u7684\u7f16\u8bd1\u8fc7\u7a0b\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-json\">se_policy_conf {\n    name: &quot;plat_policy_for_vendor.conf&quot;,\n    srcs: plat_policies_for_vendor,\n    installable: false,\n}<\/code><\/pre>\n<p>plat_policies_for_vendor\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-json\">plat_policies_for_vendor = [\n    &quot;:se_build_files{.plat_public_for_vendor}&quot;,\n    &quot;:se_build_files{.plat_private_for_vendor}&quot;,\n    &quot;:se_build_files{.system_ext_public_for_vendor}&quot;,\n    &quot;:se_build_files{.system_ext_private_for_vendor}&quot;,\n    &quot;:se_build_files{.product_public_for_vendor}&quot;,\n    &quot;:se_build_files{.product_private_for_vendor}&quot;,\n]<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\uff0cplat_policy_for_vendor\u7684\u7f16\u8bd1\u8fc7\u7a0b\u4e0d\u4f1a\u4f7f\u7528plat_vendor_for_vendor\u4e2d\u5b9a\u4e49\u7684sepolicy\u6587\u4ef6\uff0c\u6240\u4ee5\u5982\u679c\u5728system_ext_public_for_vendor\u4e2d\u589e\u52a0\u4e86\u4e00\u4e2a\u89c4\u5219\uff0c\u4f46\u662f\u65b0\u589e\u7684\u89c4\u5219\u4f9d\u8d56plat_vendor_for_vendor\u4e2d\u7684type\uff0c\u80af\u5b9a\u4f1a\u7f16\u8bd1\u51fa\u9519\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u81ea\u4eceAndroid 8\u5f15\u5165Treble\u6846\u67b6\u540e\uff0cAndroid\u5c06System\u548cVendor\u5206\u4e3a\u4e24\u4e2a\u90e8\u5206\uff0c\u5141\u8bb8\u72ec\u7acb\u5347\u7ea7system\u548cvendor\uff0c\u968f\u540e\u5f15\u5165\u4e86Product\u3001ODM\u7b49\u5206\u533a\u3002\u5728\u8fd9\u6837\u7684\u80cc\u666f\u4e0b\uff0cSELinux\u89c4\u5219\u4e5f\u88ab\u5212\u5206\u4e3aplatform\uff08system\uff09\u3001system_ext\u3001product\u3001vendor\u548codm\u51e0\u4e2a\u90e8\u5206\u3002 \u672c\u6587\u4ee5Vendor\u5206\u533a\u4e3a\u4f8b\uff0c\u8be6\u7ec6\u5206\u6790\u4e86\u5982\u4f55\u5c06sepolicy\u6587\u4ef6\u5305\u542b\u5230Android\u7f16\u8bd1\u7cfb\u7edf\u4e2d\uff0c\u4ee5\u53caAndroid.mk\u7684\u53d8\u91cf\u5982\u4f55\u4f20\u9012\u5230Soong\u7f16\u8bd1\u7cfb\u7edf\uff0c\u5e76\u6700\u7ec8\u5982\u4f55\u4e0eAndroid.bp\u4e2d\u7684\u6a21\u5757\u548c\u53d8\u91cf\u76f8\u5bf9\u5e94\u3002 1. Android Makefile\u4e2d include SELinux policy\u6587\u4ef6 \u9996\u5148\uff0cVendor\u7684SELinux\u7b56\u7565\u6587\u4ef6\u901a\u8fc7 BOARD_VENDOR_SEPOLICY_DIRS \u6216\u8005 BOARD_SEPOLICY_DIRS \u53d8\u91cf\u6dfb\u52a0\u5230Android\u7684\u7f16\u8bd1\u7cfb\u7edf\u4e2d\u3002\u4f8b\u5982\uff1a BOARD_VENDOR_SEPOLICY_DIRS += vendor\/xx\/featureA\/sepolicy 2. Android Makefile\u53d8\u91cf\u4f20\u9012\u7ed9Soong \u8fd9\u4e9bMakefile\u53d8\u91cf\u901a\u8fc7 soong_config.mk \u88ab\u8f6c\u6362\u4e3aJSON\u683c\u5f0f\uff0c\u7136\u540e\u4f20\u9012\u7ed9Soong\u7f16\u8bd1\u7cfb\u7edf\uff0c\u6307\u5b9a\u76f8\u5e94\u7684Go\u8bed\u8a00\u53d8\u91cf\uff08\u4f8b\u5982 BoardVendorSepolicyDirs\uff09\u3002 .\/build\/make\/core\/soong_config.mk:203: $(call add_json_list, BoardVendorSepolicyDirs, $(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_SEPOLICY_DIRS)) 3. Soong\u4e2d\u53d8\u91cf\u7684\u58f0\u660e \u5728Soong\u7684 variable.go \u6587\u4ef6\u4e2d\uff0c\u5b9a\u4e49\u4e86\u5b58\u50a8Vendor SELinux\u7b56\u7565\u6587\u4ef6\u8def\u5f84\u7684\u53d8\u91cf\u3002 .\/build\/soong\/android\/variable.go:355: BoardVendorSepolicyDirs []string `json:&quot;,omitempty&quot;` 4. \u83b7\u53d6Vendor\u7b56\u7565\u8def\u5f84\u7684\u63a5\u53e3 Soong\u63d0\u4f9b\u4e86\u63a5\u53e3\u6765\u83b7\u53d6Vendor\u7b56\u7565\u6587\u4ef6\u7684\u8def\u5f84\u5217\u8868\u3002 func (c *deviceConfig) VendorSepolicyDirs() []string { return c.config.productVariables.BoardVendorSepolicyDirs } 5. Android.bp\u4e2d\u53d8\u91cf\u4e0eMakefile\u4e2dSELinux\u53d8\u91cf\u7684\u5bf9\u5e94\u5173\u7cfb \u5728Android\u7f16\u8bd1\u7cfb\u7edf\u7684 build\/soong\/build_files.go \u6587\u4ef6\u4e2d\uff0c\u5b9e\u73b0\u4e86Android.bp\u4e2d\u53d8\u91cf\u4e0eMakefile\u4e2dSELinux\u53d8\u91cf\u7684\u6620\u5c04\u5173\u7cfb\u3002 func (b *buildFiles) GenerateAndroidBuildActions(ctx android.ModuleContext) { b.srcs = make(map[string]android.Paths) b.srcs[&quot;.reqd_mask&quot;] = b.findSrcsInDirs(ctx, filepath.Join(ctx.ModuleDir(), &quot;reqd_mask&quot;)) b.srcs[&quot;.plat_public&quot;] = b.findSrcsInDirs(ctx, filepath.Join(ctx.ModuleDir(), &quot;public&quot;)) b.srcs[&quot;.plat_private&quot;] = b.findSrcsInDirs(ctx, filepath.Join(ctx.ModuleDir(), &quot;private&quot;)) b.srcs[&quot;.plat_vendor&quot;] = b.findSrcsInDirs(ctx, filepath.Join(ctx.ModuleDir(), &quot;vendor&quot;)) b.srcs[&quot;.system_ext_public&quot;] = b.findSrcsInDirs(ctx, ctx.DeviceConfig().SystemExtPublicSepolicyDirs()&#8230;) b.srcs[&quot;.system_ext_private&quot;] = b.findSrcsInDirs(ctx, ctx.DeviceConfig().SystemExtPrivateSepolicyDirs()&#8230;) b.srcs[&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[3,13],"tags":[14,15,5,11,12,16],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-android","category-selinux","tag-android","tag-android-build","tag-linux","tag-selinux","tag-sepolicy","tag-soong"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android Vendor SELinux Policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790 - TianYa Blog %<\/title>\n<meta name=\"description\" content=\"\u6587\u7ae0\u8be6\u7ec6\u63a2\u8ba8\u4e86\u5728Android\u7cfb\u7edf\u4e2d\uff0c\u7279\u522b\u662f\u5728Vendor\u5206\u533a\uff0c\u5982\u4f55\u7ba1\u7406\u548c\u7f16\u8bd1SELinux\u7b56\u7565\u6587\u4ef6\u7684\u8fc7\u7a0b\uff0c\u6db5\u76d6\u4e86\u4eceMakefile\u5230Soong\u7f16\u8bd1\u7cfb\u7edf\u7684\u53d8\u91cf\u4f20\u9012\u4e0e\u6620\u5c04\uff0c\u4ee5\u53ca\u5728Android.bp\u4e2d\u7684\u7b56\u7565\u6587\u4ef6\u4f9d\u8d56\u5173\u7cfb\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Vendor SELinux Policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790 - TianYa Blog %\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u8be6\u7ec6\u63a2\u8ba8\u4e86\u5728Android\u7cfb\u7edf\u4e2d\uff0c\u7279\u522b\u662f\u5728Vendor\u5206\u533a\uff0c\u5982\u4f55\u7ba1\u7406\u548c\u7f16\u8bd1SELinux\u7b56\u7565\u6587\u4ef6\u7684\u8fc7\u7a0b\uff0c\u6db5\u76d6\u4e86\u4eceMakefile\u5230Soong\u7f16\u8bd1\u7cfb\u7edf\u7684\u53d8\u91cf\u4f20\u9012\u4e0e\u6620\u5c04\uff0c\u4ee5\u53ca\u5728Android.bp\u4e2d\u7684\u7b56\u7565\u6587\u4ef6\u4f9d\u8d56\u5173\u7cfb\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790\/\" \/>\n<meta property=\"og:site_name\" content=\"TianYa Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-06-17T02:48:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-17T02:53:21+00:00\" \/>\n<meta name=\"author\" content=\"zdm\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"zdm\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/2024\\\/06\\\/17\\\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/2024\\\/06\\\/17\\\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\\\/\"},\"author\":{\"name\":\"zdm\",\"@id\":\"https:\\\/\\\/www.swreader.com\\\/#\\\/schema\\\/person\\\/9c90501e33afc9307d757bc8cfaf1c6f\"},\"headline\":\"Android Vendor SELinux Policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790\",\"datePublished\":\"2024-06-17T02:48:30+00:00\",\"dateModified\":\"2024-06-17T02:53:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/2024\\\/06\\\/17\\\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\\\/\"},\"wordCount\":248,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/#\\\/schema\\\/person\\\/9c90501e33afc9307d757bc8cfaf1c6f\"},\"keywords\":[\"Android\",\"Android build\",\"linux\",\"Selinux\",\"sepolicy\",\"Soong\"],\"articleSection\":[\"Android\",\"Selinux\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/2024\\\/06\\\/17\\\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/2024\\\/06\\\/17\\\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\\\/\",\"url\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/2024\\\/06\\\/17\\\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\\\/\",\"name\":\"Android Vendor SELinux Policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790 - TianYa Blog %\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/#website\"},\"datePublished\":\"2024-06-17T02:48:30+00:00\",\"dateModified\":\"2024-06-17T02:53:21+00:00\",\"description\":\"\u6587\u7ae0\u8be6\u7ec6\u63a2\u8ba8\u4e86\u5728Android\u7cfb\u7edf\u4e2d\uff0c\u7279\u522b\u662f\u5728Vendor\u5206\u533a\uff0c\u5982\u4f55\u7ba1\u7406\u548c\u7f16\u8bd1SELinux\u7b56\u7565\u6587\u4ef6\u7684\u8fc7\u7a0b\uff0c\u6db5\u76d6\u4e86\u4eceMakefile\u5230Soong\u7f16\u8bd1\u7cfb\u7edf\u7684\u53d8\u91cf\u4f20\u9012\u4e0e\u6620\u5c04\uff0c\u4ee5\u53ca\u5728Android.bp\u4e2d\u7684\u7b56\u7565\u6587\u4ef6\u4f9d\u8d56\u5173\u7cfb\u3002\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/2024\\\/06\\\/17\\\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\\\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/2024\\\/06\\\/17\\\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/2024\\\/06\\\/17\\\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\\\/\\\/www.swreader.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android Vendor SELinux Policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.swreader.com\\\/#website\",\"url\":\"https:\\\/\\\/www.swreader.com\\\/\",\"name\":\"TianYa Blog\",\"description\":\"Technology And Life\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/#\\\/schema\\\/person\\\/9c90501e33afc9307d757bc8cfaf1c6f\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.swreader.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.swreader.com\\\/#\\\/schema\\\/person\\\/9c90501e33afc9307d757bc8cfaf1c6f\",\"name\":\"zdm\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g\",\"caption\":\"zdm\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g\"},\"sameAs\":[\"http:\\\/\\\/www.swreader.com\"],\"url\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/author\\\/zdm\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Vendor SELinux Policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790 - TianYa Blog %","description":"\u6587\u7ae0\u8be6\u7ec6\u63a2\u8ba8\u4e86\u5728Android\u7cfb\u7edf\u4e2d\uff0c\u7279\u522b\u662f\u5728Vendor\u5206\u533a\uff0c\u5982\u4f55\u7ba1\u7406\u548c\u7f16\u8bd1SELinux\u7b56\u7565\u6587\u4ef6\u7684\u8fc7\u7a0b\uff0c\u6db5\u76d6\u4e86\u4eceMakefile\u5230Soong\u7f16\u8bd1\u7cfb\u7edf\u7684\u53d8\u91cf\u4f20\u9012\u4e0e\u6620\u5c04\uff0c\u4ee5\u53ca\u5728Android.bp\u4e2d\u7684\u7b56\u7565\u6587\u4ef6\u4f9d\u8d56\u5173\u7cfb\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790\/","og_locale":"zh_CN","og_type":"article","og_title":"Android Vendor SELinux Policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790 - TianYa Blog %","og_description":"\u6587\u7ae0\u8be6\u7ec6\u63a2\u8ba8\u4e86\u5728Android\u7cfb\u7edf\u4e2d\uff0c\u7279\u522b\u662f\u5728Vendor\u5206\u533a\uff0c\u5982\u4f55\u7ba1\u7406\u548c\u7f16\u8bd1SELinux\u7b56\u7565\u6587\u4ef6\u7684\u8fc7\u7a0b\uff0c\u6db5\u76d6\u4e86\u4eceMakefile\u5230Soong\u7f16\u8bd1\u7cfb\u7edf\u7684\u53d8\u91cf\u4f20\u9012\u4e0e\u6620\u5c04\uff0c\u4ee5\u53ca\u5728Android.bp\u4e2d\u7684\u7b56\u7565\u6587\u4ef6\u4f9d\u8d56\u5173\u7cfb\u3002","og_url":"https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790\/","og_site_name":"TianYa Blog","article_published_time":"2024-06-17T02:48:30+00:00","article_modified_time":"2024-06-17T02:53:21+00:00","author":"zdm","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"zdm","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\/#article","isPartOf":{"@id":"https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\/"},"author":{"name":"zdm","@id":"https:\/\/www.swreader.com\/#\/schema\/person\/9c90501e33afc9307d757bc8cfaf1c6f"},"headline":"Android Vendor SELinux Policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790","datePublished":"2024-06-17T02:48:30+00:00","dateModified":"2024-06-17T02:53:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\/"},"wordCount":248,"commentCount":0,"publisher":{"@id":"https:\/\/www.swreader.com\/#\/schema\/person\/9c90501e33afc9307d757bc8cfaf1c6f"},"keywords":["Android","Android build","linux","Selinux","sepolicy","Soong"],"articleSection":["Android","Selinux"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\/","url":"https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\/","name":"Android Vendor SELinux Policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790 - TianYa Blog %","isPartOf":{"@id":"https:\/\/www.swreader.com\/#website"},"datePublished":"2024-06-17T02:48:30+00:00","dateModified":"2024-06-17T02:53:21+00:00","description":"\u6587\u7ae0\u8be6\u7ec6\u63a2\u8ba8\u4e86\u5728Android\u7cfb\u7edf\u4e2d\uff0c\u7279\u522b\u662f\u5728Vendor\u5206\u533a\uff0c\u5982\u4f55\u7ba1\u7406\u548c\u7f16\u8bd1SELinux\u7b56\u7565\u6587\u4ef6\u7684\u8fc7\u7a0b\uff0c\u6db5\u76d6\u4e86\u4eceMakefile\u5230Soong\u7f16\u8bd1\u7cfb\u7edf\u7684\u53d8\u91cf\u4f20\u9012\u4e0e\u6620\u5c04\uff0c\u4ee5\u53ca\u5728Android.bp\u4e2d\u7684\u7b56\u7565\u6587\u4ef6\u4f9d\u8d56\u5173\u7cfb\u3002","breadcrumb":{"@id":"https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.swreader.com\/index.php\/2024\/06\/17\/android-vendor-selinux-policy%e7%bc%96%e8%af%91%e8%bf%87%e7%a8%8b%e5%88%86%e6%9e%90\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.swreader.com\/"},{"@type":"ListItem","position":2,"name":"Android Vendor SELinux Policy\u7f16\u8bd1\u8fc7\u7a0b\u5206\u6790"}]},{"@type":"WebSite","@id":"https:\/\/www.swreader.com\/#website","url":"https:\/\/www.swreader.com\/","name":"TianYa Blog","description":"Technology And Life","publisher":{"@id":"https:\/\/www.swreader.com\/#\/schema\/person\/9c90501e33afc9307d757bc8cfaf1c6f"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.swreader.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.swreader.com\/#\/schema\/person\/9c90501e33afc9307d757bc8cfaf1c6f","name":"zdm","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/secure.gravatar.com\/avatar\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g","caption":"zdm"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g"},"sameAs":["http:\/\/www.swreader.com"],"url":"https:\/\/www.swreader.com\/index.php\/author\/zdm\/"}]}},"_links":{"self":[{"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":4,"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":37,"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/posts\/33\/revisions\/37"}],"wp:attachment":[{"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}