<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="/atom.xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-cn">
  <id>https://maxlen727.github.io/tags/afwall/</id>
  <title>AFWall on 暮歌</title>
  <updated>2026-10-29T02:16:48Z</updated>
  <language>zh-cn</language>
  <subtitle>它甚至消失不起</subtitle>
  <background>/background_hu_d92feabfcd60f52c.webp</background><accent>139, 92, 246</accent>
  <accentLight>167, 139, 250</accentLight>
  <debounce>70</debounce>
  <author>
    <name>微恙</name>
    <email>maxlen@duck.com</email>
    <uri>https://maxlen727.github.io/</uri>
  </author><link href="https://maxlen727.github.io/tags/afwall/atom.xml" rel="self" type="application/atom+xml" /><link href="https://maxlen727.github.io/tags/afwall/" rel="alternate" type="text/html" />
  <generator uri="https://gohugo.io" version="0.148.2">Hugo</generator>
  <rights>© 2021 - 2026 MaxLen All Rights Reserved.</rights>
  
  <entry>
    <id>https://maxlen727.github.io/posts/internet-wall-aosp/</id>
    <title>类原生联网管控，我是这样做的</title>
    <published>2023-07-31T10:35:25+08:00</published>
    <updated>2024-02-12T10:35:25+08:00</updated>
    <author><name>微恙</name></author>
    <link href="https://maxlen727.github.io/posts/internet-wall-aosp/" rel="alternate" type="text/html" />
    <summary>联网管控是国内深度定制 UI 中非常好用的一个功能，想必各位类原生用户也十分眼馋，束束最近发现了一个开源项目，可以给类原生联网管控的能力</summary>
    <content type="html" xml:base="https://maxlen727.github.io/posts/internet-wall-aosp/"><![CDATA[
<h2 class="relative group">前言 
    <div id="前言" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
        <a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e5%89%8d%e8%a8%80" aria-label="锚点">#</a>
    </span>        
    
</h2>
<blockquote>
<p>💡 本文提到的操作均需 Root 权限或需 Magisk 模块</p></blockquote>
<hr>

<h2 class="relative group">最朴素的办法：手动改 hosts 
    <div id="最朴素的办法手动改-hosts" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
        <a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e6%9c%80%e6%9c%b4%e7%b4%a0%e7%9a%84%e5%8a%9e%e6%b3%95%e6%89%8b%e5%8a%a8%e6%94%b9-hosts" aria-label="锚点">#</a>
    </span>        
    
</h2>
<p>hosts 文件不必多说，系统在访问网址时会优先到 hosts 文件中查找对应IP地址。依据这个，我们可以通过修改 hosts文件来封锁对应网站。</p>
<p>安卓的 hosts 文件位置和 Linux 中一致，就在 <code>/etc/hosts</code></p>
<p>






<figure>
    <img class="my-0 rounded-md" loading="lazy" alt="image" src="https://github.com/maxlen727/picx-images-hosting/raw/master/20240212/image.1xj5zqp3jd9.png">

  
</figure>
</p>
<p>ip+网址就是这个文件简单的编写方法。所以如果我们要控制应用联网，只需要阻断应用要访问的网址就好了。</p>
<p>但要想知道应用到底访问了什么网址，这可能还需要点功夫，可以使用 <strong>HttpCanary 对指定应用</strong>进行抓包。</p>
<p>当然这种方法既麻烦又不够优雅，束束写这篇文章也并不是为了介绍这个，毕竟它几乎人尽皆知。</p>
<hr>

<h2 class="relative group">AFWall + ：给类原生控制应用联网的能力 
    <div id="afwall--给类原生控制应用联网的能力" class="anchor"></div>
    
    <span
        class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100 select-none">
        <a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#afwall--%e7%bb%99%e7%b1%bb%e5%8e%9f%e7%94%9f%e6%8e%a7%e5%88%b6%e5%ba%94%e7%94%a8%e8%81%94%e7%bd%91%e7%9a%84%e8%83%bd%e5%8a%9b" aria-label="锚点">#</a>
    </span>        
    
</h2>
<p>这是个开源项目，地址在这里 <a
  href="https://github.com/ukanth/afwall"
    target="_blank"
  >https://github.com/ukanth/afwall</a> .界面大概就这个样子</p>
<p>






<figure>
    <img class="my-0 rounded-md" loading="lazy" alt="image" src="https://github.com/maxlen727/picx-images-hosting/raw/master/20240212/image.53fb3ldnfa80.png">

  
</figure>
</p>
<p>熟悉感扑面而来，MIUI上的联网管理差不多也长这个样子，所以使用也是很简单的了。</p>
<p>首先要切换一下模式，改为「阻挡所选」就好了。</p>
<p>






<figure>
    <img class="my-0 rounded-md" loading="lazy" alt="image" src="https://github.com/maxlen727/picx-images-hosting/raw/master/20240212/image.548y20afjc40.webp">

  
</figure>
</p>
<p>然后勾上要阻挡的APP,再「打开防火墙」就好了</p>
<p>






<figure>
    <img class="my-0 rounded-md" loading="lazy" alt="image" src="https://github.com/maxlen727/picx-images-hosting/raw/master/20240212/image.4k86tkivjes0.png">

  
</figure>
</p>
<p>这个软件不需要后台运行，设置完毕后直接从后台划掉就好了。但是束束发现一个小问题：它可能会造成莫名的耗电，如果续航显著下降，那大概就是这个软件的锅。</p>
]]></content>
    <category term="刷机" /><category term="安卓" /><category term="类原生" /><category term="联网管控" /><category term="AFWall" />
  </entry>
  
</feed>
