Merge "Improve getModemActivityInfo API" am: aa8c59bea2 am: b60680edf3 am: 0331c954fc
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1895248
Change-Id: If0ac3d85f7de6619267eaad5237b0d4582e50e77
diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsInfo.aidl
index 2da0167..93940fd 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsInfo.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsInfo.aidl
@@ -36,6 +36,5 @@
parcelable ActivityStatsInfo {
int sleepModeTimeMs;
int idleModeTimeMs;
- int[] txmModetimeMs;
- int rxModeTimeMs;
+ android.hardware.radio.modem.ActivityStatsTechSpecificInfo[] techSpecificInfo;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl
new file mode 100644
index 0000000..798ec36
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.modem;
+@VintfStability
+parcelable ActivityStatsTechSpecificInfo {
+ android.hardware.radio.AccessNetwork rat;
+ int frequencyRange;
+ int[] txmModetimeMs;
+ int rxModeTimeMs;
+ const int FREQUENCY_RANGE_UNKNOWN = 0;
+ const int FREQUENCY_RANGE_LOW = 1;
+ const int FREQUENCY_RANGE_MID = 2;
+ const int FREQUENCY_RANGE_HIGH = 3;
+ const int FREQUENCY_RANGE_MMWAVE = 4;
+}
diff --git a/radio/aidl/android/hardware/radio/modem/ActivityStatsInfo.aidl b/radio/aidl/android/hardware/radio/modem/ActivityStatsInfo.aidl
index 764a86d..d0aa695 100644
--- a/radio/aidl/android/hardware/radio/modem/ActivityStatsInfo.aidl
+++ b/radio/aidl/android/hardware/radio/modem/ActivityStatsInfo.aidl
@@ -16,6 +16,8 @@
package android.hardware.radio.modem;
+import android.hardware.radio.modem.ActivityStatsTechSpecificInfo;
+
@VintfStability
parcelable ActivityStatsInfo {
/**
@@ -28,17 +30,10 @@
*/
int idleModeTimeMs;
/**
- * Each index represent total time (in ms) during which the transmitter is active/awake for a
- * particular power range as shown below.
- * index 0 = tx_power < 0dBm
- * index 1 = 0dBm < tx_power < 5dBm
- * index 2 = 5dBm < tx_power < 15dBm
- * index 3 = 15dBm < tx_power < 20dBm
- * index 4 = tx_power > 20dBm
+ * Technology specific activity stats info.
+ * List of the activity stats for each RATs (2G, 3G, 4G and 5G) and frequency ranges (HIGH for
+ * sub6 and MMWAVE) in case of 5G. In case implementation doesn't have RAT specific activity
+ * stats then send only one activity stats info with RAT unknown.
*/
- int[] txmModetimeMs;
- /**
- * Total time (in ms) for which receiver is active/awake and the transmitter is inactive
- */
- int rxModeTimeMs;
+ ActivityStatsTechSpecificInfo[] techSpecificInfo;
}
diff --git a/radio/aidl/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl b/radio/aidl/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl
new file mode 100644
index 0000000..fb14223
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.modem;
+
+import android.hardware.radio.AccessNetwork;
+
+@VintfStability
+parcelable ActivityStatsTechSpecificInfo {
+ /** Indicates the frequency range is unknown. */
+ const int FREQUENCY_RANGE_UNKNOWN = 0;
+ /** Indicates the frequency range is below 1GHz. */
+ const int FREQUENCY_RANGE_LOW = 1;
+ /** Indicates the frequency range is between 1GHz and 3GHz. */
+ const int FREQUENCY_RANGE_MID = 2;
+ /** Indicates the frequency range is between 3GHz and 6GHz. */
+ const int FREQUENCY_RANGE_HIGH = 3;
+ /** Indicates the frequency range is above 6GHz (millimeter wave frequency). */
+ const int FREQUENCY_RANGE_MMWAVE = 4;
+ /**
+ * Radio access technology. Set UNKNOWN if the Activity statistics
+ * is RAT independent.
+ */
+ AccessNetwork rat;
+ /**
+ * Frequency range. Values are FREQUENCY_RANGE_
+ * Set FREQUENCY_RANGE_UNKNOWN if the Activity statistics when frequency range
+ * is not applicable.
+ */
+ int frequencyRange;
+ /**
+ * Each index represent total time (in ms) during which the transmitter is active/awake for a
+ * particular power range as shown below.
+ * index 0 = tx_power <= 0dBm
+ * index 1 = 0dBm < tx_power <= 5dBm
+ * index 2 = 5dBm < tx_power <= 15dBm
+ * index 3 = 15dBm < tx_power <= 20dBm
+ * index 4 = tx_power > 20dBm
+ */
+ int[] txmModetimeMs;
+ /**
+ * Total time (in ms) for which receiver is active/awake and the transmitter is inactive
+ */
+ int rxModeTimeMs;
+}
diff --git a/radio/aidl/compat/libradiocompat/modem/structs.cpp b/radio/aidl/compat/libradiocompat/modem/structs.cpp
index c1cd64c..53d5753 100644
--- a/radio/aidl/compat/libradiocompat/modem/structs.cpp
+++ b/radio/aidl/compat/libradiocompat/modem/structs.cpp
@@ -24,6 +24,7 @@
namespace android::hardware::radio::compat {
+using ::aidl::android::hardware::radio::AccessNetwork;
using ::aidl::android::hardware::radio::RadioAccessFamily;
using ::aidl::android::hardware::radio::RadioTechnology;
namespace aidl = ::aidl::android::hardware::radio::modem;
@@ -82,11 +83,18 @@
}
aidl::ActivityStatsInfo toAidl(const V1_0::ActivityStatsInfo& info) {
+ const aidl::ActivityStatsTechSpecificInfo techSpecificInfo = {
+ .rat = AccessNetwork(AccessNetwork::UNKNOWN),
+ .frequencyRange = static_cast<int32_t>(
+ aidl::ActivityStatsTechSpecificInfo::FREQUENCY_RANGE_UNKNOWN),
+ .txmModetimeMs = toAidl(info.txmModetimeMs),
+ .rxModeTimeMs = static_cast<int32_t>(info.rxModeTimeMs),
+ };
+
return {
.sleepModeTimeMs = static_cast<int32_t>(info.sleepModeTimeMs),
.idleModeTimeMs = static_cast<int32_t>(info.idleModeTimeMs),
- .txmModetimeMs = toAidl(info.txmModetimeMs),
- .rxModeTimeMs = static_cast<int32_t>(info.rxModeTimeMs),
+ .techSpecificInfo = {techSpecificInfo},
};
}
diff --git a/radio/aidl/compat/libradiocompat/modem/structs.h b/radio/aidl/compat/libradiocompat/modem/structs.h
index 3ac1edb..af714c7 100644
--- a/radio/aidl/compat/libradiocompat/modem/structs.h
+++ b/radio/aidl/compat/libradiocompat/modem/structs.h
@@ -16,6 +16,7 @@
#pragma once
#include <aidl/android/hardware/radio/modem/ActivityStatsInfo.h>
+#include <aidl/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.h>
#include <aidl/android/hardware/radio/modem/HardwareConfig.h>
#include <aidl/android/hardware/radio/modem/HardwareConfigModem.h>
#include <aidl/android/hardware/radio/modem/HardwareConfigSim.h>