liyujie
2025-08-28 d9927380ed7c8366f762049be9f3fee225860833
android/hardware/aw/camera/3_4/camera.cpp
....@@ -371,48 +371,90 @@
371371 return;
372372 }
373373 int64_t timestamp = 0;
374
- struct timespec ts;
375
- int res = 0;
376
- res = clock_gettime(CLOCK_MONOTONIC, &ts);
377
- if (res) {
378
- HAL_LOGE("Failed to get BOOTTIME for state delegate: %d (%s)",
379
- errno,
380
- strerror(errno));
381
- completeRequestWithError(request);
382
- return;
383
- }
384
- timestamp = ts.tv_sec * 1000000000ULL + ts.tv_nsec;
385
- res = request->settings.update(ANDROID_SENSOR_TIMESTAMP, &timestamp, 1);
386
- if (res) {
387
- HAL_LOGE("Failed to update metadata tag 0x%x", ANDROID_SENSOR_TIMESTAMP);
388
- }
374
+// struct timespec ts;
375
+// int res = 0;
376
+// res = clock_gettime(CLOCK_MONOTONIC, &ts);
377
+// if (res) {
378
+// HAL_LOGE("Failed to get BOOTTIME for state delegate: %d (%s)",
379
+// errno,
380
+// strerror(errno));
381
+// completeRequestWithError(request);
382
+// return;
383
+// }
384
+ //timestamp = ts.tv_sec * 1000000000ULL + ts.tv_nsec;
385
+ //res = request->settings.update(ANDROID_SENSOR_TIMESTAMP, &timestamp, 1);
386
+ //if (res) {
387
+ // HAL_LOGE("Failed to update metadata tag 0x%x", ANDROID_SENSOR_TIMESTAMP);
388
+ //}
389389
390390 // Since |request| has been removed from the tracking, this method
391391 // MUST call sendResult (can still return a result in an error state, e.g.
392392 // through completeRequestWithError) so the frame doesn't get lost.
393393 if (err) {
394
- HAL_LOGE("mId:%d: Error completing request for frame %d.",
395
- mId, request->frame_number);
396
- completeRequestWithError(request);
397
- return;
394
+ switch (err) {
395
+ case 404:
396
+ HAL_LOGI("This is a record complete request!");
397
+ break;
398
+ default:
399
+ HAL_LOGE("mId:%d: Error completing request for frame %d.",
400
+ mId, request->frame_number);
401
+ completeRequestWithError(request);
402
+ return;
403
+ }
398404 }
399405
400
- // Notify the framework with the shutter time (extracted from the result).
401
- // TODO(b/31360070): The general metadata methods should be part of the
402
- // default_camera_hal namespace, not the v4l2_camera_hal namespace.
403
- res = v4l2_camera_hal::SingleTagValue(
404
- request->settings, ANDROID_SENSOR_TIMESTAMP, &timestamp);
406
+ if (!err) {
407
+ HAL_LOGI("It's a merge picture!");
408
+ struct timespec ts;
409
+ int res;
410
+ res = clock_gettime(CLOCK_BOOTTIME, &ts);
411
+ if (res) {
412
+ HAL_LOGE("Failed to get BOOTTIME for state delegate: %d (%s)",
413
+ errno,
414
+ strerror(errno));
415
+ }
416
+ timestamp = ts.tv_sec * 1000000000ULL + ts.tv_nsec;
417
+ res = request->settings.update(ANDROID_SENSOR_TIMESTAMP, &timestamp, 1);
418
+ if (res) {
419
+ HAL_LOGE("Failed to UpdateMetadata timestamp.");
420
+ }
421
+ } else {
422
+ HAL_LOGI("It's a record!");
423
+ int res;
424
+ // Notify the framework with the shutter time (extracted from the result).
425
+ // TODO(b/31360070): The general metadata methods should be part of the
426
+ // default_camera_hal namespace, not the v4l2_camera_hal namespace.
427
+ res = v4l2_camera_hal::SingleTagValue(
428
+ request->settings, ANDROID_SENSOR_TIMESTAMP, &timestamp);
405429
406
- if (res) {
407
- HAL_LOGE("mId:%d: Request for frame %d is missing required metadata.",
408
- mId, request->frame_number);
409
- // TODO(b/31653322): Send RESULT error.
410
- // For now sending REQUEST error instead.
411
- // TODO(calvin) fix this one, SingleTagValue error.
412
- // completeRequestWithError(request);
413
- // return;
430
+ if (res) {
431
+ HAL_LOGE("%s:%d: Request for frame %d is missing required metadata.",
432
+ __func__, mId, request->frame_number);
433
+ // TODO(b/31653322): Send RESULT error.
434
+ // For now sending REQUEST error instead.
435
+ // TODO:calvin, fix this one, SingleTagValue error.
436
+ // completeRequestWithError(request);
437
+ // return;
438
+ }
414439 }
415440
441
+
442
+ //// Notify the framework with the shutter time (extracted from the result).
443
+ //// TODO(b/31360070): The general metadata methods should be part of the
444
+ //// default_camera_hal namespace, not the v4l2_camera_hal namespace.
445
+ //res = v4l2_camera_hal::SingleTagValue(
446
+ // request->settings, ANDROID_SENSOR_TIMESTAMP, &timestamp);
447
+
448
+ //if (res) {
449
+ // HAL_LOGE("mId:%d: Request for frame %d is missing required metadata.",
450
+ // mId, request->frame_number);
451
+ // // TODO(b/31653322): Send RESULT error.
452
+ // // For now sending REQUEST error instead.
453
+ // // TODO(calvin) fix this one, SingleTagValue error.
454
+ // // completeRequestWithError(request);
455
+ // // return;
456
+ //}
457
+
416458 #if DBG_PERFORMANCE
417459 if (btimeRequest == 0) {
418460 btimeRequest = request->timeRequest;