Use FileProvider for load measurements

- Implements changes of PR#244
This commit is contained in:
fr3ts0n
2024-03-27 17:01:17 +01:00
parent 0d869ee3ae
commit f4c60291b6
5 changed files with 20 additions and 3 deletions

View File

@@ -61,6 +61,15 @@
android:name=".PidCustomization"
android:label="@string/customize_display"
android:configChanges="touchscreen|orientation|screenSize" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
</application>
</manifest>

View File

@@ -54,6 +54,8 @@ import android.widget.ListView;
import android.widget.Spinner;
import android.widget.Toast;
import androidx.core.content.FileProvider;
import com.fr3ts0n.androbd.plugin.Plugin;
import com.fr3ts0n.androbd.plugin.mgr.PluginManager;
import com.fr3ts0n.ecu.EcuCodeItem;
@@ -1913,9 +1915,10 @@ public class MainActivity extends PluginManager
File file = new File(FileHelper.getPath(this));
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
Uri data = Uri.fromFile(file);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri uri = FileProvider.getUriForFile(MainActivity.this, getPackageName()+".provider", file);
String type = "*/*";
intent.setDataAndType(data, type);
intent.setDataAndType(uri, type);
startActivityForResult(intent, REQUEST_SELECT_FILE);
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path path="." name="external_storage_root" />
</paths>

View File

@@ -6,7 +6,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0"
}
}

View File

@@ -1,3 +1,4 @@
android.nonFinalResIds=false
android.nonTransitiveRClass=true
android.useAndroidX=true
org.gradle.unsafe.configuration-cache=true