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

Commit d308133c authored by Tim Yu's avatar Tim Yu
Browse files

Autofill add service uid to some logs

Add Autofill Provider UID to:
1. AutofillSaveEventReported
2. AutofillSessionCommitted
3. AutofillPresentationEventReported

Fixes: 326516222
Test: n/a, logging only change
Change-Id: Ie2fc8fc96a02791835e308802903871472f7514c
parent 8fffa0ff
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -285,6 +285,16 @@ public class SaveEventLogger {
    });
  }

  /**
   * Set autofill_service_uid as long as mEventInternal presents.
   */
  public void maybeSetAutofillServiceUid(int uid) {
        mEventInternal.ifPresent(
                event -> {
                    event.mServiceUid = uid;
                });
  }

  /**
   * Log an AUTOFILL_SAVE_EVENT_REPORTED event.
   */
@@ -312,7 +322,8 @@ public class SaveEventLogger {
          + " mLatencySaveUiDisplayMillis=" + event.mLatencySaveUiDisplayMillis
          + " mLatencySaveRequestMillis=" + event.mLatencySaveRequestMillis
          + " mLatencySaveFinishMillis=" + event.mLatencySaveFinishMillis
          + " mIsFrameworkCreatedSaveInfo=" + event.mIsFrameworkCreatedSaveInfo);
          + " mIsFrameworkCreatedSaveInfo=" + event.mIsFrameworkCreatedSaveInfo
          + " mServiceUid=" + event.mServiceUid);
    }
    FrameworkStatsLog.write(
        AUTOFILL_SAVE_EVENT_REPORTED,
@@ -331,7 +342,8 @@ public class SaveEventLogger {
        event.mLatencySaveUiDisplayMillis,
        event.mLatencySaveRequestMillis,
        event.mLatencySaveFinishMillis,
        event.mIsFrameworkCreatedSaveInfo);
        event.mIsFrameworkCreatedSaveInfo,
        event.mServiceUid);
    mEventInternal = Optional.empty();
  }

@@ -351,7 +363,7 @@ public class SaveEventLogger {
    long mLatencySaveRequestMillis = UNINITIATED_TIMESTAMP;
    long mLatencySaveFinishMillis = UNINITIATED_TIMESTAMP;
    boolean mIsFrameworkCreatedSaveInfo = false;

    int mServiceUid = -1;
    SaveEventInternal() {
    }
  }
+3 −0
Original line number Diff line number Diff line
@@ -1336,8 +1336,11 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
        mPresentationStatsEventLogger.maybeSetIsCredentialRequest(isCredmanRequested);
        mPresentationStatsEventLogger.maybeSetFieldClassificationRequestId(
                mFieldClassificationIdSnapshot);
        mPresentationStatsEventLogger.maybeSetAutofillServiceUid(getAutofillServiceUid());
        mFillRequestEventLogger.maybeSetRequestId(requestId);
        mFillRequestEventLogger.maybeSetAutofillServiceUid(getAutofillServiceUid());
        mSaveEventLogger.maybeSetAutofillServiceUid(getAutofillServiceUid());
        mSessionCommittedEventLogger.maybeSetAutofillServiceUid(getAutofillServiceUid());
        if (mSessionFlags.mInlineSupportedByService) {
            mFillRequestEventLogger.maybeSetInlineSuggestionHostUid(mContext, userId);
        }
+15 −10
Original line number Diff line number Diff line
@@ -17,21 +17,15 @@
package com.android.server.autofill;

import static android.view.autofill.AutofillManager.COMMIT_REASON_UNKNOWN;

import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_SESSION_COMMITTED;
import static com.android.server.autofill.Helper.sVerbose;

import android.annotation.IntDef;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Slog;
import android.view.autofill.AutofillManager.AutofillCommitReason;

import com.android.internal.util.FrameworkStatsLog;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Optional;

/**
@@ -91,6 +85,14 @@ public final class SessionCommittedEventLogger {
    });
  }

  /** Set autofill_service_uid as long as mEventInternal presents. */
  public void maybeSetAutofillServiceUid(int uid) {
        mEventInternal.ifPresent(
                event -> {
                    event.mServiceUid = uid;
                });
  }

  /**
   * Log an AUTOFILL_SESSION_COMMITTED event.
   */
@@ -106,7 +108,8 @@ public final class SessionCommittedEventLogger {
          + " mComponentPackageUid=" + event.mComponentPackageUid
          + " mRequestCount=" + event.mRequestCount
          + " mCommitReason=" + event.mCommitReason
          + " mSessionDurationMillis=" + event.mSessionDurationMillis);
          + " mSessionDurationMillis=" + event.mSessionDurationMillis
          + " mServiceUid=" + event.mServiceUid);
    }
    FrameworkStatsLog.write(
        AUTOFILL_SESSION_COMMITTED,
@@ -114,7 +117,8 @@ public final class SessionCommittedEventLogger {
        event.mComponentPackageUid,
        event.mRequestCount,
        event.mCommitReason,
        event.mSessionDurationMillis);
        event.mSessionDurationMillis,
        event.mServiceUid);
    mEventInternal = Optional.empty();
  }

@@ -123,6 +127,7 @@ public final class SessionCommittedEventLogger {
    int mRequestCount = 0;
    int mCommitReason = COMMIT_REASON_UNKNOWN;
    long mSessionDurationMillis = 0;
    int mServiceUid = -1;

    SessionCommittedEventInternal() {
    }