update to 8.9.0
15
Dockerfile
|
@ -27,4 +27,17 @@ RUN cp $ANDROID_HOME/build-tools/30.0.3/lib/dx.jar $ANDROID_HOME/build-tools/31.
|
|||
ENV PATH ${ANDROID_NDK_HOME}:$PATH
|
||||
ENV PATH ${ANDROID_NDK_HOME}/prebuilt/linux-x86_64/bin/:$PATH
|
||||
|
||||
CMD mkdir -p /home/source/TMessagesProj/build/outputs/apk && mkdir -p /home/source/TMessagesProj/build/outputs/native-debug-symbols && cp -R /home/source/. /home/gradle && cd /home/gradle && gradle bundleBundleAfat_SDK23Release && gradle bundleBundleAfatRelease && gradle assembleStandalone && gradle assembleAfatRelease && cp -R /home/gradle/TMessagesProj/build/outputs/apk/. /home/source/TMessagesProj/build/outputs/apk && cp -R /home/gradle/TMessagesProj/build/outputs/bundle/. /home/source/TMessagesProj/build/outputs/bundle && cp -R /home/gradle/TMessagesProj/build/outputs/native-debug-symbols/. /home/source/TMessagesProj/build/outputs/native-debug-symbols
|
||||
CMD mkdir -p /home/source/TMessagesProj/build/outputs/apk && \
|
||||
mkdir -p /home/gradle/TMessagesProj/build/outputs/bundle && \
|
||||
mkdir -p /home/source/TMessagesProj/build/outputs/native-debug-symbols && \
|
||||
cp -R /home/source/. /home/gradle && \
|
||||
cd /home/gradle && \
|
||||
gradle :TMessagesProj_App:bundleBundleAfat_SDK23Release && \
|
||||
gradle :TMessagesProj_App:bundleBundleAfatRelease && \
|
||||
gradle :TMessagesProj_App:assembleAfatStandalone && \
|
||||
gradle :TMessagesProj_App:assembleAfatRelease && \
|
||||
gradle :TMessagesProj_AppHuawei:assembleAfatRelease && \
|
||||
cp -R /home/gradle/TMessagesProj_App/build/outputs/apk/. /home/source/TMessagesProj/build/outputs/apk && \
|
||||
cp -R /home/gradle/TMessagesProj_AppHuawei/build/outputs/apk/. /home/source/TMessagesProj/build/outputs/apk && \
|
||||
cp -R /home/gradle/TMessagesProj_App/build/outputs/bundle/. /home/source/TMessagesProj/build/outputs/bundle && \
|
||||
cp -R /home/gradle/TMessagesProj_App/build/outputs/native-debug-symbols/. /home/source/TMessagesProj/build/outputs/native-debug-symbols
|
|
@ -1,4 +1,4 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -38,7 +38,6 @@ dependencies {
|
|||
implementation 'com.stripe:stripe-android:2.0.2'
|
||||
implementation 'com.google.mlkit:language-id:16.1.1'
|
||||
implementation 'com.android.billingclient:billing:5.0.0'
|
||||
implementation files('libs/libgsaverification-client.aar')
|
||||
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||
}
|
||||
|
@ -48,8 +47,6 @@ android {
|
|||
buildToolsVersion '31.0.0'
|
||||
ndkVersion "21.4.7075529"
|
||||
|
||||
defaultConfig.applicationId = "org.telegram.messenger"
|
||||
|
||||
sourceSets.main.jniLibs.srcDirs = ['./jni/']
|
||||
|
||||
externalNativeBuild {
|
||||
|
@ -75,189 +72,17 @@ android {
|
|||
coreLibraryDesugaringEnabled true
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
debug {
|
||||
storeFile file("config/release.keystore")
|
||||
storePassword RELEASE_STORE_PASSWORD
|
||||
keyAlias RELEASE_KEY_ALIAS
|
||||
keyPassword RELEASE_KEY_PASSWORD
|
||||
}
|
||||
|
||||
release {
|
||||
storeFile file("config/release.keystore")
|
||||
storePassword RELEASE_STORE_PASSWORD
|
||||
keyAlias RELEASE_KEY_ALIAS
|
||||
keyPassword RELEASE_KEY_PASSWORD
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
debuggable true
|
||||
jniDebuggable true
|
||||
signingConfig signingConfigs.debug
|
||||
applicationIdSuffix ".beta"
|
||||
minifyEnabled false
|
||||
shrinkResources false
|
||||
multiDexEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
ndk.debugSymbolLevel = 'FULL'
|
||||
}
|
||||
|
||||
/*debugAsan {
|
||||
debuggable true
|
||||
jniDebuggable true
|
||||
signingConfig signingConfigs.debug
|
||||
applicationIdSuffix ".beta"
|
||||
minifyEnabled true
|
||||
multiDexEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
|
||||
packagingOptions {
|
||||
doNotStrip "**.so"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
jniLibs {
|
||||
srcDir {
|
||||
'jniLibs'
|
||||
}
|
||||
}
|
||||
resources {
|
||||
srcDir {
|
||||
'jniRes'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
HA {
|
||||
debuggable false
|
||||
jniDebuggable false
|
||||
signingConfig signingConfigs.debug
|
||||
applicationIdSuffix ".beta"
|
||||
minifyEnabled true
|
||||
multiDexEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
ndk.debugSymbolLevel = 'FULL'
|
||||
}
|
||||
|
||||
standalone {
|
||||
debuggable false
|
||||
jniDebuggable false
|
||||
signingConfig signingConfigs.release
|
||||
applicationIdSuffix ".web"
|
||||
minifyEnabled true
|
||||
multiDexEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
ndk.debugSymbolLevel = 'FULL'
|
||||
}
|
||||
|
||||
release {
|
||||
debuggable false
|
||||
jniDebuggable false
|
||||
signingConfig signingConfigs.release
|
||||
minifyEnabled true
|
||||
shrinkResources false
|
||||
multiDexEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
ndk.debugSymbolLevel = 'FULL'
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.debug {
|
||||
manifest.srcFile 'config/debug/AndroidManifest.xml'
|
||||
}
|
||||
|
||||
/*sourceSets.debugAsan {
|
||||
manifest.srcFile 'config/debug/AndroidManifest.xml'
|
||||
}*/
|
||||
|
||||
sourceSets.HA {
|
||||
manifest.srcFile 'config/debug/AndroidManifest.xml'
|
||||
}
|
||||
|
||||
sourceSets.standalone {
|
||||
manifest.srcFile 'config/release/AndroidManifest.xml'
|
||||
}
|
||||
|
||||
sourceSets.release {
|
||||
manifest.srcFile 'config/release/AndroidManifest.xml'
|
||||
}
|
||||
|
||||
flavorDimensions "minApi"
|
||||
|
||||
productFlavors {
|
||||
bundleAfat {
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
|
||||
}
|
||||
ext {
|
||||
abiVersionCode = 1
|
||||
}
|
||||
}
|
||||
bundleAfat_SDK23 {
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
|
||||
}
|
||||
sourceSets.debug {
|
||||
manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml'
|
||||
}
|
||||
sourceSets.release {
|
||||
manifest.srcFile 'config/release/AndroidManifest_SDK23.xml'
|
||||
}
|
||||
sourceSets.standalone {
|
||||
manifest.srcFile 'config/release/AndroidManifest_standalone.xml'
|
||||
}
|
||||
minSdkVersion 23
|
||||
ext {
|
||||
abiVersionCode = 2
|
||||
}
|
||||
}
|
||||
afat {
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
|
||||
}
|
||||
sourceSets.debug {
|
||||
manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml'
|
||||
}
|
||||
sourceSets.release {
|
||||
manifest.srcFile 'config/release/AndroidManifest_SDK23.xml'
|
||||
}
|
||||
sourceSets.standalone {
|
||||
manifest.srcFile 'config/release/AndroidManifest_standalone.xml'
|
||||
}
|
||||
ext {
|
||||
abiVersionCode = 9
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig.versionCode = 2721
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.all { output ->
|
||||
outputFileName = "app.apk"
|
||||
output.versionCodeOverride = defaultConfig.versionCode * 10 + variant.productFlavors.get(0).abiVersionCode
|
||||
}
|
||||
}
|
||||
|
||||
variantFilter { variant ->
|
||||
def names = variant.flavors*.name
|
||||
if (variant.buildType.name != "release" && !names.contains("afat")) {
|
||||
setIgnore(true)
|
||||
}
|
||||
}
|
||||
defaultConfig.versionCode = 2751
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
versionName "8.8.5"
|
||||
versionName "8.9.0"
|
||||
|
||||
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
|
||||
|
||||
multiDexEnabled true
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version '3.10.2'
|
||||
|
@ -265,6 +90,46 @@ android {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
debuggable true
|
||||
jniDebuggable true
|
||||
minifyEnabled false
|
||||
shrinkResources false
|
||||
multiDexEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro'
|
||||
ndk.debugSymbolLevel = 'FULL'
|
||||
}
|
||||
|
||||
HA {
|
||||
debuggable false
|
||||
jniDebuggable false
|
||||
minifyEnabled true
|
||||
multiDexEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro'
|
||||
ndk.debugSymbolLevel = 'FULL'
|
||||
}
|
||||
|
||||
standalone {
|
||||
debuggable false
|
||||
jniDebuggable false
|
||||
minifyEnabled true
|
||||
multiDexEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro'
|
||||
ndk.debugSymbolLevel = 'FULL'
|
||||
}
|
||||
|
||||
release {
|
||||
debuggable false
|
||||
jniDebuggable false
|
||||
minifyEnabled true
|
||||
shrinkResources false
|
||||
multiDexEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro'
|
||||
ndk.debugSymbolLevel = 'FULL'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="org.telegram.messenger"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
|
||||
|
@ -32,7 +31,7 @@
|
|||
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
|
||||
|
||||
<service
|
||||
android:name=".GcmPushListenerService">
|
||||
android:name="org.telegram.messenger.GcmPushListenerService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="org.telegram.messenger"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
|
||||
|
@ -26,7 +25,6 @@
|
|||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:label="@string/AppNameBeta"
|
||||
android:theme="@style/Theme.TMessages.Start"
|
||||
android:name=".ApplicationLoader"
|
||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
android:largeHeap="true"
|
||||
android:supportsRtl="false"
|
||||
|
@ -36,7 +34,7 @@
|
|||
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
|
||||
|
||||
<service
|
||||
android:name=".GcmPushListenerService">
|
||||
android:name="org.telegram.messenger.GcmPushListenerService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="org.telegram.messenger"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
|
||||
|
@ -23,7 +22,6 @@
|
|||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:label="@string/AppName"
|
||||
android:theme="@style/Theme.TMessages.Start"
|
||||
android:name=".ApplicationLoader"
|
||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
android:largeHeap="true"
|
||||
android:supportsRtl="false"
|
||||
|
@ -33,7 +31,7 @@
|
|||
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
|
||||
|
||||
<service
|
||||
android:name=".GcmPushListenerService">
|
||||
android:name="org.telegram.messenger.GcmPushListenerService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="org.telegram.messenger"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
|
||||
|
@ -26,7 +25,6 @@
|
|||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:label="@string/AppName"
|
||||
android:theme="@style/Theme.TMessages.Start"
|
||||
android:name=".ApplicationLoader"
|
||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
android:largeHeap="true"
|
||||
android:supportsRtl="false"
|
||||
|
@ -36,7 +34,7 @@
|
|||
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
|
||||
|
||||
<service
|
||||
android:name=".GcmPushListenerService">
|
||||
android:name="org.telegram.messenger.GcmPushListenerService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="org.telegram.messenger"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
|
||||
|
@ -26,7 +25,6 @@
|
|||
android:roundIcon="@mipmap/ic_launcher_sa"
|
||||
android:label="@string/AppName"
|
||||
android:theme="@style/Theme.TMessages.Start"
|
||||
android:name=".ApplicationLoader"
|
||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
android:largeHeap="true"
|
||||
android:supportsRtl="false"
|
||||
|
@ -36,7 +34,7 @@
|
|||
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
|
||||
|
||||
<service
|
||||
android:name=".GcmPushListenerService">
|
||||
android:name="org.telegram.messenger.GcmPushListenerService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
|
|
|
@ -42,7 +42,6 @@ typedef struct LottieInfo {
|
|||
uint32_t fileFrame = 0;
|
||||
bool nextFrameIsCacheFrame = false;
|
||||
|
||||
FILE *precacheFile = nullptr;
|
||||
char *compressBuffer = nullptr;
|
||||
const char *buffer = nullptr;
|
||||
bool firstFrame = false;
|
||||
|
@ -164,18 +163,6 @@ JNIEXPORT jlong Java_org_telegram_ui_Components_RLottieDrawable_create(JNIEnv *e
|
|||
return (jlong) (intptr_t) info;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring Java_org_telegram_ui_Components_RLottieDrawable_getCacheFile(JNIEnv *env, jclass clazz, jlong ptr) {
|
||||
if (!ptr) {
|
||||
return NULL;
|
||||
}
|
||||
auto info = (LottieInfo *) (intptr_t) ptr;
|
||||
if (info->precache) {
|
||||
return env->NewStringUTF(info->cacheFile.c_str());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jlong Java_org_telegram_ui_Components_RLottieDrawable_createWithJson(JNIEnv *env, jclass clazz, jstring json, jstring name, jintArray data, jintArray colorReplacement) {
|
||||
std::map<int32_t, int32_t> *colors = nullptr;
|
||||
if (colorReplacement != nullptr) {
|
||||
|
@ -255,126 +242,6 @@ JNIEXPORT void Java_org_telegram_ui_Components_RLottieDrawable_replaceColors(JNI
|
|||
}
|
||||
}
|
||||
|
||||
bool cacheWriteThreadCreated{false};
|
||||
LottieInfo *cacheWriteThreadTask{nullptr};
|
||||
bool cacheWriteThreadDone{false};
|
||||
std::thread worker;
|
||||
std::mutex cacheMutex;
|
||||
std::condition_variable cacheCv;
|
||||
|
||||
std::mutex cacheDoneMutex;
|
||||
std::condition_variable cacheDoneCv;
|
||||
std::atomic<bool> frameReady{false};
|
||||
|
||||
void CacheWriteThreadProc() {
|
||||
while (!cacheWriteThreadDone) {
|
||||
std::unique_lock<std::mutex> lk(cacheMutex);
|
||||
cacheCv.wait(lk, [] { return frameReady.load(); });
|
||||
std::lock_guard<std::mutex> lg(cacheDoneMutex);
|
||||
LottieInfo *task;
|
||||
if (cacheWriteThreadTask != nullptr) {
|
||||
task = cacheWriteThreadTask;
|
||||
cacheWriteThreadTask = nullptr;
|
||||
} else {
|
||||
task = nullptr;
|
||||
}
|
||||
lk.unlock();
|
||||
|
||||
if (task != nullptr) {
|
||||
auto size = (uint32_t) LZ4_compress_default(task->buffer, task->compressBuffer, task->bufferSize, task->compressBound);
|
||||
if (task->firstFrame) {
|
||||
task->firstFrameSize = size;
|
||||
task->fileOffset = 9 + sizeof(uint32_t) + task->firstFrameSize;
|
||||
task->fileFrame = 1;
|
||||
}
|
||||
task->maxFrameSize = MAX(task->maxFrameSize, size);
|
||||
fwrite(&size, sizeof(uint32_t), 1, task->precacheFile);
|
||||
fwrite(task->compressBuffer, sizeof(uint8_t), size, task->precacheFile);
|
||||
|
||||
fflush(task->precacheFile);
|
||||
fsync(fileno(task->precacheFile));
|
||||
task->framesAvailableInCache++;
|
||||
}
|
||||
frameReady = false;
|
||||
cacheDoneCv.notify_one();
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void Java_org_telegram_ui_Components_RLottieDrawable_createCache(JNIEnv *env, jclass clazz, jlong ptr, jint w, jint h) {
|
||||
if (ptr == NULL) {
|
||||
return;
|
||||
}
|
||||
auto info = (LottieInfo *) (intptr_t) ptr;
|
||||
|
||||
FILE *cacheFile = fopen(info->cacheFile.c_str(), "r+");
|
||||
if (cacheFile != nullptr) {
|
||||
uint8_t temp;
|
||||
size_t read = fread(&temp, sizeof(uint8_t), 1, cacheFile);
|
||||
fclose(cacheFile);
|
||||
if (read == 1 && temp != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!cacheWriteThreadCreated) {
|
||||
cacheWriteThreadCreated = true;
|
||||
worker = std::thread(CacheWriteThreadProc);
|
||||
}
|
||||
|
||||
if (info->nextFrameIsCacheFrame && info->createCache && info->frameCount != 0) {
|
||||
info->precacheFile = fopen(info->cacheFile.c_str(), "w+");
|
||||
if (info->precacheFile != nullptr) {
|
||||
fseek(info->precacheFile, info->fileOffset = 9, SEEK_SET);
|
||||
info->fileFrame = 0;
|
||||
info->maxFrameSize = 0;
|
||||
info->bufferSize = w * h * 4;
|
||||
info->imageSize = (uint32_t) w * h * 4;
|
||||
info->compressBound = LZ4_compressBound(info->bufferSize);
|
||||
info->compressBuffer = new char[info->compressBound];
|
||||
auto firstBuffer = new uint8_t[info->bufferSize];
|
||||
auto secondBuffer = new uint8_t[info->bufferSize];
|
||||
//long time = ConnectionsManager::getInstance(0).getCurrentTimeMonotonicMillis();
|
||||
|
||||
Surface surface1((uint32_t *) firstBuffer, (size_t) w, (size_t) h, (size_t) w * 4);
|
||||
Surface surface2((uint32_t *) secondBuffer, (size_t) w, (size_t) h, (size_t) w * 4);
|
||||
int framesPerUpdate = !info->limitFps || info->fps < 60 ? 1 : 2;
|
||||
int num = 0;
|
||||
for (size_t a = 0; a < info->frameCount; a += framesPerUpdate) {
|
||||
Surface &surfaceToRender = num % 2 == 0 ? surface1 : surface2;
|
||||
num++;
|
||||
info->animation->renderSync(a, surfaceToRender, true);
|
||||
if (a != 0) {
|
||||
std::unique_lock<std::mutex> lk(cacheDoneMutex);
|
||||
cacheDoneCv.wait(lk, [] { return !frameReady.load(); });
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lg(cacheMutex);
|
||||
cacheWriteThreadTask = info;
|
||||
info->firstFrame = a == 0;
|
||||
info->buffer = (const char *) surfaceToRender.buffer();
|
||||
frameReady = true;
|
||||
cacheCv.notify_one();
|
||||
}
|
||||
std::unique_lock<std::mutex> lk(cacheDoneMutex);
|
||||
cacheDoneCv.wait(lk, [] { return !frameReady.load(); });
|
||||
|
||||
//DEBUG_D("sticker time = %d", (int) (ConnectionsManager::getInstance(0).getCurrentTimeMonotonicMillis() - time));
|
||||
delete[] info->compressBuffer;
|
||||
delete[] firstBuffer;
|
||||
delete[] secondBuffer;
|
||||
fseek(info->precacheFile, 0, SEEK_SET);
|
||||
uint8_t byte = 1;
|
||||
fwrite(&byte, sizeof(uint8_t), 1, info->precacheFile);
|
||||
uint32_t maxFrameSize = info->maxFrameSize;
|
||||
fwrite(&maxFrameSize, sizeof(uint32_t), 1, info->precacheFile);
|
||||
fwrite(&info->imageSize, sizeof(uint32_t), 1, info->precacheFile);
|
||||
fflush(info->precacheFile);
|
||||
fsync(fileno(info->precacheFile));
|
||||
info->createCache = false;
|
||||
fclose(info->precacheFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jint Java_org_telegram_ui_Components_RLottieDrawable_getFrame(JNIEnv *env, jclass clazz, jlong ptr, jint frame, jobject bitmap, jint w, jint h, jint stride, jboolean clear) {
|
||||
if (!ptr || bitmap == nullptr) {
|
||||
|
@ -382,73 +249,16 @@ JNIEXPORT jint Java_org_telegram_ui_Components_RLottieDrawable_getFrame(JNIEnv *
|
|||
}
|
||||
auto info = (LottieInfo *) (intptr_t) ptr;
|
||||
|
||||
int framesPerUpdate = !info->limitFps || info->fps < 60 ? 1 : 2;
|
||||
int framesAvailableInCache = info->framesAvailableInCache;
|
||||
|
||||
if (info->createCache && info->precache && frame > 0) {
|
||||
if (frame / framesPerUpdate >= framesAvailableInCache) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void *pixels;
|
||||
bool result = false;
|
||||
if (AndroidBitmap_lockPixels(env, bitmap, &pixels) >= 0) {
|
||||
bool loadedFromCache = false;
|
||||
uint32_t maxFrameSize = info->maxFrameSize;
|
||||
if (info->precache && (!info->createCache || frame > 0) && w * 4 == stride && maxFrameSize <= w * h * 4 && info->imageSize == w * h * 4) {
|
||||
FILE *precacheFile = fopen(info->cacheFile.c_str(), "r");
|
||||
if (precacheFile != nullptr) {
|
||||
if (info->decompressBuffer != nullptr && info->decompressBufferSize < maxFrameSize) {
|
||||
delete[] info->decompressBuffer;
|
||||
info->decompressBuffer = nullptr;
|
||||
}
|
||||
if (info->decompressBuffer == nullptr) {
|
||||
info->decompressBufferSize = maxFrameSize;
|
||||
if (info->createCache) {
|
||||
info->decompressBufferSize += 10000;
|
||||
}
|
||||
info->decompressBuffer = new uint8_t[info->decompressBufferSize];
|
||||
}
|
||||
int currentFrame = frame / framesPerUpdate;
|
||||
if (info->fileFrame != frame) {
|
||||
info->fileOffset = 9;
|
||||
info->fileFrame = 0;
|
||||
while (info->fileFrame != currentFrame) {
|
||||
fseek(precacheFile, info->fileOffset, SEEK_SET);
|
||||
uint32_t frameSize;
|
||||
fread(&frameSize, sizeof(uint32_t), 1, precacheFile);
|
||||
info->fileOffset += 4 + frameSize;
|
||||
info->fileFrame++;
|
||||
}
|
||||
}
|
||||
fseek(precacheFile, info->fileOffset, SEEK_SET);
|
||||
uint32_t frameSize;
|
||||
fread(&frameSize, sizeof(uint32_t), 1, precacheFile);
|
||||
if (frameSize > 0 && frameSize <= info->decompressBufferSize) {
|
||||
fread(info->decompressBuffer, sizeof(uint8_t), frameSize, precacheFile);
|
||||
info->fileOffset += 4 + frameSize;
|
||||
info->fileFrame = currentFrame + 1;
|
||||
LZ4_decompress_safe((const char *) info->decompressBuffer, (char *) pixels, frameSize, w * h * 4);
|
||||
loadedFromCache = true;
|
||||
}
|
||||
fclose(precacheFile);
|
||||
if (frame + framesPerUpdate >= info->frameCount) {
|
||||
info->fileOffset = 9;
|
||||
info->fileFrame = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!loadedFromCache) {
|
||||
if (!info->nextFrameIsCacheFrame || !info->precache) {
|
||||
Surface surface((uint32_t *) pixels, (size_t) w, (size_t) h, (size_t) stride);
|
||||
info->animation->renderSync((size_t) frame, surface, clear);
|
||||
info->nextFrameIsCacheFrame = true;
|
||||
}
|
||||
}
|
||||
|
||||
info->animation->renderSync((size_t) frame, surface, clear, &result);
|
||||
AndroidBitmap_unlockPixels(env, bitmap);
|
||||
}
|
||||
if (!result) {
|
||||
return -5;
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -354,7 +354,7 @@ public:
|
|||
*
|
||||
* @internal
|
||||
*/
|
||||
void renderSync(size_t frameNo, Surface &surface, bool clear);
|
||||
void renderSync(size_t frameNo, Surface &surface, bool clear, bool* result);
|
||||
|
||||
/**
|
||||
* @brief Returns root layer of the composition updated with
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
double frameRate() const { return mModel->frameRate(); }
|
||||
size_t totalFrame() const { return mModel->totalFrame(); }
|
||||
size_t frameAtPos(double pos) const { return mModel->frameAtPos(pos); }
|
||||
Surface render(size_t frameNo, const Surface &surface, bool clear);
|
||||
Surface render(size_t frameNo, const Surface &surface, bool clear, bool* result);
|
||||
const LOTLayerNode * renderTree(size_t frameNo, const VSize &size);
|
||||
|
||||
const LayerInfoList &layerInfoList() const
|
||||
|
@ -93,11 +93,12 @@ bool AnimationImpl::update(size_t frameNo, const VSize &size)
|
|||
return mCompItem->update(frameNo);
|
||||
}
|
||||
|
||||
Surface AnimationImpl::render(size_t frameNo, const Surface &surface, bool clear)
|
||||
Surface AnimationImpl::render(size_t frameNo, const Surface &surface, bool clear, bool* result)
|
||||
{
|
||||
bool renderInProgress = mRenderInProgress.load();
|
||||
if (renderInProgress) {
|
||||
vCritical << "Already Rendering Scheduled for this Animation";
|
||||
*result = false;
|
||||
return surface;
|
||||
}
|
||||
|
||||
|
@ -106,6 +107,7 @@ Surface AnimationImpl::render(size_t frameNo, const Surface &surface, bool clear
|
|||
VSize(surface.drawRegionWidth(), surface.drawRegionHeight()));
|
||||
mCompItem->render(surface, clear);
|
||||
mRenderInProgress.store(false);
|
||||
*result = true;
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
@ -198,9 +200,9 @@ const LOTLayerNode *Animation::renderTree(size_t frameNo, size_t width,
|
|||
return d->renderTree(frameNo, VSize(width, height));
|
||||
}
|
||||
|
||||
void Animation::renderSync(size_t frameNo, Surface &surface, bool clear)
|
||||
void Animation::renderSync(size_t frameNo, Surface &surface, bool clear, bool* res)
|
||||
{
|
||||
d->render(frameNo, surface, clear);
|
||||
d->render(frameNo, surface, clear, res);
|
||||
}
|
||||
|
||||
const LayerInfoList &Animation::layers() const
|
||||
|
|
5
TMessagesProj/proguard-rules.pro
vendored
|
@ -93,6 +93,11 @@
|
|||
<init>(com.google.android.exoplayer2.upstream.DataSource$Factory);
|
||||
}
|
||||
|
||||
# Huawei Services
|
||||
-keep class com.huawei.hianalytics.**{ *; }
|
||||
-keep class com.huawei.updatesdk.**{ *; }
|
||||
-keep class com.huawei.hms.**{ *; }
|
||||
|
||||
# Don't warn about checkerframework and Kotlin annotations
|
||||
-dontwarn org.checkerframework.**
|
||||
-dontwarn javax.annotation.**
|
||||
|
|
|
@ -329,15 +329,6 @@
|
|||
android:resizeableActivity="false"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".GoogleVoiceClientActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.voicesearch.SEND_MESSAGE_TO_CONTACTS" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="text/plain" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="org.telegram.ui.VoIPPermissionActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||
android:taskAffinity="${applicationId}.voip"
|
||||
|
@ -417,7 +408,6 @@
|
|||
android:foregroundServiceType="location"
|
||||
android:enabled="true"/>
|
||||
<service android:name=".voip.VoIPService" android:enabled="true" android:foregroundServiceType="mediaProjection|camera|microphone|mediaPlayback"/>
|
||||
<service android:name=".GoogleVoiceClientService"/>
|
||||
<service android:name=".MusicPlayerService" android:exported="true" android:enabled="true" android:foregroundServiceType="mediaPlayback"/>
|
||||
<service android:name=".MusicBrowserService" android:exported="true">
|
||||
<intent-filter>
|
||||
|
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 1,008 B After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.3 KiB |