android static analysis
This commit is contained in:
parent
7cc4e8d01e
commit
c5a4048322
7 changed files with 13 additions and 7 deletions
|
@ -52,7 +52,7 @@ class AnalysisHandler(private val activity: Activity, private val onAnalysisComp
|
|||
}
|
||||
|
||||
// can be null or empty
|
||||
val contentIds = call.argument<List<Int>>("contentIds");
|
||||
val contentIds = call.argument<List<Int>>("contentIds")
|
||||
|
||||
if (!activity.isMyServiceRunning(AnalysisService::class.java)) {
|
||||
val intent = Intent(activity, AnalysisService::class.java)
|
||||
|
|
|
@ -775,7 +775,7 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
|
|||
try {
|
||||
Metadata.openSafeInputStream(context, uri, mimeType, sizeBytes)?.use { input ->
|
||||
val metadata = ImageMetadataReader.readMetadata(input)
|
||||
val xmpStrings = metadata.getDirectoriesOfType(XmpDirectory::class.java).map { XMPMetaFactory.serializeToString(it.xmpMeta, xmpSerializeOptions) }.filterNotNull()
|
||||
val xmpStrings = metadata.getDirectoriesOfType(XmpDirectory::class.java).mapNotNull { XMPMetaFactory.serializeToString(it.xmpMeta, xmpSerializeOptions) }
|
||||
result.success(xmpStrings.toMutableList())
|
||||
return
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.graphics.BitmapFactory
|
|||
import android.graphics.BitmapRegionDecoder
|
||||
import android.graphics.Rect
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.DecodeFormat
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
|
@ -68,8 +69,13 @@ class RegionFetcher internal constructor(
|
|||
if (currentDecoderRef == null) {
|
||||
val newDecoder = StorageUtils.openInputStream(context, uri)?.use { input ->
|
||||
@Suppress("BlockingMethodInNonBlockingContext")
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
BitmapRegionDecoder.newInstance(input)
|
||||
} else {
|
||||
@Suppress("deprecation")
|
||||
BitmapRegionDecoder.newInstance(input, false)
|
||||
}
|
||||
}
|
||||
if (newDecoder == null) {
|
||||
result.error("getRegion-read-null", "failed to open file for uri=$uri regionRect=$regionRect", null)
|
||||
return
|
||||
|
|
|
@ -62,7 +62,7 @@ internal class SvgFetcher(val model: SvgThumbnail, val width: Int, val height: I
|
|||
val bitmapHeight: Int
|
||||
if (width / height > svgWidth / svgHeight) {
|
||||
bitmapWidth = ceil(svgWidth * height / svgHeight).toInt()
|
||||
bitmapHeight = height;
|
||||
bitmapHeight = height
|
||||
} else {
|
||||
bitmapWidth = width
|
||||
bitmapHeight = ceil(svgHeight * width / svgWidth).toInt()
|
||||
|
|
|
@ -23,7 +23,7 @@ object XMP {
|
|||
private const val GAUDIO_SCHEMA_NS = "http://ns.google.com/photos/1.0/audio/"
|
||||
const val GCAMERA_SCHEMA_NS = "http://ns.google.com/photos/1.0/camera/"
|
||||
private const val GDEPTH_SCHEMA_NS = "http://ns.google.com/photos/1.0/depthmap/"
|
||||
const val GIMAGE_SCHEMA_NS = "http://ns.google.com/photos/1.0/image/"
|
||||
private const val GIMAGE_SCHEMA_NS = "http://ns.google.com/photos/1.0/image/"
|
||||
const val CONTAINER_SCHEMA_NS = "http://ns.google.com/photos/1.0/container/"
|
||||
private const val CONTAINER_ITEM_SCHEMA_NS = "http://ns.google.com/photos/1.0/container/item/"
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ class MediaStoreImageProvider : ImageProvider() {
|
|||
}
|
||||
|
||||
fun checkObsoleteContentIds(context: Context, knownContentIds: List<Int>): List<Int> {
|
||||
val foundContentIds = ArrayList<Int>()
|
||||
val foundContentIds = HashSet<Int>()
|
||||
fun check(context: Context, contentUri: Uri) {
|
||||
val projection = arrayOf(MediaStore.MediaColumns._ID)
|
||||
try {
|
||||
|
|
|
@ -23,7 +23,7 @@ object FlutterUtils {
|
|||
}
|
||||
|
||||
lateinit var flutterLoader: FlutterLoader
|
||||
FlutterUtils.runOnUiThread {
|
||||
runOnUiThread {
|
||||
// initialization must happen on the main thread
|
||||
flutterLoader = FlutterInjector.instance().flutterLoader().apply {
|
||||
startInitialization(context)
|
||||
|
|
Loading…
Reference in a new issue