Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

packages-services-Analytics: Commit

packages/services/Analytics


Commit MetaInfo

Révision3c0203012fe95cc3907ad73f1b290213113bd5c8 (tree)
l'heure2016-08-11 01:50:31
AuteurChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Message de Log

HardwareCollector: send wifi and ethernet info

Send the wifi and ethernet module names to GA if
the interfaces are found.

Change Summary

Modification

--- a/HardwareCollector/src/org/android_x86/hardwarecollector/HardwareCollectorService.java
+++ b/HardwareCollector/src/org/android_x86/hardwarecollector/HardwareCollectorService.java
@@ -26,6 +26,8 @@ import android.graphics.SurfaceTexture;
2626 import android.hardware.input.InputManager;
2727 import android.opengl.EGL14;
2828 import android.opengl.GLES20;
29+import android.os.SystemProperties;
30+import android.system.Os;
2931 import android.util.Log;
3032 import android.view.InputDevice;
3133
@@ -51,12 +53,15 @@ public class HardwareCollectorService extends IntentService {
5153 private static final String GA_ACTION_CPU_MODEL = "cpu_model";
5254 private static final String GA_ACTION_TOUCH_SCREEN_NAME = "touch_screen_name";
5355 private static final String GA_ACTION_HAS_BATTERY = "has_battery";
56+ private static final String GA_ACTION_HAS_WIFI = "has_wifi";
57+ private static final String GA_ACTION_HAS_ETHERNET = "has_ethernet";
5458 private static final String GA_LABEL_HAS_BATTERY = "battery";
5559 private static final String GA_LABEL_NO_BATTERY = "no_battery";
5660
5761 private static final String LAST_INFO_FILE_NAME = "lastInfo.json";
5862 private static final String CPU_INFO_FILE = "/proc/cpuinfo";
5963 private static final String CPU_INFO_MODEL_NAME_PRE = "model name\t: ";
64+ private static final String ETHERNET_SYS_FILE = "/sys/class/net/eth0/device/driver/module";
6065 private static final int TOUCHSCREEN_SOURCE_BIT = 4098;
6166
6267 private Context mContext;
@@ -89,6 +94,7 @@ public class HardwareCollectorService extends IntentService {
8994 collectCPUInfo();
9095 collectTouchScreenInfo();
9196 collectBatteryInfo();
97+ collectNetworkInfo();
9298 }
9399
94100 private void collectOpenGLInfo() {
@@ -169,6 +175,20 @@ public class HardwareCollectorService extends IntentService {
169175 customEvent.sendWithSampling();
170176 }
171177
178+ private void collectNetworkInfo() {
179+ String wlan = SystemProperties.get("wlan.modname", "");
180+ if (!wlan.isEmpty()) {
181+ checkAndSend(GA_ACTION_HAS_WIFI, wlan);
182+ }
183+
184+ try {
185+ File mod = new File(Os.readlink(ETHERNET_SYS_FILE));
186+ checkAndSend(GA_ACTION_HAS_ETHERNET, mod.getName());
187+ } catch (Exception e) {
188+ Log.d(TAG, "eth0 not found", e);
189+ }
190+ }
191+
172192 private void getLastInfo() {
173193 try {
174194 if (mInfoFile.exists()) {
Afficher sur ancien navigateur de dépôt.