diff options
author | Ayaz Ahmad <aahmad@codeaurora.org> | 2013-09-05 16:53:09 +0530 |
---|---|---|
committer | Ayaz Ahmad <aahmad@codeaurora.org> | 2013-09-13 12:09:17 +0530 |
commit | 5d19b1bbc9102c472fc62914ae08339a45ae1b51 (patch) | |
tree | ccd06d38b31beadbba872e5b90266d95eb616e37 /fmapp | |
parent | cd4bbb4f8e74be388a7d99dea1ca58c87ca19193 (diff) | |
download | android_hardware_qcom_fm-5d19b1bbc9102c472fc62914ae08339a45ae1b51.tar.gz android_hardware_qcom_fm-5d19b1bbc9102c472fc62914ae08339a45ae1b51.tar.bz2 android_hardware_qcom_fm-5d19b1bbc9102c472fc62914ae08339a45ae1b51.zip |
fm: Check FM process status while recording
FM recording does not stop after clearing app data
of FM package. When recording starts check repeatedly
client status which requested for recording.
Change-Id: Ibd33ef18c306f64848e84caf98ce4058f3312414
CRs-Fixed: 535211
Diffstat (limited to 'fmapp')
-rw-r--r-- | fmapp/src/com/codeaurora/fmradio/FMRadioService.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/fmapp/src/com/codeaurora/fmradio/FMRadioService.java b/fmapp/src/com/codeaurora/fmradio/FMRadioService.java index 4505e9f..db64782 100644 --- a/fmapp/src/com/codeaurora/fmradio/FMRadioService.java +++ b/fmapp/src/com/codeaurora/fmradio/FMRadioService.java @@ -82,6 +82,9 @@ import android.content.Intent; import android.content.IntentFilter; import android.app.IntentService; import android.os.UserHandle; +import android.os.Process; +import android.app.ActivityManager; +import android.app.ActivityManager.RunningAppProcessInfo; /** * Provides "background" FM Radio (that uses the hardware) capabilities, @@ -688,6 +691,24 @@ public class FMRadioService extends Service return true; } + private String getProcessName() { + int id = Process.myPid(); + String myProcessName = this.getPackageName(); + + ActivityManager actvityManager = + (ActivityManager)this.getSystemService(this.ACTIVITY_SERVICE); + List<RunningAppProcessInfo> procInfos = + actvityManager.getRunningAppProcesses(); + + for(RunningAppProcessInfo procInfo : procInfos) { + if (id == procInfo.pid) { + myProcessName = procInfo.processName; + } + } + procInfos.clear(); + return myProcessName; + } + private void sendRecordIntent(int action) { Intent intent = new Intent(ACTION_FM_RECORDING); intent.putExtra("state", action); @@ -698,6 +719,8 @@ public class FMRadioService extends Service mRecordDuration = (FmSharedPreferences.getRecordDuration() * 60 * 1000); } intent.putExtra("record_duration", mRecordDuration); + intent.putExtra("process_name", getProcessName()); + intent.putExtra("process_id", Process.myPid()); } Log.d(LOGTAG, "Sending Recording intent for = " +action); getApplicationContext().sendBroadcast(intent); |