Files
fastfetch/src/detection/host/host_android.c
T

38 lines
1.5 KiB
C
Raw Normal View History

2022-09-04 12:43:30 +02:00
#include "host.h"
2022-09-04 13:33:18 +02:00
#include "common/settings.h"
2022-09-04 12:43:30 +02:00
#include <ctype.h>
2023-06-12 22:53:12 +08:00
const char* ffDetectHost(FFHostResult* host)
2022-09-04 12:43:30 +02:00
{
2023-07-27 19:23:27 +08:00
// http://newandroidbook.com/ddb/
2022-09-04 12:43:30 +02:00
ffSettingsGetAndroidProperty("ro.product.device", &host->productFamily);
2023-07-27 19:23:27 +08:00
ffSettingsGetAndroidProperty("ro.product.marketname", &host->productName)
|| ffSettingsGetAndroidProperty("ro.vendor.product.display", &host->productName)
|| ffSettingsGetAndroidProperty("ro.config.devicename", &host->productName)
|| ffSettingsGetAndroidProperty("ro.config.marketing_name", &host->productName)
|| ffSettingsGetAndroidProperty("ro.product.vendor.model", &host->productName)
|| ffSettingsGetAndroidProperty("ro.product.oppo_model", &host->productName)
|| ffSettingsGetAndroidProperty("ro.oppo.market.name", &host->productName)
|| ffSettingsGetAndroidProperty("ro.product.brand", &host->productName);
if (ffSettingsGetAndroidProperty("ro.product.model", &host->productVersion))
2023-06-12 22:53:12 +08:00
{
2023-07-27 19:23:27 +08:00
if (ffStrbufStartsWithIgnCase(&host->productVersion, &host->productName))
{
ffStrbufSubstrAfter(&host->productVersion, host->productName.length);
ffStrbufTrimLeft(&host->productVersion, ' ');
}
2022-09-04 12:43:30 +02:00
}
ffSettingsGetAndroidProperty("ro.product.manufacturer", &host->sysVendor);
2023-07-27 19:23:27 +08:00
if(host->sysVendor.length && !ffStrbufStartsWithIgnCase(&host->productName, &host->sysVendor))
{
ffStrbufPrependS(&host->productName, " ");
ffStrbufPrepend(&host->productName, &host->sysVendor);
}
2023-06-12 22:53:12 +08:00
return NULL;
2022-09-04 12:43:30 +02:00
}