Skip to content

Commit

Permalink
Update to 7.0.0 (2060)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKLO committed Aug 14, 2020
1 parent c0125f2 commit 321b756
Show file tree
Hide file tree
Showing 8,001 changed files with 1,605,488 additions and 421,671 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
101 changes: 8 additions & 93 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import java.security.MessageDigest

apply plugin: 'com.android.application'

repositories {
Expand All @@ -26,7 +24,7 @@ dependencies {

compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
implementation 'com.google.firebase:firebase-messaging:20.2.3'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
implementation 'com.google.firebase:firebase-config:19.2.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-auth:18.1.0'
Expand All @@ -38,6 +36,8 @@ dependencies {
implementation 'com.googlecode.mp4parser:isoparser:1.0.6'
implementation 'com.stripe:stripe-android:2.0.2'
implementation files('libs/libgsaverification-client.aar')

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
}

android {
Expand Down Expand Up @@ -68,6 +68,8 @@ android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

coreLibraryDesugaringEnabled true
}

signingConfigs {
Expand Down Expand Up @@ -277,12 +279,7 @@ android {
}
}

defaultConfig.versionCode = 2042

def tgVoipDexFileName = "libtgvoip.dex"
def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"]
def tgVoipDexClassesPath = "org/telegram/messenger/voip"
def dxUtilPath = "${sdkDirectory.path}/build-tools/${buildToolsVersion}/dx"
defaultConfig.versionCode = 2060

applicationVariants.all { variant ->
variant.outputs.all { output ->
Expand All @@ -305,61 +302,6 @@ android {
file(manifestPath).write(manifestContent)
}
}

def assembleTgVoipDexTaskName = "assemble${variant.name.capitalize()}TgVoipDex"

task "${assembleTgVoipDexTaskName}" {
doLast {
def sourceDir = (File) android.sourceSets.main.java.srcDirs[0]
def classesDir = "${buildDir}/intermediates/javac/${variant.name}/classes"
def javaDir = "${buildDir}/intermediates/java_tgvoip/${variant.name}/java"
def tgVoipDir = new File(classesDir, tgVoipDexClassesPath)
def javaVoipDirFile = new File(javaDir, tgVoipDexClassesPath)
def tgVoipDexJavaFile = new File(javaVoipDirFile, "TgVoipDex.java")
if (!javaVoipDirFile.exists()) {
javaVoipDirFile.mkdirs()
}
def assetsDirFile = new File(buildDir, "intermediates/merged_assets/${variant.name}/out")
if (!assetsDirFile.exists()) {
assetsDirFile.mkdirs()
}
def tgVoipDexFile = new File(assetsDirFile, tgVoipDexFileName)

def classes = tgVoipDir.list(new FilenameFilter() {
@Override
boolean accept(File dir, String name) {
// handle inner and anonymous classes
return tgVoipDexClasses.any { name == "${it}.class" || name.startsWith("${it}\$") && name.endsWith(".class") }
}
}).collect { "${tgVoipDexClassesPath}/${it}" }

// 1. create libtgvoip.dex
exec {
workingDir classesDir
commandLine([dxUtilPath, "--dex", "--output=${tgVoipDexFile}"] + classes)
}

// 2. remove classes from the main dex
project.delete classes.collect { "${classesDir}/${it}" }

// 3. insert checksum of libtgvoip.dex into TgVoipDex.java
def digest = MessageDigest.getInstance("SHA1")
def fileInputStream = tgVoipDexFile.newInputStream()
def buffer = new byte[4096]
def len
while ((len = fileInputStream.read(buffer)) > 0) {
digest.update(buffer, 0, len)
}
def dexChecksum = new String(Base64.getEncoder().encode(digest.digest())).trim()
tgVoipDexJavaFile.write(new String(new File(sourceDir, "${tgVoipDexClassesPath}/TgVoipDex.java").readBytes()).replace("\$CHECKSUM\$", dexChecksum))
exec {
commandLine([findJavac(), "-d", classesDir, tgVoipDexJavaFile.absolutePath])
}
}
}

tasks.findByName("compile${variant.name.capitalize()}JavaWithJavac").finalizedBy(assembleTgVoipDexTaskName)
tasks.findByName("${assembleTgVoipDexTaskName}").mustRunAfter tasks.findByName("merge${variant.name.capitalize()}Assets")
}

variantFilter { variant ->
Expand All @@ -372,44 +314,17 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionName "6.3.0"
versionName "7.0.0"

vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

externalNativeBuild {
ndkBuild {
arguments "NDK_APPLICATION_MK:=jni/Application.mk", "APP_PLATFORM:=android-16", "--jobs=8", "LOCAL_ARM_NEON:=false"
arguments "NDK_APPLICATION_MK:=jni/Application.mk", "APP_PLATFORM:=android-16", "--jobs=16"
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
}
}
}

private static File findJavaHome() {
String javaPath = System.getProperty("java.home")
if (javaPath != null) {
File javaBase = new File(javaPath)
if (javaBase.exists()) {
if (javaBase.getName().equalsIgnoreCase("jre") && new File(javaBase.getParentFile(), "bin/java").exists()) {
return javaBase.getParentFile()
} else {
return javaBase
}
} else {
return null
}
} else {
return null
}
}

private static File findJavac() {
File javaHome = findJavaHome()
if (javaHome != null) {
return new File(javaHome, "bin/javac")
} else {
return null
}
}

apply plugin: 'com.google.gms.google-services'
128 changes: 66 additions & 62 deletions TMessagesProj/jni/Android.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
MY_LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(MY_LOCAL_PATH)
LOCAL_PATH := $(call my-dir)

LOCAL_MODULE := avutil

Expand Down Expand Up @@ -97,18 +96,23 @@ include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

TGVOIP_NATIVE_VERSION := 1.1
TGVOIP_ADDITIONAL_CFLAGS := -DTGVOIP_NO_VIDEO
include $(MY_LOCAL_PATH)/libtgvoip/Android.mk
LOCAL_PATH := $(MY_LOCAL_PATH) # restore local path after include
include $(CLEAR_VARS)
LOCAL_MODULE := ssl

TGVOIP_NATIVE_VERSION := 3.1
TGVOIP_ADDITIONAL_CFLAGS := -DTGVOIP_NO_VIDEO
include $(MY_LOCAL_PATH)/libtgvoip3/Android.mk
LOCAL_PATH := $(MY_LOCAL_PATH) # restore local path after include
include $(CLEAR_VARS)
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_SRC_FILES := ./boringssl/lib/libssl_armeabi-v7a.a
else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
LOCAL_SRC_FILES := ./boringssl/lib/libssl_arm64-v8a.a
else ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_SRC_FILES := ./boringssl/lib/libssl_x86.a
else ifeq ($(TARGET_ARCH_ABI),x86_64)
LOCAL_SRC_FILES := ./boringssl/lib/libssl_x86_64.a
endif

include $(PREBUILT_STATIC_LIBRARY)

include ./jni/TgCalls.mk

include $(CLEAR_VARS)
LOCAL_CPPFLAGS := -Wall -std=c++14 -DANDROID -frtti -DHAVE_PTHREAD -finline-functions -ffast-math -Os

LOCAL_C_INCLUDES += ./jni/boringssl/include/
Expand Down Expand Up @@ -294,8 +298,8 @@ LOCAL_ARM_MODE := arm
LOCAL_MODULE := rlottie
LOCAL_CPPFLAGS := -DNDEBUG -Wall -std=c++14 -DANDROID -fno-rtti -DHAVE_PTHREAD -finline-functions -ffast-math -Os -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wnon-virtual-dtor -Woverloaded-virtual -Wno-unused-parameter -fvisibility=hidden
ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI),armeabi-v7a))
LOCAL_CFLAGS := -DUSE_ARM_NEON -fno-integrated-as
LOCAL_CPPFLAGS += -DUSE_ARM_NEON -fno-integrated-as
LOCAL_CFLAGS := -DUSE_ARM_NEON -fno-integrated-as
LOCAL_CPPFLAGS += -DUSE_ARM_NEON -fno-integrated-as
else ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI),arm64-v8a))
LOCAL_CFLAGS := -DUSE_ARM_NEON -D__ARM64_NEON__ -fno-integrated-as
LOCAL_CPPFLAGS += -DUSE_ARM_NEON -D__ARM64_NEON__ -fno-integrated-as
Expand Down Expand Up @@ -353,13 +357,15 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false

