summaryrefslogtreecommitdiffstats
path: root/FMRecord
diff options
context:
space:
mode:
authorVenkateshwarlu Domakonda <vdomak@codeaurora.org>2014-06-06 14:49:56 +0530
committerVenkateshwarlu Domakonda <vdomak@codeaurora.org>2014-06-06 16:32:32 +0530
commita82af36f8768435271ba6a437d61d6ac559679a8 (patch)
tree2822b03ca7c461b6f1653e5ca80953e55c3a2017 /FMRecord
parenta363d1d11b158d9f051cb4c552264ade3a904f33 (diff)
downloadandroid_hardware_qcom_fm-a82af36f8768435271ba6a437d61d6ac559679a8.tar.gz
android_hardware_qcom_fm-a82af36f8768435271ba6a437d61d6ac559679a8.tar.bz2
android_hardware_qcom_fm-a82af36f8768435271ba6a437d61d6ac559679a8.zip
FMRecord: Fix the issue with duration info
Add the duration value to the recorded file. Change-Id: Ib35fc28d7ef42ba0d545040de89c376e92a2043f CRs-Fixed: 667869
Diffstat (limited to 'FMRecord')
-rw-r--r--FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java b/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
index d1c6154..da55d8c 100644
--- a/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
+++ b/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -93,6 +93,8 @@ public class FMRecordingService extends Service {
private int clientPid = -1;
private String clientProcessName = "";
private String mAudioType = "audio/*";
+ private long startTimerMs = 0;
+ private long stopTimerMs = 0;
public void onCreate() {
@@ -259,6 +261,7 @@ public class FMRecordingService extends Service {
mRecorder.prepare();
Log.d(TAG, "start");
mRecorder.start();
+ startTimerMs = System.currentTimeMillis();
} catch (IOException e) {
Log.d(TAG, "IOException while start");
mRecorder.reset();
@@ -324,6 +327,7 @@ public class FMRecordingService extends Service {
return;
try {
mRecorder.stop();
+ stopTimerMs = System.currentTimeMillis();
mRecorder.reset();
mRecorder.release();
mRecorder = null;
@@ -370,6 +374,7 @@ public class FMRecordingService extends Service {
ContentValues cv = new ContentValues();
long current = System.currentTimeMillis();
long modDate = file.lastModified();
+ long recordDuration = stopTimerMs - startTimerMs;
Date date = new Date(current);
SimpleDateFormat formatter = new SimpleDateFormat(
res.getString(R.string.audio_db_title_format));
@@ -382,6 +387,7 @@ public class FMRecordingService extends Service {
cv.put(MediaStore.Audio.Media.DATA, file.getAbsolutePath());
cv.put(MediaStore.Audio.Media.DATE_ADDED, (int) (current / 1000));
cv.put(MediaStore.Audio.Media.DATE_MODIFIED, (int) (modDate / 1000));
+ cv.put(MediaStore.Audio.Media.DURATION, recordDuration);
cv.put(MediaStore.Audio.Media.MIME_TYPE, mAudioType);
cv.put(MediaStore.Audio.Media.ARTIST,
res.getString(R.string.audio_db_artist_name));