mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 14:35:03 +01:00
Check if native lib loaded before opening db
This commit is contained in:
parent
d8c2966efc
commit
585ba77ea7
2 changed files with 10 additions and 1 deletions
|
@ -62,6 +62,8 @@ public class MessagesStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openDatabase() {
|
public void openDatabase() {
|
||||||
|
NativeLoader.initNativeLibs(ApplicationLoader.applicationContext);
|
||||||
|
|
||||||
cacheFile = new File(ApplicationLoader.applicationContext.getFilesDir(), "cache4.db");
|
cacheFile = new File(ApplicationLoader.applicationContext.getFilesDir(), "cache4.db");
|
||||||
|
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("dbconfig", Context.MODE_PRIVATE);
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("dbconfig", Context.MODE_PRIVATE);
|
||||||
|
|
|
@ -28,7 +28,14 @@ public class NativeLoader {
|
||||||
0, //mips
|
0, //mips
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void initNativeLibs(Context context) {
|
private static volatile boolean nativeLoaded = false;
|
||||||
|
|
||||||
|
public static synchronized void initNativeLibs(Context context) {
|
||||||
|
if (nativeLoaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nativeLoaded = true;
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 9) {
|
if (Build.VERSION.SDK_INT >= 9) {
|
||||||
try {
|
try {
|
||||||
String folder = null;
|
String folder = null;
|
||||||
|
|
Loading…
Reference in a new issue