diff options
| author | Blake Kragten <kragtenb@google.com> | 2019-09-06 11:03:30 -0700 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2019-09-06 11:03:30 -0700 |
| commit | da96cb408646fe3facd711bc7f9aff2fcd5363e5 (patch) | |
| tree | 683b6d60d4f0ef4da4b76118bc45df8d7a04eb87 /core/java | |
| parent | a5c53a01ae0aff071eefdc7cf980d48be289f527 (diff) | |
| parent | cf1268a5f54d7e77095913c1e9e79d792c55bd4d (diff) | |
Merge "Connection change and high tx power Q port Changed missed Q merge back in April" into qt-qpr1-dev
am: cf1268a5f5
Change-Id: I294286840c969fba42ff2814423ae4dbd81a8577
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/os/BatteryStats.java | 26 | ||||
| -rw-r--r-- | core/java/com/android/internal/app/IBatteryStats.aidl | 2 | ||||
| -rw-r--r-- | core/java/com/android/internal/os/BatteryStatsImpl.java | 32 |
3 files changed, 33 insertions, 27 deletions
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java index 00d522bae27f..ecd16dd1f612 100644 --- a/core/java/android/os/BatteryStats.java +++ b/core/java/android/os/BatteryStats.java @@ -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. @@ -2371,18 +2374,21 @@ 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 - public static final int NUM_DATA_CONNECTION_TYPES = DATA_CONNECTION_OTHER+1; + public static final int NUM_DATA_CONNECTION_TYPES = DATA_CONNECTION_OTHER + 1; /** * Returns the time in microseconds that the phone has been running with @@ -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(); @@ -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); diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl index d60d5438b3a7..15b1d75e88d0 100644 --- a/core/java/com/android/internal/app/IBatteryStats.aidl +++ b/core/java/com/android/internal/app/IBatteryStats.aidl @@ -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(); diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index 651991df2f90..e1a640eeaf5b 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -906,8 +906,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; @@ -5261,16 +5259,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 { - bin = DATA_CONNECTION_OTHER; + 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); @@ -11190,19 +11198,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; + mHistoryCur.states2 |= HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG; addHistoryRecordLocked(elapsedRealtime, uptime); - mIsCellularTxPowerHigh = false; } - return; } private final class BluetoothActivityInfoCache { @@ -13660,7 +13658,6 @@ public class BatteryStatsImpl extends BatteryStats { mCameraOnTimer.readSummaryFromParcelLocked(in); mBluetoothScanNesting = 0; mBluetoothScanTimer.readSummaryFromParcelLocked(in); - mIsCellularTxPowerHigh = false; int NRPMS = in.readInt(); if (NRPMS > 10000) { @@ -14644,7 +14641,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(); |
