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

Commit 5b04c63c authored by Tyler Gunn's avatar Tyler Gunn Committed by Gerrit Code Review
Browse files

Merge "Add telecom log marking shell command."

parents 4065fa64 043bb30f
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -37,6 +37,8 @@ import com.android.internal.os.BaseCommand;
import com.android.internal.telecom.ITelecomService;
import com.android.internal.telecom.ITelecomService;


import java.io.PrintStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.stream.Collectors;


public final class Telecom extends BaseCommand {
public final class Telecom extends BaseCommand {


@@ -88,6 +90,10 @@ public final class Telecom extends BaseCommand {
    private static final String COMMAND_GET_MAX_PHONES = "get-max-phones";
    private static final String COMMAND_GET_MAX_PHONES = "get-max-phones";
    private static final String COMMAND_SET_TEST_EMERGENCY_PHONE_ACCOUNT_PACKAGE_FILTER =
    private static final String COMMAND_SET_TEST_EMERGENCY_PHONE_ACCOUNT_PACKAGE_FILTER =
            "set-test-emergency-phone-account-package-filter";
            "set-test-emergency-phone-account-package-filter";
    /**
     * Command used to emit a distinct "mark" in the logs.
     */
    private static final String COMMAND_LOG_MARK = "log-mark";


    private ComponentName mComponent;
    private ComponentName mComponent;
    private String mAccountId;
    private String mAccountId;
@@ -156,6 +162,8 @@ public final class Telecom extends BaseCommand {
                        + " package name that will be used for test emergency calls. To clear,"
                        + " package name that will be used for test emergency calls. To clear,"
                        + " send an empty package name. Real emergency calls will still be placed"
                        + " send an empty package name. Real emergency calls will still be placed"
                        + " over Telephony.\n"
                        + " over Telephony.\n"
                + "telecom log-mark <MESSAGE>: emits a message into the telecom logs.  Useful for "
                        + "testers to indicate where in the logs various test steps take place.\n"
        );
        );
    }
    }


@@ -257,6 +265,9 @@ public final class Telecom extends BaseCommand {
            case COMMAND_SET_TEST_EMERGENCY_PHONE_ACCOUNT_PACKAGE_FILTER:
            case COMMAND_SET_TEST_EMERGENCY_PHONE_ACCOUNT_PACKAGE_FILTER:
                runSetEmergencyPhoneAccountPackageFilter();
                runSetEmergencyPhoneAccountPackageFilter();
                break;
                break;
            case COMMAND_LOG_MARK:
                runLogMark();
                break;
            default:
            default:
                Log.w(this, "onRun: unknown command: %s", command);
                Log.w(this, "onRun: unknown command: %s", command);
                throw new IllegalArgumentException ("unknown command '" + command + "'");
                throw new IllegalArgumentException ("unknown command '" + command + "'");
@@ -429,6 +440,11 @@ public final class Telecom extends BaseCommand {


    }
    }


    private void runLogMark() throws RemoteException {
        String message = Arrays.stream(mArgs.peekRemainingArgs()).collect(Collectors.joining(" "));
        mTelecomService.requestLogMark(message);
    }

    private PhoneAccountHandle getPhoneAccountHandleFromArgs() throws RemoteException {
    private PhoneAccountHandle getPhoneAccountHandleFromArgs() throws RemoteException {
        if (TextUtils.isEmpty(mArgs.peekNextArg())) {
        if (TextUtils.isEmpty(mArgs.peekNextArg())) {
            return null;
            return null;
+5 −0
Original line number Original line Diff line number Diff line
@@ -344,6 +344,11 @@ interface ITelecomService {


    void setTestDefaultCallRedirectionApp(String packageName);
    void setTestDefaultCallRedirectionApp(String packageName);


    /**
     * @see TelecomServiceImpl#requestLogMark
     */
    void requestLogMark(in String message);

    void setTestPhoneAcctSuggestionComponent(String flattenedComponentName);
    void setTestPhoneAcctSuggestionComponent(String flattenedComponentName);


    void setTestDefaultCallScreeningApp(String packageName);
    void setTestDefaultCallScreeningApp(String packageName);