Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -95,6 +95,7 @@ import com.android.internal.telephony.data.AccessNetworksManager.AccessNetworksM import com.android.internal.telephony.data.DataNetwork; import com.android.internal.telephony.data.DataNetwork; import com.android.internal.telephony.data.DataNetworkController.DataNetworkControllerCallback; import com.android.internal.telephony.data.DataNetworkController.DataNetworkControllerCallback; import com.android.internal.telephony.imsphone.ImsPhone; import com.android.internal.telephony.imsphone.ImsPhone; import com.android.internal.telephony.metrics.RadioPowerStateStats; import com.android.internal.telephony.metrics.ServiceStateStats; import com.android.internal.telephony.metrics.ServiceStateStats; import com.android.internal.telephony.metrics.TelephonyMetrics; import com.android.internal.telephony.metrics.TelephonyMetrics; import com.android.internal.telephony.subscription.SubscriptionInfoInternal; import com.android.internal.telephony.subscription.SubscriptionInfoInternal; Loading Loading @@ -1325,6 +1326,8 @@ public class ServiceStateTracker extends Handler { break; break; case EVENT_RADIO_STATE_CHANGED: case EVENT_RADIO_STATE_CHANGED: RadioPowerStateStats.onRadioStateChanged(mCi.getRadioState()); // fall through, the code above only logs metrics when radio state changes case EVENT_PHONE_TYPE_SWITCHED: case EVENT_PHONE_TYPE_SWITCHED: if(!mPhone.isPhoneTypeGsm() && if(!mPhone.isPhoneTypeGsm() && mCi.getRadioState() == TelephonyManager.RADIO_POWER_ON) { mCi.getRadioState() == TelephonyManager.RADIO_POWER_ON) { Loading src/java/com/android/internal/telephony/metrics/RadioPowerStateStats.java 0 → 100644 +52 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2023 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 com.android.internal.telephony.metrics; import static com.android.internal.telephony.TelephonyStatsLog.CELLULAR_RADIO_POWER_STATE_CHANGED; import static com.android.internal.telephony.TelephonyStatsLog.CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_OFF; import static com.android.internal.telephony.TelephonyStatsLog.CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_ON; import static com.android.internal.telephony.TelephonyStatsLog.CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_UNAVAILABLE; import static com.android.internal.telephony.TelephonyStatsLog.CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_UNKNOWN; import android.telephony.Annotation; import android.telephony.TelephonyManager; import com.android.internal.telephony.TelephonyStatsLog; /** Logs cellular radio power state changes to statsd */ public class RadioPowerStateStats { /** Logs cellular radio power state changes to statsd */ public static void onRadioStateChanged(@Annotation.RadioPowerState int state) { TelephonyStatsLog.write(CELLULAR_RADIO_POWER_STATE_CHANGED, radioPowerStateToProtoEnum(state)); } private static int radioPowerStateToProtoEnum(@Annotation.RadioPowerState int state) { switch (state) { case TelephonyManager.RADIO_POWER_OFF: return CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_OFF; case TelephonyManager.RADIO_POWER_ON: return CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_ON; case TelephonyManager.RADIO_POWER_UNAVAILABLE: return CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_UNAVAILABLE; default: return CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_UNKNOWN; } } } Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -95,6 +95,7 @@ import com.android.internal.telephony.data.AccessNetworksManager.AccessNetworksM import com.android.internal.telephony.data.DataNetwork; import com.android.internal.telephony.data.DataNetwork; import com.android.internal.telephony.data.DataNetworkController.DataNetworkControllerCallback; import com.android.internal.telephony.data.DataNetworkController.DataNetworkControllerCallback; import com.android.internal.telephony.imsphone.ImsPhone; import com.android.internal.telephony.imsphone.ImsPhone; import com.android.internal.telephony.metrics.RadioPowerStateStats; import com.android.internal.telephony.metrics.ServiceStateStats; import com.android.internal.telephony.metrics.ServiceStateStats; import com.android.internal.telephony.metrics.TelephonyMetrics; import com.android.internal.telephony.metrics.TelephonyMetrics; import com.android.internal.telephony.subscription.SubscriptionInfoInternal; import com.android.internal.telephony.subscription.SubscriptionInfoInternal; Loading Loading @@ -1325,6 +1326,8 @@ public class ServiceStateTracker extends Handler { break; break; case EVENT_RADIO_STATE_CHANGED: case EVENT_RADIO_STATE_CHANGED: RadioPowerStateStats.onRadioStateChanged(mCi.getRadioState()); // fall through, the code above only logs metrics when radio state changes case EVENT_PHONE_TYPE_SWITCHED: case EVENT_PHONE_TYPE_SWITCHED: if(!mPhone.isPhoneTypeGsm() && if(!mPhone.isPhoneTypeGsm() && mCi.getRadioState() == TelephonyManager.RADIO_POWER_ON) { mCi.getRadioState() == TelephonyManager.RADIO_POWER_ON) { Loading
src/java/com/android/internal/telephony/metrics/RadioPowerStateStats.java 0 → 100644 +52 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2023 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 com.android.internal.telephony.metrics; import static com.android.internal.telephony.TelephonyStatsLog.CELLULAR_RADIO_POWER_STATE_CHANGED; import static com.android.internal.telephony.TelephonyStatsLog.CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_OFF; import static com.android.internal.telephony.TelephonyStatsLog.CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_ON; import static com.android.internal.telephony.TelephonyStatsLog.CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_UNAVAILABLE; import static com.android.internal.telephony.TelephonyStatsLog.CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_UNKNOWN; import android.telephony.Annotation; import android.telephony.TelephonyManager; import com.android.internal.telephony.TelephonyStatsLog; /** Logs cellular radio power state changes to statsd */ public class RadioPowerStateStats { /** Logs cellular radio power state changes to statsd */ public static void onRadioStateChanged(@Annotation.RadioPowerState int state) { TelephonyStatsLog.write(CELLULAR_RADIO_POWER_STATE_CHANGED, radioPowerStateToProtoEnum(state)); } private static int radioPowerStateToProtoEnum(@Annotation.RadioPowerState int state) { switch (state) { case TelephonyManager.RADIO_POWER_OFF: return CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_OFF; case TelephonyManager.RADIO_POWER_ON: return CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_ON; case TelephonyManager.RADIO_POWER_UNAVAILABLE: return CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_UNAVAILABLE; default: return CELLULAR_RADIO_POWER_STATE_CHANGED__STATE__RADIO_POWER_STATE_UNKNOWN; } } }