OSDN Git Service

HardwareCollector: send sensors info marshmallow-x86 android-x86-6.0-r1 android-x86-6.0-r2 android-x86-6.0-r3
authorChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 15 Aug 2016 05:13:43 +0000 (13:13 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 15 Aug 2016 05:13:43 +0000 (13:13 +0800)
Send the sensors hal name if it's not the default kbd.

HardwareCollector/src/org/android_x86/hardwarecollector/HardwareCollectorService.java

index e9fab5e..b607907 100644 (file)
@@ -55,6 +55,7 @@ public class HardwareCollectorService extends IntentService {
     private static final String GA_ACTION_HAS_BATTERY = "has_battery";
     private static final String GA_ACTION_HAS_WIFI = "has_wifi";
     private static final String GA_ACTION_HAS_ETHERNET = "has_ethernet";
+    private static final String GA_ACTION_HAS_SENSORS = "has_sensors";
     private static final String GA_LABEL_HAS_BATTERY = "battery";
     private static final String GA_LABEL_NO_BATTERY = "no_battery";
 
@@ -95,6 +96,7 @@ public class HardwareCollectorService extends IntentService {
         collectTouchScreenInfo();
         collectBatteryInfo();
         collectNetworkInfo();
+        collectSensorsInfo();
     }
 
     private void collectOpenGLInfo() {
@@ -189,6 +191,13 @@ public class HardwareCollectorService extends IntentService {
         }
     }
 
+    private void collectSensorsInfo() {
+        String sensors = SystemProperties.get("ro.hardware.sensors", "");
+        if (!sensors.isEmpty() && !"kbd".equals(sensors)) {
+            checkAndSend(GA_ACTION_HAS_SENSORS, sensors);
+        }
+    }
+
     private void getLastInfo() {
         try {
             if (mInfoFile.exists()) {