add device type to clouglog ctx (#19890)

* add device type to clouglog ctx

* remove is_eon

* str
pull/19891/head
Adeeb Shihadeh 2021-01-22 20:02:48 -08:00 committed by GitHub
parent 6a1378b40a
commit c9679222ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 4 deletions

View File

@ -14,9 +14,9 @@ ATHENA_MGR_PID_PARAM = "AthenadPid"
def main():
params = Params()
dongle_id = params.get("DongleId").decode('utf-8')
cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, is_eon=True)
cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty)
crash.bind_user(id=dongle_id)
crash.bind_extra(version=version, dirty=dirty, is_eon=True)
crash.bind_extra(version=version, dirty=dirty)
crash.install()
try:

View File

@ -12,6 +12,7 @@
#include "json11.hpp"
#include "common/timing.h"
#include "common/util.h"
#include "common/version.h"
#include "swaglog.h"
@ -58,6 +59,15 @@ static void cloudlog_init() {
cloudlog_bind_locked("version", COMMA_VERSION);
s.ctx_j["dirty"] = !getenv("CLEAN");
// device type
if (util::file_exists("/EON")) {
cloudlog_bind_locked("device", "eon");
} else if (util::file_exists("/TICI")) {
cloudlog_bind_locked("device", "tici");
} else {
cloudlog_bind_locked("device", "pc");
}
s.inited = true;
}

View File

@ -28,6 +28,10 @@ class HardwareBase:
def get_os_version(self):
pass
@abstractmethod
def get_device_type(self):
pass
@abstractmethod
def get_sound_card_online(self):
pass

View File

@ -65,6 +65,9 @@ class Android(HardwareBase):
with open("/VERSION") as f:
return f.read().strip()
def get_device_type(self):
return "eon"
def get_sound_card_online(self):
return (os.path.isfile('/proc/asound/card0/state') and
open('/proc/asound/card0/state').read().strip() == 'ONLINE')

View File

@ -11,6 +11,9 @@ class Pc(HardwareBase):
def get_os_version(self):
return None
def get_device_type(self):
return "pc"
def get_sound_card_online(self):
return True

View File

@ -40,6 +40,9 @@ class Tici(HardwareBase):
with open("/VERSION") as f:
return f.read().strip()
def get_device_type(self):
return "tici"
def get_sound_card_online(self):
return os.system("pulseaudio --check") == 0

View File

@ -418,9 +418,10 @@ def manager_init():
if not dirty:
os.environ['CLEAN'] = '1'
cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, is_eon=True)
cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty,
device=HARDWARE.get_device_type())
crash.bind_user(id=dongle_id)
crash.bind_extra(version=version, dirty=dirty, is_eon=True)
crash.bind_extra(version=version, dirty=dirty, device=HARDWARE.get_device_type())
# ensure shared libraries are readable by apks
if EON: