Skip to content

Commit

Permalink
Update to 7.3.0 (2196)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKLO committed Dec 24, 2020
1 parent d52b2c9 commit 4b588b9
Show file tree
Hide file tree
Showing 69 changed files with 4,280 additions and 1,841 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ RUN $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSIO
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/intermediates/ndkBuild && cp -R /home/source/. /home/gradle && cd /home/gradle && gradle assembleRelease && cp -R /home/gradle/TMessagesProj/build/outputs/apk/. /home/source/TMessagesProj/build/outputs/apk && cp -R /home/gradle/TMessagesProj/build/intermediates/ndkBuild/. /home/source/TMessagesProj/build/intermediates/ndkBuild
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 assembleRelease && cp -R /home/gradle/TMessagesProj/build/outputs/apk/. /home/source/TMessagesProj/build/outputs/apk && cp -R /home/gradle/TMessagesProj/build/outputs/native-debug-symbols/. /home/source/TMessagesProj/build/outputs/native-debug-symbols
2 changes: 1 addition & 1 deletion TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ android {
}
}

defaultConfig.versionCode = 2195
defaultConfig.versionCode = 2196

applicationVariants.all { variant ->
variant.outputs.all { output ->
Expand Down
2,677 changes: 1,957 additions & 720 deletions TMessagesProj/jni/sqlite/sqlite3.c

Large diffs are not rendered by default.

79 changes: 71 additions & 8 deletions TMessagesProj/jni/sqlite/sqlite3.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.33.0"
#define SQLITE_VERSION_NUMBER 3033000
#define SQLITE_SOURCE_ID "2020-08-14 13:23:32 fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f"
#define SQLITE_VERSION "3.34.0"
#define SQLITE_VERSION_NUMBER 3034000
#define SQLITE_SOURCE_ID "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b"

/*
** CAPI3REF: Run-Time Library Version Numbers
Expand Down Expand Up @@ -504,6 +504,7 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_IOERR_COMMIT_ATOMIC (SQLITE_IOERR | (30<<8))
#define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<8))
#define SQLITE_IOERR_DATA (SQLITE_IOERR | (32<<8))
#define SQLITE_IOERR_CORRUPTFS (SQLITE_IOERR | (33<<8))
#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
#define SQLITE_LOCKED_VTAB (SQLITE_LOCKED | (2<<8))
#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
Expand Down Expand Up @@ -6186,6 +6187,57 @@ SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);
*/
SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);

/*
** CAPI3REF: Determine the transaction state of a database
** METHOD: sqlite3
**
** ^The sqlite3_txn_state(D,S) interface returns the current
** [transaction state] of schema S in database connection D. ^If S is NULL,
** then the highest transaction state of any schema on database connection D
** is returned. Transaction states are (in order of lowest to highest):
** <ol>
** <li value="0"> SQLITE_TXN_NONE
** <li value="1"> SQLITE_TXN_READ
** <li value="2"> SQLITE_TXN_WRITE
** </ol>
** ^If the S argument to sqlite3_txn_state(D,S) is not the name of
** a valid schema, then -1 is returned.
*/
SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);

/*
** CAPI3REF: Allowed return values from [sqlite3_txn_state()]
** KEYWORDS: {transaction state}
**
** These constants define the current transaction state of a database file.
** ^The [sqlite3_txn_state(D,S)] interface returns one of these
** constants in order to describe the transaction state of schema S
** in [database connection] D.
**
** <dl>
** [[SQLITE_TXN_NONE]] <dt>SQLITE_TXN_NONE</dt>
** <dd>The SQLITE_TXN_NONE state means that no transaction is currently
** pending.</dd>
**
** [[SQLITE_TXN_READ]] <dt>SQLITE_TXN_READ</dt>
** <dd>The SQLITE_TXN_READ state means that the database is currently
** in a read transaction. Content has been read from the database file
** but nothing in the database file has changed. The transaction state
** will advanced to SQLITE_TXN_WRITE if any changes occur and there are
** no other conflicting concurrent write transactions. The transaction
** state will revert to SQLITE_TXN_NONE following a [ROLLBACK] or
** [COMMIT].</dd>
**
** [[SQLITE_TXN_WRITE]] <dt>SQLITE_TXN_WRITE</dt>
** <dd>The SQLITE_TXN_WRITE state means that the database is currently
** in a write transaction. Content has been written to the database file
** but has not yet committed. The transaction state will change to
** to SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].</dd>
*/
#define SQLITE_TXN_NONE 0
#define SQLITE_TXN_READ 1
#define SQLITE_TXN_WRITE 2

