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

Commit 7dc7f596 authored by Shishir Agrawal's avatar Shishir Agrawal Committed by Android Git Automerger
Browse files

am 4cdf0a45: Log last 20 CAT proactive commands.

* commit '4cdf0a45':
  Log last 20 CAT proactive commands.
parents 0d0f2577 4cdf0a45
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -362,6 +362,14 @@ public class CatService extends Handler implements AppInterface {
    private void handleCommand(CommandParams cmdParams, boolean isProactiveCmd) {
        CatLog.d(this, cmdParams.getCommandType().name());

        // Log all proactive commands.
        if (isProactiveCmd) {
            if (mUiccController != null) {
                mUiccController.addCardLog("ProactiveCommand mSlotId=" + mSlotId +
                        " cmdParams=" + cmdParams);
            }
        }

        CharSequence message;
        CatCmdMessage cmdMsg = new CatCmdMessage(cmdParams);
        switch (cmdParams.getCommandType()) {
+10 −0
Original line number Diff line number Diff line
@@ -57,6 +57,11 @@ class DisplayTextParams extends CommandParams {
        }
        return false;
    }

    @Override
    public String toString() {
        return "TextMessage=" + mTextMsg + " " + super.toString();
    }
}

class LaunchBrowserParams extends CommandParams {
@@ -80,6 +85,11 @@ class LaunchBrowserParams extends CommandParams {
        }
        return false;
    }

    @Override
    public String toString() {
        return "TextMessage=" + mConfirmMsg + " " + super.toString();
    }
}

class SetEventListParams extends CommandParams {
+9 −1
Original line number Diff line number Diff line
@@ -72,4 +72,12 @@ public class TextMessage implements Parcelable {
            return new TextMessage[size];
        }
    };

    @Override
    public String toString() {
        return "title=" + title + " text=" + text + " icon=" + icon +
            " iconSelfExplanatory=" + iconSelfExplanatory + " isHighPriority=" +
            isHighPriority + " responseNeeded=" + responseNeeded + " userClear=" +
            userClear + " duration=" + duration;
    }
}
+19 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.RegistrantList;
import android.os.SystemProperties;
import android.telephony.TelephonyManager;
import android.telephony.Rlog;
import android.text.format.Time;

import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.PhoneConstants;
@@ -32,6 +33,7 @@ import com.android.internal.telephony.SubscriptionController;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.LinkedList;

/**
 * This class is responsible for keeping all knowledge about
@@ -98,6 +100,10 @@ public class UiccController extends Handler {

    protected RegistrantList mIccChangedRegistrants = new RegistrantList();

    // Logging for dumpsys. Useful in cases when the cards run into errors.
    private static final int MAX_PROACTIVE_COMMANDS_TO_LOG = 20;
    private LinkedList<String> mCardLogs = new LinkedList<String>();

    public static UiccController make(Context c, CommandsInterface[] ci) {
        synchronized (mLock) {
            if (mInstance != null) {
@@ -340,6 +346,15 @@ public class UiccController extends Handler {
        Rlog.d(LOG_TAG, string);
    }

    // TODO: This is hacky. We need a better way of saving the logs.
    public void addCardLog(String data) {
        Time t = new Time();
        t.setToNow();
        mCardLogs.addLast(t.format("%m-%d %H:%M:%S") + " " + data);
        if (mCardLogs.size() > MAX_PROACTIVE_COMMANDS_TO_LOG) {
            mCardLogs.removeFirst();
        }
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("UiccController: " + this);
@@ -361,5 +376,9 @@ public class UiccController extends Handler {
                mUiccCards[i].dump(fd, pw, args);
            }
        }
        pw.println("mCardLogs: ");
        for (int i = 0; i < mCardLogs.size(); ++i) {
            pw.println("  " + mCardLogs.get(i));
        }
    }
}