Bluetooth: Handling SOC logging based on SOC type

Handling SOC logging based on SOC type from logkit
Application based on system property.

Change-Id: I43ae91de47fd77f1897e67bb52340df831719619
CRs-Fixed: 906567
diff --git a/QLogging/src/com/android/qlogging/BTStateReceiver.java b/QLogging/src/com/android/qlogging/BTStateReceiver.java
index b9fe2be..8267172 100644
--- a/QLogging/src/com/android/qlogging/BTStateReceiver.java
+++ b/QLogging/src/com/android/qlogging/BTStateReceiver.java
@@ -69,7 +69,7 @@
 import java.io.PrintWriter;
 import java.lang.reflect.Field;
 import java.lang.Runnable;
-
+import android.os.SystemProperties;
 import android.content.pm.PackageManager;
 
 public class BTStateReceiver extends BroadcastReceiver{
@@ -77,6 +77,8 @@
     public void onReceive(Context context, Intent intent) {
         final String action = intent.getAction();
         Toast toast;
+        String mRome ="rome";
+        String bt_soc_type;
 
         final int btstate = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
         switch (btstate) {
@@ -87,6 +89,7 @@
             case BluetoothAdapter.STATE_ON:
                 Map map;
                 int counter = 0;
+                bt_soc_type = SystemProperties.get("qcom.bluetooth.soc");
                 Utils.setGlobalSettings(context);
                 String[] profile_tags = context.getResources().getStringArray(R.array.profile_list_tags);
                 String[] stack_list_names = context.getResources().getStringArray(R.array.stack_list_names);
@@ -106,12 +109,18 @@
                     }
                 }
                 else
-                    Log.d(Main.TAG,"Map empty for Stack");
+                    Log.d(Main.TAG,"Map empty for Stack"+ bt_soc_type);
 
                 map = Utils.getPreviousSettings(context, Main.SOC_MODULE_ID);
                 if (!Main.soc_log_enabled)
                 {
-                    sendIntent.transmitIntent(context, 0, "F", Main.SOC_ALL_MODULE_ID);
+                    if (bt_soc_type.equals(mRome))
+                        Log.d(Main.TAG,"soc type is rome dont enable SOC logging");
+                    else
+                    {
+                        sendIntent.transmitIntent(context, 0, "F", Main.SOC_ALL_MODULE_ID);
+                        Log.d(Main.TAG,"soc type is not rome enable SOC logging");
+                    }
                 }
                 else
                 {
@@ -132,7 +141,13 @@
                                 getSecondoryOptions.SOC_levels+=String.valueOf(0);
                             }
                         }
-                        sendIntent.transmitIntent(context, Main.SOC_ALL_MODULE_ID, getSecondoryOptions.SOC_levels, Main.SOC_ALL_MODULE_ID);
+                        if (bt_soc_type.equals(mRome))
+                            Log.d(Main.TAG,"soc type is rome dont enable SOC logging");
+                        else
+                        {
+                            Log.d(Main.TAG,"soc type is not rome enable SOC logging");
+                            sendIntent.transmitIntent(context, Main.SOC_ALL_MODULE_ID, getSecondoryOptions.SOC_levels, Main.SOC_ALL_MODULE_ID);
+                        }
                     }
                     else
                         Log.d(Main.TAG,"Map empty for SOC");
diff --git a/QLogging/src/com/android/qlogging/getSecondoryOptions.java b/QLogging/src/com/android/qlogging/getSecondoryOptions.java
index dbfe34a..bf8981e 100644
--- a/QLogging/src/com/android/qlogging/getSecondoryOptions.java
+++ b/QLogging/src/com/android/qlogging/getSecondoryOptions.java
@@ -52,6 +52,7 @@
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.Shader;
 import java.util.Map;
+import android.os.SystemProperties;
 
 public class getSecondoryOptions extends Activity{
 /*
@@ -63,7 +64,8 @@
     public static LinearLayout lv;
     public static ScrollView sv;
     public static String SOC_levels="";
-
+    String mRome ="rome";
+    String bt_soc_type = SystemProperties.get("qcom.bluetooth.soc");
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -164,7 +166,13 @@
                         lv.setVisibility(View.VISIBLE);
                     }else{
                         lv.setVisibility(View.GONE);
-                        sendIntent.transmitIntent(this, 0, "F", Main.SOC_ALL_MODULE_ID);
+                        if (bt_soc_type.equals(mRome))
+                            Log.d(Main.TAG,"soc type is rome dont enable SOC logging");
+                        else
+                        {
+                            sendIntent.transmitIntent(this, 0, "F", Main.SOC_ALL_MODULE_ID);
+                            Log.d(Main.TAG,"soc type is not rome enable SOC logging");
+                        }
                     }
                     titlebarHeading = "SOC log levels";
                 }
@@ -219,7 +227,13 @@
                         Main.soc_log_enabled=true;
                         Utils.saveGlobalState(getApplicationContext());
                         Toast.makeText(getApplicationContext(), "SOC logging turned on", Toast.LENGTH_SHORT).show();
-                        sendIntent.transmitIntent(getApplicationContext(), 0, SOC_levels, Main.SOC_ALL_MODULE_ID);
+                        if (bt_soc_type.equals(mRome))
+                            Log.d(Main.TAG,"soc type is rome dont enable SOC logging");
+                        else
+                        {
+                            sendIntent.transmitIntent(getApplicationContext(), 0, SOC_levels, Main.SOC_ALL_MODULE_ID);
+                            Log.d(Main.TAG,"soc type is not rome enable SOC logging");
+                        }
                         init_soc = 1;
                     }else{
                         Utils.saveCurrentState(getApplicationContext());
@@ -228,7 +242,13 @@
                         tv.setVisibility(View.VISIBLE);
                         Main.soc_log_enabled=false;
                         Utils.saveGlobalState(getApplicationContext());
-                        sendIntent.transmitIntent(getApplicationContext(), 0, "F", Main.SOC_ALL_MODULE_ID);
+                        if (bt_soc_type.equals(mRome))
+                            Log.d(Main.TAG,"soc type is rome dont enable SOC logging");
+                        else
+                        {
+                            sendIntent.transmitIntent(getApplicationContext(), 0, "F", Main.SOC_ALL_MODULE_ID);
+                            Log.d(Main.TAG,"soc type is not rome enable SOC logging");
+                        }
                     }
                 }
             });