/*
** CAPI3REF: Find the next prepared statement
** METHOD: sqlite3
Expand Down Expand Up @@ -7712,7 +7764,8 @@ SQLITE_API int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_RESULT_INTREAL 27
#define SQLITE_TESTCTRL_PRNG_SEED 28
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
#define SQLITE_TESTCTRL_LAST 29 /* Largest TESTCTRL */
#define SQLITE_TESTCTRL_SEEK_COUNT 30
#define SQLITE_TESTCTRL_LAST 30 /* Largest TESTCTRL */

/*
** CAPI3REF: SQL Keyword Checking
Expand Down Expand Up @@ -9192,10 +9245,11 @@ SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
** CAPI3REF: Determine If Virtual Table Column Access Is For UPDATE
**
** If the sqlite3_vtab_nochange(X) routine is called within the [xColumn]
** method of a [virtual table], then it returns true if and only if the
** method of a [virtual table], then it might return true if the
** column is being fetched as part of an UPDATE operation during which the
** column value will not change. Applications might use this to substitute
** a return value that is less expensive to compute and that the corresponding
** column value will not change. The virtual table implementation can use
** this hint as permission to substitute a return value that is less
** expensive to compute and that the corresponding
** [xUpdate] method understands as a "no-change" value.
**
** If the [xColumn] method calls sqlite3_vtab_nochange() and finds that
Expand All @@ -9204,6 +9258,12 @@ SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
** any of the [sqlite3_result_int|sqlite3_result_xxxxx() interfaces].
** In that case, [sqlite3_value_nochange(X)] will return true for the
** same column in the [xUpdate] method.
**
** The sqlite3_vtab_nochange() routine is an optimization. Virtual table
** implementations should continue to give a correct answer even if the
** sqlite3_vtab_nochange() interface were to always return false. In the
** current implementation, the sqlite3_vtab_nochange() interface does always
** returns false for the enhanced [UPDATE FROM] statement.
*/
SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*);

Expand Down Expand Up @@ -9345,6 +9405,7 @@ SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);

