@@ -40,10 +40,14 @@ public class TinkerLoadResult {
40
40
public SharePatchInfo patchInfo ;
41
41
//@Nullable
42
42
public String currentVersion ;
43
+ //@Nullable
44
+ public String oatDir ;
45
+
46
+ public boolean versionChanged ;
43
47
44
- public boolean versionChanged ;
48
+ public boolean useInterpretMode ;
45
49
46
- public boolean systemOTA ;
50
+ public boolean systemOTA ;
47
51
48
52
//@Nullable
49
53
public File patchVersionDirectory ;
@@ -74,10 +78,13 @@ public boolean parseTinkerResult(Context context, Intent intentResult) {
74
78
75
79
costTime = ShareIntentUtil .getIntentPatchCostTime (intentResult );
76
80
systemOTA = ShareIntentUtil .getBooleanExtra (intentResult , ShareIntentUtil .INTENT_PATCH_SYSTEM_OTA , false );
81
+ oatDir = ShareIntentUtil .getStringExtra (intentResult , ShareIntentUtil .INTENT_PATCH_OAT_DIR );
82
+ useInterpretMode = ShareConstants .INTERPRET_DEX_OPTIMIZE_PATH .equals (oatDir );
83
+
77
84
final boolean isMainProcess = tinker .isMainProcess ();
78
85
79
- TinkerLog .i (TAG , "parseTinkerResult loadCode:%d, process name:%s, main process:%b, systemOTA:%b" ,
80
- loadCode , ShareTinkerInternals .getProcessName (context ), isMainProcess , systemOTA );
86
+ TinkerLog .i (TAG , "parseTinkerResult loadCode:%d, process name:%s, main process:%b, systemOTA:%b, oatDir:%s, useInterpretMode:%b " ,
87
+ loadCode , ShareTinkerInternals .getProcessName (context ), isMainProcess , systemOTA , oatDir , useInterpretMode );
81
88
82
89
//@Nullable
83
90
final String oldVersion = ShareIntentUtil .getStringExtra (intentResult , ShareIntentUtil .INTENT_PATCH_OLD_VERSION );
@@ -87,7 +94,6 @@ public boolean parseTinkerResult(Context context, Intent intentResult) {
87
94
final File patchDirectory = tinker .getPatchDirectory ();
88
95
final File patchInfoFile = tinker .getPatchInfoFile ();
89
96
90
-
91
97
if (oldVersion != null && newVersion != null ) {
92
98
if (isMainProcess ) {
93
99
currentVersion = newVersion ;
@@ -107,7 +113,7 @@ public boolean parseTinkerResult(Context context, Intent intentResult) {
107
113
resourceDirectory = new File (patchVersionDirectory , ShareConstants .RES_PATH );
108
114
resourceFile = new File (resourceDirectory , ShareConstants .RES_NAME );
109
115
}
110
- patchInfo = new SharePatchInfo (oldVersion , newVersion , Build .FINGERPRINT );
116
+ patchInfo = new SharePatchInfo (oldVersion , newVersion , Build .FINGERPRINT , oatDir );
111
117
versionChanged = !(oldVersion .equals (newVersion ));
112
118
}
113
119
@@ -123,9 +129,6 @@ public boolean parseTinkerResult(Context context, Intent intentResult) {
123
129
case ShareConstants .ERROR_LOAD_PATCH_VERSION_DEX_LOAD_EXCEPTION :
124
130
errorCode = ShareConstants .ERROR_LOAD_EXCEPTION_DEX ;
125
131
break ;
126
- case ShareConstants .ERROR_LOAD_PATCH_VERSION_PARALLEL_DEX_OPT_EXCEPTION :
127
- errorCode = ShareConstants .ERROR_LOAD_EXCEPTION_DEX_OPT ;
128
- break ;
129
132
case ShareConstants .ERROR_LOAD_PATCH_VERSION_RESOURCE_LOAD_EXCEPTION :
130
133
errorCode = ShareConstants .ERROR_LOAD_EXCEPTION_RESOURCE ;
131
134
break ;
@@ -308,6 +311,12 @@ public boolean parseTinkerResult(Context context, Intent intentResult) {
308
311
tinker .getLoadReporter ().onLoadFileMd5Mismatch (resourceFile ,
309
312
ShareConstants .TYPE_RESOURCE );
310
313
break ;
314
+ case ShareConstants .ERROR_LOAD_PATCH_GET_OTA_INSTRUCTION_SET_EXCEPTION :
315
+ tinker .getLoadReporter ().onLoadInterpret (ShareConstants .TYPE_INTERPRET_GET_INSTRUCTION_SET_ERROR , ShareIntentUtil .getIntentInterpretException (intentResult ));
316
+ break ;
317
+ case ShareConstants .ERROR_LOAD_PATCH_OTA_INTERPRET_ONLY_EXCEPTION :
318
+ tinker .getLoadReporter ().onLoadInterpret (ShareConstants .TYPE_INTERPRET_COMMAND_ERROR , ShareIntentUtil .getIntentInterpretException (intentResult ));
319
+ break ;
311
320
case ShareConstants .ERROR_LOAD_OK :
312
321
TinkerLog .i (TAG , "oh yeah, tinker load all success" );
313
322
tinker .setTinkerLoaded (true );
@@ -317,6 +326,9 @@ public boolean parseTinkerResult(Context context, Intent intentResult) {
317
326
318
327
packageConfig = ShareIntentUtil .getIntentPackageConfig (intentResult );
319
328
329
+ if (useInterpretMode ) {
330
+ tinker .getLoadReporter ().onLoadInterpret (ShareConstants .TYPE_INTERPRET_OK , null );
331
+ }
320
332
if (isMainProcess && versionChanged ) {
321
333
//change the old version to new
322
334
tinker .getLoadReporter ().onLoadPatchVersionChanged (oldVersion , newVersion , patchDirectory , patchVersionDirectory .getName ());
0 commit comments