FM-APP2: Configure repeat count for PS string

Added support for setting repeat count for PS string
to get refined PS string from receiver

Change-Id: I5be0ee6b0f28b8312af9cc64c9cca1a38dc88241
CRs-Fixed: 474719
diff --git a/fmapp2/res/values/arrays.xml b/fmapp2/res/values/arrays.xml
index e71aa83..d7904be 100644
--- a/fmapp2/res/values/arrays.xml
+++ b/fmapp2/res/values/arrays.xml
@@ -359,6 +359,7 @@
       <item> Get GoodChRmssi Threshold</item>
       <item> Get AfJmpRmssi Samples count</item>
       <item> RF Statistics</item>
+      <item> Set RXREPEAT Count</item>
   </string-array>
 
   <string-array name="stats_options">
diff --git a/fmapp2/res/values/strings.xml b/fmapp2/res/values/strings.xml
index 30246e5..12c9778 100644
--- a/fmapp2/res/values/strings.xml
+++ b/fmapp2/res/values/strings.xml
@@ -244,5 +244,7 @@
     <string name="enter_AfJmpRmssiSmplsCnt">Enter Af Jump Rmssi Samples count</string>
     <string name="set_AfJmpRmssiSmplsCnt">Config Af Jump Rmssi Samples count</string>
     <string name="rt_plus_tags">Tags</string>
+    <string name="enter_RxRePeatCount">Enter RxRePeat count</string>
+    <string name="set_RxRePeatCount">Config RxRePeat count</string>
 
 </resources>
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 119fba9..26ed158 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -1453,6 +1453,10 @@
       {
           return (mService.get().setAfJmpRmssiSamplesCnt(afJmpRmssiSmplsCnt));
       }
+      public boolean setRxRepeatCount(int count)
+      {
+           return (mService.get().setRxRepeatCount(count));
+      }
    }
    private final IBinder mBinder = new ServiceStub(this);
 
@@ -2906,6 +2910,13 @@
        cancelAlarmRecordTimeout();
        cancelAlarmDealyedServiceStop();
    }
+   public boolean setRxRepeatCount(int count) {
+      if(mReceiver != null)
+         return mReceiver.setPSRxRepeatCount(count);
+      else
+         return false;
+   }
+
    //handling the sleep and record stop when FM App not in focus
    private void delayedStop(long duration, int nType) {
        int whatId = (nType == STOP_SERVICE) ? STOPSERVICE_ONSLEEP: STOPRECORD_ONTIMEOUT;
diff --git a/fmapp2/src/com/caf/fmradio/FMStats.java b/fmapp2/src/com/caf/fmradio/FMStats.java
index f19477d..4014b8e 100644
--- a/fmapp2/src/com/caf/fmradio/FMStats.java
+++ b/fmapp2/src/com/caf/fmradio/FMStats.java
@@ -431,6 +431,30 @@
        }
     };
 
+    private View.OnClickListener mOnSetRxRePeatCount = new View.OnClickListener() {
+        public void onClick(View v) {
+            String a;
+            a =  txtbox1.getText().toString();
+            try {
+                 int count = Integer.parseInt(a);
+                 Log.d(LOGTAG, "Value entered for mOnSetRxRePeatCount: " + count);
+                 if((count < 0) ||
+                     (count > 255))
+                     return;
+                 if(mService != null) {
+                    try {
+                         mService.setRxRepeatCount(count);
+                    } catch (RemoteException e) {
+                         e.printStackTrace();
+                    }
+                 }
+            } catch (NumberFormatException e) {
+                 Log.e(LOGTAG, "Value entered is not in correct format : " + a);
+                 txtbox1.setText("");
+            }
+        }
+    };
+
     private View.OnClickListener mOnSetSigThListener = new View.OnClickListener() {
        public void onClick(View v) {
           String a;
@@ -1286,6 +1310,21 @@
                     spinOptionFmRf.setAdapter(adaptRfCfg);
                     spinOptionFmRf.setOnItemSelectedListener(mSpinRfCfgListener);
                     break;
+                case 21:
+                    if (txtbox1 != null) {
+                        txtbox1.setText(R.string.type_rd);
+                        txtbox1.setVisibility(View.VISIBLE);
+                    }
+                    if (tv1 != null) {
+                        tv1.setText(R.string.enter_RxRePeatCount);
+                        tv1.setVisibility(View.VISIBLE);
+                    }
+                    if (SetButton != null) {
+                        SetButton.setText(R.string.set_RxRePeatCount);
+                        SetButton.setVisibility(View.VISIBLE);
+                        SetButton.setOnClickListener(mOnSetRxRePeatCount);
+                    }
+                    break;
             }
         }
         public void onNothingSelected(AdapterView<?> parent) {
diff --git a/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl b/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
index d4217e7..c2dc7fb 100644
--- a/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
+++ b/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
@@ -69,5 +69,6 @@
     int getAfJmpRmssiTh();
     int getGoodChRmssiTh();
     int getAfJmpRmssiSamplesCnt();
+    boolean setRxRepeatCount(int count);
 }