mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 09:45:19 +08:00
19 lines
10 KiB
JavaScript
19 lines
10 KiB
JavaScript
import{_ as t,r as l,o as i,c as r,b as e,d as o,e as s,a as n}from"./app-BpUB8-Q8.js";const c={},d=n('<h1 id="migrate-to-yukihookapi-1-3-x" tabindex="-1"><a class="header-anchor" href="#migrate-to-yukihookapi-1-3-x" aria-hidden="true">#</a> Migrate to YukiHookAPI 1.3.x</h1><p><code>YukiHookAPI</code> has deprecated its own reflection API since <code>1.3.0</code>, you can read on to see what are the notes and new features.</p><div class="custom-container warning"><p class="custom-container-title">Notice</p><p>If you are using <code>1.2.x</code> and previous versions of <code>YukiHookAPI</code>, it is recommended to read <a href="move-to-api-1-2-x">Migrate to YukiHookAPI 1.2.x</a> instead of this document.</p></div><h2 id="self-reflection-api-deprecated" tabindex="-1"><a class="header-anchor" href="#self-reflection-api-deprecated" aria-hidden="true">#</a> Self-reflection API Deprecated</h2>',4),p=e("code",null,"YukiHookAPI",-1),h=e("code",null,"1.3.0",-1),u={href:"https://github.com/HighCapable/KavaRef",target:"_blank",rel:"noopener noreferrer"},m=e("code",null,"YukiHookAPI",-1),v={href:"https://highcapable.github.io/KavaRef/en/config/migration",target:"_blank",rel:"noopener noreferrer"},A=e("code",null,"KavaRef",-1),y=e("p",null,[e("code",null,"YukiHookAPI"),o(" has now implemented complete decoupling of the reflection API. The reflection API used by its internal API has also been migrated to "),e("code",null,"KavaRef"),o(" and has been tested stably.")],-1),f=e("p",null,[o("In later versions of "),e("code",null,"2.0.0"),o(", the self-reflection API will be completely removed, during which time you will have enough time to learn and migrate to this brand new set of reflection APIs.")],-1),b=e("h2",{id:"freereflection-deprecated",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#freereflection-deprecated","aria-hidden":"true"},"#"),o(" FreeReflection Deprecated")],-1),g=e("code",null,"YukiHookAPI",-1),k={href:"https://github.com/tiann/FreeReflection",target:"_blank",rel:"noopener noreferrer"},B=e("code",null,"1.3.0",-1),D={href:"https://github.com/LSPosed/AndroidHiddenApiBypass",target:"_blank",rel:"noopener noreferrer"},_=n(`<p>When the reflection system hides the API, you cannot reflect directly like before, but need to do some operations.</p><p>YukiHookAPI has built-in <code>AndroidHiddenApiBypassResolver</code> in <code>KavaRef</code>'s third-party Member parser, and now you can use it like this where you need the reflection system to hide the API.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#96D0FF;">"android.app.ActivityThread"</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">toClass</span><span style="color:#ADBAC7;">()</span></span>
|
|
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
|
|
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#768390;">// Add a custom Member parser</span></span>
|
|
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">processor</span><span style="color:#ADBAC7;">(AndroidHiddenApiBypassResolver.</span><span style="color:#DCBDFB;">get</span><span style="color:#ADBAC7;">())</span></span>
|
|
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
|
|
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">"currentActivityThread"</span></span>
|
|
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">emptyParameters</span><span style="color:#ADBAC7;">()</span></span>
|
|
<span class="line"><span style="color:#ADBAC7;"> }.</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">()</span></span>
|
|
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,4),C={class:"custom-container warning"},w=e("p",{class:"custom-container-title"},"Notice",-1),P=e("code",null,"AndroidHiddenApiBypassResolver",-1),I=e("code",null,"2.0.0",-1),x={href:"https://highcapable.github.io/KavaRef/en/config/processor-resolvers",target:"_blank",rel:"noopener noreferrer"},F=e("code",null,"KavaRef",-1),H=n(`<h2 id="original-method-call" tabindex="-1"><a class="header-anchor" href="#original-method-call" aria-hidden="true">#</a> Original Method Call</h2><p><code>Xposed</code> provides the <code>XposedBridge.invokeOriginalMethod</code> function, which can call original methods without a Hook.</p><p>Due to deprecation of the self-reflection API, the method <code>method { ... }.get().original().call(...)</code> will no longer be available.</p><p>So, YukiHookAPI has added an extension to <code>KavaRef</code>, and you can still implement this feature now.</p><p><code>YukiHookAPI</code> provides the following methods to connect to the original method calls of <code>KavaRef</code>.</p><ul><li><code>invokeOriginal(...)</code> → <code>invoke(...)</code></li><li><code>invokeOriginalQuietly(...)</code> → <code>invokeQuietly(...)</code></li></ul><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an instance of the Test class</span></span>
|
|
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> instance: </span><span style="color:#F69D50;">Any</span></span>
|
|
<span class="line"><span style="color:#768390;">// Original call to the method using KavaRef</span></span>
|
|
<span class="line"><span style="color:#96D0FF;">"com.example.Test"</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">toClass</span><span style="color:#ADBAC7;">()</span></span>
|
|
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
|
|
<span class="line"><span style="color:#ADBAC7;"> .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
|
|
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">"test"</span></span>
|
|
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">emptyParameters</span><span style="color:#ADBAC7;">()</span></span>
|
|
<span class="line"><span style="color:#ADBAC7;"> }.</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(instance).</span><span style="color:#DCBDFB;">invokeOriginal</span><span style="color:#ADBAC7;">()</span></span>
|
|
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="repeat-hook-restricted-deprecated" tabindex="-1"><a class="header-anchor" href="#repeat-hook-restricted-deprecated" aria-hidden="true">#</a> Repeat Hook Restricted Deprecated</h2><p><code>YukiHookAPI</code> has deprecated the restriction of duplicate Hook since the <code>1.3.0</code> version. Now, <code>YukiHookAPI</code> no longer limits duplicate Hooks to the same method, you can hook multiple times on the same method.</p><p><code>YukiHookAPI</code> also deprecated the <code>onAlreadyHooked</code> method of <code>hook { ... }</code>. Now this method will be useless and will not be called back. If necessary, please manually handle the relevant logic of duplicate Hooks.</p><h2 id="register-module-app-s-activity-behavior-change" tabindex="-1"><a class="header-anchor" href="#register-module-app-s-activity-behavior-change" aria-hidden="true">#</a> Register Module App's Activity Behavior Change</h2><p><code>YukiHookAPI</code> starting with <code>1.3.0</code>, the way in which the module <code>Activity</code> behavior has changed.</p><p>Please read <a href="../api/special-features/host-inject#register-module-app-s-activity">Register Module App's Activity</a> for more information.</p><h2 id="ylog-behavior-change" tabindex="-1"><a class="header-anchor" href="#ylog-behavior-change" aria-hidden="true">#</a> YLog Behavior Change</h2><p><code>YukiHookAPI</code> allows the <code>msg</code> parameter of <code>YLog</code> to be passed into any object starting from <code>1.3.0</code>, and they will be automatically converted using the <code>toString()</code> method.</p>`,16);function R(Y,q){const a=l("ExternalLinkIcon");return i(),r("div",null,[d,e("p",null,[p,o(" has deprecated its own reflection API since the "),h,o(" version. Now we recommend that all developers move to a brand new development. "),e("a",u,[o("KavaRef"),s(a)]),o(", we no longer recommend the reflection API of "),m,o(" itself, which have been marked as deprecated.")]),e("p",null,[o("Please refer to the migration document "),e("a",v,[o("here"),s(a)]),o(" which will jump to the "),A,o(" document.")]),y,f,b,e("p",null,[g,o(" has deprecated "),e("a",k,[o("FreeReflection"),s(a)]),o(" since the "),B,o(" version and migrated to a maintained by the LSPosed team "),e("a",D,[o("AndroidHiddenApiBypass"),s(a)]),o(".")]),_,e("div",C,[w,e("p",null,[P,o(" is a tentative feature and may be migrated to a separate module in the "),I,o(" version, you can also refer to "),e("a",x,[o("Third-party Member Resolvers"),s(a)]),o(" implement one by yourself, which will jump to the "),F,o(" document.")])]),H])}const M=t(c,[["render",R],["__file","move-to-api-1-3-x.html.vue"]]);export{M as default};
|