Use Android 14 compatible backup file format
This commit is contained in:
@ -1764,8 +1764,7 @@ class MainActivity : AppCompatActivity() {
|
||||
if (!Utils.unZip(zipFilePath)) {
|
||||
Log.w(TAG, "Failed to unzip file '$zipFile'")
|
||||
Utils.alertView(this, getString(R.string.error),
|
||||
String.format(getString(R.string.restore_failed),
|
||||
Utils.fileNameOfUri(applicationContext, downloadsInputUri!!)))
|
||||
String.format(getString(R.string.restore_unzip_failed), "baresip", "60.0.0"))
|
||||
return
|
||||
}
|
||||
Utils.deleteFile(File(zipFilePath))
|
||||
|
||||
@ -765,12 +765,12 @@ object Utils {
|
||||
try {
|
||||
ZipOutputStream(BufferedOutputStream(FileOutputStream(zipFilePath))).use { out ->
|
||||
val data = ByteArray(1024)
|
||||
for (file in fileNames) {
|
||||
val filePath = BaresipService.filesPath + "/" + file
|
||||
for (fileName in fileNames) {
|
||||
val filePath = BaresipService.filesPath + "/" + fileName
|
||||
if (File(filePath).exists()) {
|
||||
FileInputStream(filePath).use { fi ->
|
||||
BufferedInputStream(fi).use { origin ->
|
||||
val entry = ZipEntry(filePath)
|
||||
val entry = ZipEntry(fileName)
|
||||
out.putNextEntry(entry)
|
||||
while (true) {
|
||||
val readBytes = origin.read(data)
|
||||
@ -794,15 +794,15 @@ object Utils {
|
||||
"gzrtp.zid", "cert.pem", "ca_cert", "ca_certs.crt")
|
||||
val zipFiles = mutableListOf<String>()
|
||||
try {
|
||||
ZipFile(zipFilePath).use { zip ->
|
||||
ZipFile(File(zipFilePath)).use { zip ->
|
||||
zip.entries().asSequence().forEach { entry ->
|
||||
if (!entry.name.contains("/${BaresipService.pName}/")) {
|
||||
Log.e(TAG, "Backup file is not from this application")
|
||||
return false
|
||||
}
|
||||
zipFiles.add(entry.name.substringAfter("/files/"))
|
||||
val entryName = if (entry.name.startsWith("/"))
|
||||
entry.name.substringAfterLast("/")
|
||||
else
|
||||
entry.name
|
||||
zipFiles.add(entryName)
|
||||
zip.getInputStream(entry).use { input ->
|
||||
File(entry.name).outputStream().use { output ->
|
||||
File(BaresipService.filesPath + "/" + entryName).outputStream().use { output ->
|
||||
input.copyTo(output)
|
||||
}
|
||||
}
|
||||
|
||||
@ -548,6 +548,9 @@
|
||||
annoit oikean salasanan ja että palautustiedosto kuuluu tällä sovellukselle.
|
||||
Android versioon 9 saakka tarkista myös Asetukset → Sovellukset → baresip → Käyttöluvat →
|
||||
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_calls">Et voi soittaa puheluita tai vastata niihin ilman Mikrofoni-lupaa.</string>
|
||||
<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
|
||||
in Download folder.
|
||||
</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\"
|
||||
permission.</string>
|
||||
<string name="no_calls">baresip needs \"Microphone\" permission for voice calls.</string>
|
||||
|
||||
Reference in New Issue
Block a user