Added IME flag asking Android not to process user input in secured chat rooms
This commit is contained in:
parent
eb0b998c2c
commit
60cc5a31c4
7 changed files with 30 additions and 2 deletions
|
@ -18,6 +18,7 @@ Group changes to describe their impact on the project, as follows:
|
||||||
- Allow video recording in chat file sharing
|
- Allow video recording in chat file sharing
|
||||||
- Unread messages indicator in chat conversation that separates read & unread messages
|
- Unread messages indicator in chat conversation that separates read & unread messages
|
||||||
- Notify incoming/outgoing calls on bluetooth devices using self-managed connections from telecom manager API (disables SDK audio focus)
|
- Notify incoming/outgoing calls on bluetooth devices using self-managed connections from telecom manager API (disables SDK audio focus)
|
||||||
|
- Ask Android to not process what user types in an encrypted chat room to improve privacy, see [IME_FLAG_NO_PERSONALIZED_LEARNING](https://developer.android.com/reference/android/view/inputmethod/EditorInfo#IME_FLAG_NO_PERSONALIZED_LEARNING)
|
||||||
- New video call UI on foldable device like Galaxy Z Fold
|
- New video call UI on foldable device like Galaxy Z Fold
|
||||||
- Setting to automatically record all calls
|
- Setting to automatically record all calls
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
package org.linphone.activities.main.chat.viewmodels
|
package org.linphone.activities.main.chat.viewmodels
|
||||||
|
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
|
@ -37,6 +38,7 @@ import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||||
import org.linphone.R
|
import org.linphone.R
|
||||||
import org.linphone.activities.main.chat.data.ChatMessageAttachmentData
|
import org.linphone.activities.main.chat.data.ChatMessageAttachmentData
|
||||||
import org.linphone.activities.main.chat.data.ChatMessageData
|
import org.linphone.activities.main.chat.data.ChatMessageData
|
||||||
|
import org.linphone.compatibility.Compatibility
|
||||||
import org.linphone.core.*
|
import org.linphone.core.*
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
import org.linphone.utils.AppUtils
|
import org.linphone.utils.AppUtils
|
||||||
|
@ -88,6 +90,13 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
||||||
|
|
||||||
val voiceRecordPlayingPosition = MutableLiveData<Int>()
|
val voiceRecordPlayingPosition = MutableLiveData<Int>()
|
||||||
|
|
||||||
|
val imeFlags: Int = if (chatRoom.hasCapability(ChatRoomCapabilities.Encrypted.toInt())) {
|
||||||
|
// IME_FLAG_NO_PERSONALIZED_LEARNING is only available on Android 8 and newer
|
||||||
|
Compatibility.getImeFlagsForSecureChatRoom()
|
||||||
|
} else {
|
||||||
|
EditorInfo.IME_FLAG_NO_EXTRACT_UI
|
||||||
|
}
|
||||||
|
|
||||||
private val recorder: Recorder
|
private val recorder: Recorder
|
||||||
|
|
||||||
private var voiceRecordAudioFocusRequest: AudioFocusRequestCompat? = null
|
private var voiceRecordAudioFocusRequest: AudioFocusRequestCompat? = null
|
||||||
|
|
|
@ -34,6 +34,7 @@ import android.os.Vibrator
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
import org.linphone.R
|
import org.linphone.R
|
||||||
import org.linphone.core.Content
|
import org.linphone.core.Content
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
|
@ -45,6 +46,7 @@ import org.linphone.utils.PermissionHelper
|
||||||
@TargetApi(21)
|
@TargetApi(21)
|
||||||
class Api21Compatibility {
|
class Api21Compatibility {
|
||||||
companion object {
|
companion object {
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
fun getDeviceName(context: Context): String {
|
fun getDeviceName(context: Context): String {
|
||||||
var name = BluetoothAdapter.getDefaultAdapter().name
|
var name = BluetoothAdapter.getDefaultAdapter().name
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
|
@ -212,5 +214,9 @@ class Api21Compatibility {
|
||||||
fun getUpdateCurrentPendingIntentFlag(): Int {
|
fun getUpdateCurrentPendingIntentFlag(): Int {
|
||||||
return PendingIntent.FLAG_UPDATE_CURRENT
|
return PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getImeFlagsForSecureChatRoom(): Int {
|
||||||
|
return EditorInfo.IME_FLAG_NO_EXTRACT_UI
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import android.media.AudioAttributes
|
||||||
import android.os.VibrationEffect
|
import android.os.VibrationEffect
|
||||||
import android.os.Vibrator
|
import android.os.Vibrator
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.core.app.NotificationManagerCompat
|
import androidx.core.app.NotificationManagerCompat
|
||||||
import org.linphone.R
|
import org.linphone.R
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
|
@ -149,5 +150,9 @@ class Api26Compatibility {
|
||||||
code
|
code
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getImeFlagsForSecureChatRoom(): Int {
|
||||||
|
return EditorInfo.IME_FLAG_NO_EXTRACT_UI or EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,5 +261,12 @@ class Compatibility {
|
||||||
}
|
}
|
||||||
return Api21Compatibility.getUpdateCurrentPendingIntentFlag()
|
return Api21Compatibility.getUpdateCurrentPendingIntentFlag()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getImeFlagsForSecureChatRoom(): Int {
|
||||||
|
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
|
||||||
|
return Api26Compatibility.getImeFlagsForSecureChatRoom()
|
||||||
|
}
|
||||||
|
return Api21Compatibility.getImeFlagsForSecureChatRoom()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,7 @@
|
||||||
android:id="@+id/message"
|
android:id="@+id/message"
|
||||||
android:enabled="@{!chatSendingViewModel.isReadOnly}"
|
android:enabled="@{!chatSendingViewModel.isReadOnly}"
|
||||||
android:text="@={chatSendingViewModel.textToSend}"
|
android:text="@={chatSendingViewModel.textToSend}"
|
||||||
|
android:imeOptions="@{chatSendingViewModel.imeFlags}"
|
||||||
android:hint="@string/chat_room_sending_message_hint"
|
android:hint="@string/chat_room_sending_message_hint"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -106,7 +107,6 @@
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/resizable_text_field"
|
android:background="@drawable/resizable_text_field"
|
||||||
android:imeOptions="flagNoExtractUi"
|
|
||||||
android:inputType="textShortMessage|textMultiLine|textAutoComplete|textAutoCorrect|textCapSentences"
|
android:inputType="textShortMessage|textMultiLine|textAutoComplete|textAutoCorrect|textCapSentences"
|
||||||
android:maxLines="6"
|
android:maxLines="6"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
|
|
|
@ -229,6 +229,7 @@
|
||||||
android:id="@+id/message"
|
android:id="@+id/message"
|
||||||
android:text="@={chatSendingViewModel.textToSend}"
|
android:text="@={chatSendingViewModel.textToSend}"
|
||||||
android:hint="@{chatSendingViewModel.isPendingAnswer ? @string/chat_room_sending_reply_hint : @string/chat_room_sending_message_hint}"
|
android:hint="@{chatSendingViewModel.isPendingAnswer ? @string/chat_room_sending_reply_hint : @string/chat_room_sending_message_hint}"
|
||||||
|
android:imeOptions="@{chatSendingViewModel.imeFlags}"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
@ -236,7 +237,6 @@
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/resizable_text_field"
|
android:background="@drawable/resizable_text_field"
|
||||||
android:imeOptions="flagNoExtractUi"
|
|
||||||
android:inputType="textShortMessage|textMultiLine|textAutoComplete|textAutoCorrect|textCapSentences"
|
android:inputType="textShortMessage|textMultiLine|textAutoComplete|textAutoCorrect|textCapSentences"
|
||||||
android:maxLines="6"
|
android:maxLines="6"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
|
|
Loading…
Reference in a new issue