@@ -240,10 +240,10 @@ private static void triggerPMDexOptOnDemand(Context context, String dexPath, Str
240240 ShareTinkerLog .i (TAG , "[+] Oat file %s should be valid, skip triggering dexopt." , oatPath );
241241 return ;
242242 }
243- for (int i = 0 ; i < 5 ; ++i ) {
243+ for (int i = 0 ; i < 20 ; ++i ) {
244244 if (ShareTinkerInternals .isNewerOrEqualThanVersion (31 , true )
245- && !"xiaomi" .equalsIgnoreCase (Build .MANUFACTURER ) && !"redmi" .equalsIgnoreCase (Build .MANUFACTURER )
246- && !"oppo" .equalsIgnoreCase (Build .MANUFACTURER ) && !"vivo" .equalsIgnoreCase (Build .MANUFACTURER )) {
245+ && !"xiaomi" .equalsIgnoreCase (Build .MANUFACTURER ) && !"redmi" .equalsIgnoreCase (Build .MANUFACTURER )
246+ && !"oppo" .equalsIgnoreCase (Build .MANUFACTURER ) && !"vivo" .equalsIgnoreCase (Build .MANUFACTURER )) {
247247 try {
248248 registerDexModule (context , dexPath );
249249 if (SharePatchFileUtil .isLegalFile (oatFile )) {
@@ -280,20 +280,26 @@ private static void triggerPMDexOptOnDemand(Context context, String dexPath, Str
280280 ShareTinkerLog .printErrStackTrace (TAG , thr , "[-] Error." );
281281 }
282282 SystemClock .sleep (1000 );
283+ }
284+ if (!SharePatchFileUtil .isLegalFile (oatFile )) {
283285 if ("huawei" .equalsIgnoreCase (Build .MANUFACTURER ) || "honor" .equalsIgnoreCase (Build .MANUFACTURER )) {
284- try {
285- registerDexModule (context , dexPath );
286- if (SharePatchFileUtil .isLegalFile (oatFile )) {
287- break ;
286+ for (int i = 0 ; i < 5 ; ++i ) {
287+ try {
288+ registerDexModule (context , dexPath );
289+ if (SharePatchFileUtil .isLegalFile (oatFile )) {
290+ break ;
291+ }
292+ } catch (Throwable thr ) {
293+ ShareTinkerLog .printErrStackTrace (TAG , thr , "[-] Error." );
288294 }
289- } catch (Throwable thr ) {
290- ShareTinkerLog .printErrStackTrace (TAG , thr , "[-] Error." );
295+ SystemClock .sleep (3000 );
296+ }
297+ if (!SharePatchFileUtil .isLegalFile (oatFile )) {
298+ throw new IllegalStateException ("No odex file was generated after calling registerDexModule" );
291299 }
300+ } else {
301+ throw new IllegalStateException ("No odex file was generated after calling performDexOptSecondary" );
292302 }
293- SystemClock .sleep (3000 );
294- }
295- if (!SharePatchFileUtil .isLegalFile (oatFile )) {
296- throw new IllegalStateException ("No odex file was generated after calling performDexOptSecondary" );
297303 }
298304 }
299305
0 commit comments