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

Commit a1f1a3c5 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

More battery stats.

- Add events for sync.
- Add more descriptive tags for wake events.
- Fix battery reset.
- Fix tracking of wifi data.

Change-Id: Ic07f2a86a5ed33e7da57eb1108c31c777ecd801f
parent 24bcc34f
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -1843,6 +1843,17 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            return true;
        }

        case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            IIntentSender r = IIntentSender.Stub.asInterface(
                data.readStrongBinder());
            String prefix = data.readString();
            String tag = getTagForIntentSender(r, prefix);
            reply.writeNoException();
            reply.writeString(tag);
            return true;
        }

        case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            Configuration config = Configuration.CREATOR.createFromParcel(data);
@@ -4435,6 +4446,21 @@ class ActivityManagerProxy implements IActivityManager
        return res;
    }

    public String getTagForIntentSender(IIntentSender sender, String prefix)
            throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeStrongBinder(sender.asBinder());
        data.writeString(prefix);
        mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
        reply.readException();
        String res = reply.readString();
        data.recycle();
        reply.recycle();
        return res;
    }

    public void updatePersistentConfiguration(Configuration values) throws RemoteException
    {
        Parcel data = Parcel.obtain();
+6 −0
Original line number Diff line number Diff line
@@ -367,6 +367,8 @@ public interface IActivityManager extends IInterface {

    public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException;

    public String getTagForIntentSender(IIntentSender sender, String prefix) throws RemoteException;

    public void updatePersistentConfiguration(Configuration values) throws RemoteException;

    public long[] getProcessPss(int[] pids) throws RemoteException;
@@ -709,4 +711,8 @@ public interface IActivityManager extends IInterface {
    int GET_HOME_ACTIVITY_TOKEN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+183;
    int GET_ACTIVITY_CONTAINER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+184;
    int DELETE_ACTIVITY_CONTAINER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+185;


    // Start of L transactions
    int GET_TAG_FOR_INTENT_SENDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+210;
}
+14 −0
Original line number Diff line number Diff line
@@ -888,6 +888,20 @@ public final class PendingIntent implements Parcelable {
        }
    }

    /**
     * @hide
     * Return descriptive tag for this PendingIntent.
     */
    public String getTag(String prefix) {
        try {
            return ActivityManagerNative.getDefault()
                .getTagForIntentSender(mTarget, prefix);
        } catch (RemoteException e) {
            // Should never happen.
            return null;
        }
    }

    /**
     * Comparison operator on two PendingIntent objects, such that true
     * is returned then they both represent the same operation from the
+16 −3
Original line number Diff line number Diff line
@@ -15,9 +15,6 @@

package android.os;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * {@hide}
 */
@@ -33,6 +30,22 @@ public class BatteryProperties implements Parcelable {
    public int batteryTemperature;
    public String batteryTechnology;

    public BatteryProperties() {
    }

    public void set(BatteryProperties other) {
        chargerAcOnline = other.chargerAcOnline;
        chargerUsbOnline = other.chargerUsbOnline;
        chargerWirelessOnline = other.chargerWirelessOnline;
        batteryStatus = other.batteryStatus;
        batteryHealth = other.batteryHealth;
        batteryPresent = other.batteryPresent;
        batteryLevel = other.batteryLevel;
        batteryVoltage = other.batteryVoltage;
        batteryTemperature = other.batteryTemperature;
        batteryTechnology = other.batteryTechnology;
    }

    /*
     * Parcel read/write code must be kept in sync with
     * frameworks/native/services/batteryservice/BatteryProperties.cpp
+7 −3
Original line number Diff line number Diff line
@@ -588,8 +588,10 @@ public abstract class BatteryStats implements Parcelable {
        public static final int EVENT_FOREGROUND = 0x0002;
        // Event is about an application package that is at the top of the screen.
        public static final int EVENT_TOP = 0x0003;
        // Event is about an application package that is at the top of the screen.
        public static final int EVENT_SYNC = 0x0004;
        // Number of event types.
        public static final int EVENT_COUNT = 0x0004;
        public static final int EVENT_COUNT = 0x0005;

        public static final int EVENT_PROC_START = EVENT_PROC | EVENT_FLAG_START;
        public static final int EVENT_PROC_FINISH = EVENT_PROC | EVENT_FLAG_FINISH;
@@ -597,6 +599,8 @@ public abstract class BatteryStats implements Parcelable {
        public static final int EVENT_FOREGROUND_FINISH = EVENT_FOREGROUND | EVENT_FLAG_FINISH;
        public static final int EVENT_TOP_START = EVENT_TOP | EVENT_FLAG_START;
        public static final int EVENT_TOP_FINISH = EVENT_TOP | EVENT_FLAG_FINISH;
        public static final int EVENT_SYNC_START = EVENT_SYNC | EVENT_FLAG_START;
        public static final int EVENT_SYNC_FINISH = EVENT_SYNC | EVENT_FLAG_FINISH;

        // For CMD_EVENT.
        public int eventCode;
@@ -975,11 +979,11 @@ public abstract class BatteryStats implements Parcelable {
    };

    public static final String[] HISTORY_EVENT_NAMES = new String[] {
            "null", "proc", "fg", "top"
            "null", "proc", "fg", "top", "sync"
    };

    public static final String[] HISTORY_EVENT_CHECKIN_NAMES = new String[] {
            "Nl", "Pr", "Fg", "Tp"
            "Enl", "Epr", "Efg", "Etp", "Esy"
    };

    /**
Loading