Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fm-commonsys
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
vendor
qcom-opensource
fm-commonsys
Commits
fccef147
Commit
fccef147
authored
11 years ago
by
Linux Build Service Account
Committed by
Gerrit - the friendly Code Review server
11 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Merge tag 'AU_LINUX_ANDROID_KK.04.04.04.010.104' into HEAD"
parents
930dee89
bad3182d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
+37
-1
37 additions, 1 deletion
...rd/src/com/codeaurora/fmrecording/FMRecordingService.java
with
37 additions
and
1 deletion
FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
+
37
−
1
View file @
fccef147
...
...
@@ -372,6 +372,7 @@ public class FMRecordingService extends Service {
Log
.
d
(
TAG
,
"In addToMediaDB"
);
Resources
res
=
getResources
();
ContentValues
cv
=
new
ContentValues
();
int
audioId
=
-
1
;
long
current
=
System
.
currentTimeMillis
();
long
modDate
=
file
.
lastModified
();
long
recordDuration
=
stopTimerMs
-
startTimerMs
;
...
...
@@ -393,6 +394,11 @@ public class FMRecordingService extends Service {
res
.
getString
(
R
.
string
.
audio_db_artist_name
));
cv
.
put
(
MediaStore
.
Audio
.
Media
.
ALBUM
,
res
.
getString
(
R
.
string
.
audio_db_album_name
));
audioId
=
getFileIdInVideoDB
(
file
);
if
(
audioId
!=
-
1
)
{
//remove the record if it is already added into video table.
removeRecordInVideoDB
(
audioId
);
Log
.
d
(
TAG
,
"Remove audio record "
+
audioId
+
" in video database"
);
}
Log
.
d
(
TAG
,
"Inserting audio record: "
+
cv
.
toString
());
ContentResolver
resolver
=
getContentResolver
();
Uri
base
=
MediaStore
.
Audio
.
Media
.
EXTERNAL_CONTENT_URI
;
...
...
@@ -405,7 +411,7 @@ public class FMRecordingService extends Service {
if
(
getPlaylistId
(
res
)
==
-
1
)
{
createPlaylist
(
res
,
resolver
);
}
int
audioId
=
Integer
.
valueOf
(
result
.
getLastPathSegment
());
audioId
=
Integer
.
valueOf
(
result
.
getLastPathSegment
());
addToPlaylist
(
resolver
,
audioId
,
getPlaylistId
(
res
));
// Notify those applications such as Music listening to the
...
...
@@ -414,6 +420,36 @@ public class FMRecordingService extends Service {
return
result
;
}
private
int
getFileIdInVideoDB
(
File
file
)
{
int
id
=
-
1
;
final
String
where
=
MediaStore
.
Video
.
Media
.
DATA
+
"=?"
;
final
String
[]
args
=
new
String
[]
{
file
.
getAbsolutePath
()
};
final
String
[]
ids
=
new
String
[]
{
MediaStore
.
Video
.
Media
.
_ID
};
Uri
base
=
MediaStore
.
Video
.
Media
.
EXTERNAL_CONTENT_URI
;
Cursor
cursor
=
query
(
base
,
ids
,
where
,
args
,
null
);
if
(
cursor
==
null
)
{
Log
.
v
(
TAG
,
"Data query returns null"
);
}
else
{
if
(
cursor
.
moveToNext
()
!=
false
)
{
id
=
cursor
.
getInt
(
0
);
cursor
.
close
();
}
}
return
id
;
}
private
void
removeRecordInVideoDB
(
int
id
)
{
final
String
where
=
MediaStore
.
Video
.
Media
.
_ID
+
"="
+
id
;
Uri
base
=
MediaStore
.
Video
.
Media
.
EXTERNAL_CONTENT_URI
;
ContentValues
cv
=
new
ContentValues
();
ContentResolver
resolver
=
getContentResolver
();
cv
.
put
(
MediaStore
.
Video
.
Media
.
DATA
,
"null"
);
resolver
.
update
(
base
,
cv
,
where
,
null
);
resolver
.
delete
(
base
,
where
,
null
);
}
private
int
getPlaylistId
(
Resources
res
)
{
Uri
uri
=
MediaStore
.
Audio
.
Playlists
.
getContentUri
(
"external"
);
final
String
[]
ids
=
new
String
[]
{
MediaStore
.
Audio
.
Playlists
.
_ID
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment