Use constant TAG as log tag everywhere
This commit is contained in:
@ -40,13 +40,13 @@ class AccountsActivity : AppCompatActivity() {
|
||||
addAccountButton.setOnClickListener {
|
||||
val aor = newAorView.text.toString().trim()
|
||||
if (!Utils.checkAor("sip:$aor")) {
|
||||
Log.d("Baresip", "Invalid Address of Record $aor")
|
||||
Log.d(TAG, "Invalid Address of Record $aor")
|
||||
Utils.alertView(this, getString(R.string.notice),
|
||||
String.format(getString(R.string.invalid_aor), aor))
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (Account.ofAor("sip:$aor") != null) {
|
||||
Log.d("Baresip", "Account $aor already exists")
|
||||
Log.d(TAG, "Account $aor already exists")
|
||||
Utils.alertView(this, getString(R.string.notice),
|
||||
String.format(getString(R.string.account_exists), aor.split(":")[0]))
|
||||
return@setOnClickListener
|
||||
@ -54,13 +54,13 @@ class AccountsActivity : AppCompatActivity() {
|
||||
val laddr = "sip:$aor"
|
||||
val ua = UserAgent.uaAlloc("<$laddr>;stunserver=\"stun:stun.l.google.com:19302\";regq=0.5;pubint=0;regint=0;mwi=no")
|
||||
if (ua == null) {
|
||||
Log.e("Baresip", "Failed to allocate UA for $aor")
|
||||
Log.e(TAG, "Failed to allocate UA for $aor")
|
||||
Utils.alertView(this, getString(R.string.notice),
|
||||
getString(R.string.account_allocation_failure))
|
||||
return@setOnClickListener
|
||||
}
|
||||
// Api.account_debug(ua.account.accp)
|
||||
Log.d("Baresip", "Allocated UA ${ua.uap} for ${Api.account_luri(ua.account.accp)}")
|
||||
Log.d(TAG, "Allocated UA ${ua.uap} for ${Api.account_luri(ua.account.accp)}")
|
||||
newAorView.setText("")
|
||||
newAorView.hint = getString(R.string.user_domain)
|
||||
newAorView.clearFocus()
|
||||
@ -191,7 +191,7 @@ class AccountsActivity : AppCompatActivity() {
|
||||
count++
|
||||
}
|
||||
Utils.putFileContents(BaresipService.filesPath + "/accounts", accounts.toByteArray())
|
||||
// Log.d("Baresip", "Saved accounts '${accounts}' to '${BaresipService.filesPath}/accounts'")
|
||||
// Log.d(TAG, "Saved accounts '${accounts}' to '${BaresipService.filesPath}/accounts'")
|
||||
}
|
||||
|
||||
fun noAccounts(): Boolean {
|
||||
@ -207,7 +207,7 @@ class AccountsActivity : AppCompatActivity() {
|
||||
if ((ap != "") && (acc.regint > 0))
|
||||
Api.ua_register(ua.uap)
|
||||
} else {
|
||||
Log.e("Baresip", "Setting of auth pass failed")
|
||||
Log.e(TAG, "Setting of auth pass failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ class BootCompletedReceiver : BroadcastReceiver() {
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
|
||||
Log.i("Baresip", "BootCompletedReceiver received intent ${intent.action}")
|
||||
Log.i(TAG, "BootCompletedReceiver received intent ${intent.action}")
|
||||
|
||||
val configPath = context.filesDir.absolutePath + "/config"
|
||||
val config = String(Utils.getFileContents(configPath)!!, StandardCharsets.ISO_8859_1)
|
||||
@ -27,7 +27,7 @@ class BootCompletedReceiver : BroadcastReceiver() {
|
||||
|
||||
if ((asCv.size > 0) && (asCv[0] == "yes")) {
|
||||
|
||||
Log.i("Baresip", "Start baresip upon boot completed")
|
||||
Log.i(TAG, "Start baresip upon boot completed")
|
||||
|
||||
val i = Intent(context, MainActivity::class.java).apply {
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
|
||||
@ -42,7 +42,7 @@ class CallHistory(val aor: String, val peerUri: String, val direction: String,
|
||||
}
|
||||
|
||||
fun save() {
|
||||
Log.d("Baresip", "Saving history of ${BaresipService.callHistory.size} calls")
|
||||
Log.d(TAG, "Saving history of ${BaresipService.callHistory.size} calls")
|
||||
val file = File(BaresipService.filesPath, "calls")
|
||||
try {
|
||||
val fos = FileOutputStream(file)
|
||||
@ -51,7 +51,7 @@ class CallHistory(val aor: String, val peerUri: String, val direction: String,
|
||||
oos.close()
|
||||
fos.close()
|
||||
} catch (e: IOException) {
|
||||
Log.e("Baresip", "OutputStream exception: " + e.toString())
|
||||
Log.e(TAG, "OutputStream exception: " + e.toString())
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
@ -66,15 +66,15 @@ class CallHistory(val aor: String, val peerUri: String, val direction: String,
|
||||
BaresipService.callHistory = ois.readObject() as ArrayList<CallHistory>
|
||||
ois.close()
|
||||
fis.close()
|
||||
Log.d("Baresip", "Restored history of ${BaresipService.callHistory.size} calls")
|
||||
Log.d(TAG, "Restored history of ${BaresipService.callHistory.size} calls")
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "InputStream exception: - " + e.toString())
|
||||
Log.e(TAG, "InputStream exception: - " + e.toString())
|
||||
}
|
||||
}
|
||||
|
||||
fun print() {
|
||||
for (h in BaresipService.callHistory)
|
||||
Log.d("Baresip", "[${h.aor}, ${h.peerUri}, ${h.direction}, ${h.connected}]")
|
||||
Log.d(TAG, "[${h.aor}, ${h.peerUri}, ${h.direction}, ${h.connected}]")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ class ChatActivity : AppCompatActivity() {
|
||||
|
||||
val userAgent = UserAgent.ofAor(aor)
|
||||
if (userAgent == null) {
|
||||
Log.w("Baresip", "MessageActivity did not find ua of $aor")
|
||||
Log.w(TAG, "MessageActivity did not find ua of $aor")
|
||||
MainActivity.activityAor = aor
|
||||
returnResult(Activity.RESULT_CANCELED)
|
||||
return
|
||||
@ -181,7 +181,7 @@ class ChatActivity : AppCompatActivity() {
|
||||
|
||||
override fun onPause() {
|
||||
if (newMessage.text.toString() != "") {
|
||||
Log.d("Baresip", "Saving newMessage ${newMessage.text} for $aor::$peerUri")
|
||||
Log.d(TAG, "Saving newMessage ${newMessage.text} for $aor::$peerUri")
|
||||
BaresipService.chatTexts.put("$aor::$peerUri", newMessage.text.toString())
|
||||
}
|
||||
MainActivity.activityAor = aor
|
||||
@ -193,7 +193,7 @@ class ChatActivity : AppCompatActivity() {
|
||||
super.onResume()
|
||||
val chatText = BaresipService.chatTexts["$aor::$peerUri"]
|
||||
if (chatText != null) {
|
||||
Log.d("Baresip", "Restoring newMessage ${newMessage.text} for $aor::$peerUri")
|
||||
Log.d(TAG, "Restoring newMessage ${newMessage.text} for $aor::$peerUri")
|
||||
newMessage.setText(chatText)
|
||||
newMessage.requestFocus()
|
||||
BaresipService.chatTexts.remove("$aor::$peerUri")
|
||||
|
||||
@ -113,29 +113,29 @@ class CodecsActivity : AppCompatActivity() {
|
||||
if (media == "audio")
|
||||
if (mc != acc.audioCodec) {
|
||||
if (Api.account_set_audio_codecs(acc.accp, mcList) == 0) {
|
||||
Log.d("Baresip", "New audio codecs '$mcList'")
|
||||
Log.d(TAG, "New audio codecs '$mcList'")
|
||||
acc.audioCodec = mc
|
||||
save = true
|
||||
} else {
|
||||
Log.e("Baresip", "Setting of audio codecs '$mcList' failed")
|
||||
Log.e(TAG, "Setting of audio codecs '$mcList' failed")
|
||||
}
|
||||
}
|
||||
|
||||
if (media == "video")
|
||||
if (mc != acc.videoCodec) {
|
||||
if (Api.account_set_video_codecs(acc.accp, mcList) == 0) {
|
||||
Log.d("Baresip", "New video codecs '$mcList'")
|
||||
Log.d(TAG, "New video codecs '$mcList'")
|
||||
acc.videoCodec = mc
|
||||
save = true
|
||||
} else {
|
||||
Log.e("Baresip", "Setting of video codecs '$mcList' failed")
|
||||
Log.e(TAG, "Setting of video codecs '$mcList' failed")
|
||||
}
|
||||
}
|
||||
|
||||
if (save) {
|
||||
AccountsActivity.saveAccounts()
|
||||
if (Api.ua_update_account(ua.uap) != 0)
|
||||
Log.e("Baresip", "Failed to update UA ${ua.uap} with AoR $aor")
|
||||
Log.e(TAG, "Failed to update UA ${ua.uap} with AoR $aor")
|
||||
}
|
||||
|
||||
if ((acc.regint > 0) && !((acc.authUser != "") && (acc.authPass == "")))
|
||||
|
||||
@ -12,7 +12,7 @@ object Config {
|
||||
|
||||
fun initialize() {
|
||||
|
||||
Log.d("Baresip", "Config is '$config'")
|
||||
Log.d(TAG, "Config is '$config'")
|
||||
|
||||
if (!config.contains(Regex("ausrc_format s16"))) {
|
||||
config = "${config}ausrc_format s16\nauplay_format s16\nauenc_format s16\naudec_format s16\nmodule webrtc_aec.so\n"
|
||||
@ -89,7 +89,7 @@ object Config {
|
||||
|
||||
Utils.putFileContents(configPath, config.toByteArray())
|
||||
BaresipService.isConfigInitialized = true
|
||||
Log.i("Baresip", "Initialized config to '$config'")
|
||||
Log.i(TAG, "Initialized config to '$config'")
|
||||
|
||||
}
|
||||
|
||||
@ -136,12 +136,12 @@ object Config {
|
||||
result = result + line + '\n'
|
||||
config = result
|
||||
Utils.putFileContents(configPath, config.toByteArray())
|
||||
Log.d("Baresip", "New config '$result'")
|
||||
Log.d(TAG, "Saved new config '$result'")
|
||||
// Api.reload_config()
|
||||
}
|
||||
|
||||
fun updateDnsServers(dnsServers: List<InetAddress>): Int {
|
||||
Log.i("Baresip", "Updating dnsServers with $dnsServers")
|
||||
Log.i(TAG, "Updating dnsServers with $dnsServers")
|
||||
var servers = ""
|
||||
for (dnsServer in dnsServers) {
|
||||
var address = dnsServer.hostAddress.removePrefix("/")
|
||||
|
||||
@ -55,18 +55,18 @@ class Contact(var name: String, var uri: String, var color: Int, val id: Long) {
|
||||
id = idValue.toLong()
|
||||
else
|
||||
id = baseId + contactNo
|
||||
Log.d("Baresip", "Restoring contact $name, $uri, $color, $id, $androidContact")
|
||||
Log.d(TAG, "Restoring contact $name, $uri, $color, $id, $androidContact")
|
||||
val contact = Contact(name, uri, color, id)
|
||||
contact.androidContact = androidContact
|
||||
val avatarFilePath = BaresipService.filesPath + "/$id.png"
|
||||
if (File(avatarFilePath).exists()) {
|
||||
try {
|
||||
contact.avatarImage = BitmapFactory.decodeFile(avatarFilePath)
|
||||
Log.d("Baresip", "Set avatarImage")
|
||||
Log.d(TAG, "Set avatarImage")
|
||||
if (contact.avatarImage == null)
|
||||
Log.d("Baresip", "Contact $id avatarImage is null")
|
||||
Log.d(TAG, "Contact $id avatarImage is null")
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "Could not read avatar image from '$id.img")
|
||||
Log.e(TAG, "Could not read avatar image from '$id.img")
|
||||
}
|
||||
}
|
||||
BaresipService.contacts.add(contact)
|
||||
|
||||
@ -162,7 +162,7 @@ class ContactActivity : AppCompatActivity() {
|
||||
if (Utils.saveBitmap(rotatedBitmap, File(BaresipService.filesPath, "tmp.png")))
|
||||
newAvatar = "image"
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "Could not read avatar image: $e")
|
||||
Log.e(TAG, "Could not read avatar image: $e")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -421,7 +421,7 @@ class ContactActivity : AppCompatActivity() {
|
||||
try {
|
||||
ctx.contentResolver.applyBatch(ContactsContract.AUTHORITY, ops)
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "Adding of contact ${contact.name} failed")
|
||||
Log.e(TAG, "Adding of contact ${contact.name} failed")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@ -446,7 +446,7 @@ class ContactActivity : AppCompatActivity() {
|
||||
try {
|
||||
contentResolver.applyBatch(ContactsContract.AUTHORITY, ops)
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "Adding of SIP URI $sipUri failed")
|
||||
Log.e(TAG, "Adding of SIP URI $sipUri failed")
|
||||
}
|
||||
}
|
||||
|
||||
@ -458,7 +458,7 @@ class ContactActivity : AppCompatActivity() {
|
||||
return try {
|
||||
contentResolver.update(ContactsContract.Data.CONTENT_URI, contentValues, where, null)
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "Adding of SIP URI $sipUri failed")
|
||||
Log.e(TAG, "Adding of SIP URI $sipUri failed")
|
||||
0
|
||||
}
|
||||
}
|
||||
@ -476,7 +476,7 @@ class ContactActivity : AppCompatActivity() {
|
||||
try {
|
||||
contentResolver.applyBatch(ContactsContract.AUTHORITY, ops)
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "Adding of Android photo failed")
|
||||
Log.e(TAG, "Adding of Android photo failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -493,7 +493,7 @@ class ContactActivity : AppCompatActivity() {
|
||||
return try {
|
||||
contentResolver.update(ContactsContract.Data.CONTENT_URI, contentValues, where, null)
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "updateAndroidPhoto failed")
|
||||
Log.e(TAG, "updateAndroidPhoto failed")
|
||||
0
|
||||
}
|
||||
}
|
||||
@ -507,7 +507,7 @@ class ContactActivity : AppCompatActivity() {
|
||||
out.close()
|
||||
out.toByteArray()
|
||||
} catch (e: Exception) {
|
||||
Log.w("Baresip", "Unable to serialize photo: $e")
|
||||
Log.w(TAG, "Unable to serialize photo: $e")
|
||||
null
|
||||
}
|
||||
}
|
||||
@ -542,7 +542,7 @@ class ContactActivity : AppCompatActivity() {
|
||||
CommonDataKinds.SipAddress.CONTENT_ITEM_TYPE -> kind = "sip"
|
||||
CommonDataKinds.Photo.CONTENT_ITEM_TYPE -> kind = "thumb"
|
||||
}
|
||||
Log.d("Baresip", "got $id, $name, $kind - $data")
|
||||
Log.d(TAG, "got $id, $name, $kind - $data")
|
||||
var info: MutableList<String>
|
||||
if (contacts.containsKey(id)) {
|
||||
info = contacts[id]!!
|
||||
|
||||
@ -87,7 +87,7 @@ class ContactListAdapter(private val ctx: Context, private val rows: ArrayList<C
|
||||
i.putExtra("action", "message")
|
||||
val ua = UserAgent.ofAor(aor)
|
||||
if (ua == null) {
|
||||
Log.w("Baresip", "onClickListener did not find AoR $aor")
|
||||
Log.w(TAG, "onClickListener did not find AoR $aor")
|
||||
} else {
|
||||
BaresipService.activities.clear()
|
||||
i.putExtra("uap", ua.uap)
|
||||
@ -123,7 +123,7 @@ class ContactListAdapter(private val ctx: Context, private val rows: ArrayList<C
|
||||
try {
|
||||
avatarFile.delete()
|
||||
} catch (e: IOException) {
|
||||
Log.e("Baresip", "Could not delete file '$id.img")
|
||||
Log.e(TAG, "Could not delete file '$id.img")
|
||||
}
|
||||
}
|
||||
if (contact.androidContact &&
|
||||
|
||||
@ -44,9 +44,9 @@ class Message(val aor: String, val peerUri: String, val message: String, val tim
|
||||
oos.writeObject(BaresipService.messages)
|
||||
oos.close()
|
||||
fos.close()
|
||||
Log.d("Baresip", "Saved ${BaresipService.messages.size} messages")
|
||||
Log.d(TAG, "Saved ${BaresipService.messages.size} messages")
|
||||
} catch (e: IOException) {
|
||||
Log.e("Baresip", "OutputStream exception: " + e.toString())
|
||||
Log.e(TAG, "OutputStream exception: " + e.toString())
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
@ -61,9 +61,9 @@ class Message(val aor: String, val peerUri: String, val message: String, val tim
|
||||
BaresipService.messages = ois.readObject() as ArrayList<Message>
|
||||
ois.close()
|
||||
fis.close()
|
||||
Log.d("Baresip", "Restored ${BaresipService.messages.size} messages")
|
||||
Log.d(TAG, "Restored ${BaresipService.messages.size} messages")
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "InputStream exception: - " + e.toString())
|
||||
Log.e(TAG, "InputStream exception: - " + e.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ open class OnSwipeTouchListener(ctx: Context) : View.OnTouchListener {
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "onFling exception $e")
|
||||
Log.e(TAG, "onFling exception $e")
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ class UserAgent(val uap: String) {
|
||||
fun uaAlloc(uri: String): UserAgent? {
|
||||
val uap = Api.ua_alloc(uri)
|
||||
if (uap != "") return UserAgent(uap)
|
||||
Log.e("Baresip", "Failed to allocate UserAgent for $uri")
|
||||
Log.e(TAG, "Failed to allocate UserAgent for $uri")
|
||||
return null
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ class UserAgent(val uap: String) {
|
||||
for (ua in BaresipService.uas) {
|
||||
if (ua.account.regint > 0) {
|
||||
if (Api.ua_register(ua.uap) != 0)
|
||||
Log.d("Baresip", "Failed to register ${ua.account.aor}")
|
||||
Log.d(TAG, "Failed to register ${ua.account.aor}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,10 +294,10 @@ object Utils {
|
||||
var updated = false
|
||||
val ipV6Addr = findIpV6Address(linkAddresses)
|
||||
if (ipV6Addr != findIpV6Address(BaresipService.linkAddresses)) {
|
||||
Log.d("Baresip", "Updating IPv6 address to '$ipV6Addr'")
|
||||
Log.d(TAG, "Updating IPv6 address to '$ipV6Addr'")
|
||||
if (ipV6Addr != "") {
|
||||
if (Api.net_set_address(ipV6Addr) != 0)
|
||||
Log.w("Baresip", "Failed to update net address '$ipV6Addr")
|
||||
Log.w(TAG, "Failed to update net address '$ipV6Addr")
|
||||
} else {
|
||||
Api.net_unset_address(Api.AF_INET6)
|
||||
}
|
||||
@ -305,10 +305,10 @@ object Utils {
|
||||
}
|
||||
val ipV4Addr = findIpV4Address(linkAddresses)
|
||||
if (ipV4Addr != findIpV4Address(BaresipService.linkAddresses)) {
|
||||
Log.d("Baresip", "Updating IPv4 address to '$ipV4Addr'")
|
||||
Log.d(TAG, "Updating IPv4 address to '$ipV4Addr'")
|
||||
if (ipV4Addr != "") {
|
||||
if (Api.net_set_address(ipV4Addr) != 0)
|
||||
Log.w("Baresip", "Failed to update net address '$ipV4Addr'")
|
||||
Log.w(TAG, "Failed to update net address '$ipV4Addr'")
|
||||
} else {
|
||||
Api.net_unset_address(Api.AF_INET)
|
||||
}
|
||||
@ -327,7 +327,7 @@ object Utils {
|
||||
if (BaresipService.dynDns && (BaresipService.dnsServers != props.dnsServers)) {
|
||||
if (BaresipService.isServiceRunning)
|
||||
if (Config.updateDnsServers(props.dnsServers) != 0)
|
||||
Log.w("Baresip", "Failed to update DNS servers '${props.dnsServers}'")
|
||||
Log.w(TAG, "Failed to update DNS servers '${props.dnsServers}'")
|
||||
else
|
||||
BaresipService.dnsServers = props.dnsServers
|
||||
else
|
||||
@ -362,9 +362,9 @@ object Utils {
|
||||
val digit = text[0]
|
||||
val call = Call.ofCallp(callp)
|
||||
if (call == null) {
|
||||
Log.w("Baresip", "dtmfWatcher did not find call $callp")
|
||||
Log.w(TAG, "dtmfWatcher did not find call $callp")
|
||||
} else {
|
||||
Log.d("Baresip", "Got DTMF digit '$digit'")
|
||||
Log.d(TAG, "Got DTMF digit '$digit'")
|
||||
if (((digit >= '0') && (digit <= '9')) || (digit == '*') || (digit == '#'))
|
||||
call.sendDigit(digit)
|
||||
}
|
||||
@ -408,7 +408,7 @@ object Utils {
|
||||
os.close()
|
||||
`is`.close()
|
||||
} catch (e: IOException) {
|
||||
Log.e("Baresip", "Failed to copy asset '$asset' to file: $e")
|
||||
Log.e(TAG, "Failed to copy asset '$asset' to file: $e")
|
||||
}
|
||||
}
|
||||
|
||||
@ -417,7 +417,7 @@ object Utils {
|
||||
try {
|
||||
file.delete()
|
||||
} catch (e: IOException) {
|
||||
Log.e("Baresip", "Could not delete file ${file.absolutePath}")
|
||||
Log.e(TAG, "Could not delete file ${file.absolutePath}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -426,10 +426,10 @@ object Utils {
|
||||
return try {
|
||||
File(filePath).readBytes()
|
||||
} catch (e: FileNotFoundException) {
|
||||
Log.e("Baresip", "File '$filePath' not found: ${e.printStackTrace()}")
|
||||
Log.e(TAG, "File '$filePath' not found: ${e.printStackTrace()}")
|
||||
null
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "Failed to read file '$filePath': ${e.printStackTrace()}")
|
||||
Log.e(TAG, "Failed to read file '$filePath': ${e.printStackTrace()}")
|
||||
null
|
||||
}
|
||||
}
|
||||
@ -439,7 +439,7 @@ object Utils {
|
||||
File(filePath).writeBytes(contents)
|
||||
}
|
||||
catch (e: IOException) {
|
||||
Log.e("Baresip", "Failed to write file '$filePath': $e")
|
||||
Log.e(TAG, "Failed to write file '$filePath': $e")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@ -465,9 +465,9 @@ object Utils {
|
||||
scaledBitmap.compress(Bitmap.CompressFormat.PNG, 100, out)
|
||||
out.flush()
|
||||
out.close()
|
||||
Log.e("Baresip", "Saved bitmap to ${file.absolutePath} of length ${file.length()}")
|
||||
Log.d(TAG, "Saved bitmap to ${file.absolutePath} of length ${file.length()}")
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "Failed to save bitmap to ${file.absolutePath}")
|
||||
Log.e(TAG, "Failed to save bitmap to ${file.absolutePath}")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@ -498,7 +498,7 @@ object Utils {
|
||||
val cipherData = cipher.doFinal(content)
|
||||
obj = Crypto(salt, iterationCount, iv, cipherData)
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "Encrypt failed: ${e.printStackTrace()}")
|
||||
Log.e(TAG, "Encrypt failed: ${e.printStackTrace()}")
|
||||
}
|
||||
return obj
|
||||
|
||||
@ -516,7 +516,7 @@ object Utils {
|
||||
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec)
|
||||
plainData = cipher.doFinal(obj.data)
|
||||
} catch (e: Exception) {
|
||||
Log.e("Baresip", "Decrypt failed: ${e.printStackTrace()}")
|
||||
Log.e(TAG, "Decrypt failed: ${e.printStackTrace()}")
|
||||
}
|
||||
return plainData
|
||||
}
|
||||
@ -528,7 +528,7 @@ object Utils {
|
||||
it.writeObject(obj)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w("Baresip", "encryptToStream failed: $e")
|
||||
Log.w(TAG, "encryptToStream failed: $e")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@ -542,7 +542,7 @@ object Utils {
|
||||
plainData = decrypt(obj, password.toCharArray())
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w("Baresip", "decryptFromStream failed: $e")
|
||||
Log.w(TAG, "decryptFromStream failed: $e")
|
||||
}
|
||||
return plainData
|
||||
}
|
||||
@ -570,7 +570,7 @@ object Utils {
|
||||
}
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
Log.e("Baresip", "Failed to zip file '$zipFilePath': $e")
|
||||
Log.e(TAG, "Failed to zip file '$zipFilePath': $e")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@ -592,7 +592,7 @@ object Utils {
|
||||
}
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
Log.e("Baresip", "Failed to unzip file '$zipFilePath': $e")
|
||||
Log.e(TAG, "Failed to unzip file '$zipFilePath': $e")
|
||||
return false
|
||||
}
|
||||
(allFiles - zipFiles).iterator().forEach {
|
||||
@ -605,12 +605,12 @@ object Utils {
|
||||
val bundle: Bundle = intent.extras ?: return
|
||||
val keys = bundle.keySet()
|
||||
val it = keys.iterator()
|
||||
Log.d("Baresip", "Dumping intent start")
|
||||
Log.d(TAG, "Dumping intent start")
|
||||
while (it.hasNext()) {
|
||||
val key = it.next()
|
||||
Log.d("Baresip", "[" + key + "=" + bundle.get(key) + "]")
|
||||
Log.d(TAG, "[" + key + "=" + bundle.get(key) + "]")
|
||||
}
|
||||
Log.d("Baresip", "Dumping intent finish")
|
||||
Log.d(TAG, "Dumping intent finish")
|
||||
}
|
||||
|
||||
fun randomColor(): Int {
|
||||
|
||||
Reference in New Issue
Block a user