radio_utils.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_ANDROID_RADIO_UTILS_H_
  5. #define BASE_ANDROID_RADIO_UTILS_H_
  6. #include "base/android/jni_android.h"
  7. #include "third_party/abseil-cpp/absl/types/optional.h"
  8. namespace base {
  9. namespace android {
  10. // These values are persisted to logs. Entries should not be renumbered and
  11. // numeric values should never be reused. Keep in sync with RadioSignalLevel
  12. // in //tools/metrics/histograms/enums.xml.
  13. enum class RadioSignalLevel {
  14. kNoneOrUnknown = 0,
  15. kPoor = 1,
  16. kModerate = 2,
  17. kGood = 3,
  18. kGreat = 4,
  19. kMaxValue = kGreat,
  20. };
  21. enum class RadioDataActivity {
  22. kNone = 0,
  23. kIn = 1,
  24. kOut = 2,
  25. kInOut = 3,
  26. kDormant = 4,
  27. };
  28. enum class RadioConnectionType {
  29. kUnknown = 0,
  30. kWifi = 1,
  31. kCell = 2,
  32. };
  33. class BASE_EXPORT RadioUtils {
  34. public:
  35. static bool IsSupported();
  36. static RadioConnectionType GetConnectionType();
  37. static absl::optional<RadioSignalLevel> GetCellSignalLevel();
  38. static absl::optional<RadioDataActivity> GetCellDataActivity();
  39. };
  40. } // namespace android
  41. } // namespace base
  42. #endif // BASE_ANDROID_RADIO_UTILS_H_