Improve getModemActivityInfo API

Add optional fields to allow modem to report activity information
of different technologies

Bug: 202413770
Test: m android.hardware.radio.modem-update-api

Change-Id: I3bb76c030222868ce881487fb17692a476c5f846
This commit is contained in:
Gary Jian 2021-11-19 14:54:49 +08:00
parent 14604af9d1
commit 2ea9241a0e
6 changed files with 123 additions and 16 deletions

View file

@ -36,6 +36,5 @@ package android.hardware.radio.modem;
parcelable ActivityStatsInfo {
int sleepModeTimeMs;
int idleModeTimeMs;
int[] txmModetimeMs;
int rxModeTimeMs;
android.hardware.radio.modem.ActivityStatsTechSpecificInfo[] techSpecificInfo;
}

View file

@ -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;
}

View file

@ -16,6 +16,8 @@
package android.hardware.radio.modem;
import android.hardware.radio.modem.ActivityStatsTechSpecificInfo;
@VintfStability
parcelable ActivityStatsInfo {
/**
@ -28,17 +30,10 @@ parcelable ActivityStatsInfo {
*/
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;
}

View file

@ -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;
}

View file

@ -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::HardwareConfigSim toAidl(const V1_0::HardwareConfigSim& sim) {
}
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},
};
}

View file

@ -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>