summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatadeen Mishra <matade@codeaurora.org>2015-10-07 18:02:33 +0530
committervenkata Jagadeesh <vjagad@codeaurora.org>2015-10-08 19:38:34 +0530
commit5b629fdff703a6614546bb2b8a1926c80a318859 (patch)
tree24a15e154ba0913964665df3fb7a5fc11a01fddc
parent1a8f27a91c83562015648b592340e543d2d6937f (diff)
downloadandroid_packages_apps_BluetoothExt-5b629fdff703a6614546bb2b8a1926c80a318859.tar.gz
android_packages_apps_BluetoothExt-5b629fdff703a6614546bb2b8a1926c80a318859.tar.bz2
android_packages_apps_BluetoothExt-5b629fdff703a6614546bb2b8a1926c80a318859.zip
BTLogKit: Application for BT Dynamic logging
Handling File Exception, Added check for file exist or not, If file present then load the states, otherwise print log message. Change-Id: I54c573054c293139926e103f1d34417678decf24 CRs-Fixed: 918344
-rw-r--r--QLogging/src/com/android/qlogging/BTStateReceiver.java94
1 files changed, 50 insertions, 44 deletions
diff --git a/QLogging/src/com/android/qlogging/BTStateReceiver.java b/QLogging/src/com/android/qlogging/BTStateReceiver.java
index 8267172..e2edf92 100644
--- a/QLogging/src/com/android/qlogging/BTStateReceiver.java
+++ b/QLogging/src/com/android/qlogging/BTStateReceiver.java
@@ -87,70 +87,76 @@ public class BTStateReceiver extends BroadcastReceiver{
case BluetoothAdapter.STATE_TURNING_OFF:
break;
case BluetoothAdapter.STATE_ON:
+ File file_global = new File(context.getFilesDir(), "GlobalSettings.xml");
+ File file_stack = new File(context.getFilesDir(), "StackSettings.xml");
+ File file_soc = new File(context.getFilesDir(), "StackSettings.xml");
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);
String[] stack_list_tags = context.getResources().getStringArray(R.array.stack_list_tags);
String[] soc_list_names = context.getResources().getStringArray(R.array.soc_list_names);
String[] soc_list_tags = context.getResources().getStringArray(R.array.soc_list_tags);
- map = Utils.getPreviousSettings(context, Main.STACK_MODULE_ID);
- if (!map.isEmpty()) {
- for (String stack : stack_list_names) {
- Object state_obj = map.get(stack);
- if (state_obj != null) {
- String state = state_obj.toString();
- int presState = Character.getNumericValue(state.charAt(2));
- sendIntent.transmitIntent(context, presState, stack_list_tags[counter], Main.STACK_MODULE_ID);
- counter++;
- }
- }
- }
- else
- Log.d(Main.TAG,"Map empty for Stack"+ bt_soc_type);
-
- map = Utils.getPreviousSettings(context, Main.SOC_MODULE_ID);
- if (!Main.soc_log_enabled)
- {
- 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
- {
- getSecondoryOptions.SOC_levels="";
- counter = 0;
- if (!map.isEmpty())
- {
- for (String soc : soc_list_names)
- {
- Object state_obj = map.get(soc);
- if (state_obj != null)
- {
+ bt_soc_type = SystemProperties.get("qcom.bluetooth.soc");
+ if (file_global.exists()) {
+ Utils.setGlobalSettings(context);
+ } else if (file_stack.exists()) {
+ map = Utils.getPreviousSettings(context, Main.STACK_MODULE_ID);
+ if (!map.isEmpty()) {
+ for (String stack : stack_list_names) {
+ Object state_obj = map.get(stack);
+ if (state_obj != null) {
String state = state_obj.toString();
int presState = Character.getNumericValue(state.charAt(2));
- getSecondoryOptions.SOC_levels+=String.valueOf(presState);
+ sendIntent.transmitIntent(context, presState, stack_list_tags[counter], Main.STACK_MODULE_ID);
counter++;
- }else{
- getSecondoryOptions.SOC_levels+=String.valueOf(0);
}
}
+ }
+ } else if (file_soc.exists()) {
+ map = Utils.getPreviousSettings(context, Main.SOC_MODULE_ID);
+ if (!Main.soc_log_enabled)
+ {
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");
- 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");
+ {
+ getSecondoryOptions.SOC_levels="";
+ counter = 0;
+ if (!map.isEmpty())
+ {
+ for (String soc : soc_list_names)
+ {
+ Object state_obj = map.get(soc);
+ if (state_obj != null)
+ {
+ String state = state_obj.toString();
+ int presState = Character.getNumericValue(state.charAt(2));
+ getSecondoryOptions.SOC_levels+=String.valueOf(presState);
+ counter++;
+ }else{
+ getSecondoryOptions.SOC_levels+=String.valueOf(0);
+ }
+ }
+ 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");
+ }
+ } else {
+ Log.d(Main.TAG,"File not yet created.");
}
break;
case BluetoothAdapter.STATE_TURNING_ON: