update to 8.9.0

This commit is contained in:
xaxtix 2022-08-12 19:23:51 +04:00
parent 6cb1cdf898
commit b1aa2020e5
3870 changed files with 26568 additions and 6357 deletions

View file

@ -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}:$PATH
ENV PATH ${ANDROID_NDK_HOME}/prebuilt/linux-x86_64/bin/:$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

View file

@ -1,4 +1,4 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.library'
repositories { repositories {
mavenCentral() mavenCentral()
@ -38,7 +38,6 @@ dependencies {
implementation 'com.stripe:stripe-android:2.0.2' implementation 'com.stripe:stripe-android:2.0.2'
implementation 'com.google.mlkit:language-id:16.1.1' implementation 'com.google.mlkit:language-id:16.1.1'
implementation 'com.android.billingclient:billing:5.0.0' implementation 'com.android.billingclient:billing:5.0.0'
implementation files('libs/libgsaverification-client.aar')
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
} }
@ -48,8 +47,6 @@ android {
buildToolsVersion '31.0.0' buildToolsVersion '31.0.0'
ndkVersion "21.4.7075529" ndkVersion "21.4.7075529"
defaultConfig.applicationId = "org.telegram.messenger"
sourceSets.main.jniLibs.srcDirs = ['./jni/'] sourceSets.main.jniLibs.srcDirs = ['./jni/']
externalNativeBuild { externalNativeBuild {
@ -75,189 +72,17 @@ android {
coreLibraryDesugaringEnabled true coreLibraryDesugaringEnabled true
} }
signingConfigs { defaultConfig.versionCode = 2751
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 { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 30 targetSdkVersion 30
versionName "8.8.5" versionName "8.9.0"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi'] vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
multiDexEnabled true
externalNativeBuild { externalNativeBuild {
cmake { cmake {
version '3.10.2' 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' apply plugin: 'com.google.gms.google-services'

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="org.telegram.messenger"
android:installLocation="auto"> android:installLocation="auto">
<uses-feature android:name="android.hardware.location.gps" android:required="false" /> <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" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
<service <service
android:name=".GcmPushListenerService"> android:name="org.telegram.messenger.GcmPushListenerService">
<intent-filter> <intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" /> <action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter> </intent-filter>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="org.telegram.messenger"
android:installLocation="auto"> android:installLocation="auto">
<uses-feature android:name="android.hardware.location.gps" android:required="false" /> <uses-feature android:name="android.hardware.location.gps" android:required="false" />
@ -26,7 +25,6 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/AppNameBeta" android:label="@string/AppNameBeta"
android:theme="@style/Theme.TMessages.Start" android:theme="@style/Theme.TMessages.Start"
android:name=".ApplicationLoader"
android:hardwareAccelerated="@bool/useHardwareAcceleration" android:hardwareAccelerated="@bool/useHardwareAcceleration"
android:largeHeap="true" android:largeHeap="true"
android:supportsRtl="false" android:supportsRtl="false"
@ -36,7 +34,7 @@
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
<service <service
android:name=".GcmPushListenerService"> android:name="org.telegram.messenger.GcmPushListenerService">
<intent-filter> <intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" /> <action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter> </intent-filter>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="org.telegram.messenger"
android:installLocation="auto"> android:installLocation="auto">
<uses-feature android:name="android.hardware.location.gps" android:required="false" /> <uses-feature android:name="android.hardware.location.gps" android:required="false" />
@ -23,7 +22,6 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/AppName" android:label="@string/AppName"
android:theme="@style/Theme.TMessages.Start" android:theme="@style/Theme.TMessages.Start"
android:name=".ApplicationLoader"
android:hardwareAccelerated="@bool/useHardwareAcceleration" android:hardwareAccelerated="@bool/useHardwareAcceleration"
android:largeHeap="true" android:largeHeap="true"
android:supportsRtl="false" android:supportsRtl="false"
@ -33,7 +31,7 @@
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
<service <service
android:name=".GcmPushListenerService"> android:name="org.telegram.messenger.GcmPushListenerService">
<intent-filter> <intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" /> <action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter> </intent-filter>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="org.telegram.messenger"
android:installLocation="auto"> android:installLocation="auto">
<uses-feature android:name="android.hardware.location.gps" android:required="false" /> <uses-feature android:name="android.hardware.location.gps" android:required="false" />
@ -26,7 +25,6 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/AppName" android:label="@string/AppName"
android:theme="@style/Theme.TMessages.Start" android:theme="@style/Theme.TMessages.Start"
android:name=".ApplicationLoader"
android:hardwareAccelerated="@bool/useHardwareAcceleration" android:hardwareAccelerated="@bool/useHardwareAcceleration"
android:largeHeap="true" android:largeHeap="true"
android:supportsRtl="false" android:supportsRtl="false"
@ -36,7 +34,7 @@
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
<service <service
android:name=".GcmPushListenerService"> android:name="org.telegram.messenger.GcmPushListenerService">
<intent-filter> <intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" /> <action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter> </intent-filter>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="org.telegram.messenger"
android:installLocation="auto"> android:installLocation="auto">
<uses-feature android:name="android.hardware.location.gps" android:required="false" /> <uses-feature android:name="android.hardware.location.gps" android:required="false" />
@ -26,7 +25,6 @@
android:roundIcon="@mipmap/ic_launcher_sa" android:roundIcon="@mipmap/ic_launcher_sa"
android:label="@string/AppName" android:label="@string/AppName"
android:theme="@style/Theme.TMessages.Start" android:theme="@style/Theme.TMessages.Start"
android:name=".ApplicationLoader"
android:hardwareAccelerated="@bool/useHardwareAcceleration" android:hardwareAccelerated="@bool/useHardwareAcceleration"
android:largeHeap="true" android:largeHeap="true"
android:supportsRtl="false" android:supportsRtl="false"
@ -36,7 +34,7 @@
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
<service <service
android:name=".GcmPushListenerService"> android:name="org.telegram.messenger.GcmPushListenerService">
<intent-filter> <intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" /> <action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter> </intent-filter>

View file

@ -42,7 +42,6 @@ typedef struct LottieInfo {
uint32_t fileFrame = 0; uint32_t fileFrame = 0;
bool nextFrameIsCacheFrame = false; bool nextFrameIsCacheFrame = false;
FILE *precacheFile = nullptr;
char *compressBuffer = nullptr; char *compressBuffer = nullptr;
const char *buffer = nullptr; const char *buffer = nullptr;
bool firstFrame = false; bool firstFrame = false;
@ -164,18 +163,6 @@ JNIEXPORT jlong Java_org_telegram_ui_Components_RLottieDrawable_create(JNIEnv *e
return (jlong) (intptr_t) info; 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) { 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; std::map<int32_t, int32_t> *colors = nullptr;
if (colorReplacement != 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) { 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) { if (!ptr || bitmap == nullptr) {
@ -382,73 +249,16 @@ JNIEXPORT jint Java_org_telegram_ui_Components_RLottieDrawable_getFrame(JNIEnv *
} }
auto info = (LottieInfo *) (intptr_t) ptr; 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; void *pixels;
bool result = false;
if (AndroidBitmap_lockPixels(env, bitmap, &pixels) >= 0) { 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); Surface surface((uint32_t *) pixels, (size_t) w, (size_t) h, (size_t) stride);
info->animation->renderSync((size_t) frame, surface, clear); info->animation->renderSync((size_t) frame, surface, clear, &result);
info->nextFrameIsCacheFrame = true;
}
}
AndroidBitmap_unlockPixels(env, bitmap); AndroidBitmap_unlockPixels(env, bitmap);
} }
if (!result) {
return -5;
}
return frame; return frame;
} }
} }

View file

@ -354,7 +354,7 @@ public:
* *
* @internal * @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 * @brief Returns root layer of the composition updated with

View file

@ -44,7 +44,7 @@ public:
double frameRate() const { return mModel->frameRate(); } double frameRate() const { return mModel->frameRate(); }
size_t totalFrame() const { return mModel->totalFrame(); } size_t totalFrame() const { return mModel->totalFrame(); }
size_t frameAtPos(double pos) const { return mModel->frameAtPos(pos); } 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 LOTLayerNode * renderTree(size_t frameNo, const VSize &size);
const LayerInfoList &layerInfoList() const const LayerInfoList &layerInfoList() const
@ -93,11 +93,12 @@ bool AnimationImpl::update(size_t frameNo, const VSize &size)
return mCompItem->update(frameNo); 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(); bool renderInProgress = mRenderInProgress.load();
if (renderInProgress) { if (renderInProgress) {
vCritical << "Already Rendering Scheduled for this Animation"; vCritical << "Already Rendering Scheduled for this Animation";
*result = false;
return surface; return surface;
} }
@ -106,6 +107,7 @@ Surface AnimationImpl::render(size_t frameNo, const Surface &surface, bool clear
VSize(surface.drawRegionWidth(), surface.drawRegionHeight())); VSize(surface.drawRegionWidth(), surface.drawRegionHeight()));
mCompItem->render(surface, clear); mCompItem->render(surface, clear);
mRenderInProgress.store(false); mRenderInProgress.store(false);
*result = true;
return surface; return surface;
} }
@ -198,9 +200,9 @@ const LOTLayerNode *Animation::renderTree(size_t frameNo, size_t width,
return d->renderTree(frameNo, VSize(width, height)); 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 const LayerInfoList &Animation::layers() const

View file

@ -93,6 +93,11 @@
<init>(com.google.android.exoplayer2.upstream.DataSource$Factory); <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 # Don't warn about checkerframework and Kotlin annotations
-dontwarn org.checkerframework.** -dontwarn org.checkerframework.**
-dontwarn javax.annotation.** -dontwarn javax.annotation.**

View file

@ -329,15 +329,6 @@
android:resizeableActivity="false" android:resizeableActivity="false"
android:windowSoftInputMode="adjustResize|stateHidden"> android:windowSoftInputMode="adjustResize|stateHidden">
</activity> </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" <activity android:name="org.telegram.ui.VoIPPermissionActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:taskAffinity="${applicationId}.voip" android:taskAffinity="${applicationId}.voip"
@ -417,7 +408,6 @@
android:foregroundServiceType="location" android:foregroundServiceType="location"
android:enabled="true"/> android:enabled="true"/>
<service android:name=".voip.VoIPService" android:enabled="true" android:foregroundServiceType="mediaProjection|camera|microphone|mediaPlayback"/> <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=".MusicPlayerService" android:exported="true" android:enabled="true" android:foregroundServiceType="mediaPlayback"/>
<service android:name=".MusicBrowserService" android:exported="true"> <service android:name=".MusicBrowserService" android:exported="true">
<intent-filter> <intent-filter>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,008 B

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Some files were not shown because too many files have changed in this diff Show more