summaryrefslogtreecommitdiffstats
path: root/QLogging
diff options
context:
space:
mode:
authorSai Aitharaju <saia@codeaurora.org>2015-06-19 17:01:34 +0530
committerMatadeen Mishra <matade@codeaurora.org>2015-08-25 16:24:20 +0530
commitfd57702e981af0febe36c3511256a92790336e96 (patch)
treeaa3951cedaee6427b1b1640405d9d24732591c4a /QLogging
parent128998d6d97b46db0d6118fa0266e6fc63980557 (diff)
downloadandroid_packages_apps_BluetoothExt-fd57702e981af0febe36c3511256a92790336e96.tar.gz
android_packages_apps_BluetoothExt-fd57702e981af0febe36c3511256a92790336e96.tar.bz2
android_packages_apps_BluetoothExt-fd57702e981af0febe36c3511256a92790336e96.zip
BTLogKit: Application for BT Dynamic logging
This Application is used to control the logging levels dynamically for all the Stack Layers of Bluedroid and all the SOC layers. -- This Application is enabled in userdebug builds only. -- We can set the Log Trace Levels of BT dynamically. CRs-Fixed: 872836 Change-Id: Id878bfebae10bed2546c6b73553401acf4820971
Diffstat (limited to 'QLogging')
-rw-r--r--QLogging/Android.mk22
-rw-r--r--QLogging/AndroidManifest.xml75
-rw-r--r--QLogging/jni/Android.mk28
-rw-r--r--QLogging/jni/com_android_qlogging_sendIntent.cpp177
-rw-r--r--QLogging/res/drawable/border.xml40
-rw-r--r--QLogging/res/drawable/border_off.xml40
-rwxr-xr-xQLogging/res/drawable/qti.pngbin0 -> 1518 bytes
-rw-r--r--QLogging/res/layout/activity_get_secondory_options.xml57
-rw-r--r--QLogging/res/layout/activity_main.xml78
-rw-r--r--QLogging/res/layout/profile_log_options.xml60
-rw-r--r--QLogging/res/layout/soc_switch_layout.xml46
-rw-r--r--QLogging/res/layout/spinner_item.xml44
-rw-r--r--QLogging/res/layout/spinner_item_off.xml44
-rw-r--r--QLogging/res/layout/stack_log_options.xml61
-rw-r--r--QLogging/res/menu/menu_get_secondory_options.xml59
-rw-r--r--QLogging/res/menu/menu_main.xml53
-rw-r--r--QLogging/res/values-w820dp/dimens.xml39
-rw-r--r--QLogging/res/values/colors.xml50
-rw-r--r--QLogging/res/values/dimens.xml40
-rw-r--r--QLogging/res/values/strings.xml197
-rw-r--r--QLogging/res/values/styles.xml37
-rw-r--r--QLogging/src/com/android/qlogging/BTStateReceiver.java238
-rw-r--r--QLogging/src/com/android/qlogging/Main.java176
-rw-r--r--QLogging/src/com/android/qlogging/ProfileOptionsView.java189
-rw-r--r--QLogging/src/com/android/qlogging/StackOptionsView.java180
-rw-r--r--QLogging/src/com/android/qlogging/Utils.java530
-rw-r--r--QLogging/src/com/android/qlogging/getSecondoryOptions.java327
-rw-r--r--QLogging/src/com/android/qlogging/sendIntent.java59
28 files changed, 2946 insertions, 0 deletions
diff --git a/QLogging/Android.mk b/QLogging/Android.mk
new file mode 100644
index 0000000..db46b74
--- /dev/null
+++ b/QLogging/Android.mk
@@ -0,0 +1,22 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+ $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := BTLogKit
+LOCAL_CERTIFICATE := platform
+
+LOCAL_JNI_SHARED_LIBRARIES := libqlogging_jni
+
+LOCAL_REQUIRED_MODULES := bluetooth.default
+LOCAL_MULTILIB := 32
+
+LOCAL_PROGUARD_ENABLED := disabled
+
+ifeq ($(TARGET_BUILD_VARIANT),userdebug)
+ include $(BUILD_PACKAGE)
+ include $(call all-makefiles-under,$(LOCAL_PATH))
+endif
diff --git a/QLogging/AndroidManifest.xml b/QLogging/AndroidManifest.xml
new file mode 100644
index 0000000..d86c532
--- /dev/null
+++ b/QLogging/AndroidManifest.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.qlogging"
+ android:sharedUserId="android.uid.bluetooth">
+ <uses-permission android:name="android.permission.BLUETOOTH" />
+ <uses-permission android:name="android.permission.READ_LOGS"/>
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/qti"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme"
+ android:process="com.android.bluetooth" >
+ <activity
+ android:name=".Main"
+ android:label="@string/app_name"
+ android:screenOrientation="portrait">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".getSecondoryOptions"
+ android:label="@string/title_activity_get_secondory_options"
+ android:parentActivityName=".Main"
+ android:screenOrientation="portrait">
+ <meta-data
+ android:name="android.support.PARENT_ACTIVITY"
+ android:value="com.android.qlogging.Main" />
+ </activity>
+ <receiver
+ android:name=".BTStateReceiver"
+ android:enabled="true">
+ <intent-filter>
+ <action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
+ </intent-filter>
+ </receiver>
+ </application>
+
+</manifest>
diff --git a/QLogging/jni/Android.mk b/QLogging/jni/Android.mk
new file mode 100644
index 0000000..e7eeed9
--- /dev/null
+++ b/QLogging/jni/Android.mk
@@ -0,0 +1,28 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= \
+ com_android_qlogging_sendIntent.cpp
+
+LOCAL_C_INCLUDES += \
+ $(JNI_H_INCLUDE) \
+ system/bt/include \
+ system/bt/stack/include \
+
+LOCAL_SHARED_LIBRARIES := \
+ libandroid_runtime \
+ libnativehelper \
+ libcutils \
+ libutils \
+ liblog \
+ libhardware
+
+LOCAL_MULTILIB := 32
+
+#LOCAL_CFLAGS += -O0 -g
+
+LOCAL_MODULE := libqlogging_jni
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/QLogging/jni/com_android_qlogging_sendIntent.cpp b/QLogging/jni/com_android_qlogging_sendIntent.cpp
new file mode 100644
index 0000000..7e11777
--- /dev/null
+++ b/QLogging/jni/com_android_qlogging_sendIntent.cpp
@@ -0,0 +1,177 @@
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+
+#define LOG_TAG "QLoggingJni"
+#include "hardware/bluetooth.h"
+#include "utils/Log.h"
+#include "utils/misc.h"
+#include "cutils/properties.h"
+#include "android_runtime/AndroidRuntime.h"
+#include "android_runtime/Log.h"
+#include "jni.h"
+#include "logging.h"
+#include "JNIHelp.h"
+
+#include <string.h>
+#include <pthread.h>
+
+#include <sys/stat.h>
+#include <fcntl.h>
+#define HCI_GRP_HOST_CONT_BASEBAND_CMDS (0x03 << 10)
+#define HCI_OPCODE_PACK(ogf, ocf) (unsigned short int)((ocf & 0x03ff)|(ogf << 10))
+#define HCI_RESET (0x0003 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
+
+namespace android{
+
+static const bt_interface_t *sBluetoothInterface = NULL;
+static const btstacklog_interface_t *sBluetoothLogInterface = NULL;
+
+jint HAL_Load(){
+ jint err;
+ hw_module_t* BT_HW_module;
+
+ err = hw_get_module(BT_HARDWARE_MODULE_ID,(hw_module_t const**)&BT_HW_module);
+
+ if (err == 0) {
+ hw_device_t* stack;
+ err = BT_HW_module->methods->open(BT_HW_module, BT_HARDWARE_MODULE_ID, &stack);
+ if (err == 0) {
+ bluetooth_module_t* btStack = (bluetooth_module_t *)stack;
+ sBluetoothInterface = btStack->get_bluetooth_interface();
+ } else {
+ ALOGE("Loading BT Interface failed");
+ return err;
+ }
+ }
+ else {
+ ALOGE("Error loading BT Module");
+ return err;
+ }
+ return err;
+}
+
+static void setLogging(JNIEnv* env, jclass clazz,jstring jlog_layer, jint log_level, jint module)
+{
+
+ if (sBluetoothInterface == NULL)
+ {
+ if(HAL_Load()<0)
+ ALOGE("HAL failed to load BT");
+ else
+ ALOGE("HAL loaded BT successfully");
+ }
+
+ if (sBluetoothInterface) {
+ if ( (sBluetoothLogInterface = (btstacklog_interface_t *)
+ sBluetoothInterface->get_profile_interface("LOG_ID")) == NULL) {
+ ALOGE("Error loading Stack Log Interface");
+ }
+ else{
+ const char *log_layer = env->GetStringUTFChars(jlog_layer, 0);
+ if ( module == 3 )
+ {
+ ALOGD("Setting SOC log levels.");
+ uint8_t values[7] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06};
+ uint8_t set_level = 0x00;
+ int index = log_layer[0]-'0';
+ if (log_level == 0)
+ set_level = 0xF;
+ else
+ set_level = values[log_level-1];
+
+ uint8_t array[3]={0x11,values[index],set_level};
+ sBluetoothInterface->hci_cmd_send(HCI_OPCODE_PACK(0x3F,0x17),array,3);
+ }
+ else if( module == 4)
+ {
+ ALOGD("Setting all SOC log levels.");
+ const char *log_level = env->GetStringUTFChars(jlog_layer,0);
+ uint8_t values[7] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06};
+ if (log_level[0] == 'F')/* Setting All Levels to Off.*/
+ {
+ uint8_t param[5] = {0x10,0x02,0x00,0x00,0x01};
+ sBluetoothInterface->hci_cmd_send(HCI_OPCODE_PACK(0x3F,0x17),param,5);
+ }
+ else{
+ /* Setting each SOC Layer */
+ int index[7];
+ uint8_t param[15];
+ param[0]= 0x11;
+ for(int i=0;i<7;i++){
+ index[i]=log_level[i]-'0';
+ param[2*i+1] = values[i];
+ if (index[i] == 0)
+ param[2*i+2] = 0xF;
+ param[2*i+2] = values[index[i]];
+ }
+ sBluetoothInterface->hci_cmd_send(HCI_OPCODE_PACK(0x3F,0x17),param,15);
+ }
+ }
+ else
+ {
+ ALOGD("Setting stack log levels.");
+ sBluetoothLogInterface->setLog(log_layer,log_level);
+ }
+ }
+ }
+}
+
+static JNINativeMethod sMethods[] = {
+ {"setLogging", "(Ljava/lang/String;II)V", (void *) setLogging}
+};
+
+int register_com_android_qlogging_sendIntent(JNIEnv* env)
+{
+ return jniRegisterNativeMethods(env, "com/android/qlogging/sendIntent",
+ sMethods, NELEM(sMethods));
+
+}
+
+}/*namespace android*/
+
+
+jint JNI_OnLoad(JavaVM *jvm, void *reserved)
+{
+ JNIEnv *e;
+ int status;
+
+ // Check JNI version
+ if (jvm->GetEnv((void **)&e, JNI_VERSION_1_6)) {
+ ALOGE("Error matching JNI version");
+ return JNI_ERR;
+ }
+
+ if ((status = android::register_com_android_qlogging_sendIntent(e)) < 0) {
+ ALOGE("jni QLOGGING registration failure, status: %d", status);
+ return JNI_ERR;
+ }
+ return JNI_VERSION_1_6;
+}
diff --git a/QLogging/res/drawable/border.xml b/QLogging/res/drawable/border.xml
new file mode 100644
index 0000000..e0ef788
--- /dev/null
+++ b/QLogging/res/drawable/border.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
+ <solid android:color="#dfffffff" />
+ <corners android:radius="5dp" />
+ <stroke android:width="1dip" android:color="#4fa5d5"/>
+</shape>
diff --git a/QLogging/res/drawable/border_off.xml b/QLogging/res/drawable/border_off.xml
new file mode 100644
index 0000000..2b19f1e
--- /dev/null
+++ b/QLogging/res/drawable/border_off.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
+ <solid android:color="#ADDDDDDD" />
+ <corners android:radius="5dp" />
+ <stroke android:width="1dip" android:color="#4fa5d5"/>
+</shape>
diff --git a/QLogging/res/drawable/qti.png b/QLogging/res/drawable/qti.png
new file mode 100755
index 0000000..36233d1
--- /dev/null
+++ b/QLogging/res/drawable/qti.png
Binary files differ
diff --git a/QLogging/res/layout/activity_get_secondory_options.xml b/QLogging/res/layout/activity_get_secondory_options.xml
new file mode 100644
index 0000000..ee07983
--- /dev/null
+++ b/QLogging/res/layout/activity_get_secondory_options.xml
@@ -0,0 +1,57 @@
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<ScrollView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="fill_parent"
+ android:layout_width="fill_parent"
+ android:id="@+id/outer_scroll_box"
+ android:background="@color/background_main"
+ android:fillViewport="false">
+
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"
+ xmlns:custom="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/outer_box"
+ android:orientation="vertical"
+ android:layout_gravity="center_horizontal"
+ android:gravity="center_horizontal"
+ android:layout_height="wrap_content"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ tools:context=".getSecondoryOptions">
+ </LinearLayout>
+</ScrollView>
+
diff --git a/QLogging/res/layout/activity_main.xml b/QLogging/res/layout/activity_main.xml
new file mode 100644
index 0000000..4ab7c73
--- /dev/null
+++ b/QLogging/res/layout/activity_main.xml
@@ -0,0 +1,78 @@
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:background="@color/background_main"
+ tools:context=".Main">
+
+ <Button
+ android:id="@+id/profile_button"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="1"
+ android:onClick="getOptions"
+ android:padding="15dip"
+ android:background="@drawable/border_off"
+ android:text="@string/profile_text"
+ android:clickable="false" />
+
+ <Button
+ android:id="@+id/stack_button"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="1"
+ android:onClick="getOptions"
+ android:background="@drawable/border"
+ android:text="@string/stack_text"
+ android:padding="15dip"/>
+
+ <Button
+ android:id="@+id/java_button"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="1"
+ android:onClick="getOptions"
+ android:background="@drawable/border"
+ android:text="@string/soc_text"
+ android:padding="15dip"/>
+
+</LinearLayout>
+
diff --git a/QLogging/res/layout/profile_log_options.xml b/QLogging/res/layout/profile_log_options.xml
new file mode 100644
index 0000000..dbdf85c
--- /dev/null
+++ b/QLogging/res/layout/profile_log_options.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <CheckBox
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="15dip"
+ android:textSize="16sp"
+ android:layout_marginEnd="6dip" />
+
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="2"/>
+
+ <ToggleButton
+ android:padding="15dip"
+ android:layout_alignParentEnd="true"
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent" />
+
+ <Space
+ android:layout_width="50dp"
+ android:layout_height="match_parent"/>
+
+</merge>
diff --git a/QLogging/res/layout/soc_switch_layout.xml b/QLogging/res/layout/soc_switch_layout.xml
new file mode 100644
index 0000000..ebd8a08
--- /dev/null
+++ b/QLogging/res/layout/soc_switch_layout.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal" >
+
+ <Switch
+ android:id="@+id/action_soc_enable_switch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+</RelativeLayout>
diff --git a/QLogging/res/layout/spinner_item.xml b/QLogging/res/layout/spinner_item.xml
new file mode 100644
index 0000000..1ee8fb2
--- /dev/null
+++ b/QLogging/res/layout/spinner_item.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<TextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="16sp"
+ android:gravity="left"
+ android:textColor="#000000"
+ android:padding="5dip"
+ />
diff --git a/QLogging/res/layout/spinner_item_off.xml b/QLogging/res/layout/spinner_item_off.xml
new file mode 100644
index 0000000..1ee8fb2
--- /dev/null
+++ b/QLogging/res/layout/spinner_item_off.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<TextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="16sp"
+ android:gravity="left"
+ android:textColor="#000000"
+ android:padding="5dip"
+ />
diff --git a/QLogging/res/layout/stack_log_options.xml b/QLogging/res/layout/stack_log_options.xml
new file mode 100644
index 0000000..76b6f1b
--- /dev/null
+++ b/QLogging/res/layout/stack_log_options.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <CheckBox
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="6dip"
+ android:layout_marginEnd="6dip" />
+
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1"/>
+
+ <Spinner
+ android:paddingLeft="15dip"
+ android:paddingTop="3dip"
+ android:paddingBottom="3dip"
+ android:paddingRight="15dip"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+ <Space
+ android:layout_width="50dp"
+ android:layout_height="match_parent"/>
+
+</merge>
diff --git a/QLogging/res/menu/menu_get_secondory_options.xml b/QLogging/res/menu/menu_get_secondory_options.xml
new file mode 100644
index 0000000..7b0b094
--- /dev/null
+++ b/QLogging/res/menu/menu_get_secondory_options.xml
@@ -0,0 +1,59 @@
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:context=".getSecondoryOptions">
+ <item
+ android:id="@+id/save_log_btn_start_2"
+ android:icon="@android:drawable/ic_media_play"
+ android:title="@string/log_save_start"/>
+ <item
+ android:id="@+id/save_log_btn_stop_2"
+ android:icon="@android:drawable/ic_media_pause"
+ android:title="@string/log_save_stop"/>
+ <item
+ android:id="@+id/action_set_all"
+ android:title="@string/string_set_all"
+ android:orderInCategory="100"/>
+ <item
+ android:id="@+id/action_soc_enable"
+ android:showAsAction="always"
+ android:actionViewClass="android.widget.Switch"
+ />
+ <item
+ android:id="@+id/action_settings_2"
+ android:title="@string/action_settings"
+ android:orderInCategory="100"/>
+</menu>
diff --git a/QLogging/res/menu/menu_main.xml b/QLogging/res/menu/menu_main.xml
new file mode 100644
index 0000000..d0594f4
--- /dev/null
+++ b/QLogging/res/menu/menu_main.xml
@@ -0,0 +1,53 @@
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools" tools:context=".Main">
+ <item
+ android:id="@+id/action_save_log_btn_start"
+ android:icon="@android:drawable/ic_media_play"
+ android:title="@string/log_save_start"/>
+ <item
+ android:id="@+id/action_save_log_btn_stop"
+ android:icon="@android:drawable/ic_media_pause"
+ android:title="@string/log_save_stop"/>
+<!-- <item
+ android:id="@+id/action_btlog_filter"
+ android:actionViewClass="android.widget.Switch"
+ />-->
+ <item android:id="@+id/action_settings"
+ android:title="@string/action_settings"
+ android:orderInCategory="100" />
+<!--app:showAsAction="never" />-->
+</menu>
diff --git a/QLogging/res/values-w820dp/dimens.xml b/QLogging/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..4b32dcf
--- /dev/null
+++ b/QLogging/res/values-w820dp/dimens.xml
@@ -0,0 +1,39 @@
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<resources>
+ <!-- Example customization of dimensions originally defined in res/values/dimens.xml
+ (such as screen margins) for screens with more than 820dp of available width. This
+ would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
+ <dimen name="activity_horizontal_margin">64dp</dimen>
+</resources>
diff --git a/QLogging/res/values/colors.xml b/QLogging/res/values/colors.xml
new file mode 100644
index 0000000..a9f6d97
--- /dev/null
+++ b/QLogging/res/values/colors.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<resources>
+ <color name="orange">#ff5500</color>
+ <color name="white">#ffffff</color>
+ <color name="transparent">#00000000</color>
+ <color name="date_color">#999999</color>
+ <color name="black">#000000</color>
+ <color name="gray">#999999</color>
+ <color name="blue">#0066cc</color>
+ <color name="gold">#e6b121</color>
+ <color name="blueback">#99FFFF</color>
+ <color name="articlecolor">#3399FF</color>
+ <color name="article_title">#3399FF</color>
+ <color name="background_main">#1c89d5</color>
+ <color name="cachecolor">#8ad0e8</color>
+</resources>
diff --git a/QLogging/res/values/dimens.xml b/QLogging/res/values/dimens.xml
new file mode 100644
index 0000000..102b27d
--- /dev/null
+++ b/QLogging/res/values/dimens.xml
@@ -0,0 +1,40 @@
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<resources>
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="ring_radius">60dp</dimen>
+ <dimen name="ring_thickness">1dp</dimen>
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+</resources>
diff --git a/QLogging/res/values/strings.xml b/QLogging/res/values/strings.xml
new file mode 100644
index 0000000..627b8fd
--- /dev/null
+++ b/QLogging/res/values/strings.xml
@@ -0,0 +1,197 @@
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<resources>
+
+ <string name="app_name">BTLogKit</string>
+ <string name="app_name_test">BTLogKit</string>
+
+ <string name="hello_world">Hello world!</string>
+ <string name="profile_text">Profiles</string>
+ <string name="stack_text">Stack</string>
+ <string name="soc_text">SOC</string>
+
+ <string name="D">D</string>
+ <string name="V">V</string>
+ <string name="off">Off</string>
+
+ <string name="log_save_start">Start Logging</string>
+ <string name="log_save_stop">Stop logging</string>
+ <string name="log_storage">Storage Location</string>
+ <string name="string_set_all">Set all to Verbose</string>
+ <string name="action_settings">Settings</string>
+
+ <string name="title_activity_get_secondory_options">Log Levels</string>
+
+ <string-array name="log_options_off">
+ <item>Off</item>
+ </string-array>
+
+ <string-array name="stack_log_options">
+ <item>Off</item>
+ <item>Error</item>
+ <item>Warning</item>
+ <item>API</item>
+ <item>Event</item>
+ <item>Debug</item>
+ <item>Verbose</item>
+ </string-array>
+
+ <string-array name="soc_log_options">
+ <item>Off</item>
+ <item>Error</item>
+ <item>High</item>
+ <item>Medium</item>
+ <item>Low</item>
+ </string-array>
+
+ <string-array name="profile_list_names">
+ <item>Profile 1</item>
+ <item>Profile 2</item>
+ <item>Profile 3</item>
+ <item>Profile 4</item>
+ <item>Profile 5</item>
+ <item>Profile 6</item>
+ </string-array>
+
+ <string-array name="profile_list_tags">
+ <item>profile_1</item>
+ <item>profile_2</item>
+ <item>profile_3</item>
+ <item>profile_4</item>
+ <item>profile_5</item>
+ <item>profile_6</item>
+ </string-array>
+
+ <string-array name="profile_defaults">
+ <item>1</item>
+ <item>1</item>
+ <item>1</item>
+ <item>1</item>
+ <item>1</item>
+ <item>1</item>
+ </string-array>
+
+ <string-array name="stack_list_names">
+ <item>BTM</item>
+ <item>HCI</item>
+ <item>L2CAP</item>
+ <item>OBEX</item>
+ <item>AVCT</item>
+ <item>AVDT</item>
+ <item>AVRC</item>
+ <item>AVDT_CCB</item>
+ <item>A2D</item>
+ <item>SDP</item>
+ <item>GATT</item>
+ <item>SMP</item>
+ <item>BTAPP</item>
+ <item>BTIF</item>
+ <item>HID_HOST</item>
+ <item>HID_DEV</item>
+ </string-array>
+
+ <!--<item>RFCOMM</item>-->
+ <!--<item>AVDT_SCB</item>-->
+ <!--<item>TRC_OBEX</item>-->
+ <!--<item>TRC_AVDT_SCB</item>-->
+
+ <string-array name="stack_list_tags">
+ <item>TRC_BTM</item>
+ <item>TRC_HCI</item>
+ <item>TRC_L2CAP</item>
+ <item>TRC_RFCOMM></item>
+ <item>TRC_AVCT</item>
+ <item>TRC_AVDT</item>
+ <item>TRC_AVRC</item>
+ <item>TRC_AVDT_CCB</item>
+ <item>TRC_A2D</item>
+ <item>TRC_SDP</item>
+ <item>TRC_GATT</item>
+ <item>TRC_SMP</item>
+ <item>TRC_BTAPP</item>
+ <item>TRC_BTIF</item>
+ <item>TRC_HID_HOST</item>
+ <item>TRC_HID_DEV</item>
+ </string-array>
+
+ <string-array name="stack_defaults">
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ </string-array>
+
+ <string-array name="soc_list_names">
+ <item>SLC</item>
+ <item>HIF</item>
+ <item>LLM</item>
+ <item>OTA</item>
+ <item>CxM</item>
+ <item>APP</item>
+ <item>STATS</item>
+ </string-array>
+
+ <string-array name="soc_list_tags">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+ </string-array>
+
+ <string-array name="soc_defaults">
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ <item>2</item>
+ </string-array>
+
+</resources>
diff --git a/QLogging/res/values/styles.xml b/QLogging/res/values/styles.xml
new file mode 100644
index 0000000..d003609
--- /dev/null
+++ b/QLogging/res/values/styles.xml
@@ -0,0 +1,37 @@
+<!--
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+-->
+
+<resources>
+ <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ </style>
+</resources>
diff --git a/QLogging/src/com/android/qlogging/BTStateReceiver.java b/QLogging/src/com/android/qlogging/BTStateReceiver.java
new file mode 100644
index 0000000..a5feeb2
--- /dev/null
+++ b/QLogging/src/com/android/qlogging/BTStateReceiver.java
@@ -0,0 +1,238 @@
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+
+package com.android.qlogging;
+
+import android.app.ActivityManager;
+import android.app.Activity;
+import android.bluetooth.BluetoothAdapter;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+import android.widget.CheckBox;
+import android.widget.Space;
+import android.widget.Spinner;
+import android.widget.Toast;
+import android.widget.ToggleButton;
+
+import java.util.List;
+import java.util.Map;
+
+import android.content.pm.PackageManager;
+
+public class BTStateReceiver extends BroadcastReceiver{
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ final String action = intent.getAction();
+ Toast toast;
+ if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+ final int btstate = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
+ switch (btstate) {
+ case BluetoothAdapter.STATE_OFF:
+ break;
+ case BluetoothAdapter.STATE_TURNING_OFF:
+ //Utils.saveCurrentState(context);
+ break;
+ case BluetoothAdapter.STATE_ON:
+ Map map;
+ int counter = 0;
+
+ 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);
+
+ switch (getSecondoryOptions.selected) {
+ case 0:
+ Log.d(Main.TAG,"In Main activity,and BT turned on");
+ /*map = Utils.getPreviousSettings(context, Main.PROFILE_MODULE_ID);
+ if (!map.isEmpty()) {
+ for (String profile : profile_tags) {
+ String state = map.get(profile).toString();
+ int presState = Character.getNumericValue(state.charAt(1));
+ sendIntent.transmitIntent(context, presState, profile, getSecondoryOptions.selected);
+ }
+ }*/ //TODO:send profiles states
+ map = Utils.getPreviousSettings(context, Main.STACK_MODULE_ID);
+ counter = 0;
+ 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++;
+ }
+ }
+ }
+ map = Utils.getPreviousSettings(context, Main.SOC_MODULE_ID);
+ counter = 0;
+ getSecondoryOptions.SOC_levels="";
+ 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);
+ }
+ }
+ sendIntent.transmitIntent(context, Main.SOC_ALL_MODULE_ID, getSecondoryOptions.SOC_levels, Main.SOC_ALL_MODULE_ID);
+ }else{
+ toast = Toast.makeText(context, "Map empty for SOC", Toast.LENGTH_SHORT);
+ toast.show();
+ }
+ break;
+ case Main.PROFILE_MODULE_ID:
+ /*Log.d(Main.TAG,"In Main activity,and BT turned on");
+ for (String profile : profile_tags) {
+ ProfileOptionsView profileOptionsView = (ProfileOptionsView) getSecondoryOptions.lv.findViewWithTag(profile);
+ int presState = profileOptionsView.state;
+ sendIntent.transmitIntent(context, presState, profile, getSecondoryOptions.selected);
+ }*///TODO:Sending Profiles state
+ map = Utils.getPreviousSettings(context, Main.STACK_MODULE_ID);
+ counter = 0;
+ 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++;
+ }
+ }
+ }
+ map = Utils.getPreviousSettings(context, Main.SOC_MODULE_ID);
+ counter = 0;
+ getSecondoryOptions.SOC_levels="";
+ 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);
+ }
+ }
+ sendIntent.transmitIntent(context, Main.SOC_ALL_MODULE_ID, getSecondoryOptions.SOC_levels, Main.SOC_ALL_MODULE_ID);
+ }
+ break;
+ case Main.STACK_MODULE_ID:
+ /*Log.d(Main.TAG,"In Main activity,and BT turned on");
+ map = Utils.getPreviousSettings(context, Main.PROFILE_MODULE_ID);
+ if (!map.isEmpty()) {
+ for (String profile : profile_tags) {
+ String state = map.get(profile).toString();
+ int presState = Character.getNumericValue(state.charAt(1));
+ sendIntent.transmitIntent(context, presState, profile, getSecondoryOptions.selected);
+ }
+ }*///TODO:Sending Profiles state
+ counter = 0;
+ for (String stack : stack_list_names) {
+ StackOptionsView stackOptionsView = (StackOptionsView) getSecondoryOptions.lv.findViewWithTag(stack_list_tags[counter]);
+ int presState = stackOptionsView.state;
+ sendIntent.transmitIntent(context, presState, stack_list_tags[counter], Main.STACK_MODULE_ID);
+ counter++;
+ }
+ map = Utils.getPreviousSettings(context, Main.SOC_MODULE_ID);
+ counter = 0;
+ getSecondoryOptions.SOC_levels="";
+ 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);
+ }
+ }
+ sendIntent.transmitIntent(context, Main.SOC_ALL_MODULE_ID, getSecondoryOptions.SOC_levels, Main.SOC_ALL_MODULE_ID);
+ }
+ break;
+ case Main.SOC_MODULE_ID:
+ /*Log.d(Main.TAG,"In Main activity,and BT turned on");
+ map = Utils.getPreviousSettings(context, Main.PROFILE_MODULE_ID);
+ if (!map.isEmpty()) {
+ for (String profile : profile_tags) {
+ if (map.get(profile)) {
+ String state = map.get(profile).toString();
+ int presState = Character.getNumericValue(state.charAt(1));
+ sendIntent.transmitIntent(context, presState, profile, getSecondoryOptions.selected);
+ }
+ }
+ }*///TODO:Sending Profile State
+ map = Utils.getPreviousSettings(context, Main.STACK_MODULE_ID);
+ counter = 0;
+ 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++;
+ }
+ }
+ }
+ counter = 0;
+ getSecondoryOptions.SOC_levels="";
+ for (String soc : soc_list_names) {
+ StackOptionsView stackOptionsView = (StackOptionsView) getSecondoryOptions.lv.findViewWithTag(soc_list_tags[counter]);
+ int presState = stackOptionsView.state;
+ getSecondoryOptions.SOC_levels=String.valueOf(presState);
+ counter++;
+ }
+ sendIntent.transmitIntent(context, Main.SOC_ALL_MODULE_ID, getSecondoryOptions.SOC_levels, Main.SOC_ALL_MODULE_ID);
+ break;
+ }
+ toast = Toast.makeText(context, "Present Log levels set", Toast.LENGTH_SHORT);
+ toast.show();
+ break;
+ case BluetoothAdapter.STATE_TURNING_ON:
+ break;
+ }
+ }
+ }
+}
diff --git a/QLogging/src/com/android/qlogging/Main.java b/QLogging/src/com/android/qlogging/Main.java
new file mode 100644
index 0000000..dab015a
--- /dev/null
+++ b/QLogging/src/com/android/qlogging/Main.java
@@ -0,0 +1,176 @@
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+
+package com.android.qlogging;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.content.IntentFilter;
+import android.content.SharedPreferences;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Toast;
+import android.widget.Switch;
+import android.widget.CompoundButton;
+
+public class Main extends Activity {
+/*
+Class to handle the Main activity
+*/
+ public final static String TAG = "QLoggingDebug";
+ public static boolean isLogging=false;
+ private Menu menu;
+ public static boolean stack_set_all=false;
+ public static boolean bt_log_filter=false;
+ public static boolean soc_log_enabled = true;
+ public final static int PROFILE_MODULE_ID=1;
+ public final static int STACK_MODULE_ID=2;
+ public final static int SOC_MODULE_ID=3;
+ public final static int SOC_ALL_MODULE_ID=4;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ //If the app isnt already installed, create the default settings files
+ //with the default log levels.
+ SharedPreferences ratePrefs = getSharedPreferences("First Update", 0);
+ if (!ratePrefs.getBoolean("FirstTime", false)) {
+ Utils.setDefaultLogLevels(this,PROFILE_MODULE_ID);
+ Utils.setDefaultLogLevels(this,STACK_MODULE_ID);
+ Utils.setDefaultLogLevels(this,SOC_MODULE_ID);
+ SharedPreferences.Editor edit = ratePrefs.edit();
+ edit.putBoolean("FirstTime", true);
+ edit.commit();
+ }
+ Utils.setGlobalSettings(this);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.menu_main, menu);
+
+ MenuItem menuItem_save_start = menu.findItem(R.id.action_save_log_btn_start);
+ MenuItem menuItem_save_stop = menu.findItem(R.id.action_save_log_btn_stop);
+ //MenuItem menuItem_btlog_filter= menu.findItem(R.id.action_btlog_filter);
+
+ menuItem_save_start.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
+ menuItem_save_stop.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
+ //menuItem_btlog_filter.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
+
+ if(isLogging){
+ menuItem_save_start.setVisible(false);
+ }else{
+ menuItem_save_stop.setVisible(false);
+ }
+
+ /*Switch log_filter_switch= (Switch) menuItem_btlog_filter.getActionView();
+ log_filter_switch.setTextOn("BT");
+ log_filter_switch.setTextOff("All");
+
+ log_filter_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if(isChecked){
+ bt_log_filter=true;
+ Utils.saveGlobalState(getApplicationContext());
+ Toast.makeText(getApplicationContext(), "BT Log filter ON", Toast.LENGTH_SHORT).show();
+ }else{
+ bt_log_filter=false;
+ Utils.saveGlobalState(getApplicationContext());
+ }
+ }
+ });
+ log_filter_switch.setChecked(bt_log_filter);*/
+
+ this.menu=menu;
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ int id = item.getItemId();
+
+ if (id == R.id.action_settings) {
+ return true;
+ }
+ else if (id == R.id.action_save_log_btn_stop) {
+ MenuItem newItem = menu.findItem(R.id.action_save_log_btn_start);
+ isLogging=false;
+ item.setVisible(false);
+ newItem.setVisible(true);
+ Utils.stopLogging(this);
+ Utils.saveGlobalState(getApplicationContext());
+ }
+ else if (id == R.id.action_save_log_btn_start) {
+ MenuItem newItem = menu.findItem(R.id.action_save_log_btn_stop);
+ isLogging=true;
+ item.setVisible(false);
+ newItem.setVisible(true);
+ Utils.startLogging(this);
+ Utils.saveGlobalState(getApplicationContext());
+ Toast toast = Toast.makeText(this,"Started logs", Toast.LENGTH_SHORT);
+ toast.show();
+ }
+
+ return super.onOptionsItemSelected(item);
+
+ }
+
+ public void getOptions(View view){
+ /*
+ Onclick handler for the buttons in the main page.
+ */
+ Intent intent = new Intent(this,getSecondoryOptions.class);
+ int selected = -1;
+ switch (view.getId()) {
+
+ case R.id.profile_button:
+ selected=PROFILE_MODULE_ID;
+ Log.v(TAG,"Profile button clicked");
+ break;
+ case R.id.stack_button:
+ selected=STACK_MODULE_ID;
+ Log.v(TAG,"Stack button clicked");
+ break;
+ case R.id.java_button:
+ selected=SOC_MODULE_ID;
+ Log.v(TAG,"SOC button clicked");
+ break;
+ }
+ intent.addFlags(selected);
+ startActivity(intent);
+ }
+}
diff --git a/QLogging/src/com/android/qlogging/ProfileOptionsView.java b/QLogging/src/com/android/qlogging/ProfileOptionsView.java
new file mode 100644
index 0000000..a6878fe
--- /dev/null
+++ b/QLogging/src/com/android/qlogging/ProfileOptionsView.java
@@ -0,0 +1,189 @@
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+
+package com.android.qlogging;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.Color;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.LinearLayout;
+import android.widget.Switch;
+import android.widget.ToggleButton;
+import android.widget.TextView;
+
+import android.util.Log;
+
+public class ProfileOptionsView extends LinearLayout {
+/*
+ Class to handle the profile View actions
+*/
+
+ private CheckBox checkBox;
+ private ToggleButton tButton;
+ public int state;
+ public int prevState;
+ private final int OFF=0;
+ private final int DEBUG=1;
+ private final int VERBOSE=2;
+ private int optionSelected= getSecondoryOptions.selected;
+
+ public ProfileOptionsView(Context context,AttributeSet attributeSet){
+ super(context, attributeSet);
+
+ setOrientation(LinearLayout.HORIZONTAL);
+ setGravity(Gravity.CENTER_VERTICAL);
+
+ Resources res = getResources();
+ int value = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, res.getDisplayMetrics());
+
+ setPadding(value, value, value, value);
+
+ LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ inflater.inflate(R.layout.profile_log_options, this,true);
+
+ checkBox = (CheckBox) getChildAt(0);
+ checkBox.setTextColor(Color.BLACK);
+ int id = Resources.getSystem().getIdentifier("btn_check_holo_light", "drawable", "android");
+ checkBox.setButtonDrawable(id);
+
+ tButton = (ToggleButton) getChildAt(2);
+
+ tButton.setTextOn("V");
+ tButton.setTextOff("D");
+
+ checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
+ if (!b) {
+ if(tButton.isChecked()){
+ prevState=VERBOSE;
+ }else{
+ prevState=DEBUG;
+ }
+ state = OFF;
+ setBackground(getResources().getDrawable(R.drawable.border_off));
+ tButton.setClickable(false);
+ tButton.setText("Off");
+ sendIntent.transmitIntent(getContext(), state, checkBox.getText().toString(), optionSelected);
+ } else {
+ tButton.setTextOn("V");
+ tButton.setTextOff("D");
+ if(prevState==VERBOSE) {
+ tButton.setChecked(true);
+ state = VERBOSE;
+ }else{
+ tButton.setChecked(false);
+ state = DEBUG;
+ }
+ sendIntent.transmitIntent(getContext(),state, checkBox.getText().toString(), optionSelected);
+ setBackground(getResources().getDrawable(R.drawable.border));
+ tButton.setClickable(true);
+ }
+ }
+ });
+
+ if(!checkBox.isChecked()){
+ state = OFF;
+ setBackground(getResources().getDrawable(R.drawable.border_off));
+ tButton.setClickable(false);
+ sendIntent.transmitIntent(getContext(), state, checkBox.getText().toString(), optionSelected);
+ } else {
+ setBackground(getResources().getDrawable(R.drawable.border));
+ tButton.setClickable(true);
+ tButton.setTextOn("V");
+ tButton.setTextOff("D");
+ if(tButton.isChecked()){
+ state = DEBUG;
+ }else{
+ state = VERBOSE;
+ }
+ sendIntent.transmitIntent(getContext(), state, checkBox.getText().toString(), optionSelected);
+ }
+
+ tButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView,
+ boolean isChecked) {
+ if (isChecked) {
+ state = VERBOSE;
+ prevState = VERBOSE;
+ sendIntent.transmitIntent(getContext(), state, checkBox.getText().toString(), optionSelected);
+ } else {
+ state = DEBUG;
+ prevState = DEBUG;
+ sendIntent.transmitIntent(getContext(), state, checkBox.getText().toString(),optionSelected);
+ }
+ }
+ });
+ }
+
+ public ProfileOptionsView(Context context){
+ this(context, null);
+ }
+
+ public void setState(String state){
+ CheckBox checkBox = (CheckBox) this.getChildAt(0);
+ ToggleButton toggleButton = (ToggleButton) this.getChildAt(2);
+ Log.d(Main.TAG, state);
+ int prevState = Character.getNumericValue(state.charAt(0));
+ int presState = Character.getNumericValue(state.charAt(2));
+ this.prevState=prevState;
+ this.state=presState;
+ Log.d(Main.TAG,"Profile presValue=" + String.valueOf(presState));
+ Log.d(Main.TAG,"Profile prevValue=" + String.valueOf(prevState));
+ if(presState==OFF){
+ checkBox.setChecked(false);
+ toggleButton.setText("Off");
+ }else if(presState==DEBUG){
+ toggleButton.setTextOff("D");
+ toggleButton.setTextOn("V");
+ checkBox.setChecked(true);
+ toggleButton.setChecked(false);
+ }else{
+ toggleButton.setTextOff("D");
+ toggleButton.setTextOn("V");
+ checkBox.setChecked(true);
+ toggleButton.setChecked(true);
+ }
+ }
+}
+
diff --git a/QLogging/src/com/android/qlogging/StackOptionsView.java b/QLogging/src/com/android/qlogging/StackOptionsView.java
new file mode 100644
index 0000000..4479272
--- /dev/null
+++ b/QLogging/src/com/android/qlogging/StackOptionsView.java
@@ -0,0 +1,180 @@
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+
+package com.android.qlogging;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Color;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.LinearLayout;
+import android.widget.Spinner;
+import android.util.Log;
+import android.os.Bundle;
+
+import java.lang.reflect.Array;
+
+public class StackOptionsView extends LinearLayout {
+/*
+ Class to handle the Stack and SOC related view actions.
+*/
+ private CheckBox checkBox;
+ public int prevState=0;
+ public int state=0;
+ public int prevState2=0;
+ private Spinner spinner;
+ private boolean justCreated=true;
+ private boolean justCreated1=true;
+ private ArrayAdapter<CharSequence> adapter;
+ private int optionSelected = getSecondoryOptions.selected;
+
+ public StackOptionsView(Context context,AttributeSet attributeSet) {
+ super(context, attributeSet);
+
+ setOrientation(LinearLayout.HORIZONTAL);
+ setGravity(Gravity.CENTER_VERTICAL);
+
+ Resources res = getResources();
+ int value = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, res.getDisplayMetrics());
+
+ setPadding(value, value, value, value);
+
+ LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ inflater.inflate(R.layout.stack_log_options, this, true);
+
+ checkBox = (CheckBox) getChildAt(0);
+ checkBox.setTextColor(Color.BLACK);
+
+ int id = Resources.getSystem().getIdentifier("btn_check_holo_light", "drawable", "android");
+ checkBox.setButtonDrawable(id);
+
+ spinner = (Spinner) getChildAt(2);
+
+ if (getSecondoryOptions.selected == Main.STACK_MODULE_ID) {
+ adapter = ArrayAdapter.createFromResource(getContext(), R.array.stack_log_options, R.layout.spinner_item);
+ } else if (getSecondoryOptions.selected == Main.SOC_MODULE_ID){
+ adapter = ArrayAdapter.createFromResource(getContext(), R.array.soc_log_options, R.layout.spinner_item);
+ }
+ if (adapter != null)
+ {
+ adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ spinner.setAdapter(adapter);
+ }
+
+ setBackground(getResources().getDrawable(R.drawable.border_off));
+ spinner.setEnabled(false);
+ spinner.setClickable(false);
+ spinner.setSelection(prevState);
+
+ checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if (!isChecked) {
+ setBackground(getResources().getDrawable(R.drawable.border_off));
+ spinner.setEnabled(false);
+ spinner.setClickable(false);
+ } else {
+ setBackground(getResources().getDrawable(R.drawable.border));
+ spinner.setEnabled(true);
+ spinner.setClickable(true);
+ }
+ }
+ });
+
+ checkBox.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (!checkBox.isChecked()) {
+ prevState = state;
+ state = 0;
+ spinner.setSelection(0);
+ sendIntent.transmitIntent(getContext(), state, getTag().toString(), optionSelected);
+ } else {
+ //state = spinner.getSelectedItemPosition() + 1;
+ state = prevState;
+ spinner.setSelection(state);
+ sendIntent.transmitIntent(getContext(), state, getTag().toString(), optionSelected);
+ }
+ }
+ });
+
+ spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+ if (checkBox.isChecked()) {
+ if(position == 0){
+ prevState=state;
+ checkBox.setChecked(false);
+ }
+ state = position;
+ sendIntent.transmitIntent(getContext(), state, getTag().toString(), optionSelected);
+ }
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> parent) {
+
+ }
+ });
+ }
+
+ public StackOptionsView(Context context){
+ this(context,null);
+ }
+
+ public void setState(String state){
+ //set the state of the view
+ //Input: String with format - ("%s%s%s",prevState,prevState2,state)
+ int prevState = Character.getNumericValue(state.charAt(0));
+ int prevState2 = Character.getNumericValue(state.charAt(1));
+ int presState = Character.getNumericValue(state.charAt(2));
+ this.state=presState;
+ this.prevState=prevState;
+ this.prevState2=prevState2;
+ if(presState==0){
+ checkBox.setChecked(false);
+ spinner.setSelection(0);
+ }else{
+ checkBox.setChecked(true);
+ spinner.setSelection(presState);
+ }
+ }
+}
diff --git a/QLogging/src/com/android/qlogging/Utils.java b/QLogging/src/com/android/qlogging/Utils.java
new file mode 100644
index 0000000..88b73f7
--- /dev/null
+++ b/QLogging/src/com/android/qlogging/Utils.java
@@ -0,0 +1,530 @@
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+
+package com.android.qlogging;
+
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.content.Context;
+import android.util.Log;
+import android.util.Xml;
+import android.widget.LinearLayout;
+import android.widget.Toast;
+import android.view.View;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+import org.xmlpull.v1.XmlSerializer;
+
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.lang.ProcessBuilder;
+import java.lang.Exception;
+import java.util.Scanner;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.lang.reflect.Field;
+
+public class Utils {
+ private static Process process,p;
+ private static String pid;
+ private static String timestamp;
+ private static String filesDir;
+
+ public static void startLogging(Context context){
+ //Called when the start logging button is clicked
+ try{
+ filesDir = context.getFilesDir().getAbsolutePath();
+ String cmd_clear[] = {"/system/bin/sh", "-c", "logcat -c"};
+ p = Runtime.getRuntime().exec(cmd_clear);
+ p.waitFor();
+ p.destroy();
+ if(Main.bt_log_filter){
+ int bt_id = android.os.Process.myPid();
+ //String cmd_start[] = {"/system/bin/sh", "-c", "logcat -v threadtime | grep "+String.valueOf(bt_id)+" | dd of="+filesDir+"/log.txt"};
+ //p = Runtime.getRuntime().exec(cmd_start);
+ //ProcessBuilder builder = new ProcessBuilder("/system/bin/sh", "-c", "logcat -v threadtime | grep "+String.valueOf(bt_id)+" | dd of="+filesDir+"/log.txt");
+ ProcessBuilder builder = new ProcessBuilder("/system/bin/sh", "-c", "logcat -v threadtime | grep "+String.valueOf(bt_id)+" > "+filesDir+"/log.txt");
+ p = builder.start();
+ Toast.makeText(context,String.valueOf(getPid(p)),Toast.LENGTH_LONG).show();
+ }else{
+ String cmd_start[] = {"/system/bin/sh", "-c", "logcat -v threadtime -f "+filesDir+"/log.txt"};
+ p = Runtime.getRuntime().exec(cmd_start);
+ }
+ }catch(IOException e){
+ Log.e(Main.TAG,e.toString());
+ }catch(InterruptedException e){
+ Log.e(Main.TAG,e.toString());
+ }
+ }
+
+ public static int getPid(Process process) {
+ try {
+ Class<?> ProcessImpl = process.getClass();
+ Field field = ProcessImpl.getDeclaredField("pid");
+ field.setAccessible(true);
+ return field.getInt(process);
+ } catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException e) {
+ return -1;
+ }
+ }
+
+ public static void stopLogging(Context context){
+ //Called when the stop logging button is clicked
+ try{
+ filesDir = context.getFilesDir().getAbsolutePath();
+ if(p!=null){
+ p.destroy();
+ Toast toast = Toast.makeText(context,"Log stored in "+filesDir,Toast.LENGTH_LONG);
+ toast.show();
+ }
+ Calendar cal = Calendar.getInstance();
+ DateFormat df = new SimpleDateFormat("MM-dd-HH-mm-ss-SSS");
+ cal.setTimeInMillis(System.currentTimeMillis());
+ timestamp = df.format(cal.getTime());
+ process = Runtime.getRuntime().exec("mv "+filesDir+"/log.txt "+filesDir+"/"+timestamp+"_log.txt");
+ process.waitFor();
+ process.destroy();
+ /*if(Main.bt_log_filter){
+ int bt_id = android.os.Process.myPid();
+ Toast toast = Toast.makeText(context,String.valueOf(bt_id),Toast.LENGTH_SHORT);
+ toast.show();
+ Scanner scanner = new Scanner(filesDir+"/"+timestamp+"_log.txt");
+ File filtered_file = new File(filesDir,timestamp+"_log_filtered.txt");
+ FileOutputStream f = new FileOutputStream(filtered_file);
+ PrintWriter pw = new PrintWriter(f);
+ while(scanner.hasNextLine()){
+ String newLine = scanner.nextLine();
+ Log.e(Main.TAG,newLine);
+ if(newLine.contains(String.valueOf(bt_id))){
+ pw.println(newLine);
+ }
+ }
+ pw.flush();
+ pw.close();
+ f.close();
+ }*/
+ }catch (FileNotFoundException e) {
+ Log.e(Main.TAG,e.toString());
+ }catch(IOException e){
+ Log.e(Main.TAG,e.toString());
+ }catch(InterruptedException e){
+ Log.e(Main.TAG,e.toString());
+ }
+ }
+
+ public static Map<String, String> parseXML(XmlPullParser parser) throws XmlPullParserException, IOException {
+ Map<String, String> map = new HashMap<String, String>();
+ int eventType = parser.getEventType();
+ String title = "nothingyet";
+ String presState = "0", prevState = "0", prevState2 = "0";
+ while (eventType != XmlPullParser.END_DOCUMENT) {
+ String name;
+
+ switch (eventType) {
+ case XmlPullParser.START_DOCUMENT:
+ Log.v(Main.TAG, "Start of the document");
+ break;
+ case XmlPullParser.START_TAG:
+ name = parser.getName();
+ if (!name.equalsIgnoreCase("Data")) {
+ if (name.equalsIgnoreCase("presentState")) {
+ presState = parser.nextText();
+ } else if (name.equalsIgnoreCase("prevState")) {
+ prevState = parser.nextText();
+ } else if (name.equalsIgnoreCase("prevState2")) {
+ prevState2 = parser.nextText();
+ Log.v(Main.TAG, title + presState + prevState);
+ map.put(title, prevState + prevState2 + presState);
+ } else {
+ title = name;
+ }
+ }
+ break;
+ case XmlPullParser.END_TAG:
+ name = parser.getName();
+ Log.d(Main.TAG, "Reading document over");
+ }
+ eventType = parser.next();
+ }
+ return map;
+ }
+
+ public static Map<String, String> getPreviousSettings(Context context, int option) {
+ Map<String, String> map = new HashMap<>();
+ String xmlFile = ".xml";
+ if (option == Main.PROFILE_MODULE_ID) {
+ xmlFile = "ProfileSettings.xml";
+ } else if (option == Main.STACK_MODULE_ID) {
+ xmlFile = "StackSettings.xml";
+ } else if (option == Main.SOC_MODULE_ID) {
+ xmlFile = "SocSettings.xml";
+ }
+ XmlPullParserFactory pullParserFactory;
+ try {
+ pullParserFactory = XmlPullParserFactory.newInstance();
+ XmlPullParser parser = pullParserFactory.newPullParser();
+
+ InputStream in_s = context.openFileInput(xmlFile);
+ parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
+ parser.setInput(in_s, null);
+
+ map = Utils.parseXML(parser);
+ in_s.close();
+ } catch (XmlPullParserException e) {
+
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return map;
+ }
+
+ public static void saveCurrentState(Context context) {
+ LinearLayout lv = getSecondoryOptions.lv;
+ String xmlFile = "nothing yet";
+ FileOutputStream fileos = null;
+ if (getSecondoryOptions.selected == Main.PROFILE_MODULE_ID) {
+ xmlFile = "ProfileSettings.xml";
+ } else if (getSecondoryOptions.selected == Main.STACK_MODULE_ID) {
+ xmlFile = "StackSettings.xml";
+ } else if (getSecondoryOptions.selected == Main.SOC_MODULE_ID) {
+ xmlFile = "SocSettings.xml";
+ }
+ try {
+ fileos = new FileOutputStream(new File(context.getFilesDir(), xmlFile));
+ XmlSerializer xmlSerializer = Xml.newSerializer();
+ StringWriter writer = new StringWriter();
+ xmlSerializer.setOutput(writer);
+ xmlSerializer.startDocument("UTF-8", true);
+
+ xmlSerializer.startTag(null, "Data");
+
+ StackOptionsView stackOptionsView;
+ ProfileOptionsView profileOptionsView;
+ String[] list_names = null, list_tags = null;
+ if (getSecondoryOptions.selected == Main.PROFILE_MODULE_ID) {
+ list_names = context.getResources().getStringArray(R.array.profile_list_names);
+ list_tags = context.getResources().getStringArray(R.array.profile_list_tags);
+ } else if (getSecondoryOptions.selected == Main.STACK_MODULE_ID) {
+ list_names = context.getResources().getStringArray(R.array.stack_list_names);
+ list_tags = context.getResources().getStringArray(R.array.stack_list_tags);
+ } else if (getSecondoryOptions.selected == Main.SOC_MODULE_ID) {
+ getSecondoryOptions.SOC_levels="";
+ list_names = context.getResources().getStringArray(R.array.soc_list_names);
+ list_tags = context.getResources().getStringArray(R.array.soc_list_tags);
+ }
+ if (list_names != null && list_tags != null) {
+ for (int counter = 0; counter < list_names.length; counter++) {
+ if (getSecondoryOptions.selected == Main.PROFILE_MODULE_ID) {
+ xmlSerializer.startTag(null, list_tags[counter]);
+ profileOptionsView = (ProfileOptionsView) lv.findViewWithTag(list_tags[counter]);
+ xmlSerializer.startTag(null, "presentState");
+ xmlSerializer.text(String.valueOf(profileOptionsView.state));
+ xmlSerializer.endTag(null, "presentState");
+ xmlSerializer.startTag(null, "prevState");
+ xmlSerializer.text(String.valueOf(profileOptionsView.prevState));
+ xmlSerializer.endTag(null, "prevState");
+ xmlSerializer.startTag(null, "prevState2");
+ xmlSerializer.text(String.valueOf(profileOptionsView.prevState));
+ xmlSerializer.endTag(null, "prevState2");
+ xmlSerializer.endTag(null, list_tags[counter]);
+ } else {
+ xmlSerializer.startTag(null, list_names[counter]);
+ stackOptionsView = (StackOptionsView) lv.findViewWithTag(list_tags[counter]);
+ Log.v(Main.TAG, "XML----" + list_names[counter] + String.valueOf(stackOptionsView.prevState) + String.valueOf(stackOptionsView.prevState2) + String.valueOf(stackOptionsView.state));
+ xmlSerializer.startTag(null, "presentState");
+ xmlSerializer.text(String.valueOf(stackOptionsView.state));
+ xmlSerializer.endTag(null, "presentState");
+ xmlSerializer.startTag(null, "prevState");
+ xmlSerializer.text(String.valueOf(stackOptionsView.prevState));
+ xmlSerializer.endTag(null, "prevState");
+ xmlSerializer.startTag(null, "prevState2");
+ xmlSerializer.text(String.valueOf(stackOptionsView.prevState2));
+ xmlSerializer.endTag(null, "prevState2");
+ xmlSerializer.endTag(null, list_names[counter]);
+ if(getSecondoryOptions.selected==Main.SOC_MODULE_ID){
+ getSecondoryOptions.SOC_levels+=String.valueOf(stackOptionsView.state);
+ }
+ }
+ }
+ }
+ xmlSerializer.endTag(null, "Data");
+ xmlSerializer.endDocument();
+ xmlSerializer.flush();
+ String dataWrite = writer.toString();
+ fileos.write(dataWrite.getBytes());
+ saveGlobalState(context);
+
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ Log.e(Main.TAG, e.toString());
+ } catch (IllegalArgumentException e) {
+ // TODO Auto-generated catch block
+ Log.e(Main.TAG, "Illegal argument");
+ } catch (IllegalStateException e) {
+ // TODO Auto-generated catch block
+ Log.e(Main.TAG, "Illegal state");
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ Log.e(Main.TAG, "IO Exception");
+ }
+ finally {
+ try {
+ if (fileos != null)
+ fileos.close();
+ } catch (IOException e) {
+ Log.e(Main.TAG, "IO Exception");
+ }
+ }
+ }
+
+ public static void saveGlobalState(Context context){
+ String xmlFile="GlobalSettings.xml";
+ FileOutputStream fileos = null;
+ try{
+ fileos = new FileOutputStream(new File(context.getFilesDir(), xmlFile));
+ XmlSerializer xmlSerializer = Xml.newSerializer();
+ StringWriter writer = new StringWriter();
+
+ xmlSerializer.setOutput(writer);
+ xmlSerializer.startDocument("UTF-8", true);
+ xmlSerializer.startTag(null, "Data");
+ xmlSerializer.startTag(null,"isLogging");
+ xmlSerializer.text(String.valueOf(Main.isLogging));
+ xmlSerializer.endTag(null,"isLogging");
+ xmlSerializer.startTag(null,"SOC_Enabled");
+ xmlSerializer.text(String.valueOf(Main.soc_log_enabled));
+ xmlSerializer.endTag(null,"SOC_Enabled");
+ xmlSerializer.startTag(null,"Stack_all");
+ xmlSerializer.text(String.valueOf(Main.stack_set_all));
+ xmlSerializer.endTag(null,"Stack_all");
+ xmlSerializer.startTag(null,"bt_log_filter");
+ xmlSerializer.text(String.valueOf(Main.bt_log_filter));
+ xmlSerializer.endTag(null,"bt_log_filter");
+ xmlSerializer.endTag(null, "Data");
+ xmlSerializer.endDocument();
+ xmlSerializer.flush();
+ String dataWrite = writer.toString();
+ fileos.write(dataWrite.getBytes());
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ Log.e(Main.TAG, e.toString());
+ } catch (IllegalArgumentException e) {
+ // TODO Auto-generated catch block
+ Log.e(Main.TAG, "Illegal argument");
+ } catch (IllegalStateException e) {
+ // TODO Auto-generated catch block
+ Log.e(Main.TAG, "Illegal state");
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ Log.e(Main.TAG, "IO Exception");
+ }
+ finally {
+ try {
+ if (fileos != null)
+ fileos.close();
+ } catch (IOException e) {
+ Log.e(Main.TAG, "IO Exception");
+ }
+ }
+ }
+
+ public static boolean isAppRunning(Context context) {
+ String activity = Main.class.getName();
+ ActivityManager activityManager = (ActivityManager) context.
+ getSystemService(Context.ACTIVITY_SERVICE);
+
+ List<ActivityManager.RunningTaskInfo> tasks = activityManager.
+ getRunningTasks(Integer.MAX_VALUE);
+
+ for (ActivityManager.RunningTaskInfo task : tasks) {
+ if (activity.equals(task.baseActivity.getClassName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static void setGlobalSettings(Context context){
+ String xmlFile = "GlobalSettings.xml";
+ XmlPullParserFactory pullParserFactory;
+ try {
+ pullParserFactory = XmlPullParserFactory.newInstance();
+ XmlPullParser parser = pullParserFactory.newPullParser();
+
+ InputStream in_s = context.openFileInput(xmlFile);
+ parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
+ parser.setInput(in_s, null);
+ int eventType = parser.getEventType();
+ while (eventType != XmlPullParser.END_DOCUMENT) {
+ String name;
+
+ switch (eventType) {
+ case XmlPullParser.START_DOCUMENT:
+ Log.v(Main.TAG, "Start of the document");
+ break;
+ case XmlPullParser.START_TAG:
+ name = parser.getName();
+ if (!name.equalsIgnoreCase("Data")) {
+ if (name.equalsIgnoreCase("isLogging")) {
+ Main.isLogging = Boolean.valueOf(parser.nextText());
+ } else if (name.equalsIgnoreCase("SOC_Enabled")) {
+ Main.soc_log_enabled = Boolean.valueOf(parser.nextText());
+ } else if (name.equalsIgnoreCase("bt_log_filter")) {
+ Main.bt_log_filter = Boolean.valueOf(parser.nextText());
+ } else if (name.equalsIgnoreCase("Stack_all")) {
+ Main.stack_set_all = Boolean.valueOf(parser.nextText());
+ }
+ }
+ break;
+ case XmlPullParser.END_TAG:
+ name = parser.getName();
+ Log.d(Main.TAG, "Reading document over");
+ }
+ eventType = parser.next();
+ }
+ in_s.close();
+ } catch (XmlPullParserException e) {
+
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void setDefaultLogLevels(Activity activity, int option) {
+ String xmlFile = "nothing yet";
+ FileOutputStream fileos = null;
+ if (option == Main.PROFILE_MODULE_ID) {
+ xmlFile = "ProfileSettings.xml";
+ } else if (option == Main.STACK_MODULE_ID) {
+ xmlFile = "StackSettings.xml";
+ } else if (option == Main.SOC_MODULE_ID) {
+ xmlFile = "SocSettings.xml";
+ }
+ try {
+ fileos = new FileOutputStream(new File(activity.getApplicationContext().getFilesDir(), xmlFile));
+ XmlSerializer xmlSerializer = Xml.newSerializer();
+ StringWriter writer = new StringWriter();
+ xmlSerializer.setOutput(writer);
+ xmlSerializer.startDocument("UTF-8", true);
+
+ xmlSerializer.startTag(null, "Data");
+
+ StackOptionsView stackOptionsView;
+ ProfileOptionsView profileOptionsView;
+
+ String[] list_names = null, list_tags = null,default_state=null;
+ if (option == Main.PROFILE_MODULE_ID) {
+ list_names = activity.getApplicationContext().getResources().getStringArray(R.array.profile_list_names);
+ list_tags = activity.getApplicationContext().getResources().getStringArray(R.array.profile_list_tags);
+ default_state = activity.getApplicationContext().getResources().getStringArray(R.array.profile_defaults);
+ } else if (option == Main.STACK_MODULE_ID) {
+ list_names = activity.getApplicationContext().getResources().getStringArray(R.array.stack_list_names);
+ list_tags = activity.getApplicationContext().getResources().getStringArray(R.array.stack_list_tags);
+ default_state = activity.getApplicationContext().getResources().getStringArray(R.array.stack_defaults);
+ } else if (option == Main.SOC_MODULE_ID) {
+ list_names = activity.getApplicationContext().getResources().getStringArray(R.array.soc_list_names);
+ list_tags = list_names;
+ default_state = activity.getApplicationContext().getResources().getStringArray(R.array.soc_defaults);
+ }
+ if (list_names != null && list_tags != null && default_state != null) {
+ for (int counter = 0; counter < list_names.length; counter++) {
+ LinearLayout lv = (LinearLayout) activity.findViewById(R.id.outer_box);
+ if (option == Main.PROFILE_MODULE_ID) {
+ xmlSerializer.startTag(null, list_tags[counter]);
+ xmlSerializer.startTag(null, "presentState");
+ xmlSerializer.text(default_state[counter]);
+ xmlSerializer.endTag(null, "presentState");
+ xmlSerializer.startTag(null, "prevState");
+ xmlSerializer.text(String.valueOf(0));
+ xmlSerializer.endTag(null, "prevState");
+ xmlSerializer.startTag(null, "prevState2");
+ xmlSerializer.text(String.valueOf(0));
+ xmlSerializer.endTag(null, "prevState2");
+ xmlSerializer.endTag(null, list_tags[counter]);
+ } else {
+ xmlSerializer.startTag(null, list_names[counter]);
+ xmlSerializer.startTag(null, "presentState");
+ xmlSerializer.text(default_state[counter]);
+ xmlSerializer.endTag(null, "presentState");
+ xmlSerializer.startTag(null, "prevState");
+ xmlSerializer.text(String.valueOf(0));
+ xmlSerializer.endTag(null, "prevState");
+ xmlSerializer.startTag(null, "prevState2");
+ xmlSerializer.text(String.valueOf(0));
+ xmlSerializer.endTag(null, "prevState2");
+ xmlSerializer.endTag(null, list_names[counter]);
+ }
+ }
+ }
+ xmlSerializer.endTag(null, "Data");
+ xmlSerializer.endDocument();
+ xmlSerializer.flush();
+ String dataWrite = writer.toString();
+ fileos.write(dataWrite.getBytes());
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ Log.e(Main.TAG, e.toString());
+ } catch (IllegalArgumentException e) {
+ // TODO Auto-generated catch block
+ Log.e(Main.TAG, "Illegal argument");
+ } catch (IllegalStateException e) {
+ // TODO Auto-generated catch block
+ Log.e(Main.TAG, "Illegal state");
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ Log.e(Main.TAG, "IO Exception");
+ }
+ finally {
+ try {
+ if (fileos != null)
+ fileos.close();
+ } catch (IOException e) {
+ Log.e(Main.TAG, "IO Exception");
+ }
+ }
+ }
+}
diff --git a/QLogging/src/com/android/qlogging/getSecondoryOptions.java b/QLogging/src/com/android/qlogging/getSecondoryOptions.java
new file mode 100644
index 0000000..9dead5b
--- /dev/null
+++ b/QLogging/src/com/android/qlogging/getSecondoryOptions.java
@@ -0,0 +1,327 @@
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+
+package com.android.qlogging;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.LinearLayout;
+import android.widget.Space;
+import android.widget.ScrollView;
+import android.widget.TextView;
+import android.widget.Switch;
+import android.widget.Spinner;
+import android.widget.Toast;
+import android.graphics.BitmapFactory;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.Shader;
+import java.util.Map;
+
+public class getSecondoryOptions extends Activity{
+/*
+ Class to handle the second activity
+*/
+ private Menu menu;
+ public static int selected=0;
+ public static LinearLayout lv;
+ public static String SOC_levels="";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Intent intent = getIntent();
+ String titlebarHeading = "Noting yet";
+ selected = intent.getFlags();
+
+ setContentView(R.layout.activity_get_secondory_options);
+
+ lv = (LinearLayout) findViewById(R.id.outer_box);
+ lv.setTag(selected);
+ lv.removeAllViews();
+
+ Map<String,String> map;
+
+ switch (selected) {
+ case -1:
+ Log.e(Main.TAG, "Option not received");
+ break;
+ case Main.PROFILE_MODULE_ID:
+ //Profiles case
+ Log.d(Main.TAG, "Profile button clicked");
+ map=Utils.getPreviousSettings(getApplicationContext(),1);
+ String[] profile_list = getResources().getStringArray(R.array.profile_list_names);
+ String[] profile_tags = getResources().getStringArray(R.array.profile_list_tags);
+ int counter=0;
+ for (String profile:profile_list) {
+ ProfileOptionsView profileOptionsView = new ProfileOptionsView(this);
+ profileOptionsView.setTag(profile_tags[counter]);
+ CheckBox checkBox = (CheckBox) profileOptionsView.getChildAt(0);
+ checkBox.setText(profile);
+ if(!map.isEmpty()) {
+ Object state_obj = map.get(profile_tags[counter]);
+ if (state_obj != null)
+ {
+ String state= state_obj.toString();
+ profileOptionsView.setState(state);
+ Log.d(Main.TAG,state);
+ int presState = Character.getNumericValue(state.charAt(2));
+ sendIntent.transmitIntent(this, presState,profile_tags[counter], selected);
+ }
+ }
+ lv.addView(profileOptionsView);
+ Space space = new Space(this);
+ space.setMinimumHeight(20);
+ lv.addView(space);
+ counter++;
+ }
+ titlebarHeading = "Profile log levels";
+ break;
+ case Main.STACK_MODULE_ID:
+ case Main.SOC_MODULE_ID:
+ //Stack and SOC case
+ Log.d(Main.TAG, "Stack button clicked");
+ String[] list_names=null,list_tags=null;
+ if(selected==Main.STACK_MODULE_ID){
+ list_names = getResources().getStringArray(R.array.stack_list_names);
+ list_tags = getResources().getStringArray(R.array.stack_list_tags);
+ }else if(selected==Main.SOC_MODULE_ID){
+ list_names = getResources().getStringArray(R.array.soc_list_names);
+ list_tags = getResources().getStringArray(R.array.soc_list_tags);
+ }
+ map = Utils.getPreviousSettings(getApplicationContext(),selected);
+ counter=0;
+ SOC_levels="";
+ for (String stack:list_names) {
+ StackOptionsView stackOptionsView = new StackOptionsView(this);
+ stackOptionsView.setTag(list_tags[counter]);
+ CheckBox checkBox = (CheckBox) stackOptionsView.getChildAt(0);
+ Spinner spinner = (Spinner) stackOptionsView.getChildAt(2);
+ checkBox.setText(stack);
+ if(!map.isEmpty()) {
+ Object state_obj = map.get(stack);
+ if (state_obj != null)
+ {
+ String state= state_obj.toString();
+ stackOptionsView.setState(state);
+ int presState = Character.getNumericValue(state.charAt(2));
+ Log.d(Main.TAG,"Sending present state in stack/SOC");
+ if(selected==Main.STACK_MODULE_ID){
+ sendIntent.transmitIntent(this, presState, list_tags[counter], selected);
+ }else{
+ SOC_levels+=String.valueOf(presState);
+ }
+ }
+ }
+ lv.addView(stackOptionsView);
+ Space space = new Space(this);
+ space.setMinimumHeight(15);
+ lv.addView(space);
+ counter++;
+ }
+ if(selected==Main.STACK_MODULE_ID){
+ titlebarHeading = "Stack log levels";
+ }else if(selected==Main.SOC_MODULE_ID){
+ if(Main.soc_log_enabled){
+ lv.setVisibility(View.VISIBLE);
+ sendIntent.transmitIntent(this, 0, SOC_levels, Main.SOC_ALL_MODULE_ID);
+ }else{
+ lv.setVisibility(View.GONE);
+ sendIntent.transmitIntent(this, 0, "F", Main.SOC_ALL_MODULE_ID);
+ }
+ titlebarHeading = "SOC log levels";
+ }
+ break;
+ }
+
+ try{
+ ActionBar actionBar = getActionBar();
+ actionBar.setTitle(titlebarHeading);
+ }
+ catch (NullPointerException e){
+ Log.e(Main.TAG,e.toString());
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.menu_get_secondory_options, menu);
+
+ MenuItem menuItem_save_start = menu.findItem(R.id.save_log_btn_start_2);
+ MenuItem menuItem_save_stop = menu.findItem(R.id.save_log_btn_stop_2);
+ MenuItem menuItem_set_all = menu.findItem(R.id.action_set_all);
+ MenuItem menuItem_soc_enable = menu.findItem(R.id.action_soc_enable);
+
+ menuItem_save_start.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
+ menuItem_save_stop.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
+
+ if(Main.isLogging){
+ menuItem_save_start.setVisible(false);
+ }else{
+ menuItem_save_stop.setVisible(false);
+ }
+
+ if(selected==Main.SOC_MODULE_ID){
+ menuItem_save_start.setVisible(false);
+ menuItem_save_stop.setVisible(false);
+ menuItem_soc_enable.setVisible(true);
+ Switch soc_switch = (Switch) menuItem_soc_enable.getActionView();
+ soc_switch.setTextOn("On");
+ soc_switch.setTextOff("Off");
+ soc_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ TextView textView;
+ if(isChecked){
+ lv.setVisibility(View.VISIBLE);
+ 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);
+ }else{
+ Utils.saveCurrentState(getApplicationContext());
+ textView = new TextView(getApplicationContext());
+ textView.setText("SOC Logging is disabled, enable to see the log options");
+ lv.setVisibility(View.GONE);
+ Main.soc_log_enabled=false;
+ Utils.saveGlobalState(getApplicationContext());
+ sendIntent.transmitIntent(getApplicationContext(), 0, "F", Main.SOC_ALL_MODULE_ID);
+ }
+ }
+ });
+ soc_switch.setChecked(Main.soc_log_enabled);
+ }else{
+ menuItem_soc_enable.setVisible(false);
+ }
+
+ if(selected!=Main.STACK_MODULE_ID){
+ menuItem_set_all.setVisible(false);
+ }else{
+ if(Main.stack_set_all){
+ menuItem_set_all.setTitle("Revert to previous state");
+ }else{
+ menuItem_set_all.setTitle("Set all to Verbose");
+ }
+ }
+
+ this.menu=menu;
+ return super.onCreateOptionsMenu(menu);
+ //return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ int id = item.getItemId();
+
+ if (id == R.id.action_settings_2) {
+ return true;
+ }else if (id==android.R.id.home) {
+ onBackPressed();
+ }else if (id == R.id.save_log_btn_stop_2) {
+ Log.d(Main.TAG,"Stop button clicked");
+ MenuItem newItem = menu.findItem(R.id.save_log_btn_start_2);
+ Main.isLogging=false;
+ item.setVisible(false);
+ newItem.setVisible(true);
+ Utils.stopLogging(this);
+ Utils.saveGlobalState(getApplicationContext());
+ }else if (id == R.id.save_log_btn_start_2) {
+ Log.d(Main.TAG,"Start button clicked");
+ MenuItem newItem = menu.findItem(R.id.save_log_btn_stop_2);
+ Main.isLogging=true;
+ item.setVisible(false);
+ newItem.setVisible(true);
+ Utils.startLogging(this);
+ Utils.saveGlobalState(getApplicationContext());
+ Toast toast = Toast.makeText(this,"Started logs", Toast.LENGTH_SHORT);
+ toast.show();
+ }else if (id==R.id.action_set_all){
+ if(!item.getTitle().equals("Set all to Verbose")){
+ String[] stack_list_tags = getResources().getStringArray(R.array.stack_list_tags);
+ for (String stack : stack_list_tags) {
+ StackOptionsView stackOptionsView = (StackOptionsView) findViewById(R.id.outer_box).findViewWithTag(stack);
+ CheckBox checkBox = (CheckBox) stackOptionsView.getChildAt(0);
+ Spinner spinner = (Spinner) stackOptionsView.getChildAt(2);
+ if(stackOptionsView.prevState2==0){
+ checkBox.setChecked(false);
+ stackOptionsView.state=0;
+ spinner.setSelection(stackOptionsView.state);
+ }else{
+ stackOptionsView.state=stackOptionsView.prevState2;
+ checkBox.setChecked(true);
+ spinner.setSelection(stackOptionsView.state);
+ }
+ sendIntent.transmitIntent(this, stackOptionsView.state, stack, selected);
+ Log.v(Main.TAG, "Revert----" + stack + String.valueOf(stackOptionsView.prevState) + String.valueOf(stackOptionsView.prevState2) + String.valueOf(stackOptionsView.state));
+ }
+ Main.stack_set_all=false;
+ Utils.saveGlobalState(getApplicationContext());
+ item.setTitle("Set all to Verbose");
+ }else {
+ String[] stack_list_tags = getResources().getStringArray(R.array.stack_list_tags);
+ for (String stack : stack_list_tags) {
+ StackOptionsView stackOptionsView = (StackOptionsView) findViewById(R.id.outer_box).findViewWithTag(stack);
+ stackOptionsView.prevState2 = stackOptionsView.state;
+ stackOptionsView.state=6;
+ CheckBox checkBox = (CheckBox) stackOptionsView.getChildAt(0);
+ Spinner spinner = (Spinner) stackOptionsView.getChildAt(2);
+ checkBox.setChecked(true);
+ spinner.setSelection(6);
+ sendIntent.transmitIntent(this, stackOptionsView.state, stack, selected);
+ Log.v(Main.TAG, "Verbose----" + stack + String.valueOf(stackOptionsView.prevState) + String.valueOf(stackOptionsView.prevState2) + String.valueOf(stackOptionsView.state));
+ }
+ Main.stack_set_all=true;
+ Utils.saveGlobalState(getApplicationContext());
+ item.setTitle("Revert to previous state");
+ }
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
+ public void onBackPressed() {
+ super.onBackPressed();
+ Utils.saveCurrentState(getApplicationContext());
+ selected=0;
+ }
+}
+
+
diff --git a/QLogging/src/com/android/qlogging/sendIntent.java b/QLogging/src/com/android/qlogging/sendIntent.java
new file mode 100644
index 0000000..d4aca1f
--- /dev/null
+++ b/QLogging/src/com/android/qlogging/sendIntent.java
@@ -0,0 +1,59 @@
+/*********************************************************************
+*
+* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+************************************************************************/
+
+package com.android.qlogging;
+
+import android.content.Context;
+import android.content.Intent;
+
+import android.util.Log;
+
+public class sendIntent {
+
+public static native void setLogging(String log_level, int log_type, int module);
+
+ static
+ {
+ try {
+ System.loadLibrary("qlogging_jni");
+ }
+ catch ( UnsatisfiedLinkError e )
+ {
+ Log.d(Main.TAG,"qlogging_jni ibrary failed to load.\n" + e ) ;
+ }
+ }
+
+ static void transmitIntent(Context context,int log_level,String log_layer,int module){
+ //Function to send commands to lower layers
+ setLogging(log_layer,log_level,module);
+
+ }
+}