Minor corrections.

This commit is contained in:
jens 2021-06-08 20:04:02 +02:00
parent 6d363fd02d
commit 23ded3a851
3 changed files with 15 additions and 5 deletions

View File

@ -72,6 +72,7 @@ dependencies {
implementation 'com.linkedin.dexmaker:dexmaker:2.25.0'
implementation 'org.apache.commons:commons-lang3:3.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'

View File

@ -16,6 +16,8 @@ import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.documentfile.provider.DocumentFile;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.util.ArrayList;
@ -221,10 +223,17 @@ public class ActivityMaintenance extends Activity
// Clean up
for(DocumentFile file : directory.listFiles())
{
if(file.getName().equals(XmlFileInterface.settingsFileName) && file.canWrite())
file.delete();
else if(file.getName().equals(prefsFileName) && file.canWrite())
file.delete();
/*
On some few users' devices it seems this caused a crash because file.getName() was null.
The reason for that remains unknown, but we don't want the export to crash because of it.
*/
if(!StringUtils.isEmpty(file.getName()))
{
if (file.getName().equals(XmlFileInterface.settingsFileName) && file.canWrite())
file.delete();
else if (file.getName().equals(prefsFileName) && file.canWrite())
file.delete();
}
}
DocumentFile dstRules = directory.createFile("text/xml", XmlFileInterface.settingsFileName);

View File

@ -197,7 +197,7 @@ public class AutomationService extends Service implements OnInitListener
if (checkStartupRequirements(this, startAtBoot))
{
Miscellaneous.logEvent("i", "Service", this.getResources().getString(R.string.logServiceStarting), 1);
Miscellaneous.logEvent("i", "Service", this.getResources().getString(R.string.logServiceStarting) + " VERSION_CODE: " + BuildConfig.VERSION_CODE + ", VERSION_NAME: " + BuildConfig.VERSION_NAME + ", flavor: " + BuildConfig.FLAVOR, 1);
startUpRoutine();