use of android.telephony.TelephonyHistogram in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyMetrics method buildProto.
/**
* Build the telephony proto
*
* @return Telephony proto
*/
private synchronized TelephonyLog buildProto() {
TelephonyLog log = new TelephonyLog();
// Build telephony events
log.events = new TelephonyEvent[mTelephonyEvents.size()];
mTelephonyEvents.toArray(log.events);
log.eventsDropped = mTelephonyEventsDropped;
// Build call sessions
log.callSessions = new TelephonyCallSession[mCompletedCallSessions.size()];
mCompletedCallSessions.toArray(log.callSessions);
// Build SMS sessions
log.smsSessions = new SmsSession[mCompletedSmsSessions.size()];
mCompletedSmsSessions.toArray(log.smsSessions);
// Build histogram. Currently we only support RIL histograms.
List<TelephonyHistogram> rilHistograms = RIL.getTelephonyRILTimingHistograms();
log.histograms = new TelephonyProto.TelephonyHistogram[rilHistograms.size()];
for (int i = 0; i < rilHistograms.size(); i++) {
log.histograms[i] = new TelephonyProto.TelephonyHistogram();
TelephonyHistogram rilHistogram = rilHistograms.get(i);
TelephonyProto.TelephonyHistogram histogramProto = log.histograms[i];
histogramProto.category = rilHistogram.getCategory();
histogramProto.id = rilHistogram.getId();
histogramProto.minTimeMillis = rilHistogram.getMinTime();
histogramProto.maxTimeMillis = rilHistogram.getMaxTime();
histogramProto.avgTimeMillis = rilHistogram.getAverageTime();
histogramProto.count = rilHistogram.getSampleCount();
histogramProto.bucketCount = rilHistogram.getBucketCount();
histogramProto.bucketEndPoints = rilHistogram.getBucketEndPoints();
histogramProto.bucketCounters = rilHistogram.getBucketCounters();
}
// Build modem power metrics
BatteryStatsManager batteryStatsManager = mContext == null ? null : (BatteryStatsManager) mContext.getSystemService(Context.BATTERY_STATS_SERVICE);
log.modemPowerStats = new ModemPowerMetrics(batteryStatsManager).buildProto();
// Log the hardware revision
log.hardwareRevision = SystemProperties.get("ro.boot.revision", "");
// Log the starting system time
log.startTime = new TelephonyProto.Time();
log.startTime.systemTimestampMillis = mStartSystemTimeMs;
log.startTime.elapsedTimestampMillis = mStartElapsedTimeMs;
log.endTime = new TelephonyProto.Time();
log.endTime.systemTimestampMillis = System.currentTimeMillis();
log.endTime.elapsedTimestampMillis = SystemClock.elapsedRealtime();
// Log the last active subscription information.
int phoneCount = TelephonyManager.getDefault().getPhoneCount();
ActiveSubscriptionInfo[] activeSubscriptionInfo = new ActiveSubscriptionInfo[phoneCount];
for (int i = 0; i < mLastActiveSubscriptionInfos.size(); i++) {
int key = mLastActiveSubscriptionInfos.keyAt(i);
activeSubscriptionInfo[key] = mLastActiveSubscriptionInfos.get(key);
}
for (int i = 0; i < phoneCount; i++) {
if (activeSubscriptionInfo[i] == null) {
activeSubscriptionInfo[i] = makeInvalidSubscriptionInfo(i);
}
}
log.lastActiveSubscriptionInfo = activeSubscriptionInfo;
return log;
}
use of android.telephony.TelephonyHistogram in project android_frameworks_opt_telephony by LineageOS.
the class RIL method getTelephonyRILTimingHistograms.
public static List<TelephonyHistogram> getTelephonyRILTimingHistograms() {
List<TelephonyHistogram> list;
synchronized (mRilTimeHistograms) {
list = new ArrayList<>(mRilTimeHistograms.size());
for (int i = 0; i < mRilTimeHistograms.size(); i++) {
TelephonyHistogram entry = new TelephonyHistogram(mRilTimeHistograms.valueAt(i));
list.add(entry);
}
}
return list;
}
Aggregations