Skip to content

Commit 5d17873

Browse files
adicatanafacebook-github-bot
authored andcommitted
Trigger unpacking when /data/app/../lib/arm does not exist
Reviewed By: michalgr Differential Revision: D62753901 fbshipit-source-id: c936ccdb933fd2170c60c209f14a02d693129838
1 parent 132d7bb commit 5d17873

File tree

1 file changed

+50
-36
lines changed

1 file changed

+50
-36
lines changed

java/com/facebook/soloader/recovery/CheckOnDiskStateDataApp.java

Lines changed: 50 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -46,48 +46,62 @@ public boolean recover(UnsatisfiedLinkError error, SoSource[] soSources) {
4646

4747
File nativeLibStandardDir = new File(mContext.getApplicationInfo().nativeLibraryDir);
4848
if (!nativeLibStandardDir.exists()) {
49-
LogUtil.e(
50-
SoLoader.TAG,
51-
"Native library directory "
52-
+ nativeLibStandardDir
53-
+ " does not exist, exiting /data/app recovery.");
54-
return false;
55-
}
49+
for (SoSource soSource : soSources) {
50+
if (!(soSource instanceof BackupSoSource)) {
51+
continue;
52+
}
53+
BackupSoSource uss = (BackupSoSource) soSource;
54+
try {
5655

57-
ArrayList<String> missingLibs = new ArrayList<>();
58-
for (SoSource soSource : soSources) {
59-
if (!(soSource instanceof BackupSoSource)) {
60-
continue;
56+
LogUtil.e(
57+
SoLoader.TAG,
58+
"Native library directory "
59+
+ nativeLibStandardDir
60+
+ " does not exist, will unpack everything under /data/data.");
61+
uss.prepare(0);
62+
break;
63+
} catch (Exception e) {
64+
LogUtil.e(
65+
SoLoader.TAG, "Encountered an exception while recovering from /data/app failure ", e);
66+
return false;
67+
}
6168
}
62-
BackupSoSource uss = (BackupSoSource) soSource;
63-
try {
64-
Dso[] dsosFromArchive = uss.getDsosBaseApk();
65-
for (Dso dso : dsosFromArchive) {
66-
File soFile = new File(nativeLibStandardDir, dso.name);
67-
if (soFile.exists()) {
68-
continue;
69-
}
70-
missingLibs.add(dso.name);
69+
} else {
70+
ArrayList<String> missingLibs = new ArrayList<>();
71+
for (SoSource soSource : soSources) {
72+
if (!(soSource instanceof BackupSoSource)) {
73+
continue;
7174
}
75+
BackupSoSource uss = (BackupSoSource) soSource;
76+
try {
77+
Dso[] dsosFromArchive = uss.getDsosBaseApk();
78+
for (Dso dso : dsosFromArchive) {
79+
File soFile = new File(nativeLibStandardDir, dso.name);
80+
if (soFile.exists()) {
81+
continue;
82+
}
83+
missingLibs.add(dso.name);
84+
}
7285

73-
if (missingLibs.isEmpty()) {
74-
LogUtil.e(SoLoader.TAG, "No libraries missing from " + nativeLibStandardDir);
86+
if (missingLibs.isEmpty()) {
87+
LogUtil.e(SoLoader.TAG, "No libraries missing from " + nativeLibStandardDir);
88+
return false;
89+
}
90+
91+
LogUtil.e(
92+
SoLoader.TAG,
93+
"Missing libraries from "
94+
+ nativeLibStandardDir
95+
+ ": "
96+
+ missingLibs.toString()
97+
+ ", will run prepare on tbe backup so source");
98+
uss.prepare(0);
99+
break;
100+
} catch (Exception e) {
101+
LogUtil.e(
102+
SoLoader.TAG, "Encountered an exception while recovering from /data/app failure ", e);
75103
return false;
76104
}
77-
78-
LogUtil.e(
79-
SoLoader.TAG,
80-
"Missing libraries from "
81-
+ nativeLibStandardDir
82-
+ ": "
83-
+ missingLibs.toString()
84-
+ ", will run prepare on tbe backup so source");
85-
uss.prepare(0);
86-
break;
87-
} catch (Exception e) {
88-
LogUtil.e(
89-
SoLoader.TAG, "Encountered an exception while recovering from /data/app failure ", e);
90-
return false;
91105
}
92106
}
93107

0 commit comments

Comments
 (0)