Merge "Phone service state change atom." am: 419fc89b52
am: 16e3399902
Change-Id: Ifbff53d3b113c527975b5509289600f734dcca7b
This commit is contained in:
@@ -120,6 +120,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;
|
||||
|
||||
|
||||
@@ -1137,6 +1139,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:
|
||||
|
||||
@@ -5371,6 +5371,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5382,6 +5383,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -1684,8 +1685,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. */
|
||||
|
||||
@@ -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
|
||||
@@ -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)
|
||||
|
||||
@@ -2418,39 +2418,46 @@ public class TelephonyManager {
|
||||
*
|
||||
* These are the ordinal value of IccCardConstants.State.
|
||||
*/
|
||||
public static final int SIM_STATE_UNKNOWN = 0;
|
||||
|
||||
public static final int SIM_STATE_UNKNOWN = TelephonyProtoEnums.SIM_STATE_UNKNOWN; // 0
|
||||
/** SIM card state: no SIM card is available in the device */
|
||||
public static final int SIM_STATE_ABSENT = 1;
|
||||
public static final int SIM_STATE_ABSENT = TelephonyProtoEnums.SIM_STATE_ABSENT; // 1
|
||||
/** SIM card state: Locked: requires the user's SIM PIN to unlock */
|
||||
public static final int SIM_STATE_PIN_REQUIRED = 2;
|
||||
public static final int SIM_STATE_PIN_REQUIRED =
|
||||
TelephonyProtoEnums.SIM_STATE_PIN_REQUIRED; // 2
|
||||
/** SIM card state: Locked: requires the user's SIM PUK to unlock */
|
||||
public static final int SIM_STATE_PUK_REQUIRED = 3;
|
||||
public static final int SIM_STATE_PUK_REQUIRED =
|
||||
TelephonyProtoEnums.SIM_STATE_PUK_REQUIRED; // 3
|
||||
/** SIM card state: Locked: requires a network PIN to unlock */
|
||||
public static final int SIM_STATE_NETWORK_LOCKED = 4;
|
||||
public static final int SIM_STATE_NETWORK_LOCKED =
|
||||
TelephonyProtoEnums.SIM_STATE_NETWORK_LOCKED; // 4
|
||||
/** SIM card state: Ready */
|
||||
public static final int SIM_STATE_READY = 5;
|
||||
public static final int SIM_STATE_READY = TelephonyProtoEnums.SIM_STATE_READY; // 5
|
||||
/** SIM card state: SIM Card is NOT READY */
|
||||
public static final int SIM_STATE_NOT_READY = 6;
|
||||
public static final int SIM_STATE_NOT_READY = TelephonyProtoEnums.SIM_STATE_NOT_READY; // 6
|
||||
/** SIM card state: SIM Card Error, permanently disabled */
|
||||
public static final int SIM_STATE_PERM_DISABLED = 7;
|
||||
public static final int SIM_STATE_PERM_DISABLED =
|
||||
TelephonyProtoEnums.SIM_STATE_PERM_DISABLED; // 7
|
||||
/** SIM card state: SIM Card Error, present but faulty */
|
||||
public static final int SIM_STATE_CARD_IO_ERROR = 8;
|
||||
public static final int SIM_STATE_CARD_IO_ERROR =
|
||||
TelephonyProtoEnums.SIM_STATE_CARD_IO_ERROR; // 8
|
||||
/** SIM card state: SIM Card restricted, present but not usable due to
|
||||
* carrier restrictions.
|
||||
*/
|
||||
public static final int SIM_STATE_CARD_RESTRICTED = 9;
|
||||
public static final int SIM_STATE_CARD_RESTRICTED =
|
||||
TelephonyProtoEnums.SIM_STATE_CARD_RESTRICTED; // 9
|
||||
/**
|
||||
* SIM card state: Loaded: SIM card applications have been loaded
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public static final int SIM_STATE_LOADED = 10;
|
||||
public static final int SIM_STATE_LOADED = TelephonyProtoEnums.SIM_STATE_LOADED; // 10
|
||||
/**
|
||||
* SIM card state: SIM Card is present
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public static final int SIM_STATE_PRESENT = 11;
|
||||
public static final int SIM_STATE_PRESENT = TelephonyProtoEnums.SIM_STATE_PRESENT; // 11
|
||||
|
||||
/**
|
||||
* Extra included in {@link #ACTION_SIM_CARD_STATE_CHANGED} and
|
||||
|
||||
Reference in New Issue
Block a user