1010import java .lang .reflect .Method ;
1111import java .lang .reflect .Field ;
1212
13- /**
14- * Schedule a safe install after initialization.
15- * Call this from your smali injection.
16- */
13+
14+
15+
1716public class TintFieldHook {
1817 private static final String TAG = "CustomFilterHook" ;
1918 private static boolean installed = false ;
@@ -27,14 +26,8 @@ public static void scheduleInstall(final Object toolTable) {
2726 installed = true ;
2827
2928 // Ensure this runs on the main thread after a short delay
30- new Handler (Looper .getMainLooper ()).postDelayed (() -> {
31- try {
32- installTintField (toolTable );
33- } catch (Throwable t ) {
34- Log .e (TAG , "scheduled install failed" , t );
35- }
36- }, 300 ); // 300ms delay gives initialize() time to finish
37- }
29+ new Handler (Looper .getMainLooper ()).postDelayed (() -> installTintField (toolTable ), 500 );
30+ } // <-- close scheduleInstall here
3831
3932 /**
4033 * Main hook: safely introspect the toolTable.
@@ -51,10 +44,12 @@ public static void installTintField(Object toolTable) {
5144 // Example: safely list all fields
5245 Field [] fields = toolTable .getClass ().getDeclaredFields ();
5346 for (Field f : fields ) {
54- f .setAccessible (true );
55- Object value = null ;
56- try { value = f .get (toolTable ); } catch (Throwable ignored ) {}
57- Log .i (TAG , "Field: " + f .getName () + " | Type: " + f .getType ().getSimpleName () + " | Value: " + value );
47+ try {
48+ f .setAccessible (true );
49+ Log .i (TAG , "Field: " + f .getName () + " | Type: " + f .getType ().getSimpleName () + " | Value: " + f .get (toolTable ));
50+ } catch (Throwable t ) {
51+ Log .w (TAG , "Could not read field: " + f .getName (), t );
52+ }
5853 }
5954
6055 // Example: safely call a method (if exists)
@@ -67,7 +62,6 @@ public static void installTintField(Object toolTable) {
6762 }
6863
6964 // === INSERT CUSTOM FILTER SLOT LOGIC BELOW ===
70- // At this point you can add your UI components / custom slot safely
7165 Log .i (TAG , "Custom filter hook ready for adding filter slot!" );
7266
7367 } catch (Throwable e ) {
0 commit comments