Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
apk
Commits
c4e113dc
Commit
c4e113dc
authored
Apr 05, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed native library checking, fixed preview sending for gif documents
parent
2f191225
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
90 deletions
+112
-90
build.gradle
TMessagesProj/build.gradle
+2
-2
MessagesController.java
.../main/java/org/telegram/messenger/MessagesController.java
+5
-1
NativeLoader.java
...oj/src/main/java/org/telegram/messenger/NativeLoader.java
+105
-87
No files found.
TMessagesProj/build.gradle
View file @
c4e113dc
...
@@ -82,7 +82,7 @@ android {
...
@@ -82,7 +82,7 @@ android {
defaultConfig
{
defaultConfig
{
minSdkVersion
8
minSdkVersion
8
targetSdkVersion
19
targetSdkVersion
19
versionCode
22
6
versionCode
22
9
versionName
"1.4.1
1
"
versionName
"1.4.1
2
"
}
}
}
}
TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
View file @
c4e113dc
...
@@ -1935,7 +1935,11 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1935,7 +1935,11 @@ public class MessagesController implements NotificationCenter.NotificationCenter
reqSend
.
media
.
last_name
=
user
.
last_name
;
reqSend
.
media
.
last_name
=
user
.
last_name
;
performSendMessageRequest
(
reqSend
,
newMsgObj
);
performSendMessageRequest
(
reqSend
,
newMsgObj
);
}
else
if
(
type
==
7
)
{
}
else
if
(
type
==
7
)
{
reqSend
.
media
=
new
TLRPC
.
TL_inputMediaUploadedDocument
();
if
(
document
.
thumb
.
location
!=
null
&&
document
.
thumb
.
location
instanceof
TLRPC
.
TL_fileLocation
)
{
reqSend
.
media
=
new
TLRPC
.
TL_inputMediaUploadedThumbDocument
();
}
else
{
reqSend
.
media
=
new
TLRPC
.
TL_inputMediaUploadedDocument
();
}
reqSend
.
media
.
mime_type
=
document
.
mime_type
;
reqSend
.
media
.
mime_type
=
document
.
mime_type
;
reqSend
.
media
.
file_name
=
document
.
file_name
;
reqSend
.
media
.
file_name
=
document
.
file_name
;
DelayedMessage
delayedMessage
=
new
DelayedMessage
();
DelayedMessage
delayedMessage
=
new
DelayedMessage
();
...
...
TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java
View file @
c4e113dc
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
package
org
.
telegram
.
messenger
;
package
org
.
telegram
.
messenger
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.pm.ApplicationInfo
;
import
android.os.Build
;
import
android.os.Build
;
import
java.io.File
;
import
java.io.File
;
...
@@ -29,119 +30,136 @@ public class NativeLoader {
...
@@ -29,119 +30,136 @@ public class NativeLoader {
private
static
volatile
boolean
nativeLoaded
=
false
;
private
static
volatile
boolean
nativeLoaded
=
false
;
private
static
File
getNativeLibraryDir
(
Context
context
)
{
File
f
=
null
;
if
(
context
!=
null
)
{
try
{
f
=
(
File
)
ApplicationInfo
.
class
.
getField
(
"nativeLibraryDir"
).
get
(
context
.
getApplicationInfo
());
}
catch
(
Throwable
th
)
{
th
.
printStackTrace
();
}
}
if
(
f
==
null
)
{
f
=
new
File
(
context
.
getApplicationInfo
().
dataDir
,
"lib"
);
}
if
(
f
!=
null
&&
f
.
isDirectory
())
{
return
f
;
}
return
null
;
}
public
static
synchronized
void
initNativeLibs
(
Context
context
)
{
public
static
synchronized
void
initNativeLibs
(
Context
context
)
{
if
(
nativeLoaded
)
{
if
(
nativeLoaded
)
{
return
;
return
;
}
}
if
(
Build
.
VERSION
.
SDK_INT
>=
9
)
{
try
{
try
{
String
folder
=
null
;
String
folder
=
null
;
long
libSize
=
0
;
long
libSize
=
0
;
long
libSize2
=
0
;
long
libSize2
=
0
;
try
{
try
{
if
(
Build
.
CPU_ABI
.
equalsIgnoreCase
(
"armeabi-v7a"
))
{
if
(
Build
.
CPU_ABI
.
equalsIgnoreCase
(
"armeabi-v7a"
))
{
folder
=
"armeabi-v7a"
;
folder
=
"armeabi-v7a"
;
libSize
=
sizes
[
1
];
libSize
=
sizes
[
1
];
libSize2
=
sizes
[
0
];
libSize2
=
sizes
[
0
];
}
else
if
(
Build
.
CPU_ABI
.
equalsIgnoreCase
(
"armeabi"
))
{
}
else
if
(
Build
.
CPU_ABI
.
equalsIgnoreCase
(
"armeabi"
))
{
folder
=
"armeabi"
;
folder
=
"armeabi"
;
libSize
=
sizes
[
0
];
libSize
=
sizes
[
0
];
libSize2
=
sizes
[
1
];
libSize2
=
sizes
[
1
];
}
else
if
(
Build
.
CPU_ABI
.
equalsIgnoreCase
(
"x86"
))
{
}
else
if
(
Build
.
CPU_ABI
.
equalsIgnoreCase
(
"x86"
))
{
folder
=
"x86"
;
folder
=
"x86"
;
libSize
=
sizes
[
2
];
libSize
=
sizes
[
2
];
}
else
if
(
Build
.
CPU_ABI
.
equalsIgnoreCase
(
"mips"
))
{
}
else
if
(
Build
.
CPU_ABI
.
equalsIgnoreCase
(
"mips"
))
{
folder
=
"mips"
;
folder
=
"mips"
;
libSize
=
sizes
[
3
];
libSize
=
sizes
[
3
];
}
else
{
}
else
{
folder
=
"armeabi"
;
libSize
=
sizes
[
0
];
libSize2
=
sizes
[
1
];
FileLog
.
e
(
"tmessages"
,
"Unsupported arch: "
+
Build
.
CPU_ABI
);
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
folder
=
"armeabi"
;
folder
=
"armeabi"
;
libSize
=
sizes
[
0
];
libSize
=
sizes
[
0
];
libSize2
=
sizes
[
1
];
libSize2
=
sizes
[
1
];
FileLog
.
e
(
"tmessages"
,
"Unsupported arch: "
+
Build
.
CPU_ABI
);
}
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
folder
=
"armeabi"
;
libSize
=
sizes
[
0
];
libSize2
=
sizes
[
1
];
}
File
destFile
=
getNativeLibraryDir
(
context
);
if
(
destFile
!=
null
&&
destFile
.
exists
()
&&
(
destFile
.
length
()
==
libSize
||
libSize2
!=
0
&&
destFile
.
length
()
==
libSize2
))
{
FileLog
.
d
(
"tmessages"
,
"Load normal lib"
);
try
{
System
.
loadLibrary
(
"tmessages"
);
nativeLoaded
=
true
;
return
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
File
destFile
=
new
File
(
context
.
getApplicationInfo
().
nativeLibraryDir
+
"/libtmessages.so"
);
File
destLocalFile
=
new
File
(
context
.
getFilesDir
().
getAbsolutePath
()
+
"/libtmessages.so"
);
if
(
destFile
.
exists
()
&&
(
destFile
.
length
()
==
libSize
||
libSize2
!=
0
&&
destFile
.
length
()
==
libSize2
))
{
if
(
destLocalFile
.
exists
(
))
{
FileLog
.
d
(
"tmessages"
,
"Load normal lib"
);
if
(
destLocalFile
.
length
()
==
libSize
)
{
try
{
try
{
System
.
loadLibrary
(
"tmessages"
);
FileLog
.
d
(
"tmessages"
,
"Load local lib"
);
System
.
load
(
destLocalFile
.
getAbsolutePath
());
nativeLoaded
=
true
;
nativeLoaded
=
true
;
return
;
return
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
else
{
destLocalFile
.
delete
();
}
}
}
File
destLocalFile
=
new
File
(
context
.
getFilesDir
().
getAbsolutePath
()
+
"/libtmessages.so"
);
FileLog
.
e
(
"tmessages"
,
"Library not found, arch = "
+
folder
);
if
(
destLocalFile
.
exists
())
{
if
(
destLocalFile
.
length
()
==
libSize
)
{
try
{
FileLog
.
d
(
"tmessages"
,
"Load local lib"
);
System
.
load
(
destLocalFile
.
getAbsolutePath
());
nativeLoaded
=
true
;
return
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
else
{
destLocalFile
.
delete
();
}
}
FileLog
.
e
(
"tmessages"
,
"Library not found, arch = "
+
folder
);
ZipFile
zipFile
=
null
;
ZipFile
zipFile
=
null
;
InputStream
stream
=
null
;
InputStream
stream
=
null
;
try
{
try
{
zipFile
=
new
ZipFile
(
context
.
getApplicationInfo
().
sourceDir
);
zipFile
=
new
ZipFile
(
context
.
getApplicationInfo
().
sourceDir
);
ZipEntry
entry
=
zipFile
.
getEntry
(
"lib/"
+
folder
+
"/libtmessages.so"
);
ZipEntry
entry
=
zipFile
.
getEntry
(
"lib/"
+
folder
+
"/libtmessages.so"
);
if
(
entry
==
null
)
{
if
(
entry
==
null
)
{
throw
new
Exception
(
"Unable to find file in apk:"
+
"lib/"
+
folder
+
"/libtmessages.so"
);
throw
new
Exception
(
"Unable to find file in apk:"
+
"lib/"
+
folder
+
"/libtmessages.so"
);
}
}
stream
=
zipFile
.
getInputStream
(
entry
);
stream
=
zipFile
.
getInputStream
(
entry
);
OutputStream
out
=
new
FileOutputStream
(
destLocalFile
);
OutputStream
out
=
new
FileOutputStream
(
destLocalFile
);
byte
[]
buf
=
new
byte
[
4096
];
byte
[]
buf
=
new
byte
[
4096
];
int
len
;
int
len
;
while
((
len
=
stream
.
read
(
buf
))
>
0
)
{
while
((
len
=
stream
.
read
(
buf
))
>
0
)
{
Thread
.
yield
();
Thread
.
yield
();
out
.
write
(
buf
,
0
,
len
);
out
.
write
(
buf
,
0
,
len
);
}
}
out
.
close
();
out
.
close
();
System
.
load
(
destLocalFile
.
getAbsolutePath
());
System
.
load
(
destLocalFile
.
getAbsolutePath
());
nativeLoaded
=
true
;
nativeLoaded
=
true
;
return
;
return
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
FileLog
.
e
(
"tmessages"
,
e
);
}
finally
{
}
finally
{
if
(
stream
!=
null
)
{
if
(
stream
!=
null
)
{
try
{
try
{
stream
.
close
();
stream
.
close
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
FileLog
.
e
(
"tmessages"
,
e
);
}
}
}
if
(
zipFile
!=
null
)
{
}
try
{
if
(
zipFile
!=
null
)
{
zipFile
.
close
();
try
{
}
catch
(
Exception
e
)
{
zipFile
.
close
();
FileLog
.
e
(
"tmessages"
,
e
);
}
catch
(
Exception
e
)
{
}
FileLog
.
e
(
"tmessages"
,
e
);
}
}
}
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
}
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
}
}
System
.
loadLibrary
(
"tmessages"
);
System
.
loadLibrary
(
"tmessages"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment