summaryrefslogtreecommitdiffstats
path: root/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
diff options
context:
space:
mode:
authorAyaz Ahmad <aahmad@codeaurora.org>2013-09-04 17:17:49 +0530
committerAyaz Ahmad <aahmad@codeaurora.org>2013-09-06 11:51:02 +0530
commit93e785596c81dc2414f5121a3919bc608852dc35 (patch)
treee2aa05c116648a62e30cc9e713735487e1bc8b11 /FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
parentb0880e7472611a74c9f5df1a9e8176d2b76f984c (diff)
downloadandroid_hardware_qcom_fm-93e785596c81dc2414f5121a3919bc608852dc35.tar.gz
android_hardware_qcom_fm-93e785596c81dc2414f5121a3919bc608852dc35.tar.bz2
android_hardware_qcom_fm-93e785596c81dc2414f5121a3919bc608852dc35.zip
fmapp2: Fix the issue FM recording timer does not stop
FM recording service gets killed by activity manager as no package component is bound to it, and it runs in seperate process so fm activity does not get notified of this killing. Run recording service in foreground. CRs-Fixed: 536649 Change-Id: I5dce8ff877aebb5038f3eabe60128500301afecd
Diffstat (limited to 'FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java')
-rw-r--r--FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java b/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
index 2c615e8..39db48a 100644
--- a/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
+++ b/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
@@ -57,6 +57,13 @@ import android.os.UserHandle;
import android.net.Uri;
import android.content.res.Resources;
import android.os.StatFs;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.widget.RemoteViews;
+import android.R.layout;
+import android.R.drawable;
+import android.content.ComponentName;
+import android.content.res.Resources;
public class FMRecordingService extends Service {
private static final String TAG = "FMRecordingService";
@@ -282,9 +289,19 @@ public class FMRecordingService extends Service {
});
mSampleStart = System.currentTimeMillis();
sendRecordingStatusIntent(START);
+ startNotification();
return true;
}
+ private void startNotification() {
+ RemoteViews views = new RemoteViews(getPackageName(), R.layout.record_status_bar);
+ Notification status = new Notification();
+ status.contentView = views;
+ status.flags |= Notification.FLAG_ONGOING_EVENT;
+ status.icon = R.drawable.ic_menu_record;
+ startForeground(102, status);
+ }
+
private void stopRecord() {
Log.d(TAG, "Enter stopRecord");
mFmRecordingOn = false;
@@ -301,6 +318,7 @@ public class FMRecordingService extends Service {
sendRecordingStatusIntent(STOP);
saveFile();
+ stopForeground(true);
}
private void saveFile() {