@@ -2636,4 +2636,79 @@ public static Method loadSetPinnedLimitMethod(ClassLoader classLoader) throws Ex
26362636 return method ;
26372637 });
26382638 }
2639+
2640+ public static Method loadManualProcessVideoQualityMethod (ClassLoader classLoader ) throws Exception {
2641+ return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
2642+ var processVideoQuality = Unobfuscator .loadProcessVideoQualityClass (classLoader );
2643+ var methods = dexkit .findMethod (FindMethod .create ().matcher (MethodMatcher .create ().addUsingString ("dimensions_are_zero" ).returnType (processVideoQuality )));
2644+ if (methods .isEmpty ())
2645+ throw new NoSuchMethodException ("ManualProcessVideoQuality method not found" );
2646+ return methods .get (0 ).getMethodInstance (classLoader );
2647+ });
2648+
2649+ }
2650+
2651+ public static Method loadAutoProcessVideoQualityMethod (ClassLoader classLoader ) throws Exception {
2652+ return UnobfuscatorCache .getInstance ().getMethod (classLoader , () -> {
2653+ var processVideoQuality = Unobfuscator .loadProcessVideoQualityClass (classLoader );
2654+ var methods = dexkit .findMethod (FindMethod .create ().matcher (MethodMatcher .create ().addUsingString ("min_bandwidth" ).addUsingString ("network_types" ).returnType (processVideoQuality )));
2655+ if (methods .isEmpty ())
2656+ throw new NoSuchMethodException ("ManualProcessVideoQuality method not found" );
2657+ return methods .get (0 ).getMethodInstance (classLoader );
2658+ });
2659+
2660+ }
2661+
2662+
2663+ public static HashMap <String , Field > getAllMapFields (Class <?> clazz ) throws Exception {
2664+ var cache = UnobfuscatorCache .getInstance ();
2665+ var classLoader = clazz .getClassLoader ();
2666+ if (cache != null && classLoader != null ) {
2667+ var cacheKey = "getAllMapFields:" + clazz .getName ();
2668+ return cache .getMapField (classLoader , cacheKey , () -> buildAllMapFields (clazz ));
2669+ }
2670+ return buildAllMapFields (clazz );
2671+ }
2672+
2673+ private static HashMap <String , Field > buildAllMapFields (Class <?> clazz ) throws Exception {
2674+ Method methodString ;
2675+ try {
2676+ methodString = clazz .getDeclaredMethod ("toString" );
2677+ } catch (Exception e ) {
2678+ return new HashMap <>();
2679+ }
2680+ var methodData = dexkit .getMethodData (methodString );
2681+ var usingFields = Objects .requireNonNull (methodData ).getUsingFields ();
2682+ var usingStrings = Objects .requireNonNull (methodData ).getUsingStrings ();
2683+ var result = new HashMap <String , Field >();
2684+ var idxFields = 0 ;
2685+ for (int i = 0 ; i < usingStrings .size (); i ++) {
2686+ if (idxFields == usingFields .size ()) break ;
2687+ var raw = usingStrings .get (i );
2688+ if (raw == null ) continue ;
2689+ var string = raw .strip ();
2690+ if (string .isEmpty ()) continue ;
2691+ int eq = string .lastIndexOf ('=' );
2692+ if (eq < 0 ) continue ;
2693+ int start = 0 ;
2694+ for (int j = eq - 1 ; j >= 0 ; j --) {
2695+ char c = string .charAt (j );
2696+ if (c == '\'' || c == ',' || c == ' ' || c == '(' || c == ')' || c == ':' || c == '{' || c == '}' ) {
2697+ start = j + 1 ;
2698+ break ;
2699+ }
2700+ }
2701+ if (start >= eq ) continue ;
2702+ var name = string .substring (start , eq );
2703+ var field = usingFields .get (idxFields ).getField ().getFieldInstance (clazz .getClassLoader ());
2704+ result .put (name , field );
2705+ idxFields ++;
2706+ }
2707+ return result ;
2708+ }
2709+
2710+ public static Class <?> loadMediaDataVideoConfigurationClass (ClassLoader classLoader ) throws Exception {
2711+ return UnobfuscatorCache .getInstance ().getClass (classLoader , () -> findFirstClassUsingStrings (classLoader , StringMatchType .Contains , "MediaDataVideoConfiguration(" ));
2712+ }
2713+
26392714}
0 commit comments