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

Commit 8b38cd98 authored by Sooraj Sasindran's avatar Sooraj Sasindran
Browse files

Expose api to retrieve wakelock information per client

Expose api to retrieve wakelock information per client
Provide calling package name in cell info apis

Test: Through logs confirmed that the wakelock decrement is happening
        correctly
BUG=31041780
Merged-In: Id8ca0006478212c006a103b83fb720532e9c0fab
Change-Id: Id8ca0006478212c006a103b83fb720532e9c0fab
parent 75af4b92
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.telephony.ClientRequestStats;
import android.telephony.Rlog;

import com.android.internal.annotations.VisibleForTesting;

import java.util.ArrayList;

public class ClientWakelockAccountant {
+11 −0
Original line number Diff line number Diff line
@@ -108,6 +108,17 @@ public class ClientWakelockTracker {
        }
    }

    public boolean isClientActive(String clientId) {
        ClientWakelockAccountant client = getClientWakelockAccountant(clientId);
        synchronized (mActiveClients) {
            if (mActiveClients.contains(client)) {
                return true;
            }
        }

        return false;
    }

    void dumpClientRequestTracker() {
        Rlog.d(RIL.RILJ_LOG_TAG, "-------mClients---------------");
        synchronized (mClients) {
+12 −3
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@ package com.android.internal.telephony;

import android.os.Handler;
import android.os.Message;
import android.os.WorkSource;
import android.service.carrier.CarrierIdentifier;
import android.telephony.ClientRequestStats;

import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
import com.android.internal.telephony.dataconnection.DataProfile;
@@ -1387,8 +1389,9 @@ public interface CommandsInterface {
     * Query neighboring cell ids
     *
     * @param response s callback message to cell ids
     * @param workSource calling WorkSource
     */
    void getNeighboringCids(Message response);
    default void getNeighboringCids(Message response, WorkSource workSource){}

    /**
     * Request to enable/disable network state change notifications when
@@ -1730,8 +1733,9 @@ public interface CommandsInterface {
     * AsyncResult.result is a of Collection<CellInfo>
     *
     * @param result is sent back to handler and result.obj is a AsyncResult
     * @param workSource calling WorkSource
     */
    void getCellInfoList(Message result);
    default void getCellInfoList(Message result, WorkSource workSource) {}

    /**
     * Sets the minimum time in milli-seconds between when RIL_UNSOL_CELL_INFO_LIST
@@ -1747,8 +1751,9 @@ public interface CommandsInterface {
     * @param response.obj is AsyncResult ar when sent to associated handler
     *                        ar.exception carries exception on failure or null on success
     *                        otherwise the error.
     * @param workSource calling WorkSource
     */
    void setCellInfoListRate(int rateInMillis, Message response);
    default void setCellInfoListRate(int rateInMillis, Message response, WorkSource workSource){}

    /**
     * Fires when RIL_UNSOL_CELL_INFO_LIST is received from the RIL.
@@ -2055,4 +2060,8 @@ public interface CommandsInterface {
     * @param h handler to be removed
     */
    public void unregisterForPcoData(Handler h);

    default public List<ClientRequestStats> getClientRequestStats() {
        return null;
    }
}
+5 −4
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.os.Registrant;
import android.os.RegistrantList;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.WorkSource;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.provider.Telephony;
@@ -407,9 +408,9 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public CellLocation getCellLocation() {
    public CellLocation getCellLocation(WorkSource workSource) {
        if (isPhoneTypeGsm()) {
            return mSST.getCellLocation();
            return mSST.getCellLocation(workSource);
        } else {
            CdmaCellLocation loc = (CdmaCellLocation)mSST.mCellLoc;

@@ -1723,9 +1724,9 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public void getNeighboringCids(Message response) {
    public void getNeighboringCids(Message response, WorkSource workSource) {
        if (isPhoneTypeGsm()) {
            mCi.getNeighboringCids(response);
            mCi.getNeighboringCids(response, workSource);
        } else {
            /*
             * This is currently not implemented.  At least as of June
+17 −4
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.os.Message;
import android.os.Registrant;
import android.os.RegistrantList;
import android.os.SystemProperties;
import android.os.WorkSource;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.service.carrier.CarrierIdentifier;
@@ -41,6 +42,8 @@ import android.telecom.VideoProfile;
import android.telephony.CellIdentityCdma;
import android.telephony.CellInfo;
import android.telephony.CellInfoCdma;
import android.telephony.CellLocation;
import android.telephony.ClientRequestStats;
import android.telephony.PhoneStateListener;
import android.telephony.RadioAccessFamily;
import android.telephony.Rlog;
@@ -1163,6 +1166,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mCi.getNetworkSelectionMode(message);
    }

    public List<ClientRequestStats> getClientRequestStats() {
        return mCi.getClientRequestStats();
    }

    /**
     * Manually selects a network. <code>response</code> is
     * dispatched when this is complete.  <code>response.obj</code> will be
@@ -1584,13 +1591,18 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    }

    /**
     * @param workSource calling WorkSource
     * @return all available cell information or null if none.
     */
    public List<CellInfo> getAllCellInfo() {
        List<CellInfo> cellInfoList = getServiceStateTracker().getAllCellInfo();
    public List<CellInfo> getAllCellInfo(WorkSource workSource) {
        List<CellInfo> cellInfoList = getServiceStateTracker().getAllCellInfo(workSource);
        return privatizeCellInfoList(cellInfoList);
    }

    public CellLocation getCellLocation() {
        return getCellLocation(null);
    }

    /**
     * Clear CDMA base station lat/long values if location setting is disabled.
     * @param cellInfoList the original cell info list from the RIL
@@ -1633,9 +1645,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     * A onCellInfoChanged.
     *
     * @param rateInMillis the rate
     * @param workSource calling WorkSource
     */
    public void setCellInfoListRate(int rateInMillis) {
        mCi.setCellInfoListRate(rateInMillis, null);
    public void setCellInfoListRate(int rateInMillis, WorkSource workSource) {
        mCi.setCellInfoListRate(rateInMillis, null, workSource);
    }

    /**
Loading