Fix assert not working
This commit is contained in:
@@ -25,7 +25,7 @@ import android.os.Bundle
|
||||
|
||||
class NativePlugin(resolveInfo: ResolveInfo) : ResolvedPlugin(resolveInfo) {
|
||||
init {
|
||||
assert(resolveInfo.providerInfo != null)
|
||||
check(resolveInfo.providerInfo != null)
|
||||
}
|
||||
|
||||
override val metaData: Bundle get() = resolveInfo.providerInfo.metaData
|
||||
|
||||
@@ -134,7 +134,7 @@ object PluginManager {
|
||||
private fun initNative(options: PluginOptions): String? {
|
||||
val providers = app.packageManager.queryIntentContentProviders(
|
||||
Intent(PluginContract.ACTION_NATIVE_PLUGIN, buildUri(options.id)), 0)
|
||||
assert(providers.size == 1)
|
||||
check(providers.size == 1)
|
||||
val uri = Uri.Builder()
|
||||
.scheme(ContentResolver.SCHEME_CONTENT)
|
||||
.authority(providers[0].providerInfo.authority)
|
||||
@@ -154,7 +154,7 @@ object PluginManager {
|
||||
out.putString(PluginContract.EXTRA_OPTIONS, options.id)
|
||||
val result = cr.call(uri, PluginContract.METHOD_GET_EXECUTABLE, null, out)
|
||||
.getString(PluginContract.EXTRA_ENTRY)
|
||||
assert(File(result).canExecute())
|
||||
check(File(result).canExecute())
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ object PluginManager {
|
||||
do {
|
||||
val path = cursor.getString(0)
|
||||
val file = File(pluginDir, path)
|
||||
assert(file.absolutePath.startsWith(pluginDirPath))
|
||||
check(file.absolutePath.startsWith(pluginDirPath))
|
||||
cr.openInputStream(uri.buildUpon().path(path).build()).use { inStream ->
|
||||
file.outputStream().use { outStream -> inStream.copyTo(outStream) }
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ abstract class NativePluginProvider : ContentProvider() {
|
||||
|
||||
override fun query(uri: Uri, projection: Array<out String>?, selection: String?, selectionArgs: Array<out String>?,
|
||||
sortOrder: String?): Cursor {
|
||||
assert(selection == null && selectionArgs == null && sortOrder == null)
|
||||
check(selection == null && selectionArgs == null && sortOrder == null)
|
||||
val result = MatrixCursor(projection)
|
||||
populateFiles(PathProvider(uri, result))
|
||||
return result
|
||||
@@ -79,7 +79,7 @@ abstract class NativePluginProvider : ContentProvider() {
|
||||
|
||||
abstract fun openFile(uri: Uri?): ParcelFileDescriptor
|
||||
override fun openFile(uri: Uri?, mode: String?): ParcelFileDescriptor {
|
||||
assert(mode == "r")
|
||||
check(mode == "r")
|
||||
return openFile(uri)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user