Search in sources :

Example 6 with TelephonyHistogram

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;
}
Also used : TelephonyLog(com.android.internal.telephony.nano.TelephonyProto.TelephonyLog) TelephonyHistogram(android.telephony.TelephonyHistogram) ActiveSubscriptionInfo(com.android.internal.telephony.nano.TelephonyProto.ActiveSubscriptionInfo) TelephonyProto(com.android.internal.telephony.nano.TelephonyProto) BatteryStatsManager(android.os.BatteryStatsManager)

Example 7 with TelephonyHistogram

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;
}
Also used : TelephonyHistogram(android.telephony.TelephonyHistogram)

Aggregations

TelephonyHistogram (android.telephony.TelephonyHistogram)7 BatteryStatsManager (android.os.BatteryStatsManager)1 SmallTest (android.test.suitebuilder.annotation.SmallTest)1 TelephonyProto (com.android.internal.telephony.nano.TelephonyProto)1 ActiveSubscriptionInfo (com.android.internal.telephony.nano.TelephonyProto.ActiveSubscriptionInfo)1 TelephonyLog (com.android.internal.telephony.nano.TelephonyProto.TelephonyLog)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1