/*
** CAPI3REF: Flush caches to disk mid-transaction
** METHOD: sqlite3
**
** ^If a write-transaction is open on [database connection] D when the
** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
Expand Down Expand Up @@ -9377,6 +9438,7 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);

/*
** CAPI3REF: The pre-update hook.
** METHOD: sqlite3
**
** ^These interfaces are only available if SQLite is compiled using the
** [SQLITE_ENABLE_PREUPDATE_HOOK] compile-time option.
Expand Down Expand Up @@ -9417,7 +9479,7 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
** seventh parameter is the final rowid value of the row being inserted
** or updated. The value of the seventh parameter passed to the callback
** function is not defined for operations on WITHOUT ROWID tables, or for
** INSERT operations on rowid tables.
** DELETE operations on rowid tables.
**
** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()],
** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces
Expand Down Expand Up @@ -9479,6 +9541,7 @@ SQLITE_API int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);

/*
** CAPI3REF: Low-level system error code
** METHOD: sqlite3
**
** ^Attempt to return the underlying operating system error code or error
** number that caused the most recent I/O error or failure to open a file.
Expand Down
55 changes: 31 additions & 24 deletions TMessagesProj/jni/voip/org_telegram_messenger_voip_Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class JavaObject {
struct InstanceHolder {
std::unique_ptr<Instance> nativeInstance;
std::unique_ptr<GroupInstanceImpl> groupNativeInstance;
jobject javaInstance;
std::shared_ptr<tgcalls::VideoCaptureInterface> _videoCapture;
std::shared_ptr<PlatformContext> _platformContext;
};
Expand Down Expand Up @@ -254,17 +253,17 @@ void initWebRTC(JNIEnv *env) {
JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_makeGroupNativeInstance(JNIEnv *env, jclass clazz, jobject instanceObj, jboolean highQuality) {
initWebRTC(env);

jobject globalRef = env->NewGlobalRef(instanceObj);
std::shared_ptr<PlatformContext> platformContext = std::make_shared<AndroidContext>(env);
std::shared_ptr<PlatformContext> platformContext = std::make_shared<AndroidContext>(env, instanceObj);

GroupInstanceDescriptor descriptor = {
.networkStateUpdated = [globalRef](bool state) {
tgvoip::jni::DoWithJNI([globalRef, state](JNIEnv *env) {
.networkStateUpdated = [platformContext](bool state) {
tgvoip::jni::DoWithJNI([platformContext, state](JNIEnv *env) {
jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onNetworkStateUpdated", "(Z)V"), state);
});
},
.audioLevelsUpdated = [globalRef](GroupLevelsUpdate const &update) {
tgvoip::jni::DoWithJNI([globalRef, update](JNIEnv *env) {
.audioLevelsUpdated = [platformContext](GroupLevelsUpdate const &update) {
tgvoip::jni::DoWithJNI([platformContext, update](JNIEnv *env) {
unsigned int size = update.updates.size();
jintArray intArray = env->NewIntArray(size);
jfloatArray floatArray = env->NewFloatArray(size);
Expand All @@ -282,6 +281,7 @@ JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_makeGrou
env->SetFloatArrayRegion(floatArray, 0, size, floatFill);
env->SetBooleanArrayRegion(boolArray, 0, size, boolFill);

jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onAudioLevelsUpdated", "([I[F[Z)V"), intArray, floatArray, boolArray);
env->DeleteLocalRef(intArray);
env->DeleteLocalRef(floatArray);
Expand All @@ -293,14 +293,14 @@ JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_makeGrou

auto *holder = new InstanceHolder;
holder->groupNativeInstance = std::make_unique<GroupInstanceImpl>(std::move(descriptor));
holder->javaInstance = globalRef;
holder->_platformContext = platformContext;
holder->groupNativeInstance->emitJoinPayload([globalRef](const GroupJoinPayload& payload) {
holder->groupNativeInstance->emitJoinPayload([platformContext](const GroupJoinPayload& payload) {
JNIEnv *env = webrtc::AttachCurrentThreadIfNeeded();
jobjectArray array = env->NewObjectArray(payload.fingerprints.size(), FingerprintClass, 0);
for (int a = 0; a < payload.fingerprints.size(); a++) {
env->SetObjectArrayElement(array, a, asJavaFingerprint(env, payload.fingerprints[a].hash, payload.fingerprints[a].setup, payload.fingerprints[a].fingerprint));
}
jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onEmitJoinPayload", "(Ljava/lang/String;Ljava/lang/String;[Lorg/telegram/messenger/voip/Instance$Fingerprint;I)V"), env->NewStringUTF(payload.ufrag.c_str()), env->NewStringUTF(payload.pwd.c_str()), array, (jint) payload.ssrc);
});
return reinterpret_cast<jlong>(holder);
Expand Down Expand Up @@ -382,56 +382,65 @@ JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_makeNati
memcpy(encryptionKeyValue->data(), valueBytes, 256);
env->ReleaseByteArrayElements(valueByteArray, (jbyte *) valueBytes, JNI_ABORT);

jobject globalRef = env->NewGlobalRef(instanceObj);
std::shared_ptr<VideoCaptureInterface> videoCapture = videoCapturer ? std::shared_ptr<VideoCaptureInterface>(reinterpret_cast<VideoCaptureInterface *>(videoCapturer)) : nullptr;

std::shared_ptr<PlatformContext> platformContext = videoCapture ? videoCapture->getPlatformContext() : std::make_shared<AndroidContext>(env);
std::shared_ptr<PlatformContext> platformContext;
if (videoCapture) {
platformContext = videoCapture->getPlatformContext();
((AndroidContext *) platformContext.get())->setJavaInstance(env, instanceObj);
} else {
platformContext = std::make_shared<AndroidContext>(env, instanceObj);
}

Descriptor descriptor = {
.config = Config{
.initializationTimeout = configObject.getDoubleField("initializationTimeout"),
.receiveTimeout = configObject.getDoubleField("receiveTimeout"),
.dataSaving = parseDataSaving(env, configObject.getIntField("dataSaving")),
.enableP2P = configObject.getBooleanField("enableP2p") == JNI_TRUE,
.enableStunMarking = configObject.getBooleanField("enableSm") == JNI_TRUE,
.enableAEC = configObject.getBooleanField("enableAec") == JNI_TRUE,
.enableNS = configObject.getBooleanField("enableNs") == JNI_TRUE,
.enableAGC = configObject.getBooleanField("enableAgc") == JNI_TRUE,
.enableStunMarking = configObject.getBooleanField("enableSm") == JNI_TRUE,
.enableVolumeControl = true,
.logPath = tgvoip::jni::JavaStringToStdString(env, configObject.getStringField("logPath")),
.statsLogPath = tgvoip::jni::JavaStringToStdString(env, configObject.getStringField("statsLogPath")),
.maxApiLayer = configObject.getIntField("maxApiLayer"),
.enableHighBitrateVideo = true,
.statsLogPath = tgvoip::jni::JavaStringToStdString(env, configObject.getStringField("statsLogPath")),
.preferredVideoCodecs = {cricket::kVp9CodecName}
},
.encryptionKey = EncryptionKey(
std::move(encryptionKeyValue),
encryptionKeyObject.getBooleanField("isOutgoing") == JNI_TRUE),
.videoCapture = videoCapture,
.stateUpdated = [globalRef](State state) {
.stateUpdated = [platformContext](State state) {
jint javaState = asJavaState(state);
jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
tgvoip::jni::DoWithJNI([globalRef, javaState](JNIEnv *env) {
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onStateUpdated", "(I)V"), javaState);
});
},
.platformContext = platformContext,
.signalBarsUpdated = [globalRef](int count) {
.signalBarsUpdated = [platformContext](int count) {
jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
tgvoip::jni::DoWithJNI([globalRef, count](JNIEnv *env) {
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onSignalBarsUpdated", "(I)V"), count);
});
},
.remoteMediaStateUpdated = [globalRef](AudioState audioState, VideoState videoState) {
.remoteMediaStateUpdated = [platformContext](AudioState audioState, VideoState videoState) {
jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
tgvoip::jni::DoWithJNI([globalRef, audioState, videoState](JNIEnv *env) {
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onRemoteMediaStateUpdated", "(II)V"), (jint) audioState, (jint )videoState);
});
},
.signalingDataEmitted = [globalRef](const std::vector<uint8_t> &data) {
.signalingDataEmitted = [platformContext](const std::vector<uint8_t> &data) {
jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
tgvoip::jni::DoWithJNI([globalRef, data](JNIEnv *env) {
jbyteArray arr = copyVectorToJavaByteArray(env, data);
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onSignalingData", "([B)V"), arr);
env->DeleteLocalRef(arr);
});
},
.platformContext = platformContext,
};

for (int i = 0, size = env->GetArrayLength(endpoints); i < size; i++) {
Expand Down Expand Up @@ -474,7 +483,6 @@ JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_makeNati

auto *holder = new InstanceHolder;
holder->nativeInstance = tgcalls::Meta::Create(v, std::move(descriptor));
holder->javaInstance = globalRef;
holder->_videoCapture = videoCapture;
holder->_platformContext = platformContext;
holder->nativeInstance->setIncomingVideoOutput(webrtc::JavaToNativeVideoSink(env, remoteSink));
Expand Down Expand Up @@ -576,10 +584,10 @@ JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_stopNativ
}
instance->nativeInstance->stop([instance](FinalState finalState) {
JNIEnv *env = webrtc::AttachCurrentThreadIfNeeded();
const std::string &path = tgvoip::jni::JavaStringToStdString(env, JavaObject(env, instance->javaInstance).getStringField("persistentStateFilePath"));
jobject globalRef = ((AndroidContext *) instance->_platformContext.get())->getJavaInstance();
const std::string &path = tgvoip::jni::JavaStringToStdString(env, JavaObject(env, globalRef).getStringField("persistentStateFilePath"));
savePersistentState(path.c_str(), finalState.persistentState);
env->CallVoidMethod(instance->javaInstance, env->GetMethodID(NativeInstanceClass, "onStop", "(Lorg/telegram/messenger/voip/Instance$FinalState;)V"), asJavaFinalState(env, finalState));
env->DeleteGlobalRef(instance->javaInstance);
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onStop", "(Lorg/telegram/messenger/voip/Instance$FinalState;)V"), asJavaFinalState(env, finalState));
delete instance;
});
}
Expand All @@ -591,13 +599,12 @@ JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_stopGroup
}
instance->groupNativeInstance->stop();
instance->groupNativeInstance.reset();
env->DeleteGlobalRef(instance->javaInstance);
delete instance;
}

JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_createVideoCapturer(JNIEnv *env, jclass clazz, jobject localSink, jboolean front) {
initWebRTC(env);
std::unique_ptr<VideoCaptureInterface> capture = tgcalls::VideoCaptureInterface::Create(front ? "front" : "back", std::make_shared<AndroidContext>(env));
std::unique_ptr<VideoCaptureInterface> capture = tgcalls::VideoCaptureInterface::Create(front ? "front" : "back", std::make_shared<AndroidContext>(env, nullptr));
capture->setOutput(webrtc::JavaToNativeVideoSink(env, localSink));
capture->setState(VideoState::Active);
return reinterpret_cast<intptr_t>(capture.release());
Expand Down
Loading

1 comment on commit 4b588b9

@AlexandrKozlovskiy
Copy link

@AlexandrKozlovskiy AlexandrKozlovskiy commented on 4b588b9 Dec 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated yesterday version from google play,and it still exists several accessibility issues with talkback android 10.

  1. When i have a focus on share button and swipe left to a voice message,talkback announce nothing. when i continue swipe left,on boice message talkback announce nothing too,but it announce share button. When i swipe right,or use explore by touch,all ok. Also all ok when i swipe left/right between text messages.
  2. During the scrolling of members,media,and may be other information items of group,after scrolling focus jump on some incorrect item.
  3. I not tested it yet,but before,as i know,it was impossible press on accept/reject button on screen lock.
  4. Can you please again add progress of playing of voice message,when i focus in it,because before talkback announce it.

You can read more about accessibility issues which noticed blind people at https://t.me/TGAAB. Thank you for your work about telegram accessibility. @DrKLO,i hope you will fix this issues.

Please sign in to comment.