Merge "Connection change and high tx power Q port Changed missed Q merge back in April" into qt-qpr1-dev

am: cf1268a5f5

Change-Id: I7459f4f175d6084c587a4291e377a3e1f9ef54d2
This commit is contained in:
Blake Kragten
2019-09-06 10:25:20 -07:00
committed by android-build-merger
5 changed files with 37 additions and 30 deletions

View File

@@ -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);

View File

@@ -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();

View File

@@ -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();

View File

@@ -722,10 +722,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);
}
}

View File

@@ -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);
}