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

Commit 59852c07 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

Add Reason to addRemoteInput Logs

This CL improves addRemoteInput logs and make similar them to removeRemoteInputs.

Example output:
1. addRemoteInput reason:RemoteInputView#focus entry: key, style:BigTextStyle ..
2. removeRemoteInput reason: RemoteInputViewController#sendRemoteInput entry:key, style: BigTextStyle ..
3. removeRemoteInput reason: RemoteInputView#onDefocus entry: key, style: BigTextStyle ..
4. removeRemoteInput reason: RemoteInputView$WindowInsetAnimation#onEnd entry: key, style: BigTextStyle ..
5. removeRemoteInput reason: RemoteInputView$WindowInsetAnimation#onEnd entry: key, style: BigTextStyle ..
6. removeRemoteInput reason: RemoteInputView#onDetachedFromWindow entry:key, style: BigTextStyle..

Bug: 290068526
Test: RemoteInputLogger addRemoteInput logs in BR
Change-Id: I863be99cb386d3b04a06b5445614225eee840610
parent d3f3084d
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -71,7 +71,8 @@ public class RemoteInputController {
     * @param entry the entry for which a remote input is now active.
     * @param token a token identifying the view that is managing the remote input
     */
    public void addRemoteInput(NotificationEntry entry, Object token) {
    public void addRemoteInput(NotificationEntry entry, Object token,
            @CompileTimeConstant String reason) {
        Objects.requireNonNull(entry);
        Objects.requireNonNull(token);
        boolean isActive = isRemoteInputActive(entry);
@@ -79,7 +80,9 @@ public class RemoteInputController {
                entry /* contains */, null /* remove */, token /* removeToken */);
        mLogger.logAddRemoteInput(entry.getKey()/* entryKey */,
                isActive /* isRemoteInputAlreadyActive */,
                found /* isRemoteInputFound */);
                found /* isRemoteInputFound */,
                reason /* reason */,
                entry.getNotificationStyle()/* notificationStyle */);
        if (!found) {
            mOpen.add(new Pair<>(new WeakReference<>(entry), token));
        }
+9 −2
Original line number Diff line number Diff line
@@ -32,17 +32,24 @@ constructor(@NotificationRemoteInputLog private val logBuffer: LogBuffer) {
    fun logAddRemoteInput(
        entryKey: String,
        isRemoteInputAlreadyActive: Boolean,
        isRemoteInputFound: Boolean
        isRemoteInputFound: Boolean,
        reason: String,
        notificationStyle: String
    ) =
        logBuffer.log(
            TAG,
            DEBUG,
            {
                str1 = entryKey
                str2 = reason
                str3 = notificationStyle
                bool1 = isRemoteInputAlreadyActive
                bool2 = isRemoteInputFound
            },
            { "addRemoteInput entry: $str1, isAlreadyActive: $bool1, isFound:$bool2" }
            {
                "addRemoteInput reason:$str2 entry: $str1, style:$str3" +
                    ", isAlreadyActive: $bool1, isFound:$bool2"
            }
        )

    /** logs removeRemoteInput invocation of [RemoteInputController] */
+1 −1
Original line number Diff line number Diff line
@@ -657,7 +657,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
        mEditText.setText(mEntry.remoteInputText);
        mEditText.setSelection(mEditText.length());
        mEditText.requestFocus();
        mController.addRemoteInput(mEntry, mToken);
        mController.addRemoteInput(mEntry, mToken, "RemoteInputView#focus");
        setAttachment(mEntry.remoteInputAttachment);

        updateSendButton();