fix: device model display

This commit is contained in:
Hinnka committed 2026-07-26 11:38:11 +08:00
1 parent 87b40ab2fb
commit 5d68519c00
3 files changed
+12 -11

No files matched your search

@@ -2,7 +2,6 @@ package com.hinnka.mycamera.camera
import android.graphics.ColorSpace
import android.os.Build
import com.hinnka.mycamera.utils.DeviceUtil
/**
* 拍摄信息
@@ -21,7 +20,7 @@ data class CaptureInfo(
// 设备信息
val make: String = Build.MANUFACTURER,
val model: String = Build.MODEL,
val model: String = Build.MODEL, // EXIF 设备型号代码
val software: String = "PhotonCamera",
// 拍摄参数
@@ -18,6 +18,7 @@ import com.hinnka.mycamera.raw.HncsFilmCurveMode
import com.hinnka.mycamera.raw.HncsRenderIntent
import com.hinnka.mycamera.raw.RawRenderingEngine
import com.hinnka.mycamera.raw.RawToneMappingParameters
import com.hinnka.mycamera.utils.DeviceUtil
import org.json.JSONObject
import java.text.SimpleDateFormat
import java.util.*
@@ -81,7 +82,7 @@ data class MediaMetadata(
val cropRegion: Rect? = null,
val rotation: Int = 0,
// 拍摄信息
val deviceModel: String? = null,
val deviceModel: String? = null, // 边框水印显示的机型名称
val brand: String? = null,
val dateTaken: Long? = null,
val location: String? = null,
@@ -144,12 +145,13 @@ data class MediaMetadata(
) {
/**
* 将元数据转换为 CaptureInfo,用于写入 EXIF
*
* CaptureInfo.model 使用其 Build.MODEL 默认值,不复用边框水印的 deviceModel。
*/
fun toCaptureInfo(): com.hinnka.mycamera.camera.CaptureInfo {
return com.hinnka.mycamera.camera.CaptureInfo(
iso = iso,
make = brand ?: Build.MANUFACTURER,
model = deviceModel ?: Build.MODEL,
captureTime = dateTaken ?: System.currentTimeMillis(),
imageWidth = width,
imageHeight = height,
@@ -478,7 +480,7 @@ data class MediaMetadata(
*/
fun createDefault(width: Int, height: Int): MediaMetadata {
return MediaMetadata(
deviceModel = Build.MODEL,
deviceModel = DeviceUtil.model,
brand = Build.MANUFACTURER.replaceFirstChar { it.uppercase() },
dateTaken = System.currentTimeMillis(),
width = width,
@@ -2436,7 +2436,7 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
height = height,
ratio = aspectRatio,
rotation = rotation,
deviceModel = captureInfo.model,
deviceModel = DeviceUtil.model,
brand = captureInfo.make,
dateTaken = captureInfo.captureTime,
latitude = captureInfo.latitude,
@@ -4871,7 +4871,7 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
height = image.height,
ratio = aspectRatio,
rotation = rotation,
deviceModel = captureInfo.model,
deviceModel = DeviceUtil.model,
brand = captureInfo.make,
dateTaken = captureInfo.captureTime,
latitude = captureInfo.latitude,
@@ -5046,7 +5046,7 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
height = bitmap.height,
ratio = ratio,
rotation = 0,
deviceModel = captureInfo.model,
deviceModel = DeviceUtil.model,
brand = captureInfo.make,
dateTaken = captureInfo.captureTime,
latitude = captureInfo.latitude,
@@ -5196,7 +5196,7 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
height = captureBitmap.height,
ratio = currentState.aspectRatio,
rotation = 0,
deviceModel = captureInfo.model,
deviceModel = DeviceUtil.model,
brand = captureInfo.make,
dateTaken = captureInfo.captureTime,
latitude = captureInfo.latitude,
@@ -5434,7 +5434,7 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
height = MultiFrameConfig.scaledRawOutputDimension(images[0].height, superResScale),
ratio = aspectRatio,
rotation = rotation,
deviceModel = captureInfo.model,
deviceModel = DeviceUtil.model,
brand = captureInfo.make,
dateTaken = captureInfo.captureTime,
latitude = captureInfo.latitude,
@@ -5867,7 +5867,7 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
height = image.height,
ratio = aspectRatio,
rotation = rotation,
deviceModel = captureInfo.model,
deviceModel = DeviceUtil.model,
brand = captureInfo.make,
dateTaken = captureInfo.captureTime,
latitude = captureInfo.latitude,