Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61155b8b authored by Prerepa Viswanadham's avatar Prerepa Viswanadham Committed by Android (Google) Code Review
Browse files

Merge "Activity info and stats from modem" into mnc-dev

parents f4eaa59c 27eef341
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2010,4 +2010,12 @@ public interface CommandsInterface {
     * @param h handle to be removed.
     */
    void unregisterForLceInfo(Handler h);

    /**
     *
     * Get modem activity info and stats
     *
     * @param result Callback message contains the modem activity information
     */
    public void getModemActivityInfo(Message result);
}
+5 −0
Original line number Diff line number Diff line
@@ -2065,4 +2065,9 @@ public interface Phone {
     * SIM preferences.
     */
    public Locale getLocaleFromSimAndCarrierPrefs();

    /**
     * Returns the modem activity information
     */
    public void getModemActivityInfo(Message response);
}
+6 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager;
import android.telephony.VoLteServiceState;
import android.telephony.ModemActivityInfo;
import android.text.TextUtils;

import com.android.ims.ImsManager;
@@ -2372,6 +2373,11 @@ public abstract class PhoneBase extends Handler implements Phone {
        return mLceStatus;
    }

    @Override
    public void getModemActivityInfo(Message response)  {
        mCi.getModemActivityInfo(response);
    }

    /**
     * Starts LCE service after radio becomes available.
     * LCE service state may get destroyed on the modem when radio becomes unavailable.
+5 −0
Original line number Diff line number Diff line
@@ -1569,6 +1569,11 @@ public class PhoneProxy extends Handler implements Phone {
        return mActivePhone.getLocaleFromSimAndCarrierPrefs();
    }

    @Override
    public void getModemActivityInfo(Message response)  {
        mActivePhone.getModemActivityInfo(response);
    }

    /**
     * @return true if we are in the emergency call back mode. This is a period where
     * the phone should be using as little power as possible and be ready to receive an
+40 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import android.os.PowerManager;
import android.os.BatteryManager;
import android.os.SystemProperties;
import android.os.PowerManager.WakeLock;
import android.os.SystemClock;
import android.provider.Settings.SettingNotFoundException;
import android.telephony.CellInfo;
import android.telephony.NeighboringCellInfo;
@@ -54,6 +55,7 @@ import android.telephony.SmsManager;
import android.telephony.SmsMessage;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.ModemActivityInfo;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.Display;
@@ -83,6 +85,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -2594,6 +2597,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
            case RIL_REQUEST_START_LCE: ret = responseLceStatus(p); break;
            case RIL_REQUEST_STOP_LCE: ret = responseLceStatus(p); break;
            case RIL_REQUEST_PULL_LCEDATA: ret = responseLceData(p); break;
            case RIL_REQUEST_GET_ACTIVITY_INFO: ret = responseActivityData(p); break;
            default:
                throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest);
            //break;
@@ -2664,6 +2668,11 @@ public final class RIL extends BaseCommands implements CommandsInterface {
                    }
                    break;
                }
                case RIL_REQUEST_GET_ACTIVITY_INFO:
                    ret = new ModemActivityInfo(0, 0, 0,
                            new int [ModemActivityInfo.TX_POWER_LEVELS], 0, 0);
                    error = 0;
                    break;
            }

            if (error != 0) rr.onError(error, ret);
@@ -4010,6 +4019,25 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        return statusResponse;
    }

    private Object responseActivityData(Parcel p) {
        final int sleepModeTimeMs = p.readInt();
        final int idleModeTimeMs = p.readInt();
        int [] txModeTimeMs = new int[ModemActivityInfo.TX_POWER_LEVELS];
        for (int i = 0; i < ModemActivityInfo.TX_POWER_LEVELS; i++) {
            txModeTimeMs[i] = p.readInt();
        }
        final int rxModeTimeMs = p.readInt();

        riljLog("Modem activity info received:" +
                " sleepModeTimeMs=" + sleepModeTimeMs +
                " idleModeTimeMs=" + idleModeTimeMs +
                " txModeTimeMs[]=" + Arrays.toString(txModeTimeMs) +
                " rxModeTimeMs=" + rxModeTimeMs);

        return new ModemActivityInfo(SystemClock.elapsedRealtime(), sleepModeTimeMs,
                        idleModeTimeMs, txModeTimeMs, rxModeTimeMs, 0);
    }

    static String
    requestToString(int request) {
/*
@@ -4152,6 +4180,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
            case RIL_REQUEST_START_LCE: return "RIL_REQUEST_START_LCE";
            case RIL_REQUEST_STOP_LCE: return "RIL_REQUEST_STOP_LCE";
            case RIL_REQUEST_PULL_LCEDATA: return "RIL_REQUEST_PULL_LCEDATA";
            case RIL_REQUEST_GET_ACTIVITY_INFO: return "RIL_REQUEST_GET_ACTIVITY_INFO";
            default: return "<unknown request>";
        }
    }
@@ -4791,4 +4820,15 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        }
        send(rr);
    }

    /**
    * @hide
    */
    public void getModemActivityInfo(Message response) {
        RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_ACTIVITY_INFO, response);
        if (RILJ_LOGD) {
            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
        }
        send(rr);
    }
}
Loading