Remove unnecessary DevicInfoImpl class.

PiperOrigin-RevId: 892102193
This commit is contained in:
Francis Tsui
2026-03-30 22:18:31 -07:00
committed by Copybara-Service
parent ac70b1f91f
commit f088ef3b74
29 changed files with 107 additions and 333 deletions
+2
View File
@@ -54,6 +54,7 @@ cc_library(
],
deps = [
"//internal/base:file_path",
"//internal/base:files",
"//internal/crypto_cros",
"//internal/platform:base",
"//internal/platform:mac_address",
@@ -151,6 +152,7 @@ cc_library(
"//location/nearby/analytics/cpp:__subpackages__",
"//location/nearby/apps/better_together/plugins/preferences_native:__subpackages__",
"//location/nearby/cpp/sharing:__subpackages__",
"//sharing/internal/impl/common:__subpackages__",
],
deps = [
":comm",
@@ -15,12 +15,14 @@
#ifndef PLATFORM_API_DEVICE_INFO_H_
#define PLATFORM_API_DEVICE_INFO_H_
#include <cstddef>
#include <functional>
#include <optional>
#include <string>
#include "absl/strings/string_view.h"
#include "internal/base/file_path.h"
#include "internal/base/files.h"
namespace nearby {
namespace api {
@@ -29,6 +31,23 @@ class DeviceInfo {
public:
enum class ScreenStatus { kUndetermined = 0, kLocked, kUnlocked };
enum class DeviceType { kUnknown = 0, kPhone, kTablet, kLaptop };
template <typename Sink>
void AbslStringify(Sink& sink, DeviceType device_type) {
switch (device_type) {
case DeviceType::kUnknown:
sink.Append("Unknown");
return;
case DeviceType::kPhone:
sink.Append("Phone");
return;
case DeviceType::kTablet:
sink.Append("Tablet");
return;
case DeviceType::kLaptop:
sink.Append("PC");
return;
}
}
enum class OsType {
kUnknown = 0,
kAndroid,
@@ -51,6 +70,11 @@ class DeviceInfo {
virtual FilePath GetTemporaryPath() const = 0;
virtual FilePath GetLogPath() const = 0;
virtual std::optional<size_t> GetAvailableDiskSpaceInBytes(
const FilePath& path) const {
return Files::GetAvailableDiskSpaceInBytes(path);
};
// Monitor screen status
virtual bool IsScreenLocked() const = 0;
virtual void RegisterScreenLockedListener(