mirror of
https://github.com/DrKLO/Telegram.git
synced 2025-01-03 09:49:15 +01:00
Catch native lib load errors
This commit is contained in:
parent
02a20acc4c
commit
8c9616cb00
5 changed files with 34 additions and 12 deletions
|
@ -81,7 +81,7 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 8
|
minSdkVersion 8
|
||||||
targetSdkVersion 19
|
targetSdkVersion 19
|
||||||
versionCode 254
|
versionCode 255
|
||||||
versionName "1.5.3"
|
versionName "1.5.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
LOCAL_PATH := $(call my-dir)
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_PRELINK_MODULE := false
|
||||||
LOCAL_MODULE := tmessages
|
LOCAL_MODULE := tmessages
|
||||||
LOCAL_CFLAGS := -w -std=gnu99 -O3 -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
|
LOCAL_CFLAGS := -w -std=gnu99 -O3 -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
|
||||||
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno
|
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class FileLog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void e(final String tag, final Exception e) {
|
public static void e(final String tag, final Throwable e) {
|
||||||
if (!BuildVars.DEBUG_VERSION) {
|
if (!BuildVars.DEBUG_VERSION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,12 @@ public class NativeLoader {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
System.loadLibrary("jnigraphics");
|
||||||
|
} catch (Error e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String folder = null;
|
String folder = null;
|
||||||
long libSize = 0;
|
long libSize = 0;
|
||||||
|
@ -96,8 +102,8 @@ public class NativeLoader {
|
||||||
System.loadLibrary("tmessages");
|
System.loadLibrary("tmessages");
|
||||||
nativeLoaded = true;
|
nativeLoaded = true;
|
||||||
return;
|
return;
|
||||||
} catch (Exception e) {
|
} catch (Error e) {
|
||||||
e.printStackTrace();
|
FileLog.e("tmessages", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,8 +116,8 @@ public class NativeLoader {
|
||||||
System.load(destLocalFile.getAbsolutePath());
|
System.load(destLocalFile.getAbsolutePath());
|
||||||
nativeLoaded = true;
|
nativeLoaded = true;
|
||||||
return;
|
return;
|
||||||
} catch (Exception e) {
|
} catch (Error e) {
|
||||||
e.printStackTrace();
|
FileLog.e("tmessages", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
destLocalFile.delete();
|
destLocalFile.delete();
|
||||||
|
@ -139,8 +145,12 @@ public class NativeLoader {
|
||||||
}
|
}
|
||||||
out.close();
|
out.close();
|
||||||
|
|
||||||
System.load(destLocalFile.getAbsolutePath());
|
try {
|
||||||
nativeLoaded = true;
|
System.load(destLocalFile.getAbsolutePath());
|
||||||
|
nativeLoaded = true;
|
||||||
|
} catch (Error e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
|
@ -164,7 +174,11 @@ public class NativeLoader {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
System.loadLibrary("tmessages");
|
try {
|
||||||
nativeLoaded = true;
|
System.loadLibrary("tmessages");
|
||||||
|
nativeLoaded = true;
|
||||||
|
} catch (Error e) {
|
||||||
|
FileLog.e("tmessages", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,10 +262,17 @@ public class Utilities {
|
||||||
public static File getCacheDir() {
|
public static File getCacheDir() {
|
||||||
if (externalCacheNotAvailableState == 1 || externalCacheNotAvailableState == 0 && Environment.getExternalStorageState().startsWith(Environment.MEDIA_MOUNTED)) {
|
if (externalCacheNotAvailableState == 1 || externalCacheNotAvailableState == 0 && Environment.getExternalStorageState().startsWith(Environment.MEDIA_MOUNTED)) {
|
||||||
externalCacheNotAvailableState = 1;
|
externalCacheNotAvailableState = 1;
|
||||||
return ApplicationLoader.applicationContext.getExternalCacheDir();
|
File file = ApplicationLoader.applicationContext.getExternalCacheDir();
|
||||||
|
if (file != null) {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
externalCacheNotAvailableState = 2;
|
externalCacheNotAvailableState = 2;
|
||||||
return ApplicationLoader.applicationContext.getCacheDir();
|
File file = ApplicationLoader.applicationContext.getCacheDir();
|
||||||
|
if (file != null) {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
return new File("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String bytesToHex(byte[] bytes) {
|
public static String bytesToHex(byte[] bytes) {
|
||||||
|
|
Loading…
Reference in a new issue