Loading cmds/statsd/src/atoms.proto +29 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,8 @@ message Atom { AppCrashOccurred app_crash_occurred = 78; ANROccurred anr_occurred = 79; WTFOccurred wtf_occurred = 80; PhoneServiceStateChanged phone_service_state_changed = 94; PhoneStateChanged phone_state_changed = 95; LowMemReported low_mem_reported = 81; GenericAtom generic_atom = 82; KeyValuePairsAtom key_value_pairs_atom = 83; Loading Loading @@ -1406,6 +1408,33 @@ message PhoneSignalStrengthChanged { optional android.telephony.SignalStrengthEnum signal_strength = 1; } /** * Logs when the phone state, sim state or signal strength changes * * Logged from: * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java */ message PhoneServiceStateChanged { optional android.telephony.ServiceStateEnum state = 1; optional android.telephony.SimStateEnum sim_state = 2; optional android.telephony.SignalStrengthEnum signal_strength = 3; } /** * Logs when the phone becomes on or off. * * Logged from: * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java */ message PhoneStateChanged { enum State { OFF = 0; ON = 1; } optional State state = 1; } /** * Logs that a setting was updated. * Logged from: Loading core/java/com/android/internal/os/BatteryStatsImpl.java +2 −0 Original line number Diff line number Diff line Loading @@ -5330,6 +5330,7 @@ public class BatteryStatsImpl extends BatteryStats { if (DEBUG_HISTORY) Slog.v(TAG, "Phone started scanning to: " + Integer.toHexString(mHistoryCur.states)); mPhoneSignalScanningTimer.startRunningLocked(elapsedRealtime); StatsLog.write(StatsLog.PHONE_SERVICE_STATE_CHANGED, state, simState, strengthBin); } } Loading @@ -5341,6 +5342,7 @@ public class BatteryStatsImpl extends BatteryStats { + Integer.toHexString(mHistoryCur.states)); newHistory = true; mPhoneSignalScanningTimer.stopRunningLocked(elapsedRealtime); StatsLog.write(StatsLog.PHONE_SERVICE_STATE_CHANGED, state, simState, strengthBin); } } Loading core/proto/android/telephony/enums.proto +61 −0 Original line number Diff line number Diff line Loading @@ -61,3 +61,64 @@ enum SignalStrengthEnum { SIGNAL_STRENGTH_GOOD = 3; SIGNAL_STRENGTH_GREAT = 4; } enum ServiceStateEnum { /** * Normal operation condition, the phone is registered * with an operator either in home network or in roaming. */ SERVICE_STATE_IN_SERVICE = 0; /** * Phone is not registered with any operator, the phone * can be currently searching a new operator to register to, or not * searching to registration at all, or registration is denied, or radio * signal is not available. */ SERVICE_STATE_OUT_OF_SERVICE = 1; /** * The phone is registered and locked. Only emergency numbers are allowed. {@more} */ SERVICE_STATE_EMERGENCY_ONLY = 2; /** * Radio of telephony is explicitly powered off. */ SERVICE_STATE_POWER_OFF = 3; } enum SimStateEnum { SIM_STATE_UNKNOWN = 0; /** SIM card state: no SIM card is available in the device */ SIM_STATE_ABSENT = 1; /** SIM card state: Locked: requires the user's SIM PIN to unlock */ SIM_STATE_PIN_REQUIRED = 2; /** SIM card state: Locked: requires the user's SIM PUK to unlock */ SIM_STATE_PUK_REQUIRED = 3; /** SIM card state: Locked: requires a network PIN to unlock */ SIM_STATE_NETWORK_LOCKED = 4; /** SIM card state: Ready */ SIM_STATE_READY = 5; /** SIM card state: SIM Card is NOT READY */ SIM_STATE_NOT_READY = 6; /** SIM card state: SIM Card Error, permanently disabled */ SIM_STATE_PERM_DISABLED = 7; /** SIM card state: SIM Card Error, present but faulty */ SIM_STATE_CARD_IO_ERROR = 8; /** SIM card state: SIM Card restricted, present but not usable due to * carrier restrictions. */ SIM_STATE_CARD_RESTRICTED = 9; /** * SIM card state: Loaded: SIM card applications have been loaded * @hide */ SIM_STATE_LOADED = 10; /** * SIM card state: SIM Card is present * @hide */ SIM_STATE_PRESENT = 11; } services/core/java/com/android/server/TelephonyRegistry.java +5 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.telephony.VoLteServiceState; import android.util.LocalLog; import android.util.StatsLog; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.app.IBatteryStats; Loading Loading @@ -1719,8 +1720,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { try { if (state == TelephonyManager.CALL_STATE_IDLE) { mBatteryStats.notePhoneOff(); StatsLog.write(StatsLog.PHONE_STATE_CHANGED, StatsLog.PHONE_STATE_CHANGED__STATE__OFF); } else { mBatteryStats.notePhoneOn(); StatsLog.write(StatsLog.PHONE_STATE_CHANGED, StatsLog.PHONE_STATE_CHANGED__STATE__ON); } } catch (RemoteException e) { /* The remote entity disappeared, we can safely ignore the exception. */ Loading telephony/java/android/telephony/ServiceState.java +6 −4 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ public class ServiceState implements Parcelable { * Normal operation condition, the phone is registered * with an operator either in home network or in roaming. */ public static final int STATE_IN_SERVICE = 0; public static final int STATE_IN_SERVICE = TelephonyProtoEnums.SERVICE_STATE_IN_SERVICE; // 0 /** * Phone is not registered with any operator, the phone Loading @@ -65,17 +65,19 @@ public class ServiceState implements Parcelable { * searching to registration at all, or registration is denied, or radio * signal is not available. */ public static final int STATE_OUT_OF_SERVICE = 1; public static final int STATE_OUT_OF_SERVICE = TelephonyProtoEnums.SERVICE_STATE_OUT_OF_SERVICE; // 1 /** * The phone is registered and locked. Only emergency numbers are allowed. {@more} */ public static final int STATE_EMERGENCY_ONLY = 2; public static final int STATE_EMERGENCY_ONLY = TelephonyProtoEnums.SERVICE_STATE_EMERGENCY_ONLY; // 2 /** * Radio of telephony is explicitly powered off. */ public static final int STATE_POWER_OFF = 3; public static final int STATE_POWER_OFF = TelephonyProtoEnums.SERVICE_STATE_POWER_OFF; // 3 /** @hide */ @Retention(RetentionPolicy.SOURCE) Loading Loading
cmds/statsd/src/atoms.proto +29 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,8 @@ message Atom { AppCrashOccurred app_crash_occurred = 78; ANROccurred anr_occurred = 79; WTFOccurred wtf_occurred = 80; PhoneServiceStateChanged phone_service_state_changed = 94; PhoneStateChanged phone_state_changed = 95; LowMemReported low_mem_reported = 81; GenericAtom generic_atom = 82; KeyValuePairsAtom key_value_pairs_atom = 83; Loading Loading @@ -1406,6 +1408,33 @@ message PhoneSignalStrengthChanged { optional android.telephony.SignalStrengthEnum signal_strength = 1; } /** * Logs when the phone state, sim state or signal strength changes * * Logged from: * frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java */ message PhoneServiceStateChanged { optional android.telephony.ServiceStateEnum state = 1; optional android.telephony.SimStateEnum sim_state = 2; optional android.telephony.SignalStrengthEnum signal_strength = 3; } /** * Logs when the phone becomes on or off. * * Logged from: * frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java */ message PhoneStateChanged { enum State { OFF = 0; ON = 1; } optional State state = 1; } /** * Logs that a setting was updated. * Logged from: Loading
core/java/com/android/internal/os/BatteryStatsImpl.java +2 −0 Original line number Diff line number Diff line Loading @@ -5330,6 +5330,7 @@ public class BatteryStatsImpl extends BatteryStats { if (DEBUG_HISTORY) Slog.v(TAG, "Phone started scanning to: " + Integer.toHexString(mHistoryCur.states)); mPhoneSignalScanningTimer.startRunningLocked(elapsedRealtime); StatsLog.write(StatsLog.PHONE_SERVICE_STATE_CHANGED, state, simState, strengthBin); } } Loading @@ -5341,6 +5342,7 @@ public class BatteryStatsImpl extends BatteryStats { + Integer.toHexString(mHistoryCur.states)); newHistory = true; mPhoneSignalScanningTimer.stopRunningLocked(elapsedRealtime); StatsLog.write(StatsLog.PHONE_SERVICE_STATE_CHANGED, state, simState, strengthBin); } } Loading
core/proto/android/telephony/enums.proto +61 −0 Original line number Diff line number Diff line Loading @@ -61,3 +61,64 @@ enum SignalStrengthEnum { SIGNAL_STRENGTH_GOOD = 3; SIGNAL_STRENGTH_GREAT = 4; } enum ServiceStateEnum { /** * Normal operation condition, the phone is registered * with an operator either in home network or in roaming. */ SERVICE_STATE_IN_SERVICE = 0; /** * Phone is not registered with any operator, the phone * can be currently searching a new operator to register to, or not * searching to registration at all, or registration is denied, or radio * signal is not available. */ SERVICE_STATE_OUT_OF_SERVICE = 1; /** * The phone is registered and locked. Only emergency numbers are allowed. {@more} */ SERVICE_STATE_EMERGENCY_ONLY = 2; /** * Radio of telephony is explicitly powered off. */ SERVICE_STATE_POWER_OFF = 3; } enum SimStateEnum { SIM_STATE_UNKNOWN = 0; /** SIM card state: no SIM card is available in the device */ SIM_STATE_ABSENT = 1; /** SIM card state: Locked: requires the user's SIM PIN to unlock */ SIM_STATE_PIN_REQUIRED = 2; /** SIM card state: Locked: requires the user's SIM PUK to unlock */ SIM_STATE_PUK_REQUIRED = 3; /** SIM card state: Locked: requires a network PIN to unlock */ SIM_STATE_NETWORK_LOCKED = 4; /** SIM card state: Ready */ SIM_STATE_READY = 5; /** SIM card state: SIM Card is NOT READY */ SIM_STATE_NOT_READY = 6; /** SIM card state: SIM Card Error, permanently disabled */ SIM_STATE_PERM_DISABLED = 7; /** SIM card state: SIM Card Error, present but faulty */ SIM_STATE_CARD_IO_ERROR = 8; /** SIM card state: SIM Card restricted, present but not usable due to * carrier restrictions. */ SIM_STATE_CARD_RESTRICTED = 9; /** * SIM card state: Loaded: SIM card applications have been loaded * @hide */ SIM_STATE_LOADED = 10; /** * SIM card state: SIM Card is present * @hide */ SIM_STATE_PRESENT = 11; }
services/core/java/com/android/server/TelephonyRegistry.java +5 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.telephony.VoLteServiceState; import android.util.LocalLog; import android.util.StatsLog; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.app.IBatteryStats; Loading Loading @@ -1719,8 +1720,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { try { if (state == TelephonyManager.CALL_STATE_IDLE) { mBatteryStats.notePhoneOff(); StatsLog.write(StatsLog.PHONE_STATE_CHANGED, StatsLog.PHONE_STATE_CHANGED__STATE__OFF); } else { mBatteryStats.notePhoneOn(); StatsLog.write(StatsLog.PHONE_STATE_CHANGED, StatsLog.PHONE_STATE_CHANGED__STATE__ON); } } catch (RemoteException e) { /* The remote entity disappeared, we can safely ignore the exception. */ Loading
telephony/java/android/telephony/ServiceState.java +6 −4 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ public class ServiceState implements Parcelable { * Normal operation condition, the phone is registered * with an operator either in home network or in roaming. */ public static final int STATE_IN_SERVICE = 0; public static final int STATE_IN_SERVICE = TelephonyProtoEnums.SERVICE_STATE_IN_SERVICE; // 0 /** * Phone is not registered with any operator, the phone Loading @@ -65,17 +65,19 @@ public class ServiceState implements Parcelable { * searching to registration at all, or registration is denied, or radio * signal is not available. */ public static final int STATE_OUT_OF_SERVICE = 1; public static final int STATE_OUT_OF_SERVICE = TelephonyProtoEnums.SERVICE_STATE_OUT_OF_SERVICE; // 1 /** * The phone is registered and locked. Only emergency numbers are allowed. {@more} */ public static final int STATE_EMERGENCY_ONLY = 2; public static final int STATE_EMERGENCY_ONLY = TelephonyProtoEnums.SERVICE_STATE_EMERGENCY_ONLY; // 2 /** * Radio of telephony is explicitly powered off. */ public static final int STATE_POWER_OFF = 3; public static final int STATE_POWER_OFF = TelephonyProtoEnums.SERVICE_STATE_POWER_OFF; // 3 /** @hide */ @Retention(RetentionPolicy.SOURCE) Loading