@@ -22,67 +22,165 @@ import android.content.Context
2222import android.content.Intent
2323
2424import com.sevtinge.hyperceiler.hook.module.base.BaseHook
25+ import com.sevtinge.hyperceiler.hook.module.base.tool.AppsTool.getPackageVersionCode
2526import com.sevtinge.hyperceiler.hook.utils.extension.getString
2627import com.sevtinge.hyperceiler.hook.utils.getObjectField
2728import io.github.kyuubiran.ezxhelper.core.finder.MethodFinder.`-Static`.methodFinder
29+ import io.github.kyuubiran.ezxhelper.core.misc.params
2830import io.github.kyuubiran.ezxhelper.core.util.ClassUtil.loadClass
2931import io.github.kyuubiran.ezxhelper.xposed.dsl.HookFactory.`-Static`.createHook
3032import org.json.JSONArray
3133import org.json.JSONObject
3234
3335object FlashLightNotificationColor : BaseHook() {
3436 override fun init () {
35- loadClass(" miui.systemui.flashlight.MiFlashlightManager" ).methodFinder()
36- .filterByName(" getExtraMiuiFocusParam" )
37- .single().createHook {
38- after {
39- val mContext = it.thisObject.getObjectField(" context" ) as Context
40- val stringTitle = mContext.getString(" flashlight_notification_content_title" )
41- val stringText = mContext.getString(" flashlight_notification_content_text" )
42- val button = mContext.getString(" flashlight_notification_button" )
43- val intent = Intent (" miui.systemui.action.ACTION_CLOSE_FLASHLIGHT" ).apply {
44- setPackage(" miui.systemui.plugin" )
45- }
46- val uri = intent.toUri(Intent .URI_INTENT_SCHEME )
47-
48- val paramV2Obj = JSONObject ().apply {
49- put(" protocol" , 1 )
50- put(" ticker" , stringText)
51- put(" tickerPic" , " miui.focus.pic_ticker_pic" )
52- put(" tickerPicDark" , " miui.focus.pic_ticker_pic" )
53- put(" aodTitle" , stringText)
54- put(" aodPic" , " miui.focus.pic_ado_pic" )
55- put(" scene" , " template_v2" )
56- put(" enableFloat" , true )
57- put(" updatable" , true )
58- put(" reopen" , " reopen" )
59- put(" baseInfo" , JSONObject ().apply {
60- put(" title" , stringTitle)
61- put(" colorTitle" , " " )
62- put(" content" , stringText)
63- put(" colorContent" , " " )
64- put(" subContent" , " " )
65- put(" colorSubContent" , " " )
66- put(" type" , 2 )
67- })
68- put(" bgInfo" , JSONObject ().apply {
69- put(" colorBg" , " " )
70- })
71- put(" actions" , JSONArray ().apply {
72- put(JSONObject ().apply {
73- put(" actionTitle" , button)
74- put(" actionIntentType" , 2 )
75- put(" actionIntent" , uri)
76- put(" actionIcon" , " miui.focus.pic_mark_v2" )
37+ if (getPackageVersionCode(lpparam) >= 170000000 ) {
38+ loadClass(" miui.systemui.flashlight.NotificationManager" ).methodFinder()
39+ .filterByName(" getExtraMiuiFocusParam" )
40+ .single().createHook {
41+ before {
42+ val mContext = it.args[0 ] as Context
43+ val stringTitle = mContext.getString(" flashlight_notification_content_title" )
44+ val stringText = mContext.getString(" flashlight_notification_content_text" )
45+ val button = mContext.getString(" flashlight_notification_button" )
46+ val intent = Intent (" miui.systemui.action.ACTION_CLOSE_FLASHLIGHT" ).apply {
47+ setPackage(" miui.systemui.plugin" )
48+ }
49+ val uri = intent.toUri(Intent .URI_INTENT_SCHEME )
50+
51+ val paramV2Obj = JSONObject ().apply {
52+ put(" protocol" , 1 )
53+ put(" business" , " miui_flashlight" )
54+ put(" ticker" , stringText)
55+ put(" tickerPic" , " miui.focus.pic_ticker_pic" )
56+ put(" tickerPicDark" , " miui.focus.pic_ticker_pic" )
57+ put(" aodTitle" , stringText)
58+ put(" aodPic" , " miui.focus.pic_ado_pic" )
59+ put(" scene" , " template_v2" )
60+ put(" enableFloat" , false )
61+ put(" updatable" , true )
62+ put(" reopen" , " reopen" )
63+ put(" islandFirstFloat" , false )
64+
65+ put(" param_island" , JSONObject ().apply {
66+ put(" islandProperty" , 2 )
67+
68+ put(" bigIslandArea" , JSONObject ().apply {
69+ put(" imageTextInfoLeft" , JSONObject ().apply {
70+ put(" type" , 1 )
71+ put(" picInfo" , JSONObject ().apply {
72+ put(" type" , 3 )
73+ put(" pic" , " flash_light_icon" )
74+ })
75+ })
76+ })
77+
78+ put(" smallIslandArea" , JSONObject ().apply {
79+ put(" picInfo" , JSONObject ().apply {
80+ put(" type" , 3 )
81+ put(" pic" , " flash_light_icon" )
82+ })
83+ })
7784 })
78- })
79- }
80- val jSONObject = JSONObject ().apply {
81- put(" param_v2" , paramV2Obj)
85+
86+ put(" baseInfo" , JSONObject ().apply {
87+ put(" title" , stringTitle)
88+ put(" colorTitle" , " " )
89+ put(" content" , stringText)
90+ put(" colorContent" , " " )
91+ put(" subContent" , " " )
92+ put(" colorSubContent" , " " )
93+ put(" type" , 2 )
94+ })
95+
96+ put(" bgInfo" , JSONObject ().apply {
97+ put(" colorBg" , " " )
98+ })
99+
100+ put(" iconTextInfo" , JSONObject ().apply {
101+ put(" title" , stringTitle)
102+ put(" content" , stringText)
103+ put(" subContent" , " " )
104+ put(" colorSubContent" , " " )
105+ put(" colorSubContentDark" , " " )
106+ put(" animIconInfo" , JSONObject ().apply {
107+ put(" src" , " doubleCharge" )
108+ put(" type" , " 2" )
109+ })
110+ })
111+
112+ put(" actions" , JSONArray ().apply {
113+ put(JSONObject ().apply {
114+ put(" actionTitle" , button)
115+ put(" actionIntentType" , 2 )
116+ put(" actionIntent" , uri)
117+ put(" actionIcon" , " miui.focus.pic_mark_v2" )
118+ })
119+ })
120+ }
121+
122+ val resultObj = JSONObject ().apply {
123+ put(" param_v2" , paramV2Obj)
124+ }
125+
126+ it.result = resultObj.toString()
127+
82128 }
129+ }
130+ } else {
131+ loadClass(" miui.systemui.flashlight.MiFlashlightManager" ).methodFinder()
132+ .filterByName(" getExtraMiuiFocusParam" )
133+ .single().createHook {
134+ after {
135+ val mContext = it.thisObject.getObjectField(" context" ) as Context
136+ val stringTitle =
137+ mContext.getString(" flashlight_notification_content_title" )
138+ val stringText = mContext.getString(" flashlight_notification_content_text" )
139+ val button = mContext.getString(" flashlight_notification_button" )
140+ val intent = Intent (" miui.systemui.action.ACTION_CLOSE_FLASHLIGHT" ).apply {
141+ setPackage(" miui.systemui.plugin" )
142+ }
143+ val uri = intent.toUri(Intent .URI_INTENT_SCHEME )
83144
84- it.result = jSONObject.toString()
145+ val paramV2Obj = JSONObject ().apply {
146+ put(" protocol" , 1 )
147+ put(" ticker" , stringText)
148+ put(" tickerPic" , " miui.focus.pic_ticker_pic" )
149+ put(" tickerPicDark" , " miui.focus.pic_ticker_pic" )
150+ put(" aodTitle" , stringText)
151+ put(" aodPic" , " miui.focus.pic_ado_pic" )
152+ put(" scene" , " template_v2" )
153+ put(" enableFloat" , true )
154+ put(" updatable" , true )
155+ put(" reopen" , " reopen" )
156+ put(" baseInfo" , JSONObject ().apply {
157+ put(" title" , stringTitle)
158+ put(" colorTitle" , " " )
159+ put(" content" , stringText)
160+ put(" colorContent" , " " )
161+ put(" subContent" , " " )
162+ put(" colorSubContent" , " " )
163+ put(" type" , 2 )
164+ })
165+ put(" bgInfo" , JSONObject ().apply {
166+ put(" colorBg" , " " )
167+ })
168+ put(" actions" , JSONArray ().apply {
169+ put(JSONObject ().apply {
170+ put(" actionTitle" , button)
171+ put(" actionIntentType" , 2 )
172+ put(" actionIntent" , uri)
173+ put(" actionIcon" , " miui.focus.pic_mark_v2" )
174+ })
175+ })
176+ }
177+ val jSONObject = JSONObject ().apply {
178+ put(" param_v2" , paramV2Obj)
179+ }
180+
181+ it.result = jSONObject.toString()
182+ }
85183 }
86- }
184+ }
87185 }
88186}
0 commit comments