LOCAL_MODULE := tmessages.31
LOCAL_MODULE := tmessages.32
LOCAL_CFLAGS := -w -std=c11 -Os -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -ffast-math -D__STDC_CONSTANT_MACROS
LOCAL_CPPFLAGS := -DBSD=1 -ffast-math -Os -funroll-loops -std=c++14
LOCAL_LDLIBS := -ljnigraphics -llog -lz -lEGL -lGLESv2 -landroid
LOCAL_LDLIBS := -ljnigraphics -llog -lz -lEGL -lGLESv2 -landroid -lOpenSLES
LOCAL_STATIC_LIBRARIES := webp sqlite lz4 rlottie tgnet swscale avformat avcodec avresample avutil flac
LOCAL_WHOLE_STATIC_LIBRARIES := tgcalls
LOCAL_ARM_NEON := false

LOCAL_SRC_FILES := \
./opus/src/opus.c \
Expand Down Expand Up @@ -399,7 +405,7 @@ else
LOCAL_CPPFLAGS += -Dx86fix
LOCAL_ARM_MODE := arm
# LOCAL_SRC_FILES += \
# ./libyuv/source/row_x86.asm
# ./third_party/libyuv/source/row_x86.asm

# LOCAL_SRC_FILES += \
# ./opus/celt/x86/celt_lpc_sse.c \
Expand Down Expand Up @@ -560,65 +566,63 @@ LOCAL_C_INCLUDES := \
./jni/opus/celt \
./jni/opus/ \
./jni/opus/opusfile \
./jni/libyuv/include \
./jni/third_party/libyuv/include \
./jni/boringssl/include \
./jni/ffmpeg/include \
./jni/emoji \
./jni/exoplayer/include \
./jni/exoplayer/libFLAC/include \
./jni/intro \
./jni/rlottie/inc \
./jni/ton \
./jni/tgcalls/ \
./jni/webrtc/ \
./jni/lz4

LOCAL_SRC_FILES += \
./libyuv/source/compare_common.cc \
./libyuv/source/compare_gcc.cc \
./libyuv/source/compare_neon64.cc \
./libyuv/source/compare_win.cc \
./libyuv/source/compare.cc \
./libyuv/source/convert_argb.cc \
./libyuv/source/convert_from_argb.cc \
./libyuv/source/convert_from.cc \
./libyuv/source/convert_jpeg.cc \
./libyuv/source/convert_to_argb.cc \
./libyuv/source/convert_to_i420.cc \
./libyuv/source/convert.cc \
./libyuv/source/cpu_id.cc \
./libyuv/source/mjpeg_decoder.cc \
./libyuv/source/mjpeg_validate.cc \
./libyuv/source/planar_functions.cc \
./libyuv/source/rotate_any.cc \
./libyuv/source/rotate_argb.cc \
./libyuv/source/rotate_common.cc \
./libyuv/source/rotate_gcc.cc \
./libyuv/source/rotate_mips.cc \
./libyuv/source/rotate_neon64.cc \
./libyuv/source/rotate_win.cc \
./libyuv/source/rotate.cc \
./libyuv/source/row_any.cc \
./libyuv/source/row_common.cc \
./libyuv/source/row_gcc.cc \
./libyuv/source/row_mips.cc \
./libyuv/source/row_neon64.cc \
./libyuv/source/row_win.cc \
./libyuv/source/scale_any.cc \
./libyuv/source/scale_argb.cc \
./libyuv/source/scale_common.cc \
./libyuv/source/scale_gcc.cc \
./libyuv/source/scale_mips.cc \
./libyuv/source/scale_neon64.cc \
./libyuv/source/scale_win.cc \
./libyuv/source/scale.cc \
./libyuv/source/video_common.cc
./third_party/libyuv/source/compare_common.cc \
./third_party/libyuv/source/compare_gcc.cc \
./third_party/libyuv/source/compare_neon64.cc \
./third_party/libyuv/source/compare_win.cc \
./third_party/libyuv/source/compare.cc \
./third_party/libyuv/source/convert_argb.cc \
./third_party/libyuv/source/convert_from_argb.cc \
./third_party/libyuv/source/convert_from.cc \
./third_party/libyuv/source/convert_jpeg.cc \
./third_party/libyuv/source/convert_to_argb.cc \
./third_party/libyuv/source/convert_to_i420.cc \
./third_party/libyuv/source/convert.cc \
./third_party/libyuv/source/cpu_id.cc \
./third_party/libyuv/source/mjpeg_decoder.cc \
./third_party/libyuv/source/mjpeg_validate.cc \
./third_party/libyuv/source/planar_functions.cc \
./third_party/libyuv/source/rotate_any.cc \
./third_party/libyuv/source/rotate_argb.cc \
./third_party/libyuv/source/rotate_common.cc \
./third_party/libyuv/source/rotate_gcc.cc \
./third_party/libyuv/source/rotate_neon64.cc \
./third_party/libyuv/source/rotate_win.cc \
./third_party/libyuv/source/rotate.cc \
./third_party/libyuv/source/row_any.cc \
./third_party/libyuv/source/row_common.cc \
./third_party/libyuv/source/row_gcc.cc \
./third_party/libyuv/source/row_neon64.cc \
./third_party/libyuv/source/row_win.cc \
./third_party/libyuv/source/scale_any.cc \
./third_party/libyuv/source/scale_argb.cc \
./third_party/libyuv/source/scale_common.cc \
./third_party/libyuv/source/scale_gcc.cc \
./third_party/libyuv/source/scale_neon64.cc \
./third_party/libyuv/source/scale_win.cc \
./third_party/libyuv/source/scale.cc \
./third_party/libyuv/source/video_common.cc

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_CFLAGS += -DLIBYUV_NEON
LOCAL_SRC_FILES += \
./libyuv/source/compare_neon.cc.neon \
./libyuv/source/rotate_neon.cc.neon \
./libyuv/source/row_neon.cc.neon \
./libyuv/source/scale_neon.cc.neon
./third_party/libyuv/source/compare_neon.cc.neon \
./third_party/libyuv/source/rotate_neon.cc.neon \
./third_party/libyuv/source/row_neon.cc.neon \
./third_party/libyuv/source/scale_neon.cc.neon
endif

LOCAL_SRC_FILES += \
Expand Down
Loading

0 comments on commit 321b756

Please sign in to comment.