From c0de8eed5fc2593e978a3b06b69ffb45d674328c Mon Sep 17 00:00:00 2001
From: Rupesh Tatiya <rtatiya@codeaurora.org>
Date: Thu, 28 Jan 2016 16:24:34 +0530
Subject: [PATCH] Disable/enable radio on factory reset

Recording was failing to stop on factory reset. Also mute button status
was not being reset. Also, FM Radio should also be restarted.

CRs-Fixed: 968376
Change-Id: If9966a887a09a5fd6813637b61b075616362ff39
---
 fmapp2/src/com/caf/fmradio/FMRadio.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java
index b1b613b..76b961c 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadio.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadio.java
@@ -970,9 +970,10 @@ public class FMRadio extends Activity
                 String action = data.getAction();
                 if (action != null) {
                   if (action.equals(Settings.RESTORE_FACTORY_DEFAULT_ACTION)) {
+                      disableRadio();
                       RestoreDefaults();
-                      enableRadioOnOffUI();
-                      tuneRadio(FmSharedPreferences.DEFAULT_NO_FREQUENCY);
+                      FmSharedPreferences.setTunedFrequency(FmSharedPreferences.DEFAULT_NO_FREQUENCY);
+                      enableRadio();
                       FmSharedPreferences.addStation("", FmSharedPreferences.DEFAULT_NO_FREQUENCY, 0);
                   }
                }
-- 
GitLab