17
17
package com .facebook .soloader .recovery ;
18
18
19
19
import com .facebook .soloader .BackupSoSource ;
20
+ import com .facebook .soloader .DirectorySoSource ;
20
21
import com .facebook .soloader .LogUtil ;
21
22
import com .facebook .soloader .SoLoader ;
22
23
import com .facebook .soloader .SoLoaderDSONotFoundError ;
@@ -100,6 +101,7 @@ private boolean recoverDSONotFoundError(SoSource[] soSources, String soName, int
100
101
}
101
102
102
103
private boolean lazyPrepareBackupSoSource (SoSource [] soSources , String soName ) {
104
+ boolean recovered = false ;
103
105
for (SoSource soSource : soSources ) {
104
106
if (!(soSource instanceof BackupSoSource )) {
105
107
// NonApk SoSources get reunpacked in ReunpackNonBackupSoSource recovery strategy
@@ -111,7 +113,8 @@ private boolean lazyPrepareBackupSoSource(SoSource[] soSources, String soName) {
111
113
SoLoader .TAG ,
112
114
"Preparing BackupSoSource for the first time " + backupSoSource .getName ());
113
115
backupSoSource .prepare (0 );
114
- return true ;
116
+ recovered = true ;
117
+ break ;
115
118
} catch (Exception e ) {
116
119
// Catch a general error and log it, rather than failing during recovery and crashing the
117
120
// app
@@ -128,6 +131,22 @@ private boolean lazyPrepareBackupSoSource(SoSource[] soSources, String soName) {
128
131
}
129
132
}
130
133
134
+ if (recovered ) {
135
+ for (SoSource soSource : soSources ) {
136
+ if (!(soSource instanceof DirectorySoSource )) {
137
+ continue ;
138
+ }
139
+ if (soSource instanceof BackupSoSource ) {
140
+ continue ;
141
+ }
142
+ DirectorySoSource directorySoSource = (DirectorySoSource ) soSource ;
143
+ // We need to explicitly resolve dependencies, as dlopen() cannot do
144
+ // so for dependencies at non-standard locations.
145
+ directorySoSource .setExplicitDependencyResolution ();
146
+ }
147
+ return true ;
148
+ }
149
+
131
150
return false ;
132
151
}
133
152
0 commit comments