<?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/%E5%AE%89%E5%8D%93/</id><title>安卓 on 暮歌</title><updated>2026-10-19T05:35:03Z</updated><language>zh-cn</language><subtitle>自留地，不是技术 blog, 仅仅用作我生活的记录</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/%E5%AE%89%E5%8D%93/atom.xml" rel="self" type="application/atom+xml"/><link href="https://maxlen727.github.io/tags/%E5%AE%89%E5%8D%93/" 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><entry><id>https://maxlen727.github.io/posts/flash-rom-android-fliessys/</id><title>一次刷机经历，让我开始了解安卓文件系统</title><published>2023-07-07T10: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/flash-rom-android-fliessys/" rel="alternate" type="text/html"/><summary>由一次意外而产生的新认知…</summary><content type="html" xml:base="https://maxlen727.github.io/posts/flash-rom-android-fliessys/"><![CDATA[<p>（抬头）束束刚刚泡了一杯茶，先请你尝尝吧！</p>
<hr>

<h2 class="relative group">What happened ? 
    <div id="what-happened-" 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="#what-happened-" aria-label="锚点">#</a>
    </span>        
    
</h2>
<p>发现家里有一台野生 Redmi 7, 但是 MIUI 在这台机器上实在太卡，于是束束决定给它刷一个类原生。</p>
<p>逛了逛酷安，看这个机型里有人说 cherishOS 不错，所以束束先选择的是 cherish 的 A11.</p>
<p>本以为是一次平平无奇的刷机，按照常规操作解 BL，进 fastboot，刷 Rec（用的 OrangeFox），adbsideload 侧载 rom，开机</p>
<p>？</p>
<p>开不开机！一直卡在开机界面上</p>
<p>无奈，束束认为是 Rom 的问题，于是换 dotos 的 A11，再刷</p>
<p>这次的 dotos 就还可以了，虽然也不能开机，但是可以显示一个报错的界面，全英文，具体是什么我也忘了，大概就是说需要格式化此设备才行，下面直接一个按钮 Reboot to Recovery.</p>
<p>那行，那束束就乖乖 Reboot to Recovery 去格式化呗。然而格式化 data 分区后…不行。</p>
<p>此时我以为是 rec 问题，于是又换了 TWRP，同时去下了 los 的每夜版（因为这个设备根本没有正式版啊喂！）再试一次。</p>
<p>噔噔，结果还是和刷 dotos 时一样的。看着这台没刷好的手机，束束有些着急了。</p>

<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="#%e6%80%8e%e4%b9%88%e8%a7%a3%e5%86%b3%e7%9a%84" aria-label="锚点">#</a>
    </span>        
    
</h2>
<p>束束去网上搜来搜去好像没人说到这个问题，后来不知道看了哪篇文章还是 xda 某个帖子提到了文件系统的事，索性去 TWRP 里碰碰运气，把 data 分区的文件系统从 f2fs 改为 ext4，开机，欸，竟然可以了。</p>
<p><a
  href="https://blog.ichr.me/post/f2fs-rom-issue/"
    target="_blank"
  >F2FS ROM 引发的悲剧及其解决方案</a></p>
<p>诺，这篇 blog 中提到了，但和束束遇到的情况并不完全一样。</p>

<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%af%b9%e5%ae%89%e5%8d%93%e6%96%87%e4%bb%b6%e7%b3%bb%e7%bb%9f%e7%9a%84%e6%96%b0%e4%ba%86%e8%a7%a3" aria-label="锚点">#</a>
    </span>        
    
</h2>
<p>上面文章里的博主提到了</p>
<blockquote>
<p>这次「灾难」的导火索是严格要求 F2FS 文件系统的 Android 类原生 ROM——<a
  href="https://www.droidontime.com/"
    target="_blank"
  >Dot OS (Droid on Time)</a>，而其它 ROM 譬如 Lineage OS、Pixel Experience 等均只要求 ext4 文件系统。</p></blockquote>
<p>dotos 真的只认 f2fs 吗？其实不然。安卓系统对于文件系统的支持要看内核是否支持。</p>
<p>比如说束束刷的这台 Redmi 7: 束束刷的这几个包内核都不支持 f2fs，而这里 TWRP 等 rec 刷入进去默认文件系统就是原先的 f2fs，就导致了开机报错或 cherish 那种严重的无法开机的情况。</p>
<p>再说这个 f2fs 不是很广泛了？为什么竟然不被部分内核支持。这里引用一段</p>
<blockquote>
<p>F2FS（Flash-Friendly File System）是一种闪存文件系统，最初就是为了 NAND 闪存存储设备设计的。相比之下，ext4 最初设计是考虑到运行在机械硬盘（磁盘）等区块存储设备上的，而由于其读写性能远不如 SSD 固态硬盘等闪存存储设备，所以现在很多场景都使用固态硬盘。Linux 随后也推出了 MTD 这一硬件抽象层，它能让闪存设备看起来像是一种区块设备，从而使针对区块设备的文件系统直接应用在闪存上。</p></blockquote>
<blockquote>
<p>ext4 即为<strong>第四代扩展文件系统</strong>（Fourth extended filesystem，ext4），2006 年被首次公开、2008 年被当成稳定版本并入 Linux 源代码并成为官方建议的默认文件系统。而 Android 正是基于 Linux 开发，早在 Android 2.3 就已用 ext4 取代 YAFFS，市面上绝大多数 Android ROM 也确实使用的是 ext4 文件系统。</p></blockquote>
<p>早在安卓 2.3 时 ext4 就已经被安卓官方支持，但是这段文字里没有提到 f2fs 的支持情况，具体又是怎样的呢？</p>
<p>在谷歌所维护的 AOSP 中，F2FS 并不是官方支持的文件系统，但是仍然有一些设备树可以选择支持 f2fs. 少数派的这篇文章中有提到：</p>
<p><a
  href="https://sspai.com/post/53136"
    target="_blank"
  >给你的 Android 手机换个文件系统 - 少数派</a></p>
<p>而 AOSP 默认所支持的文件系统是 ext4.</p>
<p>这也道出了另一个事实：不是被 Linux 主线内核支持的文件系统就会被安卓支持。</p>
<p>






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

  
</figure>
</p>

<h2 class="relative group">Ending 
    <div id="ending" 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="#ending" aria-label="锚点">#</a>
    </span>        
    
</h2>
<p>这次刷机“翻车”让束束学到了一些关于安卓文件系统的知识。还是不得不感叹：安卓的系统机制真是神奇且有趣啊？到底还有什么更多的东西等着咱去发掘呢？</p>
<hr>

<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%8f%82%e8%80%83%e8%b5%84%e6%96%99" aria-label="锚点">#</a>
    </span>        
    
</h2>
<p><a
  href="https://sspai.com/post/53136"
    target="_blank"
  >给你的 Android 手机换个文件系统 - 少数派</a></p>
<p><a
  href="https://blog.ichr.me/post/f2fs-rom-issue/"
    target="_blank"
  >F2FS ROM 引发的悲剧及其解决方案</a></p>
<p><a
  href="https://zh.wikipedia.org/wiki/Ext4"
    target="_blank"
  >ext4</a></p>
<p><a
  href="https://source.android.com/docs/core/architecture/android-kernel-file-system-support?hl=zh-cn"
    target="_blank"
  >Android 内核文件系统支持  |  Android 开源项目  |  Android Open Source Project</a></p>
<p><a
  href="https://forum.xda-developers.com/t/official-recovery-onclite-orangefox-recovery-project-r11-0_0-stable.4079941/post-82593949"
    target="_blank"
  >[OFFICIAL][RECOVERY][ONCLITE] OrangeFox Recovery Project&hellip;</a></p>
]]></content><category term="刷机"/><category term="安卓"/><category term="文件系统"/></entry></feed>