"')]),s._v(" "),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# 待测试应用的包名")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token assign-left variable"}},[s._v("EVENT_COUNT")]),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("1000")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# 事件数量")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token assign-left variable"}},[s._v("SEED")]),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("1234")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# 随机种子")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token assign-left variable"}},[s._v("OUTPUT_FILE")]),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"monkey_log.txt"')]),s._v(" "),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# 输出文件名")]),s._v("\n\n"),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# 执行 Monkey 测试")]),s._v("\nadb "),t("span",{pre:!0,attrs:{class:"token parameter variable"}},[s._v("-s")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token variable"}},[s._v("$DEVICE_SERIAL")]),s._v(" shell monkey "),t("span",{pre:!0,attrs:{class:"token parameter variable"}},[s._v("-p")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token variable"}},[s._v("$PACKAGE_NAME")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token parameter variable"}},[s._v("--throttle")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("500")]),s._v(" --ignore-crashes --ignore-timeouts --ignore-security-exceptions --monitor-native-crashes --pct-syskeys "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-anyevent "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-majornav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-touch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("100")]),s._v(" --pct-motion "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-trackball "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-nav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-appswitch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-flip "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-pinchzoom "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-permission "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-anyevent "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-majornav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-syskeys "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token parameter variable"}},[s._v("-v")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token parameter variable"}},[s._v("-v")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token variable"}},[s._v("$EVENT_COUNT")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token parameter variable"}},[s._v("--throttle")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("500")]),s._v(" --ignore-crashes --ignore-timeouts --ignore-security-exceptions --kill-process-after-error --pct-syskeys "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-anyevent "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-majornav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-touch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("100")]),s._v(" --pct-motion "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-trackball "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-nav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-appswitch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-flip "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-pinchzoom "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-permission "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-anyevent "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-majornav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-syskeys "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-nav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-appswitch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-flip "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-pinchzoom "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-permission "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-anyevent "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-majornav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-syskeys "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-nav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-appswitch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-flip "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-pinchzoom "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-permission "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-anyevent "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-majornav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-syskeys "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-nav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-appswitch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-flip "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-pinchzoom "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-permission "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-anyevent "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-majornav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-syskeys "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-nav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-appswitch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-flip "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-pinchzoom "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-permission "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-anyevent "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-majornav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-syskeys "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-nav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-appswitch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-flip "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-pinchzoom "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-permission "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-anyevent "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-majornav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-syskeys "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-nav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-appswitch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-flip "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-pinchzoom "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-permission "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-anyevent "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-majornav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-syskeys "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-nav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-appswitch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-flip "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-pinchzoom "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-permission "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-anyevent "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-majornav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-syskeys "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-nav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-appswitch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-flip "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-pinchzoom "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-permission "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-anyevent "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-majornav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-syskeys "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-nav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-appswitch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-flip "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-pinchzoom "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-permission "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-anyevent "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-majornav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-syskeys "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-nav "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-appswitch "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-flip "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-pinchzoom "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" --pct-permission "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token variable"}},[s._v("$OUTPUT_FILE")]),s._v("\n\n"),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v("echo")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"Monkey 测试已完成,结果保存在 '),t("span",{pre:!0,attrs:{class:"token variable"}},[s._v("$OUTPUT_FILE")]),s._v(' 中。"')]),s._v("\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br"),t("span",{staticClass:"line-number"},[s._v("5")]),t("br"),t("span",{staticClass:"line-number"},[s._v("6")]),t("br"),t("span",{staticClass:"line-number"},[s._v("7")]),t("br"),t("span",{staticClass:"line-number"},[s._v("8")]),t("br"),t("span",{staticClass:"line-number"},[s._v("9")]),t("br"),t("span",{staticClass:"line-number"},[s._v("10")]),t("br"),t("span",{staticClass:"line-number"},[s._v("11")]),t("br"),t("span",{staticClass:"line-number"},[s._v("12")]),t("br"),t("span",{staticClass:"line-number"},[s._v("13")]),t("br"),t("span",{staticClass:"line-number"},[s._v("14")]),t("br"),t("span",{staticClass:"line-number"},[s._v("15")]),t("br")])])])}),[],!1,null,null,null);t.default=e.exports}}]);
\ No newline at end of file
diff --git a/assets/js/17.80f38037.js b/assets/js/17.80f38037.js
new file mode 100644
index 0000000000..f61017dfaf
--- /dev/null
+++ b/assets/js/17.80f38037.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[17],{336:function(t,n,s){"use strict";s.r(n);var e=s(4),o=Object(e.a)({},(function(){return(0,this._self._c)("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}})}),[],!1,null,null,null);n.default=o.exports}}]);
\ No newline at end of file
diff --git a/assets/js/170.5e2b19ac.js b/assets/js/170.5e2b19ac.js
new file mode 100644
index 0000000000..0109117d4e
--- /dev/null
+++ b/assets/js/170.5e2b19ac.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[170],{486:function(t,s,a){"use strict";a.r(s);var n=a(4),e=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("blockquote",[s("p",[t._v("Bitmap的内存消耗主要取决于Bitmap的宽度、高度和配置(即像素格式)。跟 ImageView 的宽高没有关系")])]),t._v(" "),s("h2",{attrs:{id:"bitmap-优化"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#bitmap-优化"}},[t._v("#")]),t._v(" bitmap 优化")]),t._v(" "),s("h3",{attrs:{id:"_1-使用适当的bitmap配置"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_1-使用适当的bitmap配置"}},[t._v("#")]),t._v(" 1. 使用适当的Bitmap配置")]),t._v(" "),s("p",[t._v("选择适合的Bitmap.Config,例如Bitmap.Config.RGB_565,可以减少内存使用量。这种配置使用2字节来存储每个像素,而Bitmap.Config.ARGB_8888使用4字节。")]),t._v(" "),s("div",{staticClass:"language-java line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-java"}},[s("code",[s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("BitmapFactory"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Options")]),t._v(" options "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("BitmapFactory"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Options")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\noptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("inPreferredConfig "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Bitmap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Config")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("RGB_565")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Bitmap")]),t._v(" bitmap "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("BitmapFactory")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("decodeResource")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getResources")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("R")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("drawable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("image"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" options"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br")])]),s("h3",{attrs:{id:"_2-缩放bitmap"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_2-缩放bitmap"}},[t._v("#")]),t._v(" 2. 缩放Bitmap")]),t._v(" "),s("p",[t._v("如果你需要展示的Bitmap尺寸小于原图的尺寸,可以先缩放Bitmap以减少内存使用。")]),t._v(" "),s("div",{staticClass:"language-java line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-java"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("public")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("static")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Bitmap")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getScaledBitmap")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("String")]),t._v(" path"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" reqWidth"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" reqHeight"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("BitmapFactory"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Options")]),t._v(" options "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("BitmapFactory"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Options")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n options"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("inJustDecodeBounds "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("BitmapFactory")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("decodeFile")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("path"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" options"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n options"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("inSampleSize "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("calculateInSampleSize")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("options"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" reqWidth"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" reqHeight"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n options"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("inJustDecodeBounds "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("false")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("BitmapFactory")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("decodeFile")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("path"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" options"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("public")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("static")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("calculateInSampleSize")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("BitmapFactory"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Options")]),t._v(" options"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" reqWidth"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" reqHeight"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("final")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" height "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" options"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("outHeight"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("final")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" width "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" options"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("outWidth"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" inSampleSize "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("height "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" reqHeight "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("||")]),t._v(" width "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" reqWidth"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("final")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" halfHeight "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" height "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("final")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" halfWidth "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" width "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("while")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("halfHeight "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v(" inSampleSize"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">=")]),t._v(" reqHeight "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&&")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("halfWidth "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v(" inSampleSize"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">=")]),t._v(" reqWidth"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n inSampleSize "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" inSampleSize"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br"),s("span",{staticClass:"line-number"},[t._v("4")]),s("br"),s("span",{staticClass:"line-number"},[t._v("5")]),s("br"),s("span",{staticClass:"line-number"},[t._v("6")]),s("br"),s("span",{staticClass:"line-number"},[t._v("7")]),s("br"),s("span",{staticClass:"line-number"},[t._v("8")]),s("br"),s("span",{staticClass:"line-number"},[t._v("9")]),s("br"),s("span",{staticClass:"line-number"},[t._v("10")]),s("br"),s("span",{staticClass:"line-number"},[t._v("11")]),s("br"),s("span",{staticClass:"line-number"},[t._v("12")]),s("br"),s("span",{staticClass:"line-number"},[t._v("13")]),s("br"),s("span",{staticClass:"line-number"},[t._v("14")]),s("br"),s("span",{staticClass:"line-number"},[t._v("15")]),s("br"),s("span",{staticClass:"line-number"},[t._v("16")]),s("br"),s("span",{staticClass:"line-number"},[t._v("17")]),s("br"),s("span",{staticClass:"line-number"},[t._v("18")]),s("br"),s("span",{staticClass:"line-number"},[t._v("19")]),s("br"),s("span",{staticClass:"line-number"},[t._v("20")]),s("br"),s("span",{staticClass:"line-number"},[t._v("21")]),s("br"),s("span",{staticClass:"line-number"},[t._v("22")]),s("br"),s("span",{staticClass:"line-number"},[t._v("23")]),s("br"),s("span",{staticClass:"line-number"},[t._v("24")]),s("br")])]),s("h3",{attrs:{id:"_3-使用bitmapfactory-options进行解码"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_3-使用bitmapfactory-options进行解码"}},[t._v("#")]),t._v(" 3. 使用BitmapFactory.Options进行解码")]),t._v(" "),s("p",[t._v("通过设置BitmapFactory.Options来控制解码过程中的内存使用。")]),t._v(" "),s("div",{staticClass:"language-java line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-java"}},[s("code",[s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("BitmapFactory"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Options")]),t._v(" options "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("BitmapFactory"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Options")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\noptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("inPurgeable "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 允许系统在内存不足时回收该Bitmap的内存")]),t._v("\noptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("inInputShareable "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 与inPurgeable配合使用")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Bitmap")]),t._v(" bitmap "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("BitmapFactory")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("decodeResource")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getResources")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("R")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("drawable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("image"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" options"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br"),s("span",{staticClass:"line-number"},[t._v("4")]),s("br")])]),s("h3",{attrs:{id:"_4-回收bitmap内存"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_4-回收bitmap内存"}},[t._v("#")]),t._v(" 4. 回收Bitmap内存")]),t._v(" "),s("p",[t._v("在不再需要Bitmap时,及时调用bitmap.recycle()方法释放内存。")]),t._v(" "),s("div",{staticClass:"language-java line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-java"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("bitmap "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n bitmap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("recycle")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n bitmap "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br"),s("span",{staticClass:"line-number"},[t._v("4")]),s("br")])]),s("h3",{attrs:{id:"_5-使用内存缓存"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_5-使用内存缓存"}},[t._v("#")]),t._v(" 5. 使用内存缓存")]),t._v(" "),s("p",[t._v("使用内存缓存(如LruCache)来缓存Bitmap,从而避免频繁加载和解码。")]),t._v(" "),s("div",{staticClass:"language-java line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-java"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("private")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("LruCache")]),s("span",{pre:!0,attrs:{class:"token generics"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Bitmap")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v(" memoryCache"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("public")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initCache")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("final")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" maxMemory "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Runtime")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getRuntime")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("maxMemory")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1024")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("final")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" cacheSize "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" maxMemory "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n memoryCache "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("LruCache")]),s("span",{pre:!0,attrs:{class:"token generics"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Bitmap")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("cacheSize"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token annotation punctuation"}},[t._v("@Override")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("protected")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("sizeOf")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("String")]),t._v(" key"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Bitmap")]),t._v(" bitmap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" bitmap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getByteCount")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1024")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("public")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addBitmapToMemoryCache")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("String")]),t._v(" key"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Bitmap")]),t._v(" bitmap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getBitmapFromMemCache")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("key"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("==")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n memoryCache"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("put")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("key"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" bitmap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("public")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Bitmap")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getBitmapFromMemCache")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("String")]),t._v(" key"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" memoryCache"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("get")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("key"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br"),s("span",{staticClass:"line-number"},[t._v("4")]),s("br"),s("span",{staticClass:"line-number"},[t._v("5")]),s("br"),s("span",{staticClass:"line-number"},[t._v("6")]),s("br"),s("span",{staticClass:"line-number"},[t._v("7")]),s("br"),s("span",{staticClass:"line-number"},[t._v("8")]),s("br"),s("span",{staticClass:"line-number"},[t._v("9")]),s("br"),s("span",{staticClass:"line-number"},[t._v("10")]),s("br"),s("span",{staticClass:"line-number"},[t._v("11")]),s("br"),s("span",{staticClass:"line-number"},[t._v("12")]),s("br"),s("span",{staticClass:"line-number"},[t._v("13")]),s("br"),s("span",{staticClass:"line-number"},[t._v("14")]),s("br"),s("span",{staticClass:"line-number"},[t._v("15")]),s("br"),s("span",{staticClass:"line-number"},[t._v("16")]),s("br"),s("span",{staticClass:"line-number"},[t._v("17")]),s("br"),s("span",{staticClass:"line-number"},[t._v("18")]),s("br"),s("span",{staticClass:"line-number"},[t._v("19")]),s("br"),s("span",{staticClass:"line-number"},[t._v("20")]),s("br"),s("span",{staticClass:"line-number"},[t._v("21")]),s("br"),s("span",{staticClass:"line-number"},[t._v("22")]),s("br"),s("span",{staticClass:"line-number"},[t._v("23")]),s("br")])]),s("h3",{attrs:{id:"_6-使用硬件加速"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_6-使用硬件加速"}},[t._v("#")]),t._v(" 6. 使用硬件加速")]),t._v(" "),s("p",[t._v("在Android 8.0 (API level 26)及更高版本中,可以使用硬件位图(Hardware Bitmaps),这些位图存储在GPU内存中,可以减少应用的内存使用。")]),t._v(" "),s("div",{staticClass:"language-java line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-java"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Build")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("VERSION")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("SDK_INT")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Build"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("VERSION_CODES"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("O")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Bitmap")]),t._v(" bitmap "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("BitmapFactory")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("decodeResource")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getResources")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("R")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("drawable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("image"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" options"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n bitmap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setConfig")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Bitmap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Config")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("HARDWARE")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br"),s("span",{staticClass:"line-number"},[t._v("4")]),s("br")])]),s("h2",{attrs:{id:"link"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#link"}},[t._v("#")]),t._v(" link")]),t._v(" "),s("ul",[s("li",[s("a",{attrs:{href:"https://juejin.cn/post/6981403029295595534",target:"_blank",rel:"noopener noreferrer"}},[t._v("Android 内存优化之图片优化"),s("OutboundLink")],1)]),t._v(" "),s("li",[s("a",{attrs:{href:"https://mp.weixin.qq.com/s/5H3s4-_bFtM7_2xCqxhFCw",target:"_blank",rel:"noopener noreferrer"}},[t._v("内存大户Bitmap"),s("OutboundLink")],1)])])])}),[],!1,null,null,null);s.default=e.exports}}]);
\ No newline at end of file
diff --git a/assets/js/171.90db8586.js b/assets/js/171.90db8586.js
new file mode 100644
index 0000000000..048a3ffb9f
--- /dev/null
+++ b/assets/js/171.90db8586.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[171],{487:function(t,s,a){"use strict";a.r(s);var n=a(4),e=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("p",[t._v("TODO")]),t._v(" "),s("h2",{attrs:{id:"frida监控"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#frida监控"}},[t._v("#")]),t._v(" frida监控")]),t._v(" "),s("div",{staticClass:"language-js line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[t._v("Java"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("perform")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" VMRuntime "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Java"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("use")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'dalvik.system.VMRuntime'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" runtime "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" VMRuntime"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getRuntime")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n \n VMRuntime"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("newNonMovableArray"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("overload")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'java.lang.Class'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'int'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("implementation")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("cls"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" length")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" result "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("newNonMovableArray")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("cls"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" length"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n \n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 判断是否为大对象")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" threshold "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1024")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1024")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 1MB")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" size "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" length "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v(" Java"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("use")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("cls"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("classSize"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("value"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n \n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("size "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">=")]),t._v(" threshold"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("'Allocated large object: Class='")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" cls"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getName")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("', Size='")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" size "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("' bytes'")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n \n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br"),s("span",{staticClass:"line-number"},[t._v("4")]),s("br"),s("span",{staticClass:"line-number"},[t._v("5")]),s("br"),s("span",{staticClass:"line-number"},[t._v("6")]),s("br"),s("span",{staticClass:"line-number"},[t._v("7")]),s("br"),s("span",{staticClass:"line-number"},[t._v("8")]),s("br"),s("span",{staticClass:"line-number"},[t._v("9")]),s("br"),s("span",{staticClass:"line-number"},[t._v("10")]),s("br"),s("span",{staticClass:"line-number"},[t._v("11")]),s("br"),s("span",{staticClass:"line-number"},[t._v("12")]),s("br"),s("span",{staticClass:"line-number"},[t._v("13")]),s("br"),s("span",{staticClass:"line-number"},[t._v("14")]),s("br"),s("span",{staticClass:"line-number"},[t._v("15")]),s("br"),s("span",{staticClass:"line-number"},[t._v("16")]),s("br"),s("span",{staticClass:"line-number"},[t._v("17")]),s("br"),s("span",{staticClass:"line-number"},[t._v("18")]),s("br")])])])}),[],!1,null,null,null);s.default=e.exports}}]);
\ No newline at end of file
diff --git a/assets/js/172.cc24f14b.js b/assets/js/172.cc24f14b.js
new file mode 100644
index 0000000000..39919fd568
--- /dev/null
+++ b/assets/js/172.cc24f14b.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[172],{488:function(t,r,e){"use strict";e.r(r);var l=e(4),n=Object(l.a)({},(function(){var t=this,r=t._self._c;return r("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[r("h3",{attrs:{id:"请求速度优化"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#请求速度优化"}},[t._v("#")]),t._v(" 请求速度优化")]),t._v(" "),r("ul",[r("li",[t._v("DNS 优化")]),t._v(" "),r("li",[t._v("连接优化\n"),r("ul",[r("li",[t._v("复用连接。keep-alive")]),t._v(" "),r("li",[t._v("多路复用。Http1.1 VS Http2")]),t._v(" "),r("li",[t._v("TCP 对头阻塞")])])]),t._v(" "),r("li",[t._v("数据压缩\n"),r("ul",[r("li",[r("a",{attrs:{href:"http://www.52im.net/thread-323-1-1.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("Protobuf vs Json"),r("OutboundLink")],1),t._v(" "),r("ul",[r("li",[t._v("Protobuf 采用 varint 编码")]),t._v(" "),r("li",[t._v("解封包速度")])])])])])]),t._v(" "),r("h2",{attrs:{id:"link"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#link"}},[t._v("#")]),t._v(" link")]),t._v(" "),r("ul",[r("li",[r("a",{attrs:{href:"http://www.52im.net/thread-1413-1-1.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("现代移动端网络短连接的优化手段总结: 请求速度、弱网适应、安全保障"),r("OutboundLink")],1)])])])}),[],!1,null,null,null);r.default=n.exports}}]);
\ No newline at end of file
diff --git a/assets/js/173.fe9a6f35.js b/assets/js/173.fe9a6f35.js
new file mode 100644
index 0000000000..ab971ee1ad
--- /dev/null
+++ b/assets/js/173.fe9a6f35.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[173],{489:function(a,s,t){"use strict";t.r(s);var n=t(4),e=Object(n.a)({},(function(){var a=this,s=a._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":a.$parent.slotKey}},[s("RText",{attrs:{text:"anr 堆栈"}}),a._v(" "),s("div",{staticClass:"language-java line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-java"}},[s("code",[a._v("#"),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("00")]),a._v(" pc "),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("0000000000085e1")]),a._v("c "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("apex"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("com"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("runtime"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("lib64"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("bionic"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("libc"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("so "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("syscall"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("+")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("28")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n#"),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("01")]),a._v(" pc "),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("000000000028")]),a._v("c158 "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("apex"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("com"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("art"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("lib64"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("libart"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("so"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("!")]),a._v("libart"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("so "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("offset "),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("200000")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("art"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("::")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("ConditionVariable")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("::")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("WaitHoldingLocks")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("art"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("::")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Thread")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("+")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("148")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n#"),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("02")]),a._v(" pc "),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("0000000000743148")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("apex"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("com"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("art"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("lib64"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("libart"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("so"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("!")]),a._v("libart"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("so "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("offset "),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("380000")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("art"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("::")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("GoToRunnable")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("art"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("::")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Thread")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("+")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("408")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n#"),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("03")]),a._v(" pc "),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("0000000000742f")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("7")]),a._v("c "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("apex"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("com"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("art"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("lib64"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("/")]),a._v("libart"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("so"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("!")]),a._v("libart"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("so "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("offset "),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("380000")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("art"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("::")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("JniMethodEnd")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("unsigned "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" art"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("::")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Thread")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("+")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("24")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("graphics"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("HardwareRenderer")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("nPause")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("HardwareRenderer")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("graphics"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("HardwareRenderer")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("pause")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("HardwareRenderer")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("502")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("view"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("ViewRootImpl")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("performTraversals")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("ViewRootImpl")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("3884")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("view"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("ViewRootImpl")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("doTraversal")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("ViewRootImpl")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("2837")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("view"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("ViewRootImpl")]),a._v("$"),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("TraversalRunnable")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("run")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("ViewRootImpl")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("10520")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("view"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("Choreographer")]),a._v("$"),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("CallbackRecord")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("run")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Choreographer")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("1623")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("view"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("Choreographer")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("doCallbacks")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Choreographer")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("1141")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("view"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("Choreographer")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("doFrame")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Choreographer")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("1012")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("view"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("Choreographer")]),a._v("$"),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("FrameDisplayEventReceiver")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("run")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Choreographer")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("1585")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("os"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("Handler")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("handleCallback")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Handler")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("955")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("os"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("Handler")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("dispatchMessage")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Handler")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("102")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("os"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("Looper")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("loopOnce")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Looper")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("206")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("os"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("Looper")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("loop")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Looper")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("296")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("app"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("ActivityThread")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("main")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("ActivityThread")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("9000")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("java"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("lang"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("reflect"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("Method")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("invoke")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Method")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("com"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("internal"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("os"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("RuntimeInit")]),a._v("$"),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("MethodAndArgsCaller")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("run")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("RuntimeInit")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("569")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token class-name"}},[s("span",{pre:!0,attrs:{class:"token namespace"}},[a._v("com"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("android"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("internal"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("os"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")])]),a._v("ZygoteInit")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("main")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("ZygoteInit")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("java"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),s("span",{pre:!0,attrs:{class:"token number"}},[a._v("976")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n")])]),a._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[a._v("1")]),s("br"),s("span",{staticClass:"line-number"},[a._v("2")]),s("br"),s("span",{staticClass:"line-number"},[a._v("3")]),s("br"),s("span",{staticClass:"line-number"},[a._v("4")]),s("br"),s("span",{staticClass:"line-number"},[a._v("5")]),s("br"),s("span",{staticClass:"line-number"},[a._v("6")]),s("br"),s("span",{staticClass:"line-number"},[a._v("7")]),s("br"),s("span",{staticClass:"line-number"},[a._v("8")]),s("br"),s("span",{staticClass:"line-number"},[a._v("9")]),s("br"),s("span",{staticClass:"line-number"},[a._v("10")]),s("br"),s("span",{staticClass:"line-number"},[a._v("11")]),s("br"),s("span",{staticClass:"line-number"},[a._v("12")]),s("br"),s("span",{staticClass:"line-number"},[a._v("13")]),s("br"),s("span",{staticClass:"line-number"},[a._v("14")]),s("br"),s("span",{staticClass:"line-number"},[a._v("15")]),s("br"),s("span",{staticClass:"line-number"},[a._v("16")]),s("br"),s("span",{staticClass:"line-number"},[a._v("17")]),s("br"),s("span",{staticClass:"line-number"},[a._v("18")]),s("br"),s("span",{staticClass:"line-number"},[a._v("19")]),s("br"),s("span",{staticClass:"line-number"},[a._v("20")]),s("br"),s("span",{staticClass:"line-number"},[a._v("21")]),s("br")])]),s("h2",{attrs:{id:"threadedrenderer-10"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#threadedrenderer-10"}},[a._v("#")]),a._v(" ThreadedRenderer(>10)")]),a._v(" "),s("blockquote",[s("p",[a._v("public final class ThreadedRenderer extends HardwareRenderer {}")])]),a._v(" "),s("p",[a._v("在 Android 10 中将 ThreadedRenderer 改写并继承自 HardwareRenderer 主要是为了改进系统的渲染性能和体验。这个改写带来了一些好处:")]),a._v(" "),s("ul",[s("li",[s("p",[a._v("性能优化: HardwareRenderer 是一个专注于硬件加速渲染的基类, 它提供了更高效的渲染机制。通过将 ThreadedRenderer 继承自 HardwareRenderer, 可以利用硬件加速渲染, 从而提高渲染性能。这对于处理复杂的 UI 和动画效果特别有帮助。")])]),a._v(" "),s("li",[s("p",[a._v("一致性: 通过使用 HardwareRenderer 作为基类, ThreadedRenderer 可以更一致地处理渲染操作, 无论是在软件渲染模式还是硬件加速模式下。这有助于确保应用程序在不同设备上的渲染行为一致, 提供更好的用户体验。")])]),a._v(" "),s("li",[s("p",[a._v("兼容性: 通过基于 HardwareRenderer 构建 ThreadedRenderer, 可以更容易地进行系统升级和改进。这样可以减少代码重复, 提高代码的可维护性, 并简化了系统的渲染架构。")])]),a._v(" "),s("li",[s("p",[a._v("硬件加速支持: 继承自 HardwareRenderer 的 ThreadedRenderer 更容易支持硬件加速, 这意味着应用程序可以更好地利用设备的 GPU 资源, 提高渲染速度和效率。")])])]),a._v(" "),s("p",[a._v("总之, 将 ThreadedRenderer 改写并继承自 HardwareRenderer 主要是为了提高 Android 系统的渲染性能、一致性和兼容性。这有助于改进应用程序的用户体验, 并确保应用程序在不同设备和系统版本上都能正常工作。")]),a._v(" "),s("h2",{attrs:{id:"代码赏析"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#代码赏析"}},[a._v("#")]),a._v(" 代码赏析")]),a._v(" "),s("h3",{attrs:{id:"构造方法"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#构造方法"}},[a._v("#")]),a._v(" 构造方法")]),a._v(" "),s("p",[a._v("下面是 ThreadedRenderer 构造方法的一段内容。解释")]),a._v(" "),s("div",{staticClass:"language-java line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-java"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("long")]),a._v(" rootNodePtr "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("nCreateRootRenderNode")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(";")]),a._v("\nmRootNode "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("RenderNode")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("adopt")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("rootNodePtr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(";")]),a._v("\nmRootNode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("setClipToBounds")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token boolean"}},[a._v("false")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(";")]),a._v("\nmIsOpaque "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("!")]),a._v("translucent"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(";")]),a._v("\nmNativeProxy "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("nCreateProxy")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("translucent"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" rootNodePtr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(";")]),a._v("\n")])]),a._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[a._v("1")]),s("br"),s("span",{staticClass:"line-number"},[a._v("2")]),s("br"),s("span",{staticClass:"line-number"},[a._v("3")]),s("br"),s("span",{staticClass:"line-number"},[a._v("4")]),s("br"),s("span",{staticClass:"line-number"},[a._v("5")]),s("br")])]),s("p",[a._v("以下是对代码的解释:")]),a._v(" "),s("ul",[s("li",[s("p",[s("code",[a._v("nCreateRootRenderNode()")]),a._v(": 这个函数用于创建根渲染节点, 返回一个指向根渲染节点的指针, 然后将这个指针存储在 rootNodePtr 变量中。")])]),a._v(" "),s("li",[s("p",[s("code",[a._v("mRootNode = RenderNode.adopt(rootNodePtr)")]),a._v(": 这行代码将根渲染节点指针(rootNodePtr)包装成一个 RenderNode 对象, 并将其赋值给 mRootNode 变量。这个 mRootNode 对象表示应用程序界面的根渲染节点。")])]),a._v(" "),s("li",[s("p",[s("code",[a._v("mRootNode.setClipToBounds(false)")]),a._v(": 这行代码设置根渲染节点的 clipToBounds 属性为 false, 这意味着根渲染节点不会对其内容进行裁剪, 允许内容在渲染中超出根渲染节点的边界。")])]),a._v(" "),s("li",[s("p",[s("code",[a._v("mIsOpaque = !translucent")]),a._v(": 这行代码根据 translucent 变量的值来确定应用程序界面是否是不透明的。如果 translucent 为 true, 则界面是透明的, 因此 mIsOpaque 被设置为 false, 表示不透明。如果 translucent 为 false, 则界面是不透明的, 因此 mIsOpaque 被设置为 true, 表示不透明。")])]),a._v(" "),s("li",[s("p",[s("code",[a._v("mNativeProxy = nCreateProxy(translucent, rootNodePtr)")]),a._v(": 这行代码用于创建渲染代理, 并将其指针存储在 mNativeProxy 变量中。渲染代理负责协调渲染操作, 将渲染请求传递给根渲染节点以及与硬件加速相关的操作。")])])]),a._v(" "),s("p",[a._v("综合起来, 这段代码执行了创建和初始化渲染系统的根渲染节点和渲染代理的操作, 以便开始渲染应用程序界面。这些操作在 Android 渲染流程中非常重要, 因为它们确定了如何绘制应用程序的用户界面。")])],1)}),[],!1,null,null,null);s.default=e.exports}}]);
\ No newline at end of file
diff --git a/assets/js/174.374b8ab4.js b/assets/js/174.374b8ab4.js
new file mode 100644
index 0000000000..2cc491f76d
--- /dev/null
+++ b/assets/js/174.374b8ab4.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[174],{490:function(s,t,a){"use strict";a.r(t);var n=a(4),e=Object(n.a)({},(function(){var s=this,t=s._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":s.$parent.slotKey}},[t("div",{staticClass:"language-java line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-java"}},[t("code",[t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 会删减")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token boolean"}},[s._v("false")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("AsyncPLog")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("i")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("TAG")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"this is a test[1] on release on releasePlayControl"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n"),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 不会优化")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token boolean"}},[s._v("true")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("AsyncPLog")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("i")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("TAG")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"this is a test[2] on release on releasePlayControl"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n"),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 会删减")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("AbUtil")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("debuggleable")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("AsyncPLog")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("i")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("TAG")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"this is a test[3] on release on releasePlayControl"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n"),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 不会优化")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("AbUtil")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("debuggleable2")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("AsyncPLog")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("i")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("TAG")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"this is a test[4] on release on releasePlayControl"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n"),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 会删减")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("AbUtil")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("isDebuggable"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("AsyncPLog")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("i")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("TAG")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"this is a test[5] on release on releasePlayControl"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br"),t("span",{staticClass:"line-number"},[s._v("5")]),t("br"),t("span",{staticClass:"line-number"},[s._v("6")]),t("br"),t("span",{staticClass:"line-number"},[s._v("7")]),t("br"),t("span",{staticClass:"line-number"},[s._v("8")]),t("br"),t("span",{staticClass:"line-number"},[s._v("9")]),t("br"),t("span",{staticClass:"line-number"},[s._v("10")]),t("br"),t("span",{staticClass:"line-number"},[s._v("11")]),t("br"),t("span",{staticClass:"line-number"},[s._v("12")]),t("br"),t("span",{staticClass:"line-number"},[s._v("13")]),t("br"),t("span",{staticClass:"line-number"},[s._v("14")]),t("br"),t("span",{staticClass:"line-number"},[s._v("15")]),t("br"),t("span",{staticClass:"line-number"},[s._v("16")]),t("br"),t("span",{staticClass:"line-number"},[s._v("17")]),t("br"),t("span",{staticClass:"line-number"},[s._v("18")]),t("br"),t("span",{staticClass:"line-number"},[s._v("19")]),t("br"),t("span",{staticClass:"line-number"},[s._v("20")]),t("br"),t("span",{staticClass:"line-number"},[s._v("21")]),t("br"),t("span",{staticClass:"line-number"},[s._v("22")]),t("br"),t("span",{staticClass:"line-number"},[s._v("23")]),t("br"),t("span",{staticClass:"line-number"},[s._v("24")]),t("br"),t("span",{staticClass:"line-number"},[s._v("25")]),t("br")])]),t("p",[s._v("上述其中 AbUtil 的几个方法定义如下:")]),s._v(" "),t("div",{staticClass:"language-java line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-java"}},[t("code",[t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("public")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("static")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("boolean")]),s._v(" isDebuggable "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token boolean"}},[s._v("false")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// isDebuggable2 未采用 final 进行修饰")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("static")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("boolean")]),s._v(" isDebuggable2 "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token boolean"}},[s._v("false")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n\n"),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("public")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("static")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("boolean")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("debuggleable")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("return")]),s._v(" isDebuggable"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n"),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("public")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("static")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("boolean")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("debuggleable2")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("return")]),s._v(" isDebuggable2"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br"),t("span",{staticClass:"line-number"},[s._v("5")]),t("br"),t("span",{staticClass:"line-number"},[s._v("6")]),t("br"),t("span",{staticClass:"line-number"},[s._v("7")]),t("br"),t("span",{staticClass:"line-number"},[s._v("8")]),t("br"),t("span",{staticClass:"line-number"},[s._v("9")]),t("br"),t("span",{staticClass:"line-number"},[s._v("10")]),t("br"),t("span",{staticClass:"line-number"},[s._v("11")]),t("br")])]),t("p",[s._v("在编译阶段, final 类型内敛,确认不会执行的代码 scope, 会被删除")]),s._v(" "),t("h2",{attrs:{id:"smali-分析"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#smali-分析"}},[s._v("#")]),s._v(" smali 分析")]),s._v(" "),t("p",[s._v("将打包的 release 包采用 apktool 反解成 smali, "),t("code",[s._v("apktool d -r xxx.apk")]),s._v(". 搜索查看相关字符串。 发现指有在明确 "),t("code",[s._v("if(false)")]),s._v(" 中的 scope 代码会主动去处, 其他所有 case 都不会去除")]),s._v(" "),t("h2",{attrs:{id:"思考"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#思考"}},[s._v("#")]),s._v(" 思考")]),s._v(" "),t("p",[s._v("其他在运行时可以确定不需要的如:")]),s._v(" "),t("ul",[t("li",[s._v("logger.d level 的日志")])])])}),[],!1,null,null,null);t.default=e.exports}}]);
\ No newline at end of file
diff --git a/assets/js/175.096a945e.js b/assets/js/175.096a945e.js
new file mode 100644
index 0000000000..128556b649
--- /dev/null
+++ b/assets/js/175.096a945e.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[175],{491:function(t,e,a){"use strict";a.r(e);var s=a(4),r=Object(s.a)({},(function(){var t=this,e=t._self._c;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h2",{attrs:{id:"proguard-构建产物说明"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#proguard-构建产物说明"}},[t._v("#")]),t._v(" proguard 构建产物说明")]),t._v(" "),e("h3",{attrs:{id:"mapping-txt"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#mapping-txt"}},[t._v("#")]),t._v(" mapping.txt")]),t._v(" "),e("p",[t._v("Obfuscation Options,"),e("code",[t._v("-printmapping [filename]")])]),t._v(" "),e("p",[t._v("Specifies to print the mapping from old names to new names for classes and class members that have been renamed. The mapping is printed to the standard output or to the given file. For example, it is required for subsequent incremental obfuscation, or if you ever want to make sense again of obfuscated stack traces. Only applicable when obfuscating.")]),t._v(" "),e("h3",{attrs:{id:"configuration-txt"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#configuration-txt"}},[t._v("#")]),t._v(" configuration.txt")]),t._v(" "),e("p",[t._v("General Options: "),e("code",[t._v("-printconfiguration [filename]")])]),t._v(" "),e("p",[t._v("Specifies to write out the entire configuration that has been parsed, with included files and replaced variables. The structure is printed to the standard output or to the given file. This can sometimes be useful to debug configurations, or to convert XML configurations into a more readable format.")]),t._v(" "),e("h3",{attrs:{id:"seeds-txt"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#seeds-txt"}},[t._v("#")]),t._v(" seeds.txt")]),t._v(" "),e("p",[t._v("Keep Options, 可以通过 "),e("code",[t._v("-printseeds [filename]")]),t._v(" 指定输出位置")]),t._v(" "),e("p",[t._v("Specifies to exhaustively list classes and class members matched by the various "),e("code",[t._v("-keep")]),t._v(" options. The list is printed to the standard output or to the given file. The list can be useful to verify if the intended class members are really found, especially if you're using wildcards. For example, you may want to list all the applications or all the applets that you are keeping.")]),t._v(" "),e("h3",{attrs:{id:"usages-txt"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#usages-txt"}},[t._v("#")]),t._v(" usages.txt")]),t._v(" "),e("p",[t._v("可以通过 "),e("code",[t._v("-printusages [filename]")]),t._v(" 指定输出位置")]),t._v(" "),e("p",[t._v("Specifies to list "),e("strong",[t._v("dead code")]),t._v(" of the input class files. The list is printed to the standard output or to the given file. For example, you can list the unused code of an application. Only applicable when shrinking.")]),t._v(" "),e("h2",{attrs:{id:"link"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#link"}},[t._v("#")]),t._v(" link")]),t._v(" "),e("ul",[e("li",[e("a",{attrs:{href:"https://www.guardsquare.com/manual/configuration/usage",target:"_blank",rel:"noopener noreferrer"}},[t._v("progurad-usage"),e("OutboundLink")],1),t._v(" "),e("ul",[e("li",[e("a",{attrs:{href:"https://www.guardsquare.com/manual/tools/playground",target:"_blank",rel:"noopener noreferrer"}},[t._v("https://www.guardsquare.com/manual/tools/playground"),e("OutboundLink")],1)])])])])])}),[],!1,null,null,null);e.default=r.exports}}]);
\ No newline at end of file
diff --git a/assets/js/176.284db50d.js b/assets/js/176.284db50d.js
new file mode 100644
index 0000000000..698662f04c
--- /dev/null
+++ b/assets/js/176.284db50d.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[176],{492:function(t,e,r){"use strict";r.r(e);var a=r(4),i=Object(a.a)({},(function(){var t=this,e=t._self._c;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h2",{attrs:{id:"shrink-code-code-optimize"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#shrink-code-code-optimize"}},[t._v("#")]),t._v(" Shrink code / code optimize")]),t._v(" "),e("h3",{attrs:{id:"两者在r8流程中位置"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#两者在r8流程中位置"}},[t._v("#")]),t._v(" 两者在R8流程中位置")]),t._v(" "),e("p",[e("img",{attrs:{src:"https://cdn.jsdelivr.net/gh/jacky1234/picArchieve@master/uPic/20240910_111900_ER3Goc.png",alt:""}})]),t._v(" "),e("h3",{attrs:{id:"共同点"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#共同点"}},[t._v("#")]),t._v(" 共同点")]),t._v(" "),e("p",[t._v("两者都是在编译期间的优化动作,即在静态情况下,能够确认的一些场景,R8就会帮忙直接给优化掉。")]),t._v(" "),e("h3",{attrs:{id:"区别点"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#区别点"}},[t._v("#")]),t._v(" 区别点")]),t._v(" "),e("ul",[e("li",[t._v('shrink可以认为是类、方法、变脸级别的删除。着重注意关键词"删除"\n'),e("ul",[e("li",[t._v("他是在minifyEnabled=true后,就会被默认打开的。")]),t._v(" "),e("li",[t._v("在编译阶段agp会根据程序入口(MainActivity)或者keep的类,会画出一个方法调用栈的图,如果一个类、类成员变量、方法完全不在这个调用图上,那么他们将会被删除掉。")])])]),t._v(" "),e("li",[t._v('optimize主要是指对code重写,他是深入方法内部的一种重新。着重注意关键词"重写"\n'),e("ul",[e("li",[t._v("他是必须是单独配置才能打开的。")]),t._v(" "),e("li",[t._v("举例某个else一定不会进入,就会被删掉;如果一个方法只有在某几个地方调用使用,便会被内联到对方类中。")]),t._v(" "),e("li",[t._v("某些方法太简单,比如只是简单做一个if判断后,就执行一个赋值、打印等,那这个动作会直接被内联到调用方。")])])])]),t._v(" "),e("h2",{attrs:{id:"link"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#link"}},[t._v("#")]),t._v(" link")]),t._v(" "),e("ul",[e("li",[e("a",{attrs:{href:"https://developer.android.com/build/shrink-code#optimization",target:"_blank",rel:"noopener noreferrer"}},[t._v("Code optimization"),e("OutboundLink")],1)]),t._v(" "),e("li",[e("a",{attrs:{href:"https://jakewharton.com/blog/",target:"_blank",rel:"noopener noreferrer"}},[t._v("Jake Wharton的个人博客"),e("OutboundLink")],1),t._v(" 深入字节码理解每项优化的实际原理")])])])}),[],!1,null,null,null);e.default=i.exports}}]);
\ No newline at end of file
diff --git a/assets/js/177.6e9e60bf.js b/assets/js/177.6e9e60bf.js
new file mode 100644
index 0000000000..179449c0df
--- /dev/null
+++ b/assets/js/177.6e9e60bf.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[177],{493:function(t,r,e){"use strict";e.r(r);var n=e(4),a=Object(n.a)({},(function(){var t=this,r=t._self._c;return r("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[r("h2",{attrs:{id:"链接"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#链接"}},[t._v("#")]),t._v(" 链接")]),t._v(" "),r("ul",[r("li",[r("a",{attrs:{href:"https://github.com/Tencent/matrix",target:"_blank",rel:"noopener noreferrer"}},[t._v("matrix"),r("OutboundLink")],1)]),t._v(" "),r("li",[r("a",{attrs:{href:"https://github.com/Tencent/matrix/wiki",target:"_blank",rel:"noopener noreferrer"}},[t._v("wiki"),r("OutboundLink")],1)]),t._v(" "),r("li",[t._v("其他\n"),r("ul",[r("li",[r("a",{attrs:{href:"https://developer.aliyun.com/article/1129193",target:"_blank",rel:"noopener noreferrer"}},[t._v("Matrix 原理分析系列之开篇"),r("OutboundLink")],1)])])])])])}),[],!1,null,null,null);r.default=a.exports}}]);
\ No newline at end of file
diff --git a/assets/js/178.48bedc23.js b/assets/js/178.48bedc23.js
new file mode 100644
index 0000000000..6bb66387eb
--- /dev/null
+++ b/assets/js/178.48bedc23.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[178],{494:function(s,t,a){"use strict";a.r(t);var n=a(4),e=Object(n.a)({},(function(){var s=this,t=s._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":s.$parent.slotKey}},[t("blockquote",[t("p",[t("a",{attrs:{href:"https://square.github.io/leakcanary/",target:"_blank",rel:"noopener noreferrer"}},[s._v("leakcanary"),t("OutboundLink")],1),s._v(" is a memory leak detection library for Android. 最新的 leakcanary 已经更新到 3.0 版本了, 有时间可以拜读一下源码")])]),s._v(" "),t("h2",{attrs:{id:"how-leakcanary-works"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#how-leakcanary-works"}},[s._v("#")]),s._v(" How LeakCanary works")]),s._v(" "),t("blockquote",[t("p",[t("a",{attrs:{href:"https://square.github.io/leakcanary/fundamentals-how-leakcanary-works/",target:"_blank",rel:"noopener noreferrer"}},[s._v("https://square.github.io/leakcanary/fundamentals-how-leakcanary-works/"),t("OutboundLink")],1)])]),s._v(" "),t("ol",[t("li",[t("p",[s._v("Detecting retained objects")])]),s._v(" "),t("li",[t("p",[s._v("Dumping the heap")])]),s._v(" "),t("li",[t("p",[s._v("Analyzing the heap")]),s._v(" "),t("p",[s._v("LeakCanary parses the "),t("code",[s._v(".hprof")]),s._v(" file using "),t("a",{attrs:{href:"https://square.github.io/leakcanary/shark/",target:"_blank",rel:"noopener noreferrer"}},[s._v("Shark"),t("OutboundLink")],1),s._v(" and locates the retained objects in that heap dump.")])]),s._v(" "),t("li",[t("p",[s._v("Categorizing leaks")])])]),s._v(" "),t("h2",{attrs:{id:"haha-shark"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#haha-shark"}},[s._v("#")]),s._v(" HAHA/Shark")]),s._v(" "),t("p",[s._v("Absolutely! And it did. But then, we wrote more code. LeakCanary used to depend on "),t("a",{attrs:{href:"https://github.com/square/haha",target:"_blank",rel:"noopener noreferrer"}},[s._v("HAHA"),t("OutboundLink")],1),s._v(", a repackaging of perflib, the heap dump parser used by Android Studio. Unfortunately perflib was slow and used too much memory, so LeakCanary now includes its own heap dump parser: Shark. The extra code comes from "),t("a",{attrs:{href:"https://square.github.io/leakcanary/shark/",target:"_blank",rel:"noopener noreferrer"}},[s._v("Shark"),t("OutboundLink")],1),s._v(", but also from having a lot more automated tests, and an improved UI layer.")]),s._v(" "),t("h2",{attrs:{id:"code"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#code"}},[s._v("#")]),s._v(" code")]),s._v(" "),t("h3",{attrs:{id:"refwatcher"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#refwatcher"}},[s._v("#")]),s._v(" RefWatcher")]),s._v(" "),t("blockquote",[t("p",[t("a",{attrs:{href:"https://github.com/square/leakcanary/blob/v1.5.2/leakcanary-watcher/src/main/java/com/squareup/leakcanary/RefWatcher.java",target:"_blank",rel:"noopener noreferrer"}},[s._v("RefWatcher-1.5.2"),t("OutboundLink")],1)])]),s._v(" "),t("div",{staticClass:"language-java line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-java"}},[t("code",[t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 1.5.2版本的 RefWatcher 实现")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("public")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("class")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("RefWatcher")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("public")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("static")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("RefWatcher")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("DISABLED")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("new")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("RefWatcherBuilder")]),t("span",{pre:!0,attrs:{class:"token generics"}},[t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("<")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(">")])]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("build")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("WatchExecutor")]),s._v(" watchExecutor"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("DebuggerControl")]),s._v(" debuggerControl"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("GcTrigger")]),s._v(" gcTrigger"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("HeapDumper")]),s._v(" heapDumper"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Set")]),t("span",{pre:!0,attrs:{class:"token generics"}},[t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("<")]),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("String")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(">")])]),s._v(" retainedKeys"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("ReferenceQueue")]),t("span",{pre:!0,attrs:{class:"token generics"}},[t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("<")]),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Object")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(">")])]),s._v(" queue"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("HeapDump"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("Listener")]),s._v(" heapdumpListener"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("ExcludedRefs")]),s._v(" excludedRefs"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("RefWatcher")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("WatchExecutor")]),s._v(" watchExecutor"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("DebuggerControl")]),s._v(" debuggerControl"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("GcTrigger")]),s._v(" gcTrigger"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("HeapDumper")]),s._v(" heapDumper"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("HeapDump"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("Listener")]),s._v(" heapdumpListener"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("ExcludedRefs")]),s._v(" excludedRefs"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("watchExecutor "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("checkNotNull")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("watchExecutor"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"watchExecutor"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("debuggerControl "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("checkNotNull")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("debuggerControl"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"debuggerControl"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("gcTrigger "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("checkNotNull")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("gcTrigger"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"gcTrigger"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("heapDumper "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("checkNotNull")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("heapDumper"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"heapDumper"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("heapdumpListener "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("checkNotNull")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("heapdumpListener"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"heapdumpListener"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("excludedRefs "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("checkNotNull")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("excludedRefs"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"excludedRefs"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n retainedKeys "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("new")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("CopyOnWriteArraySet")]),t("span",{pre:!0,attrs:{class:"token generics"}},[t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("<")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(">")])]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n queue "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("new")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("ReferenceQueue")]),t("span",{pre:!0,attrs:{class:"token generics"}},[t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("<")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(">")])]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("/**\n * Identical to {@link #watch(Object, String)} with an empty string reference name.\n *\n * @see #watch(Object, String)\n */")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("public")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("void")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("watch")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Object")]),s._v(" watchedReference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("watch")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("watchedReference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('""')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("/**\n * Watches the provided references and checks if it can be GCed. This method is non blocking,\n * the check is done on the {@link WatchExecutor} this {@link RefWatcher} has been constructed\n * with.\n *\n * @param referenceName An logical identifier for the watched object.\n */")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("public")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("void")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("watch")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Object")]),s._v(" watchedReference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("String")]),s._v(" referenceName"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("==")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("DISABLED")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("return")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("checkNotNull")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("watchedReference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"watchedReference"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("checkNotNull")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("referenceName"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"referenceName"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("long")]),s._v(" watchStartNanoTime "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("System")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("nanoTime")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("String")]),s._v(" key "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("UUID")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("randomUUID")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("toString")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n retainedKeys"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("add")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("key"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("KeyedWeakReference")]),s._v(" reference "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("new")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("KeyedWeakReference")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("watchedReference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" key"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" referenceName"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" queue"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("ensureGoneAsync")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("watchStartNanoTime"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" reference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("void")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("ensureGoneAsync")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("long")]),s._v(" watchStartNanoTime"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("KeyedWeakReference")]),s._v(" reference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n watchExecutor"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("execute")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("new")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Retryable")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token annotation punctuation"}},[s._v("@Override")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("public")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Retryable"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("Result")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("run")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("return")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("ensureGone")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("reference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" watchStartNanoTime"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token annotation punctuation"}},[s._v("@SuppressWarnings")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"ReferenceEquality"')]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// Explicitly checking for named null.")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Retryable"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("Result")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("ensureGone")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("KeyedWeakReference")]),s._v(" reference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("long")]),s._v(" watchStartNanoTime"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("long")]),s._v(" gcStartNanoTime "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("System")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("nanoTime")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("long")]),s._v(" watchDurationMs "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("NANOSECONDS")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("toMillis")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("gcStartNanoTime "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("-")]),s._v(" watchStartNanoTime"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("removeWeaklyReachableReferences")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("debuggerControl"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("isDebuggerAttached")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// The debugger can create false leaks.")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("return")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("RETRY")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("gone")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("reference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("return")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("DONE")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n gcTrigger"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("runGc")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("removeWeaklyReachableReferences")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("!")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("gone")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("reference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("long")]),s._v(" startDumpHeap "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("System")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("nanoTime")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("long")]),s._v(" gcDurationMs "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("NANOSECONDS")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("toMillis")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("startDumpHeap "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("-")]),s._v(" gcStartNanoTime"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("File")]),s._v(" heapDumpFile "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" heapDumper"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("dumpHeap")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("heapDumpFile "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("==")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("RETRY_LATER")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// Could not dump the heap.")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("return")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("RETRY")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("long")]),s._v(" heapDumpDurationMs "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("NANOSECONDS")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("toMillis")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("System")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("nanoTime")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("-")]),s._v(" startDumpHeap"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n heapdumpListener"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("analyze")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("new")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("HeapDump")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("heapDumpFile"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" reference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("key"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" reference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("name"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" excludedRefs"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" watchDurationMs"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v("\n gcDurationMs"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" heapDumpDurationMs"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("return")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token constant"}},[s._v("DONE")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("boolean")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("gone")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("KeyedWeakReference")]),s._v(" reference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("return")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("!")]),s._v("retainedKeys"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("contains")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("reference"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("key"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("void")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("removeWeaklyReachableReferences")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// WeakReferences are enqueued as soon as the object to which they point to becomes weakly")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// reachable. This is before finalization or garbage collection has actually happened.")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("KeyedWeakReference")]),s._v(" ref"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("while")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("ref "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("KeyedWeakReference")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" queue"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("poll")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("!=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("null")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n retainedKeys"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("remove")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("ref"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("key"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br"),t("span",{staticClass:"line-number"},[s._v("5")]),t("br"),t("span",{staticClass:"line-number"},[s._v("6")]),t("br"),t("span",{staticClass:"line-number"},[s._v("7")]),t("br"),t("span",{staticClass:"line-number"},[s._v("8")]),t("br"),t("span",{staticClass:"line-number"},[s._v("9")]),t("br"),t("span",{staticClass:"line-number"},[s._v("10")]),t("br"),t("span",{staticClass:"line-number"},[s._v("11")]),t("br"),t("span",{staticClass:"line-number"},[s._v("12")]),t("br"),t("span",{staticClass:"line-number"},[s._v("13")]),t("br"),t("span",{staticClass:"line-number"},[s._v("14")]),t("br"),t("span",{staticClass:"line-number"},[s._v("15")]),t("br"),t("span",{staticClass:"line-number"},[s._v("16")]),t("br"),t("span",{staticClass:"line-number"},[s._v("17")]),t("br"),t("span",{staticClass:"line-number"},[s._v("18")]),t("br"),t("span",{staticClass:"line-number"},[s._v("19")]),t("br"),t("span",{staticClass:"line-number"},[s._v("20")]),t("br"),t("span",{staticClass:"line-number"},[s._v("21")]),t("br"),t("span",{staticClass:"line-number"},[s._v("22")]),t("br"),t("span",{staticClass:"line-number"},[s._v("23")]),t("br"),t("span",{staticClass:"line-number"},[s._v("24")]),t("br"),t("span",{staticClass:"line-number"},[s._v("25")]),t("br"),t("span",{staticClass:"line-number"},[s._v("26")]),t("br"),t("span",{staticClass:"line-number"},[s._v("27")]),t("br"),t("span",{staticClass:"line-number"},[s._v("28")]),t("br"),t("span",{staticClass:"line-number"},[s._v("29")]),t("br"),t("span",{staticClass:"line-number"},[s._v("30")]),t("br"),t("span",{staticClass:"line-number"},[s._v("31")]),t("br"),t("span",{staticClass:"line-number"},[s._v("32")]),t("br"),t("span",{staticClass:"line-number"},[s._v("33")]),t("br"),t("span",{staticClass:"line-number"},[s._v("34")]),t("br"),t("span",{staticClass:"line-number"},[s._v("35")]),t("br"),t("span",{staticClass:"line-number"},[s._v("36")]),t("br"),t("span",{staticClass:"line-number"},[s._v("37")]),t("br"),t("span",{staticClass:"line-number"},[s._v("38")]),t("br"),t("span",{staticClass:"line-number"},[s._v("39")]),t("br"),t("span",{staticClass:"line-number"},[s._v("40")]),t("br"),t("span",{staticClass:"line-number"},[s._v("41")]),t("br"),t("span",{staticClass:"line-number"},[s._v("42")]),t("br"),t("span",{staticClass:"line-number"},[s._v("43")]),t("br"),t("span",{staticClass:"line-number"},[s._v("44")]),t("br"),t("span",{staticClass:"line-number"},[s._v("45")]),t("br"),t("span",{staticClass:"line-number"},[s._v("46")]),t("br"),t("span",{staticClass:"line-number"},[s._v("47")]),t("br"),t("span",{staticClass:"line-number"},[s._v("48")]),t("br"),t("span",{staticClass:"line-number"},[s._v("49")]),t("br"),t("span",{staticClass:"line-number"},[s._v("50")]),t("br"),t("span",{staticClass:"line-number"},[s._v("51")]),t("br"),t("span",{staticClass:"line-number"},[s._v("52")]),t("br"),t("span",{staticClass:"line-number"},[s._v("53")]),t("br"),t("span",{staticClass:"line-number"},[s._v("54")]),t("br"),t("span",{staticClass:"line-number"},[s._v("55")]),t("br"),t("span",{staticClass:"line-number"},[s._v("56")]),t("br"),t("span",{staticClass:"line-number"},[s._v("57")]),t("br"),t("span",{staticClass:"line-number"},[s._v("58")]),t("br"),t("span",{staticClass:"line-number"},[s._v("59")]),t("br"),t("span",{staticClass:"line-number"},[s._v("60")]),t("br"),t("span",{staticClass:"line-number"},[s._v("61")]),t("br"),t("span",{staticClass:"line-number"},[s._v("62")]),t("br"),t("span",{staticClass:"line-number"},[s._v("63")]),t("br"),t("span",{staticClass:"line-number"},[s._v("64")]),t("br"),t("span",{staticClass:"line-number"},[s._v("65")]),t("br"),t("span",{staticClass:"line-number"},[s._v("66")]),t("br"),t("span",{staticClass:"line-number"},[s._v("67")]),t("br"),t("span",{staticClass:"line-number"},[s._v("68")]),t("br"),t("span",{staticClass:"line-number"},[s._v("69")]),t("br"),t("span",{staticClass:"line-number"},[s._v("70")]),t("br"),t("span",{staticClass:"line-number"},[s._v("71")]),t("br"),t("span",{staticClass:"line-number"},[s._v("72")]),t("br"),t("span",{staticClass:"line-number"},[s._v("73")]),t("br"),t("span",{staticClass:"line-number"},[s._v("74")]),t("br"),t("span",{staticClass:"line-number"},[s._v("75")]),t("br"),t("span",{staticClass:"line-number"},[s._v("76")]),t("br"),t("span",{staticClass:"line-number"},[s._v("77")]),t("br"),t("span",{staticClass:"line-number"},[s._v("78")]),t("br"),t("span",{staticClass:"line-number"},[s._v("79")]),t("br"),t("span",{staticClass:"line-number"},[s._v("80")]),t("br"),t("span",{staticClass:"line-number"},[s._v("81")]),t("br"),t("span",{staticClass:"line-number"},[s._v("82")]),t("br"),t("span",{staticClass:"line-number"},[s._v("83")]),t("br"),t("span",{staticClass:"line-number"},[s._v("84")]),t("br"),t("span",{staticClass:"line-number"},[s._v("85")]),t("br"),t("span",{staticClass:"line-number"},[s._v("86")]),t("br"),t("span",{staticClass:"line-number"},[s._v("87")]),t("br"),t("span",{staticClass:"line-number"},[s._v("88")]),t("br"),t("span",{staticClass:"line-number"},[s._v("89")]),t("br"),t("span",{staticClass:"line-number"},[s._v("90")]),t("br"),t("span",{staticClass:"line-number"},[s._v("91")]),t("br"),t("span",{staticClass:"line-number"},[s._v("92")]),t("br"),t("span",{staticClass:"line-number"},[s._v("93")]),t("br"),t("span",{staticClass:"line-number"},[s._v("94")]),t("br"),t("span",{staticClass:"line-number"},[s._v("95")]),t("br"),t("span",{staticClass:"line-number"},[s._v("96")]),t("br"),t("span",{staticClass:"line-number"},[s._v("97")]),t("br"),t("span",{staticClass:"line-number"},[s._v("98")]),t("br"),t("span",{staticClass:"line-number"},[s._v("99")]),t("br"),t("span",{staticClass:"line-number"},[s._v("100")]),t("br"),t("span",{staticClass:"line-number"},[s._v("101")]),t("br"),t("span",{staticClass:"line-number"},[s._v("102")]),t("br"),t("span",{staticClass:"line-number"},[s._v("103")]),t("br"),t("span",{staticClass:"line-number"},[s._v("104")]),t("br"),t("span",{staticClass:"line-number"},[s._v("105")]),t("br"),t("span",{staticClass:"line-number"},[s._v("106")]),t("br"),t("span",{staticClass:"line-number"},[s._v("107")]),t("br"),t("span",{staticClass:"line-number"},[s._v("108")]),t("br"),t("span",{staticClass:"line-number"},[s._v("109")]),t("br"),t("span",{staticClass:"line-number"},[s._v("110")]),t("br"),t("span",{staticClass:"line-number"},[s._v("111")]),t("br")])]),t("h2",{attrs:{id:"link"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#link"}},[s._v("#")]),s._v(" link")]),s._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://allenwu.itscoder.com/leakcanary-source",target:"_blank",rel:"noopener noreferrer"}},[s._v("深入理解 Android 之 LeakCanary 源码解析"),t("OutboundLink")],1)])])])}),[],!1,null,null,null);t.default=e.exports}}]);
\ No newline at end of file
diff --git a/assets/js/179.c2841c5f.js b/assets/js/179.c2841c5f.js
new file mode 100644
index 0000000000..16a9f7d371
--- /dev/null
+++ b/assets/js/179.c2841c5f.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[179],{495:function(t,s,n){"use strict";n.r(s);var r=n(4),e=Object(r.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("h2",{attrs:{id:"link"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#link"}},[this._v("#")]),this._v(" link")]),this._v(" "),t("p",[this._v("\t1. "),t("a",{attrs:{href:"https://github.com/ad-ppp/OkHttpStudy",target:"_blank",rel:"noopener noreferrer"}},[this._v("OkHttpStudyDemo"),t("OutboundLink")],1)])])}),[],!1,null,null,null);s.default=e.exports}}]);
\ No newline at end of file
diff --git a/assets/js/18.a934f28e.js b/assets/js/18.a934f28e.js
new file mode 100644
index 0000000000..c268bdc2a7
--- /dev/null
+++ b/assets/js/18.a934f28e.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[18],{337:function(t,n,s){"use strict";s.r(n);var e=s(4),o=Object(e.a)({},(function(){return(0,this._self._c)("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}})}),[],!1,null,null,null);n.default=o.exports}}]);
\ No newline at end of file
diff --git a/assets/js/180.832ec21f.js b/assets/js/180.832ec21f.js
new file mode 100644
index 0000000000..f62bf2b3d9
--- /dev/null
+++ b/assets/js/180.832ec21f.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[180],{496:function(t,e,r){"use strict";r.r(e);var o=r(4),s=Object(o.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("h2",{attrs:{id:"链接"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#链接"}},[this._v("#")]),this._v(" 链接")]),this._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/google/j2objc",target:"_blank",rel:"noopener noreferrer"}},[this._v("j2objc"),t("OutboundLink")],1),this._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://developers.google.com/j2objc",target:"_blank",rel:"noopener noreferrer"}},[this._v("wiki"),t("OutboundLink")],1)])])])])])}),[],!1,null,null,null);e.default=s.exports}}]);
\ No newline at end of file
diff --git a/assets/js/181.edf08aa8.js b/assets/js/181.edf08aa8.js
new file mode 100644
index 0000000000..14c2dab801
--- /dev/null
+++ b/assets/js/181.edf08aa8.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[181],{497:function(s,t,a){"use strict";a.r(t);var n=a(4),e=Object(n.a)({},(function(){var s=this,t=s._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":s.$parent.slotKey}},[t("h2",{attrs:{id:"handlemessage"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#handlemessage"}},[s._v("#")]),s._v(" handleMessage")]),s._v(" "),t("p",[s._v("HandlerPoster")]),s._v(" "),t("p",[t("img",{attrs:{src:"https://cdn.jsdelivr.net/gh/jacky1234/picArchieve@master/uPic/20230806_163943_AIZ6ic.png",alt:"handleMessage"}})]),s._v(" "),t("div",{staticClass:"language-java line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-java"}},[t("code",[t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("public")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("boolean")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("handleMessage")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Message")]),s._v(" msg"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n\t"),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("boolean")]),s._v(" rescheduled "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token boolean"}},[s._v("false")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// todo")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br")])]),t("p",[s._v("上述 queue 的定义如下")]),s._v(" "),t("h2",{attrs:{id:"pendingpostqueue"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#pendingpostqueue"}},[s._v("#")]),s._v(" PendingPostQueue")]),s._v(" "),t("div",{staticClass:"language-java line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-java"}},[t("code",[t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("final")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("class")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("PendingPostQueue")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token annotation punctuation"}},[s._v("@Nullable")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("PendingPost")]),s._v(" head"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token annotation punctuation"}},[s._v("@Nullable")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("private")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("PendingPost")]),s._v(" tail"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("PendingPostQueue")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("synchronized")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("void")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("enqueue")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("PendingPost")]),s._v(" pendingPost"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("pendingPost "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("==")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("null")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("else")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("tail "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("!=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("null")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("tail"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("next "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" pendingPost"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("tail "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" pendingPost"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("else")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("head "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("!=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("null")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("return")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("head "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("tail "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" pendingPost"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("notifyAll")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("synchronized")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("PendingPost")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("poll")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("PendingPost")]),s._v(" pendingPost "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("head"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("head "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("!=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("null")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("head "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("head"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("next"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("head "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("==")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("null")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("tail "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("null")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("return")]),s._v(" pendingPost"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("synchronized")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("PendingPost")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("poll")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("int")]),s._v(" maxMillisToWait"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("throws")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("InterruptedException")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),s._v("head "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("==")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("null")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("wait")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("long")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v("maxMillisToWait"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n\n "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("return")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("this")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("poll")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br"),t("span",{staticClass:"line-number"},[s._v("5")]),t("br"),t("span",{staticClass:"line-number"},[s._v("6")]),t("br"),t("span",{staticClass:"line-number"},[s._v("7")]),t("br"),t("span",{staticClass:"line-number"},[s._v("8")]),t("br"),t("span",{staticClass:"line-number"},[s._v("9")]),t("br"),t("span",{staticClass:"line-number"},[s._v("10")]),t("br"),t("span",{staticClass:"line-number"},[s._v("11")]),t("br"),t("span",{staticClass:"line-number"},[s._v("12")]),t("br"),t("span",{staticClass:"line-number"},[s._v("13")]),t("br"),t("span",{staticClass:"line-number"},[s._v("14")]),t("br"),t("span",{staticClass:"line-number"},[s._v("15")]),t("br"),t("span",{staticClass:"line-number"},[s._v("16")]),t("br"),t("span",{staticClass:"line-number"},[s._v("17")]),t("br"),t("span",{staticClass:"line-number"},[s._v("18")]),t("br"),t("span",{staticClass:"line-number"},[s._v("19")]),t("br"),t("span",{staticClass:"line-number"},[s._v("20")]),t("br"),t("span",{staticClass:"line-number"},[s._v("21")]),t("br"),t("span",{staticClass:"line-number"},[s._v("22")]),t("br"),t("span",{staticClass:"line-number"},[s._v("23")]),t("br"),t("span",{staticClass:"line-number"},[s._v("24")]),t("br"),t("span",{staticClass:"line-number"},[s._v("25")]),t("br"),t("span",{staticClass:"line-number"},[s._v("26")]),t("br"),t("span",{staticClass:"line-number"},[s._v("27")]),t("br"),t("span",{staticClass:"line-number"},[s._v("28")]),t("br"),t("span",{staticClass:"line-number"},[s._v("29")]),t("br"),t("span",{staticClass:"line-number"},[s._v("30")]),t("br"),t("span",{staticClass:"line-number"},[s._v("31")]),t("br"),t("span",{staticClass:"line-number"},[s._v("32")]),t("br"),t("span",{staticClass:"line-number"},[s._v("33")]),t("br"),t("span",{staticClass:"line-number"},[s._v("34")]),t("br"),t("span",{staticClass:"line-number"},[s._v("35")]),t("br"),t("span",{staticClass:"line-number"},[s._v("36")]),t("br"),t("span",{staticClass:"line-number"},[s._v("37")]),t("br"),t("span",{staticClass:"line-number"},[s._v("38")]),t("br"),t("span",{staticClass:"line-number"},[s._v("39")]),t("br"),t("span",{staticClass:"line-number"},[s._v("40")]),t("br"),t("span",{staticClass:"line-number"},[s._v("41")]),t("br"),t("span",{staticClass:"line-number"},[s._v("42")]),t("br"),t("span",{staticClass:"line-number"},[s._v("43")]),t("br"),t("span",{staticClass:"line-number"},[s._v("44")]),t("br"),t("span",{staticClass:"line-number"},[s._v("45")]),t("br"),t("span",{staticClass:"line-number"},[s._v("46")]),t("br"),t("span",{staticClass:"line-number"},[s._v("47")]),t("br")])])])}),[],!1,null,null,null);t.default=e.exports}}]);
\ No newline at end of file
diff --git a/assets/js/182.24f1be2e.js b/assets/js/182.24f1be2e.js
new file mode 100644
index 0000000000..6c4d6bc700
--- /dev/null
+++ b/assets/js/182.24f1be2e.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[182],{498:function(t,n,r){"use strict";r.r(n);var s=r(4),e=Object(s.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("h2",{attrs:{id:"link"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#link"}},[this._v("#")]),this._v(" link")]),this._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://juejin.cn/post/6921238915143696392",target:"_blank",rel:"noopener noreferrer"}},[this._v("Android事件分发机制三:事件分发工作流程"),t("OutboundLink")],1)])])])}),[],!1,null,null,null);n.default=e.exports}}]);
\ No newline at end of file
diff --git a/assets/js/183.52a67e98.js b/assets/js/183.52a67e98.js
new file mode 100644
index 0000000000..0d1dd2e100
--- /dev/null
+++ b/assets/js/183.52a67e98.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[183],{499:function(t,a,r){"use strict";r.r(a);var o=r(4),n=Object(o.a)({},(function(){var t=this,a=t._self._c;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("blockquote",[a("p",[t._v("因为业务原因, 我们发现竞品抖音 app 在 harmonyOS 4 上, 通过手势退到后台, 短视频的暂停速度非常快。 而一般的暂停播放方式是在 'Fragment#onPause'. 在手势上滑, 退出到当前应用到后台的场景下, 'Fragment#onPause' 会在动画结束后才会回调。 导致已经退到桌面很久了, 但是音频还没有暂停, 对用户的体验不是很好")])]),t._v(" "),a("p",[a("strong",[t._v("环境")])]),t._v(" "),a("ol",[a("li",[t._v("os: harmonyOS 4")]),t._v(" "),a("li",[t._v("抖音 version: 28.0+")])]),t._v(" "),a("h2",{attrs:{id:"调研"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#调研"}},[t._v("#")]),t._v(" 调研")]),t._v(" "),a("p",[t._v("这里总结了调研的一些思路和步骤")]),t._v(" "),a("ol",[a("li",[a("p",[t._v("harmony 4 开发文档, 了解新特性. "),a("a",{attrs:{href:"https://developer.harmonyos.com/",target:"_blank",rel:"noopener noreferrer"}},[t._v("网站"),a("OutboundLink")],1)])]),t._v(" "),a("li",[a("p",[t._v("debug 抖音 app, 见"),a("RouterLink",{attrs:{to:"/pages/2aa5cb/"}},[t._v("链接")]),t._v("。\n在 android 13 系统下,抖音退后台暂停也是通过 "),a("code",[t._v("Fragment#onPause")]),t._v(" 如下图:")],1),t._v(" "),a("p",[a("img",{attrs:{src:"https://cdn.jsdelivr.net/gh/jacky1234/picArchieve@master/uPic/20240221_163326_NspsUT.png",alt:""}})])]),t._v(" "),a("li",[a("p",[t._v("通过 apktool 反解成 smali: "),a("code",[t._v("apktool d -r {apk}")]),t._v(", 然后搜索, 'harmony' 关键字。这里我先过滤了 'const-string' 指令")]),t._v(" "),a("ul",[a("li",[a("code",[t._v("rg 'const-string' --glob '*.smali' > const_string.txt")])]),t._v(" "),a("li",[a("code",[t._v("rg 'harmony' const_string.txt")]),t._v(": 再次过滤")])])]),t._v(" "),a("li",[a("p",[t._v("frida, objection 查找内存加载模块, 可以看看是否有鸿蒙相关的功能等等")])]),t._v(" "),a("li",[a("p",[t._v("root 鸿蒙 4.0 系统, 对比抖音和拼多多播放器暂停调用堆栈")])])]),t._v(" "),a("h2",{attrs:{id:"结论"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#结论"}},[t._v("#")]),t._v(" 结论")]),t._v(" "),a("p",[t._v("这一篇的结论有些戏剧性: 其实抖音通过手势上滑退到后台, 也采取的 Fragment#onPause 中暂停。但是重点来了: 鸿蒙系统对视频类应用会提前调用 "),a("code",[t._v("onPause")]),t._v(", 让应用页面提前进入 pause, 提前响应视频音频暂停。 (这也是跟华为客服沟通了解到的)")]),t._v(" "),a("RText",{attrs:{text:"申请步骤:"}}),t._v(" "),a("ol",[a("li",[t._v("发送申请邮件过来, 说明下具体背景和情况, 华为内部去评估下看能否给配置\n邮件地址为: "),a("code",[t._v("hwthirdparty@huawei.com、guolulu2@h-partners.com、wangdandan46@h-partners.com、wangpei13@h-partners.com、yanglvhua@h-partners.com")])]),t._v(" "),a("li",[t._v("作废,不能申请")])])],1)}),[],!1,null,null,null);a.default=n.exports}}]);
\ No newline at end of file
diff --git a/assets/js/184.c5b66db2.js b/assets/js/184.c5b66db2.js
new file mode 100644
index 0000000000..d733552330
--- /dev/null
+++ b/assets/js/184.c5b66db2.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[184],{500:function(t,a,n){"use strict";n.r(a);var s=n(4),e=Object(s.a)({},(function(){var t=this,a=t._self._c;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("blockquote",[a("p",[t._v("逆向抖音, 获取 EditText 的实现是 CommentMentionEditText 组件, 借助, 这个名字在 github 上搜索相关的内容")])]),t._v(" "),a("h2",{attrs:{id:"span"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#span"}},[t._v("#")]),t._v(" span")]),t._v(" "),a("p",[t._v("记住一句话: 一切皆 span")]),t._v(" "),a("h3",{attrs:{id:"children"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#children"}},[t._v("#")]),t._v(" children")]),t._v(" "),a("ul",[a("li",[t._v("BackgroundColorSpan: 设置文本背景颜色, 参数传入一个 int 类型的颜色")]),t._v(" "),a("li",[t._v("ForegroundColorSpan: 设置文本颜色, 参数传入一个 int 类型的颜色")]),t._v(" "),a("li",[t._v("ClickableSpan: 设置点击事件, 需要继承这个类重写 onClick 方法")])]),t._v(" "),a("p",[a("a",{attrs:{href:"https://juejin.cn/post/6844904069899747341",target:"_blank",rel:"noopener noreferrer"}},[t._v("更多"),a("OutboundLink")],1)]),t._v(" "),a("p",[t._v("如自定义 emoji, 继承关系可见如下:")]),t._v(" "),a("div",{staticClass:"language-text line-numbers-mode"},[a("pre",{pre:!0,attrs:{class:"language-text"}},[a("code",[t._v("- CharacterStyle/UpdateLayout\n - MetricAffectingSpan\n - ReplacementSpan\n - DynamicDrawableSpan\n - ImageSpan\n - EmojiSpan\n - SizeEmojiSpan\n")])]),t._v(" "),a("div",{staticClass:"line-numbers-wrapper"},[a("span",{staticClass:"line-number"},[t._v("1")]),a("br"),a("span",{staticClass:"line-number"},[t._v("2")]),a("br"),a("span",{staticClass:"line-number"},[t._v("3")]),a("br"),a("span",{staticClass:"line-number"},[t._v("4")]),a("br"),a("span",{staticClass:"line-number"},[t._v("5")]),a("br"),a("span",{staticClass:"line-number"},[t._v("6")]),a("br"),a("span",{staticClass:"line-number"},[t._v("7")]),a("br")])]),a("h2",{attrs:{id:"开始"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#开始"}},[t._v("#")]),t._v(" 开始")]),t._v(" "),a("h3",{attrs:{id:"抖音-提示效果"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#抖音-提示效果"}},[t._v("#")]),t._v(" 抖音@提示效果")]),t._v(" "),a("p",[t._v("如下图:\n"),a("img",{attrs:{src:"https://cdn.jsdelivr.net/gh/jacky1234/picArchieve@master/uPic/20240304_213356_KcJNCq.jpg",alt:""}})]),t._v(" "),a("p",[t._v("通过 frida dump 出来的内存如下:")]),t._v(" "),a("div",{staticClass:"language-json line-numbers-mode"},[a("pre",{pre:!0,attrs:{class:"language-json"}},[a("code",[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spans"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.text.DynamicLayout$ChangeWatcher"')]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.widget.TextView$ChangeWatcher"')]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.text.method.TextKeyListener"')]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.widget.Editor$SpanController"')]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.text.Selection$START"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.text.Selection$END"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"com.ss.android.ugc.aweme.social.at.utils.MentionHintSpan"')]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.text.style.SpellCheckSpan"')]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"text"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"@输入搜索@的人"')]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])]),t._v(" "),a("div",{staticClass:"line-numbers-wrapper"},[a("span",{staticClass:"line-number"},[t._v("1")]),a("br"),a("span",{staticClass:"line-number"},[t._v("2")]),a("br"),a("span",{staticClass:"line-number"},[t._v("3")]),a("br"),a("span",{staticClass:"line-number"},[t._v("4")]),a("br"),a("span",{staticClass:"line-number"},[t._v("5")]),a("br"),a("span",{staticClass:"line-number"},[t._v("6")]),a("br"),a("span",{staticClass:"line-number"},[t._v("7")]),a("br"),a("span",{staticClass:"line-number"},[t._v("8")]),a("br"),a("span",{staticClass:"line-number"},[t._v("9")]),a("br"),a("span",{staticClass:"line-number"},[t._v("10")]),a("br"),a("span",{staticClass:"line-number"},[t._v("11")]),a("br"),a("span",{staticClass:"line-number"},[t._v("12")]),a("br"),a("span",{staticClass:"line-number"},[t._v("13")]),a("br"),a("span",{staticClass:"line-number"},[t._v("14")]),a("br"),a("span",{staticClass:"line-number"},[t._v("15")]),a("br"),a("span",{staticClass:"line-number"},[t._v("16")]),a("br"),a("span",{staticClass:"line-number"},[t._v("17")]),a("br"),a("span",{staticClass:"line-number"},[t._v("18")]),a("br"),a("span",{staticClass:"line-number"},[t._v("19")]),a("br"),a("span",{staticClass:"line-number"},[t._v("20")]),a("br"),a("span",{staticClass:"line-number"},[t._v("21")]),a("br"),a("span",{staticClass:"line-number"},[t._v("22")]),a("br"),a("span",{staticClass:"line-number"},[t._v("23")]),a("br"),a("span",{staticClass:"line-number"},[t._v("24")]),a("br"),a("span",{staticClass:"line-number"},[t._v("25")]),a("br"),a("span",{staticClass:"line-number"},[t._v("26")]),a("br"),a("span",{staticClass:"line-number"},[t._v("27")]),a("br"),a("span",{staticClass:"line-number"},[t._v("28")]),a("br"),a("span",{staticClass:"line-number"},[t._v("29")]),a("br"),a("span",{staticClass:"line-number"},[t._v("30")]),a("br"),a("span",{staticClass:"line-number"},[t._v("31")]),a("br"),a("span",{staticClass:"line-number"},[t._v("32")]),a("br"),a("span",{staticClass:"line-number"},[t._v("33")]),a("br"),a("span",{staticClass:"line-number"},[t._v("34")]),a("br"),a("span",{staticClass:"line-number"},[t._v("35")]),a("br"),a("span",{staticClass:"line-number"},[t._v("36")]),a("br"),a("span",{staticClass:"line-number"},[t._v("37")]),a("br")])]),a("p",[t._v("二、在输入"),a("code",[t._v("@1")]),t._v("setText 的调用如下:")]),t._v(" "),a("p",[t._v("其实现也是通过 "),a("code",[t._v("@1 + hint")]),t._v(" 然后 "),a("code",[t._v("remove hint")]),t._v(" 的方式来实现, hint 的提示效果")]),t._v(" "),a("div",{staticClass:"language- line-numbers-mode"},[a("pre",{pre:!0,attrs:{class:"language-text"}},[a("code",[t._v("EditTextClz: com.ss.android.ugc.aweme.comment.widget.CommentMentionEditText\nViewId: 2131367606\ntext: @1输入搜索@的人\n------------startFlag:48180395,objectHash:253684777,thread(id:2,name:main),timestamp:1709726438706---------------\nandroid.widget.EditText.setText()\n at android.widget.TextView.setText(Native Method)\n at X.pSN.LIZ(SourceFile:17170465)\n at X.pT1.LIZ(SourceFile:50724951)\n at X.pTY.LIZIZ(SourceFile:50724882)\n at X.pTY.LIZ(SourceFile:50659349)\n at X.pT1.LIZ(SourceFile:17104935)\n at X.pT0.LIZ(SourceFile:178)\n at X.pSA.afterTextChanged(SourceFile:17236285)\n at X.pSL.afterTextChanged(SourceFile:17170432)\n at android.widget.TextView.sendAfterTextChanged(TextView.java:11066)\n at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:14164)\n at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:1278)\n at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:578)\n at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:508)\n at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:38)\n at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:941)\n at android.view.inputmethod.BaseInputConnection.commitText(BaseInputConnection.java:219)\n at com.android.internal.inputmethod.EditableInputConnection.commitText(EditableInputConnection.java:201)\n at android.view.inputmethod.InputConnectionWrapper.commitText(InputConnectionWrapper.java:200)\n at X.pks.commitText(SourceFile:33685508)\n at com.android.internal.inputmethod.RemoteInputConnectionImpl.lambda$commitText$16$com-android-internal-inputmethod-RemoteInputConnectionImpl(RemoteInputConnectionImpl.java:569)\n at com.android.internal.inputmethod.RemoteInputConnectionImpl$$ExternalSyntheticLambda34.run(Unknown Source:8)\n at android.os.Handler.handleCallback(Handler.java:942)\n at android.os.Handler.dispatchMessage(Handler.java:99)\n at android.os.Looper.loopOnce(Looper.java:201)\n at android.os.Looper.loop(Looper.java:288)\n at android.app.ActivityThread.main(ActivityThread.java:7898)\n at java.lang.reflect.Method.invoke(Native Method)\n at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)\n------------endFlag:48180395,usedtime:3---------------\n\nEditTextClz: com.ss.android.ugc.aweme.comment.widget.CommentMentionEditText\nViewId: 2131367606\ntext: @1\n------------startFlag:11062723,objectHash:253684777,thread(id:2,name:main),timestamp:1709726438711---------------\nandroid.widget.EditText.setText()\n at android.widget.TextView.setText(Native Method)\n at X.pSN.LIZ(SourceFile:17170465)\n at X.pT1.LIZ(SourceFile:50724951)\n at X.pTY.LIZIZ(SourceFile:50724882)\n at X.pTY.LIZ(SourceFile:50659349)\n at X.pT1.LIZ(SourceFile:17104935)\n at X.pT0.LIZ(SourceFile:178)\n at X.pSA.afterTextChanged(SourceFile:17236285)\n at X.pSL.afterTextChanged(SourceFile:17170432)\n at android.widget.TextView.sendAfterTextChanged(TextView.java:11066)\n at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:14164)\n at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:1278)\n at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:578)\n at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:231)\n at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:38)\n at kotlin.jvm.internal.ALambdaS661S0100000_34.invoke$28(SourceFile:50528282)\n at kotlin.jvm.internal.ALambdaS661S0100000_34.invoke(Unknown Source:18)\n at X.pUO.LIZ(SourceFile:17039414)\n at kotlin.jvm.internal.ALambdaS575S0100000_34.invoke$507(SourceFile:16973835)\n at kotlin.jvm.internal.ALambdaS575S0100000_34.invoke(Unknown Source:167)\n at X.pUO.LIZ(SourceFile:17104928)\n at X.pUO.LIZJ(SourceFile:196626)\n at com.ss.android.ugc.aweme.social.at.utils.MentionHintHelper$handleOnSelectionChanged$1.invoke(SourceFile:33816629)\n at X.pUO.LIZ(SourceFile:17039414)\n at X.pUO.LIZ(SourceFile:33947682)\n at X.pSD.LIZ(SourceFile:33751054)\n at com.ss.android.ugc.aweme.comment.widget.CommentMentionEditText.onSelectionChanged(SourceFile:33685511)\n at android.widget.TextView.spanChange(TextView.java:11224)\n at android.widget.TextView$ChangeWatcher.onSpanChanged(TextView.java:14176)\n at android.text.SpannableStringBuilder.sendSpanChanged(SpannableStringBuilder.java:1308)\n at android.text.SpannableStringBuilder.sendToSpanWatchers(SpannableStringBuilder.java:652)\n at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:581)\n at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:508)\n at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:38)\n at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:941)\n at android.view.inputmethod.BaseInputConnection.commitText(BaseInputConnection.java:219)\n at com.android.internal.inputmethod.EditableInputConnection.commitText(EditableInputConnection.java:201)\n at android.view.inputmethod.InputConnectionWrapper.commitText(InputConnectionWrapper.java:200)\n at X.pks.commitText(SourceFile:33685508)\n at com.android.internal.inputmethod.RemoteInputConnectionImpl.lambda$commitText$16$com-android-internal-inputmethod-RemoteInputConnectionImpl(RemoteInputConnectionImpl.java:569)\n at com.android.internal.inputmethod.RemoteInputConnectionImpl$$ExternalSyntheticLambda34.run(Unknown Source:8)\n at android.os.Handler.handleCallback(Handler.java:942)\n at android.os.Handler.dispatchMessage(Handler.java:99)\n at android.os.Looper.loopOnce(Looper.java:201)\n at android.os.Looper.loop(Looper.java:288)\n at android.app.ActivityThread.main(ActivityThread.java:7898)\n at java.lang.reflect.Method.invoke(Native Method)\n at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)\n------------endFlag:11062723,usedtime:3---------------\n\n")])]),t._v(" "),a("div",{staticClass:"line-numbers-wrapper"},[a("span",{staticClass:"line-number"},[t._v("1")]),a("br"),a("span",{staticClass:"line-number"},[t._v("2")]),a("br"),a("span",{staticClass:"line-number"},[t._v("3")]),a("br"),a("span",{staticClass:"line-number"},[t._v("4")]),a("br"),a("span",{staticClass:"line-number"},[t._v("5")]),a("br"),a("span",{staticClass:"line-number"},[t._v("6")]),a("br"),a("span",{staticClass:"line-number"},[t._v("7")]),a("br"),a("span",{staticClass:"line-number"},[t._v("8")]),a("br"),a("span",{staticClass:"line-number"},[t._v("9")]),a("br"),a("span",{staticClass:"line-number"},[t._v("10")]),a("br"),a("span",{staticClass:"line-number"},[t._v("11")]),a("br"),a("span",{staticClass:"line-number"},[t._v("12")]),a("br"),a("span",{staticClass:"line-number"},[t._v("13")]),a("br"),a("span",{staticClass:"line-number"},[t._v("14")]),a("br"),a("span",{staticClass:"line-number"},[t._v("15")]),a("br"),a("span",{staticClass:"line-number"},[t._v("16")]),a("br"),a("span",{staticClass:"line-number"},[t._v("17")]),a("br"),a("span",{staticClass:"line-number"},[t._v("18")]),a("br"),a("span",{staticClass:"line-number"},[t._v("19")]),a("br"),a("span",{staticClass:"line-number"},[t._v("20")]),a("br"),a("span",{staticClass:"line-number"},[t._v("21")]),a("br"),a("span",{staticClass:"line-number"},[t._v("22")]),a("br"),a("span",{staticClass:"line-number"},[t._v("23")]),a("br"),a("span",{staticClass:"line-number"},[t._v("24")]),a("br"),a("span",{staticClass:"line-number"},[t._v("25")]),a("br"),a("span",{staticClass:"line-number"},[t._v("26")]),a("br"),a("span",{staticClass:"line-number"},[t._v("27")]),a("br"),a("span",{staticClass:"line-number"},[t._v("28")]),a("br"),a("span",{staticClass:"line-number"},[t._v("29")]),a("br"),a("span",{staticClass:"line-number"},[t._v("30")]),a("br"),a("span",{staticClass:"line-number"},[t._v("31")]),a("br"),a("span",{staticClass:"line-number"},[t._v("32")]),a("br"),a("span",{staticClass:"line-number"},[t._v("33")]),a("br"),a("span",{staticClass:"line-number"},[t._v("34")]),a("br"),a("span",{staticClass:"line-number"},[t._v("35")]),a("br"),a("span",{staticClass:"line-number"},[t._v("36")]),a("br"),a("span",{staticClass:"line-number"},[t._v("37")]),a("br"),a("span",{staticClass:"line-number"},[t._v("38")]),a("br"),a("span",{staticClass:"line-number"},[t._v("39")]),a("br"),a("span",{staticClass:"line-number"},[t._v("40")]),a("br"),a("span",{staticClass:"line-number"},[t._v("41")]),a("br"),a("span",{staticClass:"line-number"},[t._v("42")]),a("br"),a("span",{staticClass:"line-number"},[t._v("43")]),a("br"),a("span",{staticClass:"line-number"},[t._v("44")]),a("br"),a("span",{staticClass:"line-number"},[t._v("45")]),a("br"),a("span",{staticClass:"line-number"},[t._v("46")]),a("br"),a("span",{staticClass:"line-number"},[t._v("47")]),a("br"),a("span",{staticClass:"line-number"},[t._v("48")]),a("br"),a("span",{staticClass:"line-number"},[t._v("49")]),a("br"),a("span",{staticClass:"line-number"},[t._v("50")]),a("br"),a("span",{staticClass:"line-number"},[t._v("51")]),a("br"),a("span",{staticClass:"line-number"},[t._v("52")]),a("br"),a("span",{staticClass:"line-number"},[t._v("53")]),a("br"),a("span",{staticClass:"line-number"},[t._v("54")]),a("br"),a("span",{staticClass:"line-number"},[t._v("55")]),a("br"),a("span",{staticClass:"line-number"},[t._v("56")]),a("br"),a("span",{staticClass:"line-number"},[t._v("57")]),a("br"),a("span",{staticClass:"line-number"},[t._v("58")]),a("br"),a("span",{staticClass:"line-number"},[t._v("59")]),a("br"),a("span",{staticClass:"line-number"},[t._v("60")]),a("br"),a("span",{staticClass:"line-number"},[t._v("61")]),a("br"),a("span",{staticClass:"line-number"},[t._v("62")]),a("br"),a("span",{staticClass:"line-number"},[t._v("63")]),a("br"),a("span",{staticClass:"line-number"},[t._v("64")]),a("br"),a("span",{staticClass:"line-number"},[t._v("65")]),a("br"),a("span",{staticClass:"line-number"},[t._v("66")]),a("br"),a("span",{staticClass:"line-number"},[t._v("67")]),a("br"),a("span",{staticClass:"line-number"},[t._v("68")]),a("br"),a("span",{staticClass:"line-number"},[t._v("69")]),a("br"),a("span",{staticClass:"line-number"},[t._v("70")]),a("br"),a("span",{staticClass:"line-number"},[t._v("71")]),a("br"),a("span",{staticClass:"line-number"},[t._v("72")]),a("br"),a("span",{staticClass:"line-number"},[t._v("73")]),a("br"),a("span",{staticClass:"line-number"},[t._v("74")]),a("br"),a("span",{staticClass:"line-number"},[t._v("75")]),a("br"),a("span",{staticClass:"line-number"},[t._v("76")]),a("br"),a("span",{staticClass:"line-number"},[t._v("77")]),a("br"),a("span",{staticClass:"line-number"},[t._v("78")]),a("br"),a("span",{staticClass:"line-number"},[t._v("79")]),a("br"),a("span",{staticClass:"line-number"},[t._v("80")]),a("br"),a("span",{staticClass:"line-number"},[t._v("81")]),a("br"),a("span",{staticClass:"line-number"},[t._v("82")]),a("br"),a("span",{staticClass:"line-number"},[t._v("83")]),a("br"),a("span",{staticClass:"line-number"},[t._v("84")]),a("br"),a("span",{staticClass:"line-number"},[t._v("85")]),a("br"),a("span",{staticClass:"line-number"},[t._v("86")]),a("br"),a("span",{staticClass:"line-number"},[t._v("87")]),a("br"),a("span",{staticClass:"line-number"},[t._v("88")]),a("br"),a("span",{staticClass:"line-number"},[t._v("89")]),a("br"),a("span",{staticClass:"line-number"},[t._v("90")]),a("br"),a("span",{staticClass:"line-number"},[t._v("91")]),a("br"),a("span",{staticClass:"line-number"},[t._v("92")]),a("br"),a("span",{staticClass:"line-number"},[t._v("93")]),a("br")])]),a("h3",{attrs:{id:"抖音-suggestionspan"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#抖音-suggestionspan"}},[t._v("#")]),t._v(" 抖音 SuggestionSpan")]),t._v(" "),a("p",[a("img",{attrs:{src:"https://cdn.jsdelivr.net/gh/jacky1234/picArchieve@master/uPic/20240305_220103_XeZdHb.jpg",alt:""}})]),t._v(" "),a("p",[t._v("注意到 gg 下面有一条红色线条, 原来其为 SuggestionSpan, 内容如下:")]),t._v(" "),a("div",{staticClass:"language-json line-numbers-mode"},[a("pre",{pre:!0,attrs:{class:"language-json"}},[a("code",[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spans"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.text.DynamicLayout$ChangeWatcher"')]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.widget.TextView$ChangeWatcher"')]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.text.method.TextKeyListener"')]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.widget.Editor$SpanController"')]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.text.Selection$START"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("10")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.text.Selection$END"')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("5")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"com.ss.android.ugc.aweme.social.at.MentionEditText$MentionSpan"')]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanStart"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("7")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"spanEnd"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("9")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t\t\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"clazz"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"android.text.style.SuggestionSpan"')]),t._v("\n\t\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\t"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\t"),a("span",{pre:!0,attrs:{class:"token property"}},[t._v('"text"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"@福州沁儿 @gg "')]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])]),t._v(" "),a("div",{staticClass:"line-numbers-wrapper"},[a("span",{staticClass:"line-number"},[t._v("1")]),a("br"),a("span",{staticClass:"line-number"},[t._v("2")]),a("br"),a("span",{staticClass:"line-number"},[t._v("3")]),a("br"),a("span",{staticClass:"line-number"},[t._v("4")]),a("br"),a("span",{staticClass:"line-number"},[t._v("5")]),a("br"),a("span",{staticClass:"line-number"},[t._v("6")]),a("br"),a("span",{staticClass:"line-number"},[t._v("7")]),a("br"),a("span",{staticClass:"line-number"},[t._v("8")]),a("br"),a("span",{staticClass:"line-number"},[t._v("9")]),a("br"),a("span",{staticClass:"line-number"},[t._v("10")]),a("br"),a("span",{staticClass:"line-number"},[t._v("11")]),a("br"),a("span",{staticClass:"line-number"},[t._v("12")]),a("br"),a("span",{staticClass:"line-number"},[t._v("13")]),a("br"),a("span",{staticClass:"line-number"},[t._v("14")]),a("br"),a("span",{staticClass:"line-number"},[t._v("15")]),a("br"),a("span",{staticClass:"line-number"},[t._v("16")]),a("br"),a("span",{staticClass:"line-number"},[t._v("17")]),a("br"),a("span",{staticClass:"line-number"},[t._v("18")]),a("br"),a("span",{staticClass:"line-number"},[t._v("19")]),a("br"),a("span",{staticClass:"line-number"},[t._v("20")]),a("br"),a("span",{staticClass:"line-number"},[t._v("21")]),a("br"),a("span",{staticClass:"line-number"},[t._v("22")]),a("br"),a("span",{staticClass:"line-number"},[t._v("23")]),a("br"),a("span",{staticClass:"line-number"},[t._v("24")]),a("br"),a("span",{staticClass:"line-number"},[t._v("25")]),a("br"),a("span",{staticClass:"line-number"},[t._v("26")]),a("br"),a("span",{staticClass:"line-number"},[t._v("27")]),a("br"),a("span",{staticClass:"line-number"},[t._v("28")]),a("br"),a("span",{staticClass:"line-number"},[t._v("29")]),a("br"),a("span",{staticClass:"line-number"},[t._v("30")]),a("br"),a("span",{staticClass:"line-number"},[t._v("31")]),a("br"),a("span",{staticClass:"line-number"},[t._v("32")]),a("br"),a("span",{staticClass:"line-number"},[t._v("33")]),a("br"),a("span",{staticClass:"line-number"},[t._v("34")]),a("br"),a("span",{staticClass:"line-number"},[t._v("35")]),a("br"),a("span",{staticClass:"line-number"},[t._v("36")]),a("br"),a("span",{staticClass:"line-number"},[t._v("37")]),a("br")])]),a("h3",{attrs:{id:"处理表情面板-del"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#处理表情面板-del"}},[t._v("#")]),t._v(" 处理表情面板 del")]),t._v(" "),a("p",[t._v("删除有两个地方可以触发: 键盘的 del、表情面板的 del。 这里存在一个问题在键盘 ACTION_DOWN 事件未处理, 会传递给 view 的 ACTION_DOWN, "),a("code",[t._v("InputConnectionWrapper#sendKeyEvent")]),t._v(" 与 "),a("code",[t._v("View#onKey")]),t._v(" 实现一致, 这里需要做事件的去重处理。 代码略")]),t._v(" "),a("h3",{attrs:{id:"占位符的拆分与组装"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#占位符的拆分与组装"}},[t._v("#")]),t._v(" 占位符的拆分与组装")]),t._v(" "),a("p",[t._v("代码牵扯到私密问题, 这里不提供。"),a("RouterLink",{attrs:{to:"/pages/c148a0/"}},[t._v("link")])],1),t._v(" "),a("h2",{attrs:{id:"参考"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#参考"}},[t._v("#")]),t._v(" 参考")]),t._v(" "),a("ul",[a("li",[a("a",{attrs:{href:"https://www.sohu.com/a/281235927_611601",target:"_blank",rel:"noopener noreferrer"}},[t._v("Android 如何优雅地实现@人功能?——仿微博、仿 QQ、仿微信、零入侵、高扩展性 "),a("OutboundLink")],1)]),t._v(" "),a("li",[a("a",{attrs:{href:"https://juejin.cn/post/6844904069899747341",target:"_blank",rel:"noopener noreferrer"}},[t._v("Android 中 Spannable 的使用"),a("OutboundLink")],1)]),t._v(" "),a("li",[a("a",{attrs:{href:"https://github.com/andydevacc/MentionEditText",target:"_blank",rel:"noopener noreferrer"}},[t._v("MentionEditText"),a("OutboundLink")],1)]),t._v(" "),a("li",[a("a",{attrs:{href:"https://github.com/search?q=MentionEditTex&type=repositories",target:"_blank",rel:"noopener noreferrer"}},[t._v("github-search-result"),a("OutboundLink")],1)])])])}),[],!1,null,null,null);a.default=e.exports}}]);
\ No newline at end of file
diff --git a/assets/js/185.1530ae0c.js b/assets/js/185.1530ae0c.js
new file mode 100644
index 0000000000..bfab60d7ae
--- /dev/null
+++ b/assets/js/185.1530ae0c.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[185],{501:function(e,s,n){"use strict";n.r(s);var a=n(4),t=Object(a.a)({},(function(){var e=this,s=e._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[s("blockquote",[s("p",[e._v("探索抖音禁止录屏")])]),e._v(" "),s("h2",{attrs:{id:"flag-secure"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#flag-secure"}},[e._v("#")]),e._v(" FLAG_SECURE")]),e._v(" "),s("p",[e._v("在播放付费短剧内容是,执行 "),s("code",[e._v("adb shell dumpsys window windows | grep -A 30 -E 'Window #|mCurrentFocus'")]),e._v(" 发现当前 window 设置了 flag "),s("code",[e._v("SECURE")]),e._v(". 其定义在 "),s("a",{attrs:{href:"https://developer.android.com/reference/android/view/WindowManager.LayoutParams",target:"_blank",rel:"noopener noreferrer"}},[e._v("/WindowManager.LayoutParams"),s("OutboundLink")],1),e._v(" 中, 此 flag: Added in API level 1.")]),e._v(" "),s("div",{staticClass:"language-java line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-java"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[e._v("/** Window flag: treat the content of the window as secure, preventing\n * it from appearing in screenshots or from being viewed on non-secure\n * displays.\n *\n * See {@link android.view.Display#FLAG_SECURE} for more details about\n * secure surfaces and secure displays.\n */")]),e._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[e._v("public")]),e._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[e._v("static")]),e._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[e._v("final")]),e._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[e._v("int")]),e._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[e._v("FLAG_SECURE")]),e._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[e._v("=")]),e._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[e._v("0x00002000")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(";")]),e._v("\n")])]),e._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[e._v("1")]),s("br"),s("span",{staticClass:"line-number"},[e._v("2")]),s("br"),s("span",{staticClass:"line-number"},[e._v("3")]),s("br"),s("span",{staticClass:"line-number"},[e._v("4")]),s("br"),s("span",{staticClass:"line-number"},[e._v("5")]),s("br"),s("span",{staticClass:"line-number"},[e._v("6")]),s("br"),s("span",{staticClass:"line-number"},[e._v("7")]),s("br"),s("span",{staticClass:"line-number"},[e._v("8")]),s("br")])]),s("div",{staticClass:"language-text line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[e._v("--\nWindow #13 Window{8c106d1 u0 com.ss.android.ugc.aweme/com.ss.android.ugc.aweme.playlet.videodetail.PlayletVideoPlayActivity}:\n mDisplayId=0 rootTaskId=11350 mSession=Session{7a1d86 21483:u0a10517} mClient=android.os.BinderProxy@cea31f8\n mOwnerUid=10517 showForAllUsers=false package=com.ss.android.ugc.aweme appop=NONE\n mAttrs={(0,0)(fillxfill) sim={adjust=nothing forwardNavigation} ty=BASE_APPLICATION hwFlags=#0 isEmuiStyle=0 statusBarColor=#0 navigationBarColor=#ff000000 wanim=0x10302fe\n fl=KEEP_SCREEN_ON LAYOUT_IN_SCREEN SECURE LAYOUT_INSET_DECOR SPLIT_TOUCH HARDWARE_ACCELERATED DRAWS_SYSTEM_BAR_BACKGROUNDS\n pfl=FIT_INSETS_CONTROLLED\n vsysui=LAYOUT_STABLE LAYOUT_FULLSCREEN\n fitSides=}\n Requested w=720 h=1600 mLayoutSeq=25844\n mBaseLayer=21000 mSubLayer=0 mToken=ActivityRecord{70e4774 u0 com.ss.android.ugc.aweme/.playlet.videodetail.PlayletVideoPlayActivity t11350}\n mActivityRecord=ActivityRecord{70e4774 u0 com.ss.android.ugc.aweme/.playlet.videodetail.PlayletVideoPlayActivity t11350}\n mAppDied=false drawnStateEvaluated=true mightAffectAllDrawn=true\n mViewVisibility=0x0 mHaveFrame=true mObscured=false\n mSeq=0 mSystemUiVisibility=0x500\n mGivenContentInsets=[0,0][0,0] mGivenVisibleInsets=[0,0][0,0]\n mFullConfiguration={1.15 ?mcc?mnc [zh_CN_#Hans] ldltr sw360dp w360dp h776dp 320dpi nrml long port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 720, 1600) mAppBounds=Rect(0, 48 - 720, 1600) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} suim:1 fontWeightScale:100changeUserFlag:0 s.1 fontWeightAdjustment=0}\n mLastReportedConfiguration={1.15 ?mcc?mnc [zh_CN_#Hans] ldltr sw360dp w360dp h776dp 320dpi nrml long port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 720, 1600) mAppBounds=Rect(0, 48 - 720, 1600) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} suim:1 fontWeightScale:100changeUserFlag:0 s.1 fontWeightAdjustment=0}\n mHasSurface=true isReadyForDisplay()=true mWindowRemovalAllowed=false\n Frames: containing=[0,0][720,1600] parent=[0,0][720,1600]\n display=[0,0][720,1600]\n content=[0,48][720,1600] visible=[0,48][720,1600]\n decor=[0,0][720,1600]\n mFrame=[0,0][720,1600] last=[0,0][720,1600]\n cutout=DisplayCutout{insets=Rect(0, 48 - 0, 0) waterfall=Insets{left=0, top=0, right=0, bottom=0} boundingRect={Bounds=[Rect(0, 0 - 0, 0), Rect(310, 0 - 410, 48), Rect(0, 0 - 0, 0), Rect(0, 0 - 0, 0)]}} last=DisplayCutout{insets=Rect(0, 48 - 0, 0) waterfall=Insets{left=0, top=0, right=0, bottom=0} boundingRect={Bounds=[Rect(0, 0 - 0, 0), Rect(310, 0 - 410, 48), Rect(0, 0 - 0, 0), Rect(0, 0 - 0, 0)]}}\n Cur insets: content=[0,48][0,0] visible=[0,48][0,0] stable=[0,48][0,0] Lst insets: content=[0,48][0,0] visible=[0,48][0,0] stable=[0,48][0,0]\n surface=[0,0][0,0]\n WindowStateAnimator{d0be7e6 com.ss.android.ugc.aweme/com.ss.android.ugc.aweme.playlet.videodetail.PlayletVideoPlayActivity}:\n mSurface=Surface(name=com.ss.android.ugc.aweme/com.ss.android.ugc.aweme.playlet.videodetail.PlayletVideoPlayActivity)/@0x69fceef\n Surface: shown=true layer=0 alpha=1.0 rect=(0.0,0.0) 720 x 1600 transform=(1.0, 0.0, 1.0, 0.0)\n mDrawState=HAS_DRAWN mLastHidden=false\n mEnterAnimationPending=false mSystemDecorRect=[0,0][720,1600] mLastClipRect=[0,0][720,1600]\n--\nWindow #14 Window{13235d u0 com.ss.android.ugc.aweme/com.ss.android.ugc.aweme.detail.ui.DetailActivity}:\n mDisplayId=0 rootTaskId=11350 mSession=Session{7a1d86 21483:u0a10517} mClient=android.os.BinderProxy@9aff934\n mOwnerUid=10517 showForAllUsers=false package=com.ss.android.ugc.aweme appop=NONE\n mAttrs={(0,0)(fillxfill) sim={adjust=nothing forwardNavigation} ty=BASE_APPLICATION hwFlags=#0 isEmuiStyle=0 statusBarColor=#0 navigationBarColor=#ff000000 wanim=0x10302fe\n fl=KEEP_SCREEN_ON LAYOUT_IN_SCREEN SECURE LAYOUT_INSET_DECOR SPLIT_TOUCH HARDWARE_ACCELERATED DRAWS_SYSTEM_BAR_BACKGROUNDS\n pfl=FIT_INSETS_CONTROLLED\n vsysui=LAYOUT_STABLE LAYOUT_FULLSCREEN\n fitSides=}\n Requested w=720 h=1600 mLayoutSeq=25834\n mBaseLayer=21000 mSubLayer=0 mToken=ActivityRecord{4894621 u0 com.ss.android.ugc.aweme/.detail.ui.DetailActivity t11350}\n mActivityRecord=ActivityRecord{4894621 u0 com.ss.android.ugc.aweme/.detail.ui.DetailActivity t11350}\n mAppDied=false drawnStateEvaluated=true mightAffectAllDrawn=true\n mViewVisibility=0x8 mHaveFrame=true mObscured=true\n mSeq=0 mSystemUiVisibility=0x500\n mGivenContentInsets=[0,0][0,0] mGivenVisibleInsets=[0,0][0,0]\n mFullConfiguration={1.15 ?mcc?mnc [zh_CN_#Hans] ldltr sw360dp w360dp h776dp 320dpi nrml long port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 720, 1600) mAppBounds=Rect(0, 48 - 720, 1600) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} suim:1 fontWeightScale:100changeUserFlag:0 s.1 fontWeightAdjustment=0}\n mLastReportedConfiguration={1.15 ?mcc?mnc [zh_CN_#Hans] ldltr sw360dp w360dp h776dp 320dpi nrml long port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 720, 1600) mAppBounds=Rect(0, 48 - 720, 1600) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} suim:1 fontWeightScale:100changeUserFlag:0 s.1 fontWeightAdjustment=0}\n mHasSurface=false isReadyForDisplay()=false mWindowRemovalAllowed=false\n Frames: containing=[0,0][720,1600] parent=[0,0][720,1600]\n display=[0,0][720,1600]\n content=[0,48][720,1600] visible=[0,48][720,1600]\n decor=[0,0][720,1600]\n mFrame=[0,0][720,1600] last=[0,0][720,1600]\n cutout=DisplayCutout{insets=Rect(0, 48 - 0, 0) waterfall=Insets{left=0, top=0, right=0, bottom=0} boundingRect={Bounds=[Rect(0, 0 - 0, 0), Rect(310, 0 - 410, 48), Rect(0, 0 - 0, 0), Rect(0, 0 - 0, 0)]}} last=DisplayCutout{insets=Rect(0, 48 - 0, 0) waterfall=Insets{left=0, top=0, right=0, bottom=0} boundingRect={Bounds=[Rect(0, 0 - 0, 0), Rect(310, 0 - 410, 48), Rect(0, 0 - 0, 0), Rect(0, 0 - 0, 0)]}}\n Cur insets: content=[0,48][0,0] visible=[0,48][0,0] stable=[0,48][0,0] Lst insets: content=[0,48][0,0] visible=[0,48][0,0] stable=[0,48][0,0]\n surface=[0,0][0,0]\n WindowStateAnimator{8d3acf7 com.ss.android.ugc.aweme/com.ss.android.ugc.aweme.detail.ui.DetailActivity}:\n mDrawState=NO_SURFACE mLastHidden=true\n mEnterAnimationPending=false mSystemDecorRect=[0,0][720,1600] mLastClipRect=[0,0][720,1600]\n mTmpSize=[0,0][720,1600]\n mForceSeamlesslyRotate=false seamlesslyRotate: pending=null finishedFrameNumber=0\n")])]),e._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[e._v("1")]),s("br"),s("span",{staticClass:"line-number"},[e._v("2")]),s("br"),s("span",{staticClass:"line-number"},[e._v("3")]),s("br"),s("span",{staticClass:"line-number"},[e._v("4")]),s("br"),s("span",{staticClass:"line-number"},[e._v("5")]),s("br"),s("span",{staticClass:"line-number"},[e._v("6")]),s("br"),s("span",{staticClass:"line-number"},[e._v("7")]),s("br"),s("span",{staticClass:"line-number"},[e._v("8")]),s("br"),s("span",{staticClass:"line-number"},[e._v("9")]),s("br"),s("span",{staticClass:"line-number"},[e._v("10")]),s("br"),s("span",{staticClass:"line-number"},[e._v("11")]),s("br"),s("span",{staticClass:"line-number"},[e._v("12")]),s("br"),s("span",{staticClass:"line-number"},[e._v("13")]),s("br"),s("span",{staticClass:"line-number"},[e._v("14")]),s("br"),s("span",{staticClass:"line-number"},[e._v("15")]),s("br"),s("span",{staticClass:"line-number"},[e._v("16")]),s("br"),s("span",{staticClass:"line-number"},[e._v("17")]),s("br"),s("span",{staticClass:"line-number"},[e._v("18")]),s("br"),s("span",{staticClass:"line-number"},[e._v("19")]),s("br"),s("span",{staticClass:"line-number"},[e._v("20")]),s("br"),s("span",{staticClass:"line-number"},[e._v("21")]),s("br"),s("span",{staticClass:"line-number"},[e._v("22")]),s("br"),s("span",{staticClass:"line-number"},[e._v("23")]),s("br"),s("span",{staticClass:"line-number"},[e._v("24")]),s("br"),s("span",{staticClass:"line-number"},[e._v("25")]),s("br"),s("span",{staticClass:"line-number"},[e._v("26")]),s("br"),s("span",{staticClass:"line-number"},[e._v("27")]),s("br"),s("span",{staticClass:"line-number"},[e._v("28")]),s("br"),s("span",{staticClass:"line-number"},[e._v("29")]),s("br"),s("span",{staticClass:"line-number"},[e._v("30")]),s("br"),s("span",{staticClass:"line-number"},[e._v("31")]),s("br"),s("span",{staticClass:"line-number"},[e._v("32")]),s("br"),s("span",{staticClass:"line-number"},[e._v("33")]),s("br"),s("span",{staticClass:"line-number"},[e._v("34")]),s("br"),s("span",{staticClass:"line-number"},[e._v("35")]),s("br"),s("span",{staticClass:"line-number"},[e._v("36")]),s("br"),s("span",{staticClass:"line-number"},[e._v("37")]),s("br"),s("span",{staticClass:"line-number"},[e._v("38")]),s("br"),s("span",{staticClass:"line-number"},[e._v("39")]),s("br"),s("span",{staticClass:"line-number"},[e._v("40")]),s("br"),s("span",{staticClass:"line-number"},[e._v("41")]),s("br"),s("span",{staticClass:"line-number"},[e._v("42")]),s("br"),s("span",{staticClass:"line-number"},[e._v("43")]),s("br"),s("span",{staticClass:"line-number"},[e._v("44")]),s("br"),s("span",{staticClass:"line-number"},[e._v("45")]),s("br"),s("span",{staticClass:"line-number"},[e._v("46")]),s("br"),s("span",{staticClass:"line-number"},[e._v("47")]),s("br"),s("span",{staticClass:"line-number"},[e._v("48")]),s("br"),s("span",{staticClass:"line-number"},[e._v("49")]),s("br"),s("span",{staticClass:"line-number"},[e._v("50")]),s("br"),s("span",{staticClass:"line-number"},[e._v("51")]),s("br"),s("span",{staticClass:"line-number"},[e._v("52")]),s("br"),s("span",{staticClass:"line-number"},[e._v("53")]),s("br"),s("span",{staticClass:"line-number"},[e._v("54")]),s("br"),s("span",{staticClass:"line-number"},[e._v("55")]),s("br"),s("span",{staticClass:"line-number"},[e._v("56")]),s("br"),s("span",{staticClass:"line-number"},[e._v("57")]),s("br"),s("span",{staticClass:"line-number"},[e._v("58")]),s("br"),s("span",{staticClass:"line-number"},[e._v("59")]),s("br"),s("span",{staticClass:"line-number"},[e._v("60")]),s("br"),s("span",{staticClass:"line-number"},[e._v("61")]),s("br"),s("span",{staticClass:"line-number"},[e._v("62")]),s("br"),s("span",{staticClass:"line-number"},[e._v("63")]),s("br"),s("span",{staticClass:"line-number"},[e._v("64")]),s("br")])])])}),[],!1,null,null,null);s.default=t.exports}}]);
\ No newline at end of file
diff --git a/assets/js/186.fff99cfa.js b/assets/js/186.fff99cfa.js
new file mode 100644
index 0000000000..12eef5882a
--- /dev/null
+++ b/assets/js/186.fff99cfa.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[186],{502:function(s,a,t){"use strict";t.r(a);var n=t(4),e=Object(n.a)({},(function(){var s=this,a=s._self._c;return a("ContentSlotsDistributor",{attrs:{"slot-key":s.$parent.slotKey}},[a("h2",{attrs:{id:"vmpeak-与-vmsize"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#vmpeak-与-vmsize"}},[s._v("#")]),s._v(" VMPeak 与 VMSize")]),s._v(" "),a("p",[s._v("在 Android 系统中,VMPeak 和 VMSize 是进程虚拟内存的相关指标,它们对于应用的内存管理和性能有直接影响。了解这些指标对于优化应用的内存使用、特别是在 32 位设备上的优化非常重要。")]),s._v(" "),a("ol",[a("li",[s._v("VMPeak 和 VMSize 的定义")])]),s._v(" "),a("ul",[a("li",[s._v("VMPeak: 进程所使用的虚拟内存的峰值值。这个值表示自进程启动以来,进程虚拟内存使用的最大值。")]),s._v(" "),a("li",[s._v("VMSize: 当前进程所使用的虚拟内存大小。它表示进程当前的虚拟内存使用量,包括代码、数据、堆和栈等。")])]),s._v(" "),a("ol",{attrs:{start:"2"}},[a("li",[s._v("对进程的影响")])]),s._v(" "),a("ul",[a("li",[s._v("内存使用管理:VMPeak 和 VMSize 是进程内存使用的两个重要指标。过高的 VMSize 可能会导致系统内存不足,尤其在设备 RAM 本身较少时,这可能导致系统频繁进行内存交换(swap)或杀死其他后台进程。")]),s._v(" "),a("li",[s._v("性能影响: 高内存使用会影响应用和系统的整体性能。频繁的垃圾回收(GC)和内存管理开销会增加,导致应用响应变慢。")]),s._v(" "),a("li",[s._v("崩溃风险: 如果 VMPeak 超过系统允许的最大虚拟内存(尤其在 32 位设备上,这个上限通常是 4GB),可能会导致内存分配失败,进而引起应用崩溃。")])]),s._v(" "),a("hr"),s._v(" "),a("RText",{attrs:{text:"虚拟地址空间的理论上限"}}),s._v(" "),a("p",[s._v("在 32 位系统上,虚拟地址空间的理论上限是 4 GB(2^32 字节)。但是,由于操作系统和硬件保留了部分地址空间,实际应用程序可用的虚拟地址空间会少于 4 GB。")]),s._v(" "),a("p",[s._v("详细分析")]),s._v(" "),a("ol",[a("li",[s._v("理论最大值:\n32 位地址空间可以表示 4,294,967,296 字节(4 GB)。")]),s._v(" "),a("li",[s._v("实际可用空间:\n内核空间: 在许多 32 位操作系统中,内核和操作系统会占用一部分地址空间。例如,Linux 通常将最高的 1 GB 地址空间保留给内核,这意味着用户态程序可以使用的地址空间大约是 3 GB。\n系统保留和硬件映射: 系统和硬件还会保留部分地址空间用于硬件设备的内存映射和其他用途。")])]),s._v(" "),a("h2",{attrs:{id:"查看-vmsize"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#查看-vmsize"}},[s._v("#")]),s._v(" 查看 VmSize")]),s._v(" "),a("div",{staticClass:"language-shell line-numbers-mode"},[a("pre",{pre:!0,attrs:{class:"language-shell"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# 获取 pid")]),s._v("\nadb shell "),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("ps")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v("|")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("grep")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v("<")]),s._v("process_name"),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">")]),s._v("\n\n"),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# 查看 VmSize")]),s._v("\nadb shell "),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("cat")]),s._v(" /proc/"),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v("<")]),s._v("pid"),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">")]),s._v("/status "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v("|")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("grep")]),s._v(" VmSize\n")])]),s._v(" "),a("div",{staticClass:"line-numbers-wrapper"},[a("span",{staticClass:"line-number"},[s._v("1")]),a("br"),a("span",{staticClass:"line-number"},[s._v("2")]),a("br"),a("span",{staticClass:"line-number"},[s._v("3")]),a("br"),a("span",{staticClass:"line-number"},[s._v("4")]),a("br"),a("span",{staticClass:"line-number"},[s._v("5")]),a("br")])]),a("h2",{attrs:{id:"_32-位设备上的优化建议"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#_32-位设备上的优化建议"}},[s._v("#")]),s._v(" 32 位设备上的优化建议")]),s._v(" "),a("p",[s._v("针对 32 位设备,内存限制更为严格,因为它们的虚拟地址空间有限(最大 4GB,但通常系统和其他应用占用一部分,因此实际可用远小于 4GB)。可以采取以下优化措施:")]),s._v(" "),a("p",[s._v("1.内存优化策略:")]),s._v(" "),a("ul",[a("li",[a("p",[s._v("减少内存使用: 优化代码,减少不必要的对象创建和资源加载,特别是大对象和图像资源。")])]),s._v(" "),a("li",[a("p",[s._v("使用高效数据结构: 选择合适的数据结构,避免使用过多的链表、哈希表等占用大量内存的数据结构。")]),s._v(" "),a("p",[s._v("2.资源管理:")])]),s._v(" "),a("li",[a("p",[s._v("按需加载: 使用按需加载技术,只在需要时加载资源。避免在启动时加载所有资源。")])]),s._v(" "),a("li",[a("p",[s._v("释放不需要的资源: 及时释放不再需要的资源,特别是大图片、音频和视频文件。")])]),s._v(" "),a("li",[a("p",[s._v("优化图像: 使用压缩图像格式(如 WebP),并根据设备屏幕分辨率加载适当尺寸的图像。")]),s._v(" "),a("p",[s._v("3.内存分析工具:")])]),s._v(" "),a("li",[a("p",[s._v("使用 Android Profiler: 通过 Android Studio 提供的内存分析工具,监控应用的内存使用,查找和修复内存泄漏。")])]),s._v(" "),a("li",[a("p",[s._v("LeakCanary: 集成内存泄漏检测工具,如 LeakCanary,自动检测和报告内存泄漏。")]),s._v(" "),a("p",[s._v("4.优化代码:")])]),s._v(" "),a("li",[a("p",[s._v("减少全局变量和单例: 避免过多使用全局变量和单例,它们会在整个应用生命周期中占用内存。")])]),s._v(" "),a("li",[a("p",[s._v("优化算法: 确保算法的时间和空间复杂度最低,避免使用高复杂度的算法。")]),s._v(" "),a("p",[s._v("5.垃圾回收优化:")])]),s._v(" "),a("li",[a("p",[s._v("减少临时对象创建: 尽量减少临时对象的创建,减少垃圾回收的频率。")])]),s._v(" "),a("li",[a("p",[s._v("使用池化技术: 对于频繁使用的大对象,使用对象池(object pool)来重用对象,避免频繁的创建和销毁。")])])]),s._v(" "),a("p",[s._v("通过以上措施,可以有效降低 VMPeak 和 VMSize,从而减少崩溃风险,提升应用在 32 位设备上的性能和稳定性。")]),s._v(" "),a("h2",{attrs:{id:"base"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#base"}},[s._v("#")]),s._v(" base")]),s._v(" "),a("h3",{attrs:{id:"获取-cpu-abis"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#获取-cpu-abis"}},[s._v("#")]),s._v(" 获取 CPU ABIS")]),s._v(" "),a("div",{staticClass:"language-java line-numbers-mode"},[a("pre",{pre:!0,attrs:{class:"language-java"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 获取支持的cpu abi,返回一个数组。如 ['arm64-v8a', 'armeabi-v7a', 'armeabi']")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Build")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token constant"}},[s._v("SUPPORTED_ABIS")]),s._v("\n\n"),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 设备的主要 CPU 架构,armeabi-v7a. 可以拿到运行时主CPU架构。 另外也可以通过 ApplicationInfo 对象拿")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Build")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token constant"}},[s._v("CPU_ABI")]),s._v("\n\n"),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 设备的次要 CPU 架构")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Build")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token constant"}},[s._v("CPU_ABI2")]),s._v("\n\n"),a("span",{pre:!0,attrs:{class:"token comment"}},[s._v("// 通过 ApplicationInfo 对象拿")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("PackageManager")]),s._v(" pm "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("getPackageManager")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("String")]),s._v(" packageName "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("getPackageName")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("try")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("ApplicationInfo")]),s._v(" ai "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" pm"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("getApplicationInfo")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("packageName"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("PackageManager")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token constant"}},[s._v("GET_META_DATA")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("String")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("[")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("]")]),s._v(" supportedABIs"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("if")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Build")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token constant"}},[s._v("VERSION")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token constant"}},[s._v("SDK_INT")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">=")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Build")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token constant"}},[s._v("VERSION_CODES")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token constant"}},[s._v("LOLLIPOP")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Field")]),s._v(" primaryCpuAbi "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("ApplicationInfo")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("class")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("getField")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"primaryCpuAbi"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n primaryCpuAbi"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("setAccessible")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),a("span",{pre:!0,attrs:{class:"token boolean"}},[s._v("true")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("AsyncPLog")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("i")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"xxx"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"primaryCpuAbi=%s"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" primaryCpuAbi"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("get")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("ai"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Field")]),s._v(" secondaryCpuAbi "),a("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("ApplicationInfo")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("class")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("getField")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"secondaryCpuAbi"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n secondaryCpuAbi"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("setAccessible")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),a("span",{pre:!0,attrs:{class:"token boolean"}},[s._v("true")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("AsyncPLog")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("i")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"xxx"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[s._v('"secondaryCpuAbi=%s"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(",")]),s._v(" secondaryCpuAbi"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("get")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("ai"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[s._v("catch")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),a("span",{pre:!0,attrs:{class:"token class-name"}},[s._v("Exception")]),s._v(" e"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n e"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[s._v("printStackTrace")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(";")]),s._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n")])]),s._v(" "),a("div",{staticClass:"line-numbers-wrapper"},[a("span",{staticClass:"line-number"},[s._v("1")]),a("br"),a("span",{staticClass:"line-number"},[s._v("2")]),a("br"),a("span",{staticClass:"line-number"},[s._v("3")]),a("br"),a("span",{staticClass:"line-number"},[s._v("4")]),a("br"),a("span",{staticClass:"line-number"},[s._v("5")]),a("br"),a("span",{staticClass:"line-number"},[s._v("6")]),a("br"),a("span",{staticClass:"line-number"},[s._v("7")]),a("br"),a("span",{staticClass:"line-number"},[s._v("8")]),a("br"),a("span",{staticClass:"line-number"},[s._v("9")]),a("br"),a("span",{staticClass:"line-number"},[s._v("10")]),a("br"),a("span",{staticClass:"line-number"},[s._v("11")]),a("br"),a("span",{staticClass:"line-number"},[s._v("12")]),a("br"),a("span",{staticClass:"line-number"},[s._v("13")]),a("br"),a("span",{staticClass:"line-number"},[s._v("14")]),a("br"),a("span",{staticClass:"line-number"},[s._v("15")]),a("br"),a("span",{staticClass:"line-number"},[s._v("16")]),a("br"),a("span",{staticClass:"line-number"},[s._v("17")]),a("br"),a("span",{staticClass:"line-number"},[s._v("18")]),a("br"),a("span",{staticClass:"line-number"},[s._v("19")]),a("br"),a("span",{staticClass:"line-number"},[s._v("20")]),a("br"),a("span",{staticClass:"line-number"},[s._v("21")]),a("br"),a("span",{staticClass:"line-number"},[s._v("22")]),a("br"),a("span",{staticClass:"line-number"},[s._v("23")]),a("br"),a("span",{staticClass:"line-number"},[s._v("24")]),a("br"),a("span",{staticClass:"line-number"},[s._v("25")]),a("br"),a("span",{staticClass:"line-number"},[s._v("26")]),a("br")])]),a("ul",[a("li",[a("code",[s._v('aapt dump badging your_apk_file.apk | grep "native-code"')]),s._v(": 查看 apk 是 32 位还是 64 位")]),s._v(" "),a("li",[a("code",[s._v('adb shell dumpsys package | grep "cpuAbi"')]),s._v(": 通过 adb 查看架构, not worked")]),s._v(" "),a("li",[a("code",[s._v("adb shell getprop ro.product.cpu.abilist")]),s._v(": 查看系统支持的 cpu 架构")])])],1)}),[],!1,null,null,null);a.default=e.exports}}]);
\ No newline at end of file
diff --git a/assets/js/187.33cf6355.js b/assets/js/187.33cf6355.js
new file mode 100644
index 0000000000..fae6726b98
--- /dev/null
+++ b/assets/js/187.33cf6355.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[187],{503:function(t,e,a){"use strict";a.r(e);var r=a(4),n=Object(r.a)({},(function(){var t=this,e=t._self._c;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h2",{attrs:{id:"属性"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#属性"}},[t._v("#")]),t._v(" 属性")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("android:angle")]),t._v(": 整型 渐变角度(PS: 当angle=0时,渐变色是从左向右。 然后逆时针方向转,当angle=90时为从下往上。angle必须为45的整数倍)")])]),t._v(" "),e("h2",{attrs:{id:"link"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#link"}},[t._v("#")]),t._v(" link")]),t._v(" "),e("ul",[e("li",[e("a",{attrs:{href:"https://cloud.tencent.com/developer/article/1013183",target:"_blank",rel:"noopener noreferrer"}},[t._v("Android GradientDrawable(shape标签定义) 静态使用和动态使用(圆角,渐变实现)"),e("OutboundLink")],1)])])])}),[],!1,null,null,null);e.default=n.exports}}]);
\ No newline at end of file
diff --git a/assets/js/188.2bee451f.js b/assets/js/188.2bee451f.js
new file mode 100644
index 0000000000..2fd387e9cc
--- /dev/null
+++ b/assets/js/188.2bee451f.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[188],{504:function(t,s,a){"use strict";a.r(s);var n=a(4),e=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h2",{attrs:{id:"window的softinputmode"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#window的softinputmode"}},[t._v("#")]),t._v(" window的SoftInputMode")]),t._v(" "),s("ul",[s("li",[t._v("SOFT_INPUT_ADJUST_PAN")]),t._v(" "),s("li",[t._v("SOFT_INPUT_ADJUST_RESIZE")]),t._v(" "),s("li",[t._v("SOFT_INPUT_STATE_ALWAYS_VISIBLE")]),t._v(" "),s("li",[t._v("SOFT_INPUT_STATE_ALWAYS_HIDDEN")])]),t._v(" "),s("h2",{attrs:{id:"case"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#case"}},[t._v("#")]),t._v(" case")]),t._v(" "),s("h3",{attrs:{id:"软键盘中window的flag设置"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#软键盘中window的flag设置"}},[t._v("#")]),t._v(" 软键盘中window的Flag设置")]),t._v(" "),s("blockquote",[s("p",[s("a",{attrs:{href:"https://developer.android.com/reference/android/view/WindowManager.LayoutParams",target:"_blank",rel:"noopener noreferrer"}},[t._v("WindowManager.LayoutParams"),s("OutboundLink")],1)])]),t._v(" "),s("div",{staticClass:"language-java line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-java"}},[s("code",[s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Window")]),t._v(" window "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" dialog"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getWindow")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("window "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setFlags")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("WindowManager"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LayoutParams")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("FLAG_NOT_TOUCH_MODAL")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("WindowManager"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LayoutParams")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("FLAG_NOT_TOUCH_MODAL")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setLayout")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("ViewGroup"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LayoutParams")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("MATCH_PARENT")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("ViewGroup"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LayoutParams")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("MATCH_PARENT")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setGravity")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Gravity")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("TOP")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Build")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("VERSION")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("SDK_INT")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Build")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("VERSION_CODES")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("LOLLIPOP")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("addFlags")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("WindowManager"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LayoutParams")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setStatusBarColor")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getResources")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("getColor")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token generics"}},[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setSoftInputMode")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("WindowManager"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LayoutParams")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("SOFT_INPUT_ADJUST_PAN")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("showEmoji"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("isBottomContainerEmpty"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setSoftInputMode")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("WindowManager"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LayoutParams")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("SOFT_INPUT_ADJUST_RESIZE")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setSoftInputMode")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("WindowManager"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LayoutParams")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("SOFT_INPUT_STATE_ALWAYS_VISIBLE")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("setSoftInputMode")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("WindowManager"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LayoutParams")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("SOFT_INPUT_STATE_ALWAYS_HIDDEN")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br"),s("span",{staticClass:"line-number"},[t._v("4")]),s("br"),s("span",{staticClass:"line-number"},[t._v("5")]),s("br"),s("span",{staticClass:"line-number"},[t._v("6")]),s("br"),s("span",{staticClass:"line-number"},[t._v("7")]),s("br"),s("span",{staticClass:"line-number"},[t._v("8")]),s("br"),s("span",{staticClass:"line-number"},[t._v("9")]),s("br"),s("span",{staticClass:"line-number"},[t._v("10")]),s("br"),s("span",{staticClass:"line-number"},[t._v("11")]),s("br"),s("span",{staticClass:"line-number"},[t._v("12")]),s("br"),s("span",{staticClass:"line-number"},[t._v("13")]),s("br"),s("span",{staticClass:"line-number"},[t._v("14")]),s("br"),s("span",{staticClass:"line-number"},[t._v("15")]),s("br"),s("span",{staticClass:"line-number"},[t._v("16")]),s("br"),s("span",{staticClass:"line-number"},[t._v("17")]),s("br"),s("span",{staticClass:"line-number"},[t._v("18")]),s("br"),s("span",{staticClass:"line-number"},[t._v("19")]),s("br"),s("span",{staticClass:"line-number"},[t._v("20")]),s("br")])])])}),[],!1,null,null,null);s.default=e.exports}}]);
\ No newline at end of file
diff --git a/assets/js/189.9ad6c9bc.js b/assets/js/189.9ad6c9bc.js
new file mode 100644
index 0000000000..96b7f52da2
--- /dev/null
+++ b/assets/js/189.9ad6c9bc.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[189],{505:function(t,a,r){"use strict";r.r(a);var e=r(4),l=Object(e.a)({},(function(){var t=this,a=t._self._c;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("blockquote",[a("p",[a("a",{attrs:{href:"https://juejin.cn/post/6981731047855620104",target:"_blank",rel:"noopener noreferrer"}},[t._v("颜色值透明度的百分数对应十六进制表"),a("OutboundLink")],1)])]),t._v(" "),a("p",[t._v("ARGB 依次代表透明度(alpha)、红色(red)、绿色(green)、蓝色(blue)。以颜色值 "),a("code",[t._v("#FF66CC99")]),t._v(" 为例, 其中, FF 是透明度, 66 是红色值, CC 是绿色值, 99 是蓝色值。")]),t._v(" "),a("h2",{attrs:{id:"alpha"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#alpha"}},[t._v("#")]),t._v(" alpha")]),t._v(" "),a("ul",[a("li",[t._v("透明度分为 256 个等级, 即 0 - 256, 0 就是透明, 255 就是不透明, 透明度 0(透明) –> 255(不透明) 对应着 16 进制 00(透明) –> FF(不透明), 比如: 50% 透明度;50% 也就是 256 的一半即 128, 因为是从 0 开始算的, 所以是 127, 转换成 16 进制就是 7F")]),t._v(" "),a("li",[t._v("透明度和 不透明度 是两个概念, 它们加起来是 1, 或者 100%.")]),t._v(" "),a("li",[t._v("ARGB 中的透明度 alpha, 表示的是不透明度。")])]),t._v(" "),a("h2",{attrs:{id:"link"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#link"}},[t._v("#")]),t._v(" link")]),t._v(" "),a("ul",[a("li",[a("a",{attrs:{href:"https://www.fly63.com/tool/color/",target:"_blank",rel:"noopener noreferrer"}},[t._v("rgb(a)、hex、hsl(a)、hsv(a)颜色转换工具"),a("OutboundLink")],1)])])])}),[],!1,null,null,null);a.default=l.exports}}]);
\ No newline at end of file
diff --git a/assets/js/19.afa8e383.js b/assets/js/19.afa8e383.js
new file mode 100644
index 0000000000..ff909256d8
--- /dev/null
+++ b/assets/js/19.afa8e383.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[19],{338:function(t,n,s){"use strict";s.r(n);var e=s(4),o=Object(e.a)({},(function(){return(0,this._self._c)("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}})}),[],!1,null,null,null);n.default=o.exports}}]);
\ No newline at end of file
diff --git a/assets/js/190.e09ec135.js b/assets/js/190.e09ec135.js
new file mode 100644
index 0000000000..94d69a11ee
--- /dev/null
+++ b/assets/js/190.e09ec135.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[190],{506:function(_,v,t){"use strict";t.r(v);var e=t(4),l=Object(e.a)({},(function(){var _=this,v=_._self._c;return v("ContentSlotsDistributor",{attrs:{"slot-key":_.$parent.slotKey}},[v("blockquote",[v("p",[_._v("本方法使用灰度值来辨别白屏")])]),_._v(" "),v("p",[_._v("白色的RGB值为(255, 255, 255), 在灰度转换的情况下, 根据给定的转换公式 "),v("code",[_._v("Gray = (Rx4 + Gx10 + Bx2) >> 8")]),_._v(", 计算得到的灰度值为: "),v("code",[_._v("Gray=(255x4+255x10+255x2)>>8=(1020+2550+510)>>8=4080>>8=15")])]),_._v(" "),v("h2",{attrs:{id:"方案"}},[v("a",{staticClass:"header-anchor",attrs:{href:"#方案"}},[_._v("#")]),_._v(" 方案")]),_._v(" "),v("ul",[v("li",[_._v("根据(x,y,w,h)取出指定区域的图像")]),_._v(" "),v("li",[_._v("将图片每个像素点的(R,G,B)转换为灰度值(0-15), 转换公式如下:\n"),v("code",[_._v("Gray = (Rx4 + Gx10 + Bx2) >> 8")])]),_._v(" "),v("li",[_._v("统计Gray的分布情况, 把各个灰度值的情况上报")]),_._v(" "),v("li",[_._v("为了避免过多上报, 我们会先计算一下白色的占比, 计算公式如下:\n"),v("code",[_._v("whiteRate = GrayArr[15] / TotalPixels")])]),_._v(" "),v("li",[_._v("当whiteRate大于0.9 (配置中心可配web.white_rate_threshold)我们才会上报")]),_._v(" "),v("li",[_._v("我们只能截屏幕可见区域的指定部分, 如果用户有滚动, 那么截取的可能就不是首屏的内容了")])]),_._v(" "),v("h2",{attrs:{id:"检测原理"}},[v("a",{staticClass:"header-anchor",attrs:{href:"#检测原理"}},[_._v("#")]),_._v(" 检测原理")]),_._v(" "),v("p",[_._v("这个白屏检测的原理基于对截取图像的灰度分布进行分析。具体步骤如下:")]),_._v(" "),v("ul",[v("li",[_._v("截取指定区域的图像: 根据给定的区域参数(x,y,w,h), 从屏幕截取指定位置的图像。")]),_._v(" "),v("li",[_._v("将图片每个像素点的(R,G,B)转换为灰度值: 对截取的图像进行灰度转换。"),v("RText",{attrs:{text:"灰度值是图像亮度的表示, 用一个数值表示整个像素的明暗程度"}}),_._v("。根据给定的转换公式 "),v("code",[_._v("Gray = (Rx4 + Gx10 + Bx2) >> 8")]),_._v(", 计算每个像素点的灰度值, 范围为0到15。")],1),_._v(" "),v("li",[_._v("统计灰度值的分布情况: 统计转换后的灰度值的分布情况, 得到每个灰度值出现的次数或比例。")]),_._v(" "),v("li",[_._v("计算白色占比: 根据灰度值的分布情况, 计算白色(灰度值为15)的占比, 即白色像素点在总像素点中的比例。")]),_._v(" "),v("li",[_._v("白屏检测: 当白色占比大于设定的阈值(例如0.9), 即白色像素点占据了大部分图像区域, 认为截取到的内容可能是白屏。")])]),_._v(" "),v("p",[_._v("这种方法的原理是基于白屏通常是整个屏幕大部分区域都是白色的特点。通过分析截取图像的灰度分布情况, 尤其是白色(灰度值最高)的占比, 可以判断当前页面是否呈现出白屏状态。这种方法可以有效避免截取到无效的白屏内容, 并且节省了上报的资源开销。")]),_._v(" "),v("h3",{attrs:{id:"灰度图像公式"}},[v("a",{staticClass:"header-anchor",attrs:{href:"#灰度图像公式"}},[_._v("#")]),_._v(" 灰度图像公式")]),_._v(" "),v("p",[v("code",[_._v("Gray = (Rx4 + Gx10 + Bx2) >> 8")]),_._v(" 是一个用于将彩色图像转换为灰度图像的公式。这个公式通过计算 RGB 三个通道的加权和来得到灰度值,其中绿色通道的权重较大,表明绿色对灰度值的影响最大。")]),_._v(" "),v("p",[_._v("让我们详细分析一下:")]),_._v(" "),v("RText",{attrs:{text:"公式含义:"}}),_._v(" "),v("ul",[v("li",[_._v("R:表示红色通道的值。")]),_._v(" "),v("li",[_._v("G:表示绿色通道的值。")]),_._v(" "),v("li",[_._v("B:表示蓝色通道的值。")]),_._v(" "),v("li",[_._v("Gray:表示最终的灰度值。")]),_._v(" "),v("li",[v("code",[_._v(">> 8")]),_._v(":表示右移 8 位,相当于除以 256。")])]),_._v(" "),v("RText",{attrs:{text:"加权平均:"}}),_._v(" "),v("p",[_._v("这个公式将红色、绿色、蓝色三个通道的值按照不同的权重加在一起:")]),_._v(" "),v("ul",[v("li",[_._v("红色的权重是 4。")]),_._v(" "),v("li",[_._v("绿色的权重是 10,比其他两个通道更高,反映了人眼对绿色更为敏感。")]),_._v(" "),v("li",[_._v("蓝色的权重是 2,相对较低。")])]),_._v(" "),v("p",[_._v("将它们加权后除以 256 来得到一个 0 到 15 的灰度值。")]),_._v(" "),v("RText",{attrs:{text:"具体步骤:"}}),_._v(" "),v("ul",[v("li",[_._v("计算加权值:"),v("code",[_._v("Rx4 + Gx10 + Bx2")]),_._v("。")]),_._v(" "),v("li",[_._v("红色的贡献是 "),v("code",[_._v("Rx4")])]),_._v(" "),v("li",[_._v("绿色的贡献是 "),v("code",[_._v("Gx10")])]),_._v(" "),v("li",[_._v("蓝色的贡献是 "),v("code",[_._v("Bx2")])]),_._v(" "),v("li",[_._v("右移 8 位:"),v("code",[_._v(">> 8")]),_._v(",即将计算结果除以 256。右移操作可以快速实现这种整数除法。")])]),_._v(" "),v("RText",{attrs:{text:"理由:"}}),_._v(" "),v("p",[_._v("使用加权平均是因为人眼对不同颜色的敏感度不同,通常对绿色最敏感,对红色次之,对蓝色最不敏感。这个公式中赋予了绿色较大的权重(10),而红色和蓝色的权重较小(4 和 2)。")]),_._v(" "),v("RText",{attrs:{text:"总结:"}}),_._v(" "),v("ul",[v("li",[_._v("红色、绿色 和 蓝色通道按照不同的权重加在一起,计算得到灰度值。")]),_._v(" "),v("li",[_._v("绿色的权重较高,符合人眼的感知特性。")]),_._v(" "),v("li",[_._v("通过位移操作快速实现除法来缩放结果到 0-255 范围内。")])])],1)}),[],!1,null,null,null);v.default=l.exports}}]);
\ No newline at end of file
diff --git a/assets/js/191.e442adbb.js b/assets/js/191.e442adbb.js
new file mode 100644
index 0000000000..ba5dcca756
--- /dev/null
+++ b/assets/js/191.e442adbb.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[191],{507:function(t,a,s){"use strict";s.r(a);var n=s(4),e=Object(n.a)({},(function(){var t=this,a=t._self._c;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("h2",{attrs:{id:"getidentifier"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#getidentifier"}},[t._v("#")]),t._v(" getIdentifier")]),t._v(" "),a("div",{staticClass:"language-java line-numbers-mode"},[a("pre",{pre:!0,attrs:{class:"language-java"}},[a("code",[t._v("val layoutID"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("resources"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("getIdentifier")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"activity_main"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"layout"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("packageName"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("setContentView")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("layoutID"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("setContentView")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("R")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("layout"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("activity_main"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])]),t._v(" "),a("div",{staticClass:"line-numbers-wrapper"},[a("span",{staticClass:"line-number"},[t._v("1")]),a("br"),a("span",{staticClass:"line-number"},[t._v("2")]),a("br"),a("span",{staticClass:"line-number"},[t._v("3")]),a("br"),a("span",{staticClass:"line-number"},[t._v("4")]),a("br")])]),a("blockquote",[a("p",[t._v("这两种形式在功能上都是设置一个活动(Activity)的布局(layout),但它们在实现和使用场景上有一些区别。")])]),t._v(" "),a("p",[t._v("A. "),a("code",[t._v("setContentView(R.layout.activity_main)")]),t._v(": 这是最常见和直接的方式来设置活动的布局。在编译时,Android 会根据 "),a("code",[t._v("res/layout/activity_main.xml")]),t._v(" 文件生成一个对应的 "),a("code",[t._v("R.layout.activity_main")]),t._v(" 常量。这个常量是一个静态整数 ID,指向布局资源。使用这种方式,代码简洁明了,容易理解和维护。")]),t._v(" "),a("p",[t._v("B. "),a("code",[t._v("setContentView(layoutID)")]),t._v(": 这种方式首先通过 resources.getIdentifier 方法在运行时动态获取资源 ID,然后再将其设置为内容视图。具体实现如下:")]),t._v(" "),a("div",{staticClass:"language-java line-numbers-mode"},[a("pre",{pre:!0,attrs:{class:"language-java"}},[a("code",[t._v("val layoutID "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" resources"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("getIdentifier")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"activity_main"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"layout"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" packageName"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("setContentView")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("layoutID"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])]),t._v(" "),a("div",{staticClass:"line-numbers-wrapper"},[a("span",{staticClass:"line-number"},[t._v("1")]),a("br"),a("span",{staticClass:"line-number"},[t._v("2")]),a("br")])]),a("RText",{attrs:{text:"使用场景"}}),t._v(" "),a("ol",[a("li",[t._v("动态资源加载:")])]),t._v(" "),a("ul",[a("li",[t._v("多布局支持: 如果你的应用需要在运行时根据某些条件(例如设备类型、用户设置、语言环境等)动态选择布局文件,可以使用这种方法。例如,可以根据屏幕尺寸加载不同的布局文件。")]),t._v(" "),a("li",[t._v("模块化资源: 在一些复杂项目中,布局文件可能会被动态地添加或移除。在这种情况下,使用字符串资源名称可以提供更灵活的资源管理方式。")])]),t._v(" "),a("ol",{attrs:{start:"2"}},[a("li",[t._v("国际化和本地化:")])]),t._v(" "),a("ul",[a("li",[t._v("多语言支持: 通过 getIdentifier,可以更方便地在代码中处理不同语言环境下的资源。例如,不同语言环境可能有不同的布局文件命名。")])]),t._v(" "),a("ol",{attrs:{start:"3"}},[a("li",[t._v("插件化和动态更新:")])]),t._v(" "),a("ul",[a("li",[t._v("插件系统: 如果你的应用有插件系统,并且插件的布局文件是动态加载的,那么可以使用这种方法来动态解析和加载插件资源。")]),t._v(" "),a("li",[t._v("热更新: 对于需要从服务器动态获取并加载布局文件的应用,可以在下载新的布局文件后,通过资源名称动态获取其 ID 并设置内容视图。")])]),t._v(" "),a("RText",{attrs:{text:"注意事项:"}}),t._v(" "),a("ul",[a("li",[t._v("性能:resources.getIdentifier 是一个相对耗时的操作,因为它是在运行时解析资源 ID。对于频繁调用的场景,要注意性能开销。")]),t._v(" "),a("li",[t._v("安全性: 动态获取资源 ID 的方式可能会因为资源名称拼写错误或者资源不存在而导致 layoutID 返回 0,从而引发 NullPointerException 或其他错误。因此,需要添加适当的错误处理。")]),t._v(" "),a("li",[t._v("代码可读性: 这种方式的代码可读性较低,维护起来可能不如直接使用 R.layout.activity_main 方便。")])])],1)}),[],!1,null,null,null);a.default=e.exports}}]);
\ No newline at end of file
diff --git a/assets/js/192.1d52114b.js b/assets/js/192.1d52114b.js
new file mode 100644
index 0000000000..d7058464b7
--- /dev/null
+++ b/assets/js/192.1d52114b.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[192],{508:function(e,s,t){"use strict";t.r(s);var a=t(4),i=Object(a.a)({},(function(){var e=this,s=e._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[s("p",[e._v("Deep Link(深度链接)是一种URL或链接,能够将用户直接引导到移动应用或网页中的特定内容或页面,而不仅仅是打开主页。这种链接提供了一种更直接和便捷的用户体验,特别是在移动应用程序中。")]),e._v(" "),s("h2",{attrs:{id:"分类"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#分类"}},[e._v("#")]),e._v(" 分类")]),e._v(" "),s("p",[e._v("根据具体的实现方式和使用场景,Deep Link 有几种类型:")]),e._v(" "),s("h3",{attrs:{id:"传统深度链接-classic-deep-links"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#传统深度链接-classic-deep-links"}},[e._v("#")]),e._v(" 传统深度链接(Classic Deep Links)")]),e._v(" "),s("ul",[s("li",[e._v("功能: 将用户从一个应用程序、网页或其他媒介引导到另一个应用中的特定页面或内容。")]),e._v(" "),s("li",[e._v("局限: 只能在应用已经安装的情况下工作。如果用户未安装该应用,点击深度链接将导致错误或无法打开。")])]),e._v(" "),s("p",[e._v("示例: "),s("code",[e._v("myapp://profile/123")]),e._v(" 可以直接打开应用中的某个用户的个人资料页面,而不是应用的主页。")]),e._v(" "),s("h3",{attrs:{id:"延迟深度链接-deferred-deep-links"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#延迟深度链接-deferred-deep-links"}},[e._v("#")]),e._v(" 延迟深度链接(Deferred Deep Links)")]),e._v(" "),s("ul",[s("li",[e._v("功能: 不仅在应用已安装时引导用户到特定内容,还能在应用未安装时,先将用户引导到应用商店下载安装应用,之后再自动跳转到目标内容页面。")]),e._v(" "),s("li",[e._v("优势: 提供了更灵活的体验,即使用户在点击链接时没有安装应用,安装后依然可以访问最初的目标页面。")])]),e._v(" "),s("RText",{attrs:{text:"使用场景"}}),e._v(" "),s("p",[e._v("用户点击了一个推荐或分享链接,未安装该应用时被引导至应用商店安装,安装后能够继续导航到原始推荐的页面。")]),e._v(" "),s("h3",{attrs:{id:"通用链接-universal-links"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#通用链接-universal-links"}},[e._v("#")]),e._v(" 通用链接(Universal Links)")]),e._v(" "),s("p",[e._v("功能: 用于在iOS系统中统一处理深度链接。它们可以根据用户设备上的应用状态,决定是打开应用还是加载相应的网页。即使用户没有安装应用,仍然会引导他们到网页版本。\n优势: iOS系统推荐的实现方式,无需使用自定义的 URL 方案,减少了 URL 冲突的风险。")]),e._v(" "),s("p",[e._v("示例: 点击 "),s("code",[e._v("https://example.com/profile/123")]),e._v(",如果用户安装了应用,会在应用中打开个人资料页面;如果未安装应用,则在浏览器中加载网页版本的个人资料页面。")]),e._v(" "),s("h3",{attrs:{id:"应用链接-app-links"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#应用链接-app-links"}},[e._v("#")]),e._v(" 应用链接(App Links)")]),e._v(" "),s("ul",[s("li",[e._v("功能: 用于在Android系统中实现类似于iOS通用链接的功能。根据用户的设备和应用状态,决定是否打开移动应用或网页。")]),e._v(" "),s("li",[e._v("优势: 类似于iOS通用链接的功能,在Android上提供了一种更简便的深度链接管理方式。")])]),e._v(" "),s("p",[e._v("示例:")]),e._v(" "),s("ul",[s("li",[e._v("当用户点击 https://example.com/profile/123,如果应用已安装,打开应用中的个人资料页面;如果应用未安装,打开网页。")])]),e._v(" "),s("h2",{attrs:{id:"deep-link的应用场景"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#deep-link的应用场景"}},[e._v("#")]),e._v(" Deep Link的应用场景")]),e._v(" "),s("ul",[s("li",[e._v("社交分享: 用户可以将应用中的特定内容(如文章、视频、个人资料等)分享给其他人,点击后直接进入应用的内容页面。")]),e._v(" "),s("li",[e._v("广告推广: 广告商可以使用深度链接将用户从广告引导到应用内的特定产品或优惠页面,从而提高转换率。")]),e._v(" "),s("li",[e._v("电子邮件营销: 邮件中嵌入的深度链接可以引导用户直接打开应用中的相关内容,而不需要额外的导航步骤。")])])],1)}),[],!1,null,null,null);s.default=i.exports}}]);
\ No newline at end of file
diff --git a/assets/js/193.dd17e4c6.js b/assets/js/193.dd17e4c6.js
new file mode 100644
index 0000000000..a6efa62a3f
--- /dev/null
+++ b/assets/js/193.dd17e4c6.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[193],{509:function(t,e,n){"use strict";n.r(e);var r=n(4),o=Object(r.a)({},(function(){var t=this._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[t("blockquote",[t("p",[t("a",{attrs:{href:"https://developer.android.com/training/articles/keystore?hl=zh-cn",target:"_blank",rel:"noopener noreferrer"}},[this._v("Android 密钥库系统"),t("OutboundLink")],1)])]),this._v(" "),t("p",[this._v("TODO")])])}),[],!1,null,null,null);e.default=o.exports}}]);
\ No newline at end of file
diff --git a/assets/js/194.807a9f9b.js b/assets/js/194.807a9f9b.js
new file mode 100644
index 0000000000..75ff1ff2cb
--- /dev/null
+++ b/assets/js/194.807a9f9b.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[194],{510:function(e,t,s){"use strict";s.r(t);var a=s(4),r=Object(a.a)({},(function(){var e=this,t=e._self._c;return t("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[t("div",{staticClass:"custom-block tip"},[t("p",{staticClass:"custom-block-title"},[e._v("提示")]),e._v(" "),t("p",[e._v("perfetto is a tool that lets you collect performance information from Android devices via the Android Debug Bridge (ADB). Invoke the perfetto tool using the "),t("code",[e._v("adb shell perfetto")]),e._v(" ... command. perfetto uses various sources to collect performance traces from your device, such as:")]),e._v(" "),t("ul",[t("li",[e._v("ftrace for information from the kernel")]),e._v(" "),t("li",[e._v("atrace for user-space annotation in services and apps")]),e._v(" "),t("li",[e._v("heapprofd for native memory usage information of services and apps")])]),e._v(" "),t("p",[e._v("作为客户端开发工程师, 更多的会注重在 Android 或者 iOS 客户端的优化, 下面以 Android 为主要场景, 进行说明\n更多内容参考: "),t("a",{attrs:{href:"https://developer.android.com/tools/perfetto",target:"_blank",rel:"noopener noreferrer"}},[e._v("android 官网给出的 perfetto command line 介绍"),t("OutboundLink")],1)]),e._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://perfetto.dev/docs/",target:"_blank",rel:"noopener noreferrer"}},[e._v("Perfetto*"),t("OutboundLink")],1),e._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://perfetto.dev/docs/reference/trace-config-proto",target:"_blank",rel:"noopener noreferrer"}},[e._v("Reference-Trace Config proto"),t("OutboundLink")],1)])])]),e._v(" "),t("li",[t("a",{attrs:{href:"https://perfetto.dev/docs/visualization/perfetto-ui",target:"_blank",rel:"noopener noreferrer"}},[e._v("perfetto-ui"),t("OutboundLink")],1)]),e._v(" "),t("li",[t("a",{attrs:{href:"https://developer.android.com/topic/performance/tracing",target:"_blank",rel:"noopener noreferrer"}},[e._v("android system trace 概览"),t("OutboundLink")],1)]),e._v(" "),t("li",[t("a",{attrs:{href:"https://blog.csdn.net/feelabclihu/article/details/126672666",target:"_blank",rel:"noopener noreferrer"}},[e._v("Perfetto 分析进阶-CSDN"),t("OutboundLink")],1)])])]),e._v(" "),t("h2",{attrs:{id:"custom-events"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#custom-events"}},[e._v("#")]),e._v(" custom-events")]),e._v(" "),t("ol",[t("li",[e._v("perfetto 跟 systrace 同样也支持自定义事件。 可以参考 "),t("a",{attrs:{href:"https://developer.android.com/topic/performance/tracing/custom-events?hl=zh-cn#java",target:"_blank",rel:"noopener noreferrer"}},[e._v("custom-events"),t("OutboundLink")],1)]),e._v(" "),t("li",[e._v("使用 perfetto 分析自定义事件时, 你可能需要配置 atrace, 相关的内容可见: "),t("a",{attrs:{href:"https://perfetto.dev/docs/data-sources/atrace#traceconfig",target:"_blank",rel:"noopener noreferrer"}},[e._v("ATrace: Android system and app trace events"),t("OutboundLink")],1)])]),e._v(" "),t("h2",{attrs:{id:"trace-config"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#trace-config"}},[e._v("#")]),e._v(" trace config")]),e._v(" "),t("blockquote",[t("p",[e._v("这里给出配置的 demo 定义, 将如下内容保存到文件中, 比如 config.pbtx 然后运行脚本 "),t("code",[e._v("./record_android_trace -o