Use Android 14 compatible backup file format
This commit is contained in:
@@ -1764,8 +1764,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
if (!Utils.unZip(zipFilePath)) {
|
if (!Utils.unZip(zipFilePath)) {
|
||||||
Log.w(TAG, "Failed to unzip file '$zipFile'")
|
Log.w(TAG, "Failed to unzip file '$zipFile'")
|
||||||
Utils.alertView(this, getString(R.string.error),
|
Utils.alertView(this, getString(R.string.error),
|
||||||
String.format(getString(R.string.restore_failed),
|
String.format(getString(R.string.restore_unzip_failed), "baresip", "60.0.0"))
|
||||||
Utils.fileNameOfUri(applicationContext, downloadsInputUri!!)))
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Utils.deleteFile(File(zipFilePath))
|
Utils.deleteFile(File(zipFilePath))
|
||||||
|
|||||||
@@ -765,12 +765,12 @@ object Utils {
|
|||||||
try {
|
try {
|
||||||
ZipOutputStream(BufferedOutputStream(FileOutputStream(zipFilePath))).use { out ->
|
ZipOutputStream(BufferedOutputStream(FileOutputStream(zipFilePath))).use { out ->
|
||||||
val data = ByteArray(1024)
|
val data = ByteArray(1024)
|
||||||
for (file in fileNames) {
|
for (fileName in fileNames) {
|
||||||
val filePath = BaresipService.filesPath + "/" + file
|
val filePath = BaresipService.filesPath + "/" + fileName
|
||||||
if (File(filePath).exists()) {
|
if (File(filePath).exists()) {
|
||||||
FileInputStream(filePath).use { fi ->
|
FileInputStream(filePath).use { fi ->
|
||||||
BufferedInputStream(fi).use { origin ->
|
BufferedInputStream(fi).use { origin ->
|
||||||
val entry = ZipEntry(filePath)
|
val entry = ZipEntry(fileName)
|
||||||
out.putNextEntry(entry)
|
out.putNextEntry(entry)
|
||||||
while (true) {
|
while (true) {
|
||||||
val readBytes = origin.read(data)
|
val readBytes = origin.read(data)
|
||||||
@@ -794,15 +794,15 @@ object Utils {
|
|||||||
"gzrtp.zid", "cert.pem", "ca_cert", "ca_certs.crt")
|
"gzrtp.zid", "cert.pem", "ca_cert", "ca_certs.crt")
|
||||||
val zipFiles = mutableListOf<String>()
|
val zipFiles = mutableListOf<String>()
|
||||||
try {
|
try {
|
||||||
ZipFile(zipFilePath).use { zip ->
|
ZipFile(File(zipFilePath)).use { zip ->
|
||||||
zip.entries().asSequence().forEach { entry ->
|
zip.entries().asSequence().forEach { entry ->
|
||||||
if (!entry.name.contains("/${BaresipService.pName}/")) {
|
val entryName = if (entry.name.startsWith("/"))
|
||||||
Log.e(TAG, "Backup file is not from this application")
|
entry.name.substringAfterLast("/")
|
||||||
return false
|
else
|
||||||
}
|
entry.name
|
||||||
zipFiles.add(entry.name.substringAfter("/files/"))
|
zipFiles.add(entryName)
|
||||||
zip.getInputStream(entry).use { input ->
|
zip.getInputStream(entry).use { input ->
|
||||||
File(entry.name).outputStream().use { output ->
|
File(BaresipService.filesPath + "/" + entryName).outputStream().use { output ->
|
||||||
input.copyTo(output)
|
input.copyTo(output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -548,6 +548,9 @@
|
|||||||
annoit oikean salasanan ja että palautustiedosto kuuluu tällä sovellukselle.
|
annoit oikean salasanan ja että palautustiedosto kuuluu tällä sovellukselle.
|
||||||
Android versioon 9 saakka tarkista myös Asetukset → Sovellukset → baresip → Käyttöluvat →
|
Android versioon 9 saakka tarkista myös Asetukset → Sovellukset → baresip → Käyttöluvat →
|
||||||
Tallennustila ja että tiedosto \'%1$s\' on Download-kansiossa.</string>
|
Tallennustila ja että tiedosto \'%1$s\' on Download-kansiossa.</string>
|
||||||
|
<string name="restore_unzip_failed">Sovelluksen tietojen palauttaminen epäonnistui. Android
|
||||||
|
versiosta 14 alkaen ei salli tietojen palauttamista, jos ne on tallettu ennen %1$s versioa
|
||||||
|
%2$s.</string>
|
||||||
<string name="no_notifications">Et voi käyttää tätä sovellusta ilman Ilmoitukset-lupaa.</string>
|
<string name="no_notifications">Et voi käyttää tätä sovellusta ilman Ilmoitukset-lupaa.</string>
|
||||||
<string name="no_calls">Et voi soittaa puheluita tai vastata niihin ilman Mikrofoni-lupaa.</string>
|
<string name="no_calls">Et voi soittaa puheluita tai vastata niihin ilman Mikrofoni-lupaa.</string>
|
||||||
<string name="no_bluetooth">baresip ei voi havaita Bluetooth-yhteyttä ilman
|
<string name="no_bluetooth">baresip ei voi havaita Bluetooth-yhteyttä ilman
|
||||||
|
|||||||
@@ -523,6 +523,9 @@
|
|||||||
also check Apps → baresip → Permissions → Storage and that file \'%1$s\' exists
|
also check Apps → baresip → Permissions → Storage and that file \'%1$s\' exists
|
||||||
in Download folder.
|
in Download folder.
|
||||||
</string>
|
</string>
|
||||||
|
<string name="restore_unzip_failed">Failed to restore application data. Android version 14 and
|
||||||
|
above does not allow restoring data that was backed up before %1$s version %2$s.
|
||||||
|
</string>
|
||||||
<string name="no_notifications">You are not able to use this application without \"Notifications\"
|
<string name="no_notifications">You are not able to use this application without \"Notifications\"
|
||||||
permission.</string>
|
permission.</string>
|
||||||
<string name="no_calls">baresip needs \"Microphone\" permission for voice calls.</string>
|
<string name="no_calls">baresip needs \"Microphone\" permission for voice calls.</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user