Loading core/java/android/os/BatteryStats.java +18 −8 Original line number Diff line number Diff line Loading @@ -266,8 +266,11 @@ public abstract class BatteryStats implements Parcelable { * - Fixed bug in min learned capacity updating process. * New in version 34: * - Deprecated STATS_SINCE_UNPLUGGED and STATS_CURRENT. * New in version 35: * - Fixed bug that was not reporting high cellular tx power correctly * - Added out of service and emergency service modes to data connection types */ static final int CHECKIN_VERSION = 34; static final int CHECKIN_VERSION = 35; /** * Old version, we hit 9 and ran out of room, need to remove. Loading Loading @@ -2371,14 +2374,17 @@ public abstract class BatteryStats implements Parcelable { */ public abstract int getMobileRadioActiveUnknownCount(int which); public static final int DATA_CONNECTION_NONE = 0; public static final int DATA_CONNECTION_OTHER = TelephonyManager.MAX_NETWORK_TYPE + 1; public static final int DATA_CONNECTION_OUT_OF_SERVICE = 0; public static final int DATA_CONNECTION_EMERGENCY_SERVICE = TelephonyManager.MAX_NETWORK_TYPE + 1; public static final int DATA_CONNECTION_OTHER = DATA_CONNECTION_EMERGENCY_SERVICE + 1; static final String[] DATA_CONNECTION_NAMES = { "none", "gprs", "edge", "umts", "cdma", "evdo_0", "evdo_A", "oos", "gprs", "edge", "umts", "cdma", "evdo_0", "evdo_A", "1xrtt", "hsdpa", "hsupa", "hspa", "iden", "evdo_b", "lte", "ehrpd", "hspap", "gsm", "td_scdma", "iwlan", "lte_ca", "nr", "other" "emngcy", "other" }; @UnsupportedAppUsage Loading Loading @@ -6564,6 +6570,10 @@ public abstract class BatteryStats implements Parcelable { } oldState = rec.states; oldState2 = rec.states2; // Clear High Tx Power Flag for volta positioning if ((rec.states2 & HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG) != 0) { rec.states2 &= ~HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG; } } return item.toString(); Loading Loading @@ -7865,9 +7875,9 @@ public abstract class BatteryStats implements Parcelable { // Phone data connection (DATA_CONNECTION_TIME_DATA and DATA_CONNECTION_COUNT_DATA) for (int i = 0; i < NUM_DATA_CONNECTION_TYPES; ++i) { // Map OTHER to TelephonyManager.NETWORK_TYPE_UNKNOWN and mark NONE as a boolean. boolean isNone = (i == DATA_CONNECTION_NONE); boolean isNone = (i == DATA_CONNECTION_OUT_OF_SERVICE); int telephonyNetworkType = i; if (i == DATA_CONNECTION_OTHER) { if (i == DATA_CONNECTION_OTHER || i == DATA_CONNECTION_EMERGENCY_SERVICE) { telephonyNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; } final long pdcToken = proto.start(SystemProto.DATA_CONNECTION); Loading core/java/com/android/internal/app/IBatteryStats.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ interface IBatteryStats { void notePhoneOn(); void notePhoneOff(); void notePhoneSignalStrength(in SignalStrength signalStrength); void notePhoneDataConnectionState(int dataType, boolean hasData); void notePhoneDataConnectionState(int dataType, boolean hasData, int serviceType); void notePhoneState(int phoneState); void noteWifiOn(); void noteWifiOff(); Loading core/java/com/android/internal/os/BatteryStatsImpl.java +14 −18 Original line number Diff line number Diff line Loading @@ -907,8 +907,6 @@ public class BatteryStatsImpl extends BatteryStats { @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) protected StopwatchTimer mBluetoothScanTimer; boolean mIsCellularTxPowerHigh = false; int mMobileRadioPowerState = DataConnectionRealTimeInfo.DC_POWER_STATE_LOW; long mMobileRadioActiveStartTime; StopwatchTimer mMobileRadioActiveTimer; Loading Loading @@ -5275,16 +5273,26 @@ public class BatteryStatsImpl extends BatteryStats { } @UnsupportedAppUsage public void notePhoneDataConnectionStateLocked(int dataType, boolean hasData) { public void notePhoneDataConnectionStateLocked(int dataType, boolean hasData, int serviceType) { // BatteryStats uses 0 to represent no network type. // Telephony does not have a concept of no network type, and uses 0 to represent unknown. // Unknown is included in DATA_CONNECTION_OTHER. int bin = DATA_CONNECTION_NONE; int bin = DATA_CONNECTION_OUT_OF_SERVICE; if (hasData) { if (dataType > 0 && dataType <= TelephonyManager.MAX_NETWORK_TYPE) { bin = dataType; } else { switch (serviceType) { case ServiceState.STATE_OUT_OF_SERVICE: bin = DATA_CONNECTION_OUT_OF_SERVICE; break; case ServiceState.STATE_EMERGENCY_ONLY: bin = DATA_CONNECTION_EMERGENCY_SERVICE; break; default: bin = DATA_CONNECTION_OTHER; break; } } } if (DEBUG) Log.i(TAG, "Phone Data Connection -> " + dataType + " = " + hasData); Loading Loading @@ -11198,19 +11206,9 @@ public class BatteryStatsImpl extends BatteryStats { } } if (levelMaxTimeSpent == ModemActivityInfo.TX_POWER_LEVELS - 1) { if (!mIsCellularTxPowerHigh) { mHistoryCur.states2 |= HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG; addHistoryRecordLocked(elapsedRealtime, uptime); mIsCellularTxPowerHigh = true; } return; } if (mIsCellularTxPowerHigh) { mHistoryCur.states2 &= ~HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG; addHistoryRecordLocked(elapsedRealtime, uptime); mIsCellularTxPowerHigh = false; } return; } private final class BluetoothActivityInfoCache { Loading Loading @@ -13670,7 +13668,6 @@ public class BatteryStatsImpl extends BatteryStats { mCameraOnTimer.readSummaryFromParcelLocked(in); mBluetoothScanNesting = 0; mBluetoothScanTimer.readSummaryFromParcelLocked(in); mIsCellularTxPowerHigh = false; int NRPMS = in.readInt(); if (NRPMS > 10000) { Loading Loading @@ -14654,7 +14651,6 @@ public class BatteryStatsImpl extends BatteryStats { mCameraOnTimer = new StopwatchTimer(mClocks, null, -13, null, mOnBatteryTimeBase, in); mBluetoothScanNesting = 0; mBluetoothScanTimer = new StopwatchTimer(mClocks, null, -14, null, mOnBatteryTimeBase, in); mIsCellularTxPowerHigh = false; mDischargeUnplugLevel = in.readInt(); mDischargePlugLevel = in.readInt(); mDischargeCurrentLevel = in.readInt(); services/core/java/com/android/server/am/BatteryStatsService.java +2 −2 Original line number Diff line number Diff line Loading @@ -720,10 +720,10 @@ public final class BatteryStatsService extends IBatteryStats.Stub } } public void notePhoneDataConnectionState(int dataType, boolean hasData) { public void notePhoneDataConnectionState(int dataType, boolean hasData, int serviceType) { enforceCallingPermission(); synchronized (mStats) { mStats.notePhoneDataConnectionStateLocked(dataType, hasData); mStats.notePhoneDataConnectionStateLocked(dataType, hasData, serviceType); } } Loading services/core/java/com/android/server/connectivity/DataConnectionStats.java +2 −1 Original line number Diff line number Diff line Loading @@ -91,7 +91,8 @@ public class DataConnectionStats extends BroadcastReceiver { if (DEBUG) Log.d(TAG, String.format("Noting data connection for network type %s: %svisible", networkType, visible ? "" : "not ")); try { mBatteryStats.notePhoneDataConnectionState(networkType, visible); mBatteryStats.notePhoneDataConnectionState(networkType, visible, mServiceState.getState()); } catch (RemoteException e) { Log.w(TAG, "Error noting data connection state", e); } Loading Loading
core/java/android/os/BatteryStats.java +18 −8 Original line number Diff line number Diff line Loading @@ -266,8 +266,11 @@ public abstract class BatteryStats implements Parcelable { * - Fixed bug in min learned capacity updating process. * New in version 34: * - Deprecated STATS_SINCE_UNPLUGGED and STATS_CURRENT. * New in version 35: * - Fixed bug that was not reporting high cellular tx power correctly * - Added out of service and emergency service modes to data connection types */ static final int CHECKIN_VERSION = 34; static final int CHECKIN_VERSION = 35; /** * Old version, we hit 9 and ran out of room, need to remove. Loading Loading @@ -2371,14 +2374,17 @@ public abstract class BatteryStats implements Parcelable { */ public abstract int getMobileRadioActiveUnknownCount(int which); public static final int DATA_CONNECTION_NONE = 0; public static final int DATA_CONNECTION_OTHER = TelephonyManager.MAX_NETWORK_TYPE + 1; public static final int DATA_CONNECTION_OUT_OF_SERVICE = 0; public static final int DATA_CONNECTION_EMERGENCY_SERVICE = TelephonyManager.MAX_NETWORK_TYPE + 1; public static final int DATA_CONNECTION_OTHER = DATA_CONNECTION_EMERGENCY_SERVICE + 1; static final String[] DATA_CONNECTION_NAMES = { "none", "gprs", "edge", "umts", "cdma", "evdo_0", "evdo_A", "oos", "gprs", "edge", "umts", "cdma", "evdo_0", "evdo_A", "1xrtt", "hsdpa", "hsupa", "hspa", "iden", "evdo_b", "lte", "ehrpd", "hspap", "gsm", "td_scdma", "iwlan", "lte_ca", "nr", "other" "emngcy", "other" }; @UnsupportedAppUsage Loading Loading @@ -6564,6 +6570,10 @@ public abstract class BatteryStats implements Parcelable { } oldState = rec.states; oldState2 = rec.states2; // Clear High Tx Power Flag for volta positioning if ((rec.states2 & HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG) != 0) { rec.states2 &= ~HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG; } } return item.toString(); Loading Loading @@ -7865,9 +7875,9 @@ public abstract class BatteryStats implements Parcelable { // Phone data connection (DATA_CONNECTION_TIME_DATA and DATA_CONNECTION_COUNT_DATA) for (int i = 0; i < NUM_DATA_CONNECTION_TYPES; ++i) { // Map OTHER to TelephonyManager.NETWORK_TYPE_UNKNOWN and mark NONE as a boolean. boolean isNone = (i == DATA_CONNECTION_NONE); boolean isNone = (i == DATA_CONNECTION_OUT_OF_SERVICE); int telephonyNetworkType = i; if (i == DATA_CONNECTION_OTHER) { if (i == DATA_CONNECTION_OTHER || i == DATA_CONNECTION_EMERGENCY_SERVICE) { telephonyNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; } final long pdcToken = proto.start(SystemProto.DATA_CONNECTION); Loading
core/java/com/android/internal/app/IBatteryStats.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ interface IBatteryStats { void notePhoneOn(); void notePhoneOff(); void notePhoneSignalStrength(in SignalStrength signalStrength); void notePhoneDataConnectionState(int dataType, boolean hasData); void notePhoneDataConnectionState(int dataType, boolean hasData, int serviceType); void notePhoneState(int phoneState); void noteWifiOn(); void noteWifiOff(); Loading
core/java/com/android/internal/os/BatteryStatsImpl.java +14 −18 Original line number Diff line number Diff line Loading @@ -907,8 +907,6 @@ public class BatteryStatsImpl extends BatteryStats { @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) protected StopwatchTimer mBluetoothScanTimer; boolean mIsCellularTxPowerHigh = false; int mMobileRadioPowerState = DataConnectionRealTimeInfo.DC_POWER_STATE_LOW; long mMobileRadioActiveStartTime; StopwatchTimer mMobileRadioActiveTimer; Loading Loading @@ -5275,16 +5273,26 @@ public class BatteryStatsImpl extends BatteryStats { } @UnsupportedAppUsage public void notePhoneDataConnectionStateLocked(int dataType, boolean hasData) { public void notePhoneDataConnectionStateLocked(int dataType, boolean hasData, int serviceType) { // BatteryStats uses 0 to represent no network type. // Telephony does not have a concept of no network type, and uses 0 to represent unknown. // Unknown is included in DATA_CONNECTION_OTHER. int bin = DATA_CONNECTION_NONE; int bin = DATA_CONNECTION_OUT_OF_SERVICE; if (hasData) { if (dataType > 0 && dataType <= TelephonyManager.MAX_NETWORK_TYPE) { bin = dataType; } else { switch (serviceType) { case ServiceState.STATE_OUT_OF_SERVICE: bin = DATA_CONNECTION_OUT_OF_SERVICE; break; case ServiceState.STATE_EMERGENCY_ONLY: bin = DATA_CONNECTION_EMERGENCY_SERVICE; break; default: bin = DATA_CONNECTION_OTHER; break; } } } if (DEBUG) Log.i(TAG, "Phone Data Connection -> " + dataType + " = " + hasData); Loading Loading @@ -11198,19 +11206,9 @@ public class BatteryStatsImpl extends BatteryStats { } } if (levelMaxTimeSpent == ModemActivityInfo.TX_POWER_LEVELS - 1) { if (!mIsCellularTxPowerHigh) { mHistoryCur.states2 |= HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG; addHistoryRecordLocked(elapsedRealtime, uptime); mIsCellularTxPowerHigh = true; } return; } if (mIsCellularTxPowerHigh) { mHistoryCur.states2 &= ~HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG; addHistoryRecordLocked(elapsedRealtime, uptime); mIsCellularTxPowerHigh = false; } return; } private final class BluetoothActivityInfoCache { Loading Loading @@ -13670,7 +13668,6 @@ public class BatteryStatsImpl extends BatteryStats { mCameraOnTimer.readSummaryFromParcelLocked(in); mBluetoothScanNesting = 0; mBluetoothScanTimer.readSummaryFromParcelLocked(in); mIsCellularTxPowerHigh = false; int NRPMS = in.readInt(); if (NRPMS > 10000) { Loading Loading @@ -14654,7 +14651,6 @@ public class BatteryStatsImpl extends BatteryStats { mCameraOnTimer = new StopwatchTimer(mClocks, null, -13, null, mOnBatteryTimeBase, in); mBluetoothScanNesting = 0; mBluetoothScanTimer = new StopwatchTimer(mClocks, null, -14, null, mOnBatteryTimeBase, in); mIsCellularTxPowerHigh = false; mDischargeUnplugLevel = in.readInt(); mDischargePlugLevel = in.readInt(); mDischargeCurrentLevel = in.readInt();
services/core/java/com/android/server/am/BatteryStatsService.java +2 −2 Original line number Diff line number Diff line Loading @@ -720,10 +720,10 @@ public final class BatteryStatsService extends IBatteryStats.Stub } } public void notePhoneDataConnectionState(int dataType, boolean hasData) { public void notePhoneDataConnectionState(int dataType, boolean hasData, int serviceType) { enforceCallingPermission(); synchronized (mStats) { mStats.notePhoneDataConnectionStateLocked(dataType, hasData); mStats.notePhoneDataConnectionStateLocked(dataType, hasData, serviceType); } } Loading
services/core/java/com/android/server/connectivity/DataConnectionStats.java +2 −1 Original line number Diff line number Diff line Loading @@ -91,7 +91,8 @@ public class DataConnectionStats extends BroadcastReceiver { if (DEBUG) Log.d(TAG, String.format("Noting data connection for network type %s: %svisible", networkType, visible ? "" : "not ")); try { mBatteryStats.notePhoneDataConnectionState(networkType, visible); mBatteryStats.notePhoneDataConnectionState(networkType, visible, mServiceState.getState()); } catch (RemoteException e) { Log.w(TAG, "Error noting data connection state", e); } Loading