Loading core/java/android/view/autofill/AutofillManager.java +10 −6 Original line number Original line Diff line number Diff line Loading @@ -1132,8 +1132,7 @@ public final class AutofillManager { if (mSaveTriggerId != null && mSaveTriggerId.equals(id)) { if (mSaveTriggerId != null && mSaveTriggerId.equals(id)) { if (sDebug) Log.d(TAG, "triggering commit by click of " + id); if (sDebug) Log.d(TAG, "triggering commit by click of " + id); commitLocked(); commitLocked(); mMetricsLogger.action(MetricsEvent.AUTOFILL_SAVE_EXPLICITLY_TRIGGERED, mMetricsLogger.write(newLog(MetricsEvent.AUTOFILL_SAVE_EXPLICITLY_TRIGGERED)); mContext.getPackageName()); } } } } } } Loading Loading @@ -1893,12 +1892,17 @@ public final class AutofillManager { } } } } final LogMaker log = new LogMaker(MetricsEvent.AUTOFILL_DATASET_APPLIED) mMetricsLogger.write(newLog(MetricsEvent.AUTOFILL_DATASET_APPLIED) .setPackageName(mContext.getPackageName()) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_NUM_VALUES, itemCount) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_NUM_VALUES, itemCount) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_NUM_VIEWS_FILLED, numApplied); .addTaggedData(MetricsEvent.FIELD_AUTOFILL_NUM_VIEWS_FILLED, numApplied)); mMetricsLogger.write(log); } } } private LogMaker newLog(int category) { return new LogMaker(category) .setPackageName(mContext.getPackageName()) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_COMPAT_MODE, isCompatibilityModeEnabledLocked() ? 1 : 0); } } /** /** Loading proto/src/metrics_constants.proto +43 −0 Original line number Original line Diff line number Diff line Loading @@ -3967,6 +3967,7 @@ message MetricsEvent { // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // NOTE: starting on OS P, it also added the following field: // NOTE: starting on OS P, it also added the following field: // Tag FIELD_FLAGS - Flags used to start the session // Tag FIELD_FLAGS - Flags used to start the session // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SESSION_STARTED = 906; AUTOFILL_SESSION_STARTED = 906; // An autofill request was processed by a service // An autofill request was processed by a service Loading @@ -3980,6 +3981,7 @@ message MetricsEvent { // Type TYPE_CLOSE: Service returned a null response. // Type TYPE_CLOSE: Service returned a null response. // Tag FIELD_AUTOFILL_NUM_FIELD_CLASSIFICATION_IDS: if service requested field classification, // Tag FIELD_AUTOFILL_NUM_FIELD_CLASSIFICATION_IDS: if service requested field classification, // number of entries field ids in the request. // number of entries field ids in the request. // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_REQUEST = 907; AUTOFILL_REQUEST = 907; // Tag of a field for a package of an autofill service // Tag of a field for a package of an autofill service Loading @@ -3998,6 +4000,7 @@ message MetricsEvent { // Tag FIELD_AUTOFILL_NUM_DATASETS: The number of datasets shown // Tag FIELD_AUTOFILL_NUM_DATASETS: The number of datasets shown // NOTE: starting on OS P, it also added the following field: // NOTE: starting on OS P, it also added the following field: // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_FILL_UI = 910; AUTOFILL_FILL_UI = 910; // Tag of a field for the length of the filter text // Tag of a field for the length of the filter text Loading @@ -4005,12 +4008,17 @@ message MetricsEvent { // An autofill authentication succeeded // An autofill authentication succeeded // Package: Package of app that was autofilled // Package: Package of app that was autofilled // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_AUTHENTICATED = 912; AUTOFILL_AUTHENTICATED = 912; // An activity was autofilled and all values could be applied // An activity was autofilled and all values could be applied // Package: Package of app that is autofilled // Package: Package of app that is autofilled // Tag FIELD_AUTOFILL_NUM_VALUES: Number of values that were suggested to be autofilled // Tag FIELD_AUTOFILL_NUM_VALUES: Number of values that were suggested to be autofilled // Tag FIELD_AUTOFILL_NUM_VIEWS_FILLED: Number of views that could be filled // Tag FIELD_AUTOFILL_NUM_VIEWS_FILLED: Number of views that could be filled // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_DATASET_APPLIED = 913; AUTOFILL_DATASET_APPLIED = 913; // Tag of a field for the number values to be filled in // Tag of a field for the number values to be filled in Loading @@ -4027,6 +4035,7 @@ message MetricsEvent { // Tag FIELD_AUTOFILL_NUM_IDS: The number of ids that are saved // Tag FIELD_AUTOFILL_NUM_IDS: The number of ids that are saved // NOTE: starting on OS P, it also added the following field: // NOTE: starting on OS P, it also added the following field: // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SAVE_UI = 916; AUTOFILL_SAVE_UI = 916; // Tag of a field for the number of saveable ids // Tag of a field for the number of saveable ids Loading @@ -4038,10 +4047,14 @@ message MetricsEvent { // Type TYPE_FAILURE: The request failed // Type TYPE_FAILURE: The request failed // Package: Package of app that was autofilled // Package: Package of app that was autofilled // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_DATA_SAVE_REQUEST = 918; AUTOFILL_DATA_SAVE_REQUEST = 918; // An auto-fill session was finished // An auto-fill session was finished // Package: Package of app that was autofilled // Package: Package of app that was autofilled // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SESSION_FINISHED = 919; AUTOFILL_SESSION_FINISHED = 919; // meta-event: a reader has checkpointed the log here. // meta-event: a reader has checkpointed the log here. Loading Loading @@ -4167,6 +4180,8 @@ message MetricsEvent { // Package: Real package of the app being autofilled // Package: Real package of the app being autofilled // Tag FIELD_AUTOFILL_SERVICE: Package of the autofill service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of the autofill service that processed the request // TAG FIELD_AUTOFILL_FORGED_COMPONENT_NAME: Component name being forged // TAG FIELD_AUTOFILL_FORGED_COMPONENT_NAME: Component name being forged // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_FORGED_COMPONENT_ATTEMPT = 948; AUTOFILL_FORGED_COMPONENT_ATTEMPT = 948; // FIELD - The component that an app tried tro forged. // FIELD - The component that an app tried tro forged. Loading Loading @@ -4624,6 +4639,8 @@ message MetricsEvent { // OS: O MR // OS: O MR // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_PREVIOUS_LENGTH: the previous length of the value // Tag FIELD_AUTOFILL_PREVIOUS_LENGTH: the previous length of the value // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_VALUE_RESET = 1124; AUTOFILL_VALUE_RESET = 1124; // Tag of AUTOFILL_VALUE_RESET // Tag of AUTOFILL_VALUE_RESET Loading @@ -4634,18 +4651,24 @@ message MetricsEvent { // Package: Package of app that was autofilled // Package: Package of app that was autofilled // OS: O MR // OS: O MR // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_DATASET_AUTHENTICATED = 1126; AUTOFILL_DATASET_AUTHENTICATED = 1126; // An autofill service provided an invalid dataset authentication // An autofill service provided an invalid dataset authentication // Package: Package of app that was autofilled // Package: Package of app that was autofilled // OS: O MR // OS: O MR // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_INVALID_DATASET_AUTHENTICATION = 1127; AUTOFILL_INVALID_DATASET_AUTHENTICATION = 1127; // An autofill service provided an invalid authentication extra // An autofill service provided an invalid authentication extra // Package: Package of app that was autofilled // Package: Package of app that was autofilled // OS: O MR // OS: O MR // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_INVALID_AUTHENTICATION = 1128; AUTOFILL_INVALID_AUTHENTICATION = 1128; // An autofill service used a custom description (using RemoteViews) in the autofill save UI // An autofill service used a custom description (using RemoteViews) in the autofill save UI Loading @@ -4653,6 +4676,8 @@ message MetricsEvent { // OS: O MR // OS: O MR // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SAVE_CUSTOM_DESCRIPTION = 1129; AUTOFILL_SAVE_CUSTOM_DESCRIPTION = 1129; // FIELD - Type of save object passed by the service when the Save UI is shown // FIELD - Type of save object passed by the service when the Save UI is shown Loading @@ -4664,6 +4689,8 @@ message MetricsEvent { // OS: O MR // OS: O MR // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SAVE_CUSTOM_SUBTITLE = 1131; AUTOFILL_SAVE_CUSTOM_SUBTITLE = 1131; // User tapped a link in the custom description of the autofill save UI provided by an autofill service // User tapped a link in the custom description of the autofill save UI provided by an autofill service Loading @@ -4674,6 +4701,8 @@ message MetricsEvent { // Type TYPE_FAILURE: The link could not launc an activity // Type TYPE_FAILURE: The link could not launc an activity // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SAVE_LINK_TAPPED = 1132; AUTOFILL_SAVE_LINK_TAPPED = 1132; // Result of the validation on save when an autofill service provided a validator // Result of the validation on save when an autofill service provided a validator Loading @@ -4684,6 +4713,8 @@ message MetricsEvent { // Type TYPE_DISMISS: The validation failed // Type TYPE_DISMISS: The validation failed // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SAVE_VALIDATION = 1133; AUTOFILL_SAVE_VALIDATION = 1133; // Result of an operation in the autofill save UI after the user tapped a link in the custom description // Result of an operation in the autofill save UI after the user tapped a link in the custom description Loading @@ -4693,6 +4724,8 @@ message MetricsEvent { // Type TYPE_OPEN: The autofill save UI was restored // Type TYPE_OPEN: The autofill save UI was restored // Type TYPE_DISMISS: The autofill save UI was destroyed // Type TYPE_DISMISS: The autofill save UI was destroyed // Type TYPE_FAILURE: An invalid opperation was reported by the app's AutofillManager // Type TYPE_FAILURE: An invalid opperation was reported by the app's AutofillManager // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_PENDING_SAVE_UI_OPERATION = 1134; AUTOFILL_PENDING_SAVE_UI_OPERATION = 1134; // Autofill service called API that disables itself // Autofill service called API that disables itself Loading @@ -4705,6 +4738,8 @@ message MetricsEvent { // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Package: Package of the autofill service // Package: Package of the autofill service // OS: O MR // OS: O MR // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_UI_LATENCY = 1136; AUTOFILL_UI_LATENCY = 1136; // Action: the snooze leave-behind was shown after the user clicked the snooze icon // Action: the snooze leave-behind was shown after the user clicked the snooze icon Loading Loading @@ -4872,12 +4907,14 @@ message MetricsEvent { // Package: Package of app that is autofilled // Package: Package of app that is autofilled // OS: P // OS: P // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_EXPLICIT_SAVE_TRIGGER_DEFINITION = 1228; AUTOFILL_EXPLICIT_SAVE_TRIGGER_DEFINITION = 1228; // The autofill context was commited when the user clicked a view explicitly marked by the // The autofill context was commited when the user clicked a view explicitly marked by the // service as committing it // service as committing it // Package: Package of app that is autofilled // Package: Package of app that is autofilled // OS: P // OS: P // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SAVE_EXPLICITLY_TRIGGERED = 1229; AUTOFILL_SAVE_EXPLICITLY_TRIGGERED = 1229; // OPEN: Settings > Network & Internet > Mobile network > Wi-Fi calling // OPEN: Settings > Network & Internet > Mobile network > Wi-Fi calling Loading @@ -4890,6 +4927,7 @@ message MetricsEvent { // OS: P // OS: P // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_DURATION: duration (in ms) that autofill will be disabled // Tag FIELD_AUTOFILL_DURATION: duration (in ms) that autofill will be disabled // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SERVICE_DISABLED_APP = 1231; AUTOFILL_SERVICE_DISABLED_APP = 1231; // An autofill service asked to disable autofill for a given activity. // An autofill service asked to disable autofill for a given activity. Loading @@ -4898,6 +4936,7 @@ message MetricsEvent { // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_CLASS_NAME: Class name of the activity that is being disabled for autofill // Tag FIELD_CLASS_NAME: Class name of the activity that is being disabled for autofill // Tag FIELD_AUTOFILL_DURATION: duration (in ms) that autofill will be disabled // Tag FIELD_AUTOFILL_DURATION: duration (in ms) that autofill will be disabled // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SERVICE_DISABLED_ACTIVITY = 1232; AUTOFILL_SERVICE_DISABLED_ACTIVITY = 1232; // ACTION: Stop an app and turn on background check // ACTION: Stop an app and turn on background check Loading Loading @@ -5109,6 +5148,7 @@ message MetricsEvent { // OS: P // OS: P // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_MATCH_SCORE: Average score of the matches, in the range of 0 to 100 // Tag FIELD_AUTOFILL_MATCH_SCORE: Average score of the matches, in the range of 0 to 100 // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_FIELD_CLASSIFICATION_MATCHES = 1273; AUTOFILL_FIELD_CLASSIFICATION_MATCHES = 1273; // Tag used to report autofill field classification scores // Tag used to report autofill field classification scores Loading Loading @@ -5775,6 +5815,9 @@ message MetricsEvent { // OS: P // OS: P ACTION_STORAGE_MIGRATE_LATER = 1413; ACTION_STORAGE_MIGRATE_LATER = 1413; // Tag used to report whether an activity is being autofilled on compatibility mode. FIELD_AUTOFILL_COMPAT_MODE = 1414; // ---- End P Constants, all P constants go above this line ---- // ---- End P Constants, all P constants go above this line ---- // Add new aosp constants above this line. // Add new aosp constants above this line. // END OF AOSP CONSTANTS // END OF AOSP CONSTANTS Loading services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +15 −12 Original line number Original line Diff line number Diff line Loading @@ -504,7 +504,7 @@ final class AutofillManagerServiceImpl { sessionId = sRandom.nextInt(); sessionId = sRandom.nextInt(); } while (sessionId == NO_SESSION || mSessions.indexOfKey(sessionId) >= 0); } while (sessionId == NO_SESSION || mSessions.indexOfKey(sessionId) >= 0); assertCallerLocked(componentName); assertCallerLocked(componentName, compatMode); final Session newSession = new Session(this, mUi, mContext, mHandler, mUserId, mLock, final Session newSession = new Session(this, mUi, mContext, mHandler, mUserId, mLock, sessionId, uid, activityToken, appCallbackToken, hasCallback, mUiLatencyHistory, sessionId, uid, activityToken, appCallbackToken, hasCallback, mUiLatencyHistory, Loading @@ -518,7 +518,7 @@ final class AutofillManagerServiceImpl { /** /** * Asserts the component is owned by the caller. * Asserts the component is owned by the caller. */ */ private void assertCallerLocked(@NonNull ComponentName componentName) { private void assertCallerLocked(@NonNull ComponentName componentName, boolean compatMode) { final String packageName = componentName.getPackageName(); final String packageName = componentName.getPackageName(); final PackageManager pm = mContext.getPackageManager(); final PackageManager pm = mContext.getPackageManager(); final int callingUid = Binder.getCallingUid(); final int callingUid = Binder.getCallingUid(); Loading @@ -536,7 +536,7 @@ final class AutofillManagerServiceImpl { + ") passed component (" + componentName + ") owned by UID " + packageUid); + ") passed component (" + componentName + ") owned by UID " + packageUid); mMetricsLogger.write( mMetricsLogger.write( Helper.newLogMaker(MetricsEvent.AUTOFILL_FORGED_COMPONENT_ATTEMPT, Helper.newLogMaker(MetricsEvent.AUTOFILL_FORGED_COMPONENT_ATTEMPT, callingPackage, getServicePackageName()) callingPackage, getServicePackageName(), compatMode) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_FORGED_COMPONENT_NAME, .addTaggedData(MetricsEvent.FIELD_AUTOFILL_FORGED_COMPONENT_NAME, componentName == null ? "null" : componentName.flattenToShortString())); componentName == null ? "null" : componentName.flattenToShortString())); Loading Loading @@ -774,10 +774,10 @@ final class AutofillManagerServiceImpl { @Nullable ArrayList<String> changedDatasetIds, @Nullable ArrayList<String> changedDatasetIds, @Nullable ArrayList<AutofillId> manuallyFilledFieldIds, @Nullable ArrayList<AutofillId> manuallyFilledFieldIds, @Nullable ArrayList<ArrayList<String>> manuallyFilledDatasetIds, @Nullable ArrayList<ArrayList<String>> manuallyFilledDatasetIds, @NonNull String appPackageName) { @NonNull String appPackageName, boolean compatMode) { logContextCommittedLocked(sessionId, clientState, selectedDatasets, ignoredDatasets, logContextCommittedLocked(sessionId, clientState, selectedDatasets, ignoredDatasets, changedFieldIds, changedDatasetIds, manuallyFilledFieldIds, changedFieldIds, changedDatasetIds, manuallyFilledFieldIds, manuallyFilledDatasetIds, null, null, appPackageName); manuallyFilledDatasetIds, null, null, appPackageName, compatMode); } } @GuardedBy("mLock") @GuardedBy("mLock") Loading @@ -790,7 +790,7 @@ final class AutofillManagerServiceImpl { @Nullable ArrayList<ArrayList<String>> manuallyFilledDatasetIds, @Nullable ArrayList<ArrayList<String>> manuallyFilledDatasetIds, @Nullable ArrayList<AutofillId> detectedFieldIdsList, @Nullable ArrayList<AutofillId> detectedFieldIdsList, @Nullable ArrayList<FieldClassification> detectedFieldClassificationsList, @Nullable ArrayList<FieldClassification> detectedFieldClassificationsList, @NonNull String appPackageName) { @NonNull String appPackageName, boolean compatMode) { if (isValidEventLocked("logDatasetNotSelected()", sessionId)) { if (isValidEventLocked("logDatasetNotSelected()", sessionId)) { if (sVerbose) { if (sVerbose) { Slog.v(TAG, "logContextCommitted() with FieldClassification: id=" + sessionId Slog.v(TAG, "logContextCommitted() with FieldClassification: id=" + sessionId Loading @@ -800,7 +800,8 @@ final class AutofillManagerServiceImpl { + ", changedDatasetIds=" + changedDatasetIds + ", changedDatasetIds=" + changedDatasetIds + ", manuallyFilledFieldIds=" + manuallyFilledFieldIds + ", manuallyFilledFieldIds=" + manuallyFilledFieldIds + ", detectedFieldIds=" + detectedFieldIdsList + ", detectedFieldIds=" + detectedFieldIdsList + ", detectedFieldClassifications=" + detectedFieldClassificationsList); + ", detectedFieldClassifications=" + detectedFieldClassificationsList + ", compatMode=" + compatMode); } } AutofillId[] detectedFieldsIds = null; AutofillId[] detectedFieldsIds = null; FieldClassification[] detectedFieldClassifications = null; FieldClassification[] detectedFieldClassifications = null; Loading @@ -827,7 +828,7 @@ final class AutofillManagerServiceImpl { final int averageScore = (int) ((totalScore * 100) / totalSize); final int averageScore = (int) ((totalScore * 100) / totalSize); mMetricsLogger.write(Helper mMetricsLogger.write(Helper .newLogMaker(MetricsEvent.AUTOFILL_FIELD_CLASSIFICATION_MATCHES, .newLogMaker(MetricsEvent.AUTOFILL_FIELD_CLASSIFICATION_MATCHES, appPackageName, getServicePackageName()) appPackageName, getServicePackageName(), compatMode) .setCounterValue(numberFields) .setCounterValue(numberFields) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_MATCH_SCORE, .addTaggedData(MetricsEvent.FIELD_AUTOFILL_MATCH_SCORE, averageScore)); averageScore)); Loading Loading @@ -1122,7 +1123,7 @@ final class AutofillManagerServiceImpl { /** /** * Called by {@link Session} when service asked to disable autofill for an app. * Called by {@link Session} when service asked to disable autofill for an app. */ */ void disableAutofillForApp(@NonNull String packageName, long duration) { void disableAutofillForApp(@NonNull String packageName, long duration, boolean compatMode) { synchronized (mLock) { synchronized (mLock) { if (mDisabledApps == null) { if (mDisabledApps == null) { mDisabledApps = new ArrayMap<>(1); mDisabledApps = new ArrayMap<>(1); Loading @@ -1135,7 +1136,7 @@ final class AutofillManagerServiceImpl { mDisabledApps.put(packageName, expiration); mDisabledApps.put(packageName, expiration); int intDuration = duration > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) duration; int intDuration = duration > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) duration; mMetricsLogger.write(Helper.newLogMaker(MetricsEvent.AUTOFILL_SERVICE_DISABLED_APP, mMetricsLogger.write(Helper.newLogMaker(MetricsEvent.AUTOFILL_SERVICE_DISABLED_APP, packageName, getServicePackageName()) packageName, getServicePackageName(), compatMode) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_DURATION, intDuration)); .addTaggedData(MetricsEvent.FIELD_AUTOFILL_DURATION, intDuration)); } } } } Loading @@ -1143,7 +1144,8 @@ final class AutofillManagerServiceImpl { /** /** * Called by {@link Session} when service asked to disable autofill an app. * Called by {@link Session} when service asked to disable autofill an app. */ */ void disableAutofillForActivity(@NonNull ComponentName componentName, long duration) { void disableAutofillForActivity(@NonNull ComponentName componentName, long duration, boolean compatMode) { synchronized (mLock) { synchronized (mLock) { if (mDisabledActivities == null) { if (mDisabledActivities == null) { mDisabledActivities = new ArrayMap<>(1); mDisabledActivities = new ArrayMap<>(1); Loading @@ -1160,7 +1162,8 @@ final class AutofillManagerServiceImpl { mMetricsLogger.write(new LogMaker(MetricsEvent.AUTOFILL_SERVICE_DISABLED_ACTIVITY) mMetricsLogger.write(new LogMaker(MetricsEvent.AUTOFILL_SERVICE_DISABLED_ACTIVITY) .setComponentName(componentName) .setComponentName(componentName) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_SERVICE, getServicePackageName()) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_SERVICE, getServicePackageName()) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_DURATION, intDuration)); .addTaggedData(MetricsEvent.FIELD_AUTOFILL_DURATION, intDuration) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_COMPAT_MODE, compatMode ? 1 : 0)); } } } } Loading services/autofill/java/com/android/server/autofill/Helper.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.annotation.Nullable; import android.app.assist.AssistStructure; import android.app.assist.AssistStructure; import android.app.assist.AssistStructure.ViewNode; import android.app.assist.AssistStructure.ViewNode; import android.metrics.LogMaker; import android.metrics.LogMaker; import android.os.Bundle; import android.service.autofill.Dataset; import android.service.autofill.Dataset; import android.util.ArrayMap; import android.util.ArrayMap; import android.util.ArraySet; import android.util.ArraySet; Loading @@ -35,10 +34,7 @@ import com.android.internal.util.ArrayUtils; import java.io.PrintWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.LinkedList; import java.util.Objects; import java.util.Set; public final class Helper { public final class Helper { Loading Loading @@ -119,6 +115,13 @@ public final class Helper { return log; return log; } } @NonNull public static LogMaker newLogMaker(int category, String packageName, String servicePackageName, boolean compatMode) { return newLogMaker(category, packageName, servicePackageName) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_COMPAT_MODE, compatMode ? 1 : 0); } public static void printlnRedactedText(@NonNull PrintWriter pw, @Nullable CharSequence text) { public static void printlnRedactedText(@NonNull PrintWriter pw, @Nullable CharSequence text) { if (text == null) { if (text == null) { pw.println("null"); pw.println("null"); Loading services/autofill/java/com/android/server/autofill/Session.java +10 −8 Original line number Original line Diff line number Diff line Loading @@ -644,9 +644,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState Slog.d(TAG, message.toString()); Slog.d(TAG, message.toString()); } } if ((flags & FillResponse.FLAG_DISABLE_ACTIVITY_ONLY) != 0) { if ((flags & FillResponse.FLAG_DISABLE_ACTIVITY_ONLY) != 0) { mService.disableAutofillForActivity(mComponentName, disableDuration); mService.disableAutofillForActivity(mComponentName, disableDuration, mCompatMode); } else { } else { mService.disableAutofillForApp(mComponentName.getPackageName(), disableDuration); mService.disableAutofillForApp(mComponentName.getPackageName(), disableDuration, mCompatMode); } } sessionFinishedState = AutofillManager.STATE_DISABLED_BY_SERVICE; sessionFinishedState = AutofillManager.STATE_DISABLED_BY_SERVICE; } } Loading Loading @@ -1251,7 +1252,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mService.logContextCommittedLocked(id, mClientState, mSelectedDatasetIds, mService.logContextCommittedLocked(id, mClientState, mSelectedDatasetIds, ignoredDatasets, changedFieldIds, changedDatasetIds, ignoredDatasets, changedFieldIds, changedDatasetIds, manuallyFilledFieldIds, manuallyFilledDatasetIds, manuallyFilledFieldIds, manuallyFilledDatasetIds, mComponentName.getPackageName()); mComponentName.getPackageName(), mCompatMode); } } } } Loading Loading @@ -1306,7 +1307,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mService.logContextCommittedLocked(id, mClientState, mSelectedDatasetIds, mService.logContextCommittedLocked(id, mClientState, mSelectedDatasetIds, ignoredDatasets, changedFieldIds, changedDatasetIds, ignoredDatasets, changedFieldIds, changedDatasetIds, manuallyFilledFieldIds, manuallyFilledDatasetIds, manuallyFilledFieldIds, manuallyFilledDatasetIds, mComponentName.getPackageName()); mComponentName.getPackageName(), mCompatMode); return; return; } } final Scores scores = result.getParcelable(EXTRA_SCORES); final Scores scores = result.getParcelable(EXTRA_SCORES); Loading Loading @@ -1371,7 +1372,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mService.logContextCommittedLocked(id, mClientState, mSelectedDatasetIds, mService.logContextCommittedLocked(id, mClientState, mSelectedDatasetIds, ignoredDatasets, changedFieldIds, changedDatasetIds, manuallyFilledFieldIds, ignoredDatasets, changedFieldIds, changedDatasetIds, manuallyFilledFieldIds, manuallyFilledDatasetIds, detectedFieldIds, detectedFieldClassifications, manuallyFilledDatasetIds, detectedFieldIds, detectedFieldClassifications, mComponentName.getPackageName()); mComponentName.getPackageName(), mCompatMode); }); }); fcStrategy.getScores(callback, algorithm, algorithmArgs, currentValues, userValues); fcStrategy.getScores(callback, algorithm, algorithmArgs, currentValues, userValues); Loading Loading @@ -1602,7 +1603,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState getUiForShowing().showSaveUi(mService.getServiceLabel(), mService.getServiceIcon(), getUiForShowing().showSaveUi(mService.getServiceLabel(), mService.getServiceIcon(), mService.getServicePackageName(), saveInfo, this, mService.getServicePackageName(), saveInfo, this, mComponentName.getPackageName(), this, mComponentName.getPackageName(), this, mPendingSaveUi); mPendingSaveUi, mCompatMode); if (client != null) { if (client != null) { try { try { client.setSaveUiState(id, true); client.setSaveUiState(id, true); Loading Loading @@ -2080,7 +2081,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState getUiForShowing().showFillUi(filledId, response, filterText, getUiForShowing().showFillUi(filledId, response, filterText, mService.getServicePackageName(), mComponentName.getPackageName(), mService.getServicePackageName(), mComponentName.getPackageName(), mService.getServiceLabel(), mService.getServiceIcon(), this); mService.getServiceLabel(), mService.getServiceIcon(), this, mCompatMode); synchronized (mLock) { synchronized (mLock) { if (mUiShownTime == 0) { if (mUiShownTime == 0) { Loading Loading @@ -2717,7 +2718,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } } private LogMaker newLogMaker(int category, String servicePackageName) { private LogMaker newLogMaker(int category, String servicePackageName) { return Helper.newLogMaker(category, mComponentName.getPackageName(), servicePackageName); return Helper.newLogMaker(category, mComponentName.getPackageName(), servicePackageName, mCompatMode); } } private void writeLog(int category) { private void writeLog(int category) { Loading Loading
core/java/android/view/autofill/AutofillManager.java +10 −6 Original line number Original line Diff line number Diff line Loading @@ -1132,8 +1132,7 @@ public final class AutofillManager { if (mSaveTriggerId != null && mSaveTriggerId.equals(id)) { if (mSaveTriggerId != null && mSaveTriggerId.equals(id)) { if (sDebug) Log.d(TAG, "triggering commit by click of " + id); if (sDebug) Log.d(TAG, "triggering commit by click of " + id); commitLocked(); commitLocked(); mMetricsLogger.action(MetricsEvent.AUTOFILL_SAVE_EXPLICITLY_TRIGGERED, mMetricsLogger.write(newLog(MetricsEvent.AUTOFILL_SAVE_EXPLICITLY_TRIGGERED)); mContext.getPackageName()); } } } } } } Loading Loading @@ -1893,12 +1892,17 @@ public final class AutofillManager { } } } } final LogMaker log = new LogMaker(MetricsEvent.AUTOFILL_DATASET_APPLIED) mMetricsLogger.write(newLog(MetricsEvent.AUTOFILL_DATASET_APPLIED) .setPackageName(mContext.getPackageName()) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_NUM_VALUES, itemCount) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_NUM_VALUES, itemCount) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_NUM_VIEWS_FILLED, numApplied); .addTaggedData(MetricsEvent.FIELD_AUTOFILL_NUM_VIEWS_FILLED, numApplied)); mMetricsLogger.write(log); } } } private LogMaker newLog(int category) { return new LogMaker(category) .setPackageName(mContext.getPackageName()) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_COMPAT_MODE, isCompatibilityModeEnabledLocked() ? 1 : 0); } } /** /** Loading
proto/src/metrics_constants.proto +43 −0 Original line number Original line Diff line number Diff line Loading @@ -3967,6 +3967,7 @@ message MetricsEvent { // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // NOTE: starting on OS P, it also added the following field: // NOTE: starting on OS P, it also added the following field: // Tag FIELD_FLAGS - Flags used to start the session // Tag FIELD_FLAGS - Flags used to start the session // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SESSION_STARTED = 906; AUTOFILL_SESSION_STARTED = 906; // An autofill request was processed by a service // An autofill request was processed by a service Loading @@ -3980,6 +3981,7 @@ message MetricsEvent { // Type TYPE_CLOSE: Service returned a null response. // Type TYPE_CLOSE: Service returned a null response. // Tag FIELD_AUTOFILL_NUM_FIELD_CLASSIFICATION_IDS: if service requested field classification, // Tag FIELD_AUTOFILL_NUM_FIELD_CLASSIFICATION_IDS: if service requested field classification, // number of entries field ids in the request. // number of entries field ids in the request. // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_REQUEST = 907; AUTOFILL_REQUEST = 907; // Tag of a field for a package of an autofill service // Tag of a field for a package of an autofill service Loading @@ -3998,6 +4000,7 @@ message MetricsEvent { // Tag FIELD_AUTOFILL_NUM_DATASETS: The number of datasets shown // Tag FIELD_AUTOFILL_NUM_DATASETS: The number of datasets shown // NOTE: starting on OS P, it also added the following field: // NOTE: starting on OS P, it also added the following field: // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_FILL_UI = 910; AUTOFILL_FILL_UI = 910; // Tag of a field for the length of the filter text // Tag of a field for the length of the filter text Loading @@ -4005,12 +4008,17 @@ message MetricsEvent { // An autofill authentication succeeded // An autofill authentication succeeded // Package: Package of app that was autofilled // Package: Package of app that was autofilled // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_AUTHENTICATED = 912; AUTOFILL_AUTHENTICATED = 912; // An activity was autofilled and all values could be applied // An activity was autofilled and all values could be applied // Package: Package of app that is autofilled // Package: Package of app that is autofilled // Tag FIELD_AUTOFILL_NUM_VALUES: Number of values that were suggested to be autofilled // Tag FIELD_AUTOFILL_NUM_VALUES: Number of values that were suggested to be autofilled // Tag FIELD_AUTOFILL_NUM_VIEWS_FILLED: Number of views that could be filled // Tag FIELD_AUTOFILL_NUM_VIEWS_FILLED: Number of views that could be filled // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_DATASET_APPLIED = 913; AUTOFILL_DATASET_APPLIED = 913; // Tag of a field for the number values to be filled in // Tag of a field for the number values to be filled in Loading @@ -4027,6 +4035,7 @@ message MetricsEvent { // Tag FIELD_AUTOFILL_NUM_IDS: The number of ids that are saved // Tag FIELD_AUTOFILL_NUM_IDS: The number of ids that are saved // NOTE: starting on OS P, it also added the following field: // NOTE: starting on OS P, it also added the following field: // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SAVE_UI = 916; AUTOFILL_SAVE_UI = 916; // Tag of a field for the number of saveable ids // Tag of a field for the number of saveable ids Loading @@ -4038,10 +4047,14 @@ message MetricsEvent { // Type TYPE_FAILURE: The request failed // Type TYPE_FAILURE: The request failed // Package: Package of app that was autofilled // Package: Package of app that was autofilled // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_DATA_SAVE_REQUEST = 918; AUTOFILL_DATA_SAVE_REQUEST = 918; // An auto-fill session was finished // An auto-fill session was finished // Package: Package of app that was autofilled // Package: Package of app that was autofilled // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SESSION_FINISHED = 919; AUTOFILL_SESSION_FINISHED = 919; // meta-event: a reader has checkpointed the log here. // meta-event: a reader has checkpointed the log here. Loading Loading @@ -4167,6 +4180,8 @@ message MetricsEvent { // Package: Real package of the app being autofilled // Package: Real package of the app being autofilled // Tag FIELD_AUTOFILL_SERVICE: Package of the autofill service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of the autofill service that processed the request // TAG FIELD_AUTOFILL_FORGED_COMPONENT_NAME: Component name being forged // TAG FIELD_AUTOFILL_FORGED_COMPONENT_NAME: Component name being forged // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_FORGED_COMPONENT_ATTEMPT = 948; AUTOFILL_FORGED_COMPONENT_ATTEMPT = 948; // FIELD - The component that an app tried tro forged. // FIELD - The component that an app tried tro forged. Loading Loading @@ -4624,6 +4639,8 @@ message MetricsEvent { // OS: O MR // OS: O MR // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_PREVIOUS_LENGTH: the previous length of the value // Tag FIELD_AUTOFILL_PREVIOUS_LENGTH: the previous length of the value // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_VALUE_RESET = 1124; AUTOFILL_VALUE_RESET = 1124; // Tag of AUTOFILL_VALUE_RESET // Tag of AUTOFILL_VALUE_RESET Loading @@ -4634,18 +4651,24 @@ message MetricsEvent { // Package: Package of app that was autofilled // Package: Package of app that was autofilled // OS: O MR // OS: O MR // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_DATASET_AUTHENTICATED = 1126; AUTOFILL_DATASET_AUTHENTICATED = 1126; // An autofill service provided an invalid dataset authentication // An autofill service provided an invalid dataset authentication // Package: Package of app that was autofilled // Package: Package of app that was autofilled // OS: O MR // OS: O MR // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_INVALID_DATASET_AUTHENTICATION = 1127; AUTOFILL_INVALID_DATASET_AUTHENTICATION = 1127; // An autofill service provided an invalid authentication extra // An autofill service provided an invalid authentication extra // Package: Package of app that was autofilled // Package: Package of app that was autofilled // OS: O MR // OS: O MR // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_INVALID_AUTHENTICATION = 1128; AUTOFILL_INVALID_AUTHENTICATION = 1128; // An autofill service used a custom description (using RemoteViews) in the autofill save UI // An autofill service used a custom description (using RemoteViews) in the autofill save UI Loading @@ -4653,6 +4676,8 @@ message MetricsEvent { // OS: O MR // OS: O MR // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SAVE_CUSTOM_DESCRIPTION = 1129; AUTOFILL_SAVE_CUSTOM_DESCRIPTION = 1129; // FIELD - Type of save object passed by the service when the Save UI is shown // FIELD - Type of save object passed by the service when the Save UI is shown Loading @@ -4664,6 +4689,8 @@ message MetricsEvent { // OS: O MR // OS: O MR // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SAVE_CUSTOM_SUBTITLE = 1131; AUTOFILL_SAVE_CUSTOM_SUBTITLE = 1131; // User tapped a link in the custom description of the autofill save UI provided by an autofill service // User tapped a link in the custom description of the autofill save UI provided by an autofill service Loading @@ -4674,6 +4701,8 @@ message MetricsEvent { // Type TYPE_FAILURE: The link could not launc an activity // Type TYPE_FAILURE: The link could not launc an activity // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SAVE_LINK_TAPPED = 1132; AUTOFILL_SAVE_LINK_TAPPED = 1132; // Result of the validation on save when an autofill service provided a validator // Result of the validation on save when an autofill service provided a validator Loading @@ -4684,6 +4713,8 @@ message MetricsEvent { // Type TYPE_DISMISS: The validation failed // Type TYPE_DISMISS: The validation failed // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // Tag FIELD_AUTOFILL_SAVE_TYPE: Type of save object passed by the service // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SAVE_VALIDATION = 1133; AUTOFILL_SAVE_VALIDATION = 1133; // Result of an operation in the autofill save UI after the user tapped a link in the custom description // Result of an operation in the autofill save UI after the user tapped a link in the custom description Loading @@ -4693,6 +4724,8 @@ message MetricsEvent { // Type TYPE_OPEN: The autofill save UI was restored // Type TYPE_OPEN: The autofill save UI was restored // Type TYPE_DISMISS: The autofill save UI was destroyed // Type TYPE_DISMISS: The autofill save UI was destroyed // Type TYPE_FAILURE: An invalid opperation was reported by the app's AutofillManager // Type TYPE_FAILURE: An invalid opperation was reported by the app's AutofillManager // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_PENDING_SAVE_UI_OPERATION = 1134; AUTOFILL_PENDING_SAVE_UI_OPERATION = 1134; // Autofill service called API that disables itself // Autofill service called API that disables itself Loading @@ -4705,6 +4738,8 @@ message MetricsEvent { // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Package: Package of the autofill service // Package: Package of the autofill service // OS: O MR // OS: O MR // NOTE: starting on OS P, it also added the following field: // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_UI_LATENCY = 1136; AUTOFILL_UI_LATENCY = 1136; // Action: the snooze leave-behind was shown after the user clicked the snooze icon // Action: the snooze leave-behind was shown after the user clicked the snooze icon Loading Loading @@ -4872,12 +4907,14 @@ message MetricsEvent { // Package: Package of app that is autofilled // Package: Package of app that is autofilled // OS: P // OS: P // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_EXPLICIT_SAVE_TRIGGER_DEFINITION = 1228; AUTOFILL_EXPLICIT_SAVE_TRIGGER_DEFINITION = 1228; // The autofill context was commited when the user clicked a view explicitly marked by the // The autofill context was commited when the user clicked a view explicitly marked by the // service as committing it // service as committing it // Package: Package of app that is autofilled // Package: Package of app that is autofilled // OS: P // OS: P // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SAVE_EXPLICITLY_TRIGGERED = 1229; AUTOFILL_SAVE_EXPLICITLY_TRIGGERED = 1229; // OPEN: Settings > Network & Internet > Mobile network > Wi-Fi calling // OPEN: Settings > Network & Internet > Mobile network > Wi-Fi calling Loading @@ -4890,6 +4927,7 @@ message MetricsEvent { // OS: P // OS: P // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_DURATION: duration (in ms) that autofill will be disabled // Tag FIELD_AUTOFILL_DURATION: duration (in ms) that autofill will be disabled // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SERVICE_DISABLED_APP = 1231; AUTOFILL_SERVICE_DISABLED_APP = 1231; // An autofill service asked to disable autofill for a given activity. // An autofill service asked to disable autofill for a given activity. Loading @@ -4898,6 +4936,7 @@ message MetricsEvent { // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_CLASS_NAME: Class name of the activity that is being disabled for autofill // Tag FIELD_CLASS_NAME: Class name of the activity that is being disabled for autofill // Tag FIELD_AUTOFILL_DURATION: duration (in ms) that autofill will be disabled // Tag FIELD_AUTOFILL_DURATION: duration (in ms) that autofill will be disabled // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_SERVICE_DISABLED_ACTIVITY = 1232; AUTOFILL_SERVICE_DISABLED_ACTIVITY = 1232; // ACTION: Stop an app and turn on background check // ACTION: Stop an app and turn on background check Loading Loading @@ -5109,6 +5148,7 @@ message MetricsEvent { // OS: P // OS: P // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Tag FIELD_AUTOFILL_MATCH_SCORE: Average score of the matches, in the range of 0 to 100 // Tag FIELD_AUTOFILL_MATCH_SCORE: Average score of the matches, in the range of 0 to 100 // Type FIELD_AUTOFILL_COMPAT_MODE: package is being autofilled on compatibility mode. AUTOFILL_FIELD_CLASSIFICATION_MATCHES = 1273; AUTOFILL_FIELD_CLASSIFICATION_MATCHES = 1273; // Tag used to report autofill field classification scores // Tag used to report autofill field classification scores Loading Loading @@ -5775,6 +5815,9 @@ message MetricsEvent { // OS: P // OS: P ACTION_STORAGE_MIGRATE_LATER = 1413; ACTION_STORAGE_MIGRATE_LATER = 1413; // Tag used to report whether an activity is being autofilled on compatibility mode. FIELD_AUTOFILL_COMPAT_MODE = 1414; // ---- End P Constants, all P constants go above this line ---- // ---- End P Constants, all P constants go above this line ---- // Add new aosp constants above this line. // Add new aosp constants above this line. // END OF AOSP CONSTANTS // END OF AOSP CONSTANTS Loading
services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +15 −12 Original line number Original line Diff line number Diff line Loading @@ -504,7 +504,7 @@ final class AutofillManagerServiceImpl { sessionId = sRandom.nextInt(); sessionId = sRandom.nextInt(); } while (sessionId == NO_SESSION || mSessions.indexOfKey(sessionId) >= 0); } while (sessionId == NO_SESSION || mSessions.indexOfKey(sessionId) >= 0); assertCallerLocked(componentName); assertCallerLocked(componentName, compatMode); final Session newSession = new Session(this, mUi, mContext, mHandler, mUserId, mLock, final Session newSession = new Session(this, mUi, mContext, mHandler, mUserId, mLock, sessionId, uid, activityToken, appCallbackToken, hasCallback, mUiLatencyHistory, sessionId, uid, activityToken, appCallbackToken, hasCallback, mUiLatencyHistory, Loading @@ -518,7 +518,7 @@ final class AutofillManagerServiceImpl { /** /** * Asserts the component is owned by the caller. * Asserts the component is owned by the caller. */ */ private void assertCallerLocked(@NonNull ComponentName componentName) { private void assertCallerLocked(@NonNull ComponentName componentName, boolean compatMode) { final String packageName = componentName.getPackageName(); final String packageName = componentName.getPackageName(); final PackageManager pm = mContext.getPackageManager(); final PackageManager pm = mContext.getPackageManager(); final int callingUid = Binder.getCallingUid(); final int callingUid = Binder.getCallingUid(); Loading @@ -536,7 +536,7 @@ final class AutofillManagerServiceImpl { + ") passed component (" + componentName + ") owned by UID " + packageUid); + ") passed component (" + componentName + ") owned by UID " + packageUid); mMetricsLogger.write( mMetricsLogger.write( Helper.newLogMaker(MetricsEvent.AUTOFILL_FORGED_COMPONENT_ATTEMPT, Helper.newLogMaker(MetricsEvent.AUTOFILL_FORGED_COMPONENT_ATTEMPT, callingPackage, getServicePackageName()) callingPackage, getServicePackageName(), compatMode) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_FORGED_COMPONENT_NAME, .addTaggedData(MetricsEvent.FIELD_AUTOFILL_FORGED_COMPONENT_NAME, componentName == null ? "null" : componentName.flattenToShortString())); componentName == null ? "null" : componentName.flattenToShortString())); Loading Loading @@ -774,10 +774,10 @@ final class AutofillManagerServiceImpl { @Nullable ArrayList<String> changedDatasetIds, @Nullable ArrayList<String> changedDatasetIds, @Nullable ArrayList<AutofillId> manuallyFilledFieldIds, @Nullable ArrayList<AutofillId> manuallyFilledFieldIds, @Nullable ArrayList<ArrayList<String>> manuallyFilledDatasetIds, @Nullable ArrayList<ArrayList<String>> manuallyFilledDatasetIds, @NonNull String appPackageName) { @NonNull String appPackageName, boolean compatMode) { logContextCommittedLocked(sessionId, clientState, selectedDatasets, ignoredDatasets, logContextCommittedLocked(sessionId, clientState, selectedDatasets, ignoredDatasets, changedFieldIds, changedDatasetIds, manuallyFilledFieldIds, changedFieldIds, changedDatasetIds, manuallyFilledFieldIds, manuallyFilledDatasetIds, null, null, appPackageName); manuallyFilledDatasetIds, null, null, appPackageName, compatMode); } } @GuardedBy("mLock") @GuardedBy("mLock") Loading @@ -790,7 +790,7 @@ final class AutofillManagerServiceImpl { @Nullable ArrayList<ArrayList<String>> manuallyFilledDatasetIds, @Nullable ArrayList<ArrayList<String>> manuallyFilledDatasetIds, @Nullable ArrayList<AutofillId> detectedFieldIdsList, @Nullable ArrayList<AutofillId> detectedFieldIdsList, @Nullable ArrayList<FieldClassification> detectedFieldClassificationsList, @Nullable ArrayList<FieldClassification> detectedFieldClassificationsList, @NonNull String appPackageName) { @NonNull String appPackageName, boolean compatMode) { if (isValidEventLocked("logDatasetNotSelected()", sessionId)) { if (isValidEventLocked("logDatasetNotSelected()", sessionId)) { if (sVerbose) { if (sVerbose) { Slog.v(TAG, "logContextCommitted() with FieldClassification: id=" + sessionId Slog.v(TAG, "logContextCommitted() with FieldClassification: id=" + sessionId Loading @@ -800,7 +800,8 @@ final class AutofillManagerServiceImpl { + ", changedDatasetIds=" + changedDatasetIds + ", changedDatasetIds=" + changedDatasetIds + ", manuallyFilledFieldIds=" + manuallyFilledFieldIds + ", manuallyFilledFieldIds=" + manuallyFilledFieldIds + ", detectedFieldIds=" + detectedFieldIdsList + ", detectedFieldIds=" + detectedFieldIdsList + ", detectedFieldClassifications=" + detectedFieldClassificationsList); + ", detectedFieldClassifications=" + detectedFieldClassificationsList + ", compatMode=" + compatMode); } } AutofillId[] detectedFieldsIds = null; AutofillId[] detectedFieldsIds = null; FieldClassification[] detectedFieldClassifications = null; FieldClassification[] detectedFieldClassifications = null; Loading @@ -827,7 +828,7 @@ final class AutofillManagerServiceImpl { final int averageScore = (int) ((totalScore * 100) / totalSize); final int averageScore = (int) ((totalScore * 100) / totalSize); mMetricsLogger.write(Helper mMetricsLogger.write(Helper .newLogMaker(MetricsEvent.AUTOFILL_FIELD_CLASSIFICATION_MATCHES, .newLogMaker(MetricsEvent.AUTOFILL_FIELD_CLASSIFICATION_MATCHES, appPackageName, getServicePackageName()) appPackageName, getServicePackageName(), compatMode) .setCounterValue(numberFields) .setCounterValue(numberFields) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_MATCH_SCORE, .addTaggedData(MetricsEvent.FIELD_AUTOFILL_MATCH_SCORE, averageScore)); averageScore)); Loading Loading @@ -1122,7 +1123,7 @@ final class AutofillManagerServiceImpl { /** /** * Called by {@link Session} when service asked to disable autofill for an app. * Called by {@link Session} when service asked to disable autofill for an app. */ */ void disableAutofillForApp(@NonNull String packageName, long duration) { void disableAutofillForApp(@NonNull String packageName, long duration, boolean compatMode) { synchronized (mLock) { synchronized (mLock) { if (mDisabledApps == null) { if (mDisabledApps == null) { mDisabledApps = new ArrayMap<>(1); mDisabledApps = new ArrayMap<>(1); Loading @@ -1135,7 +1136,7 @@ final class AutofillManagerServiceImpl { mDisabledApps.put(packageName, expiration); mDisabledApps.put(packageName, expiration); int intDuration = duration > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) duration; int intDuration = duration > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) duration; mMetricsLogger.write(Helper.newLogMaker(MetricsEvent.AUTOFILL_SERVICE_DISABLED_APP, mMetricsLogger.write(Helper.newLogMaker(MetricsEvent.AUTOFILL_SERVICE_DISABLED_APP, packageName, getServicePackageName()) packageName, getServicePackageName(), compatMode) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_DURATION, intDuration)); .addTaggedData(MetricsEvent.FIELD_AUTOFILL_DURATION, intDuration)); } } } } Loading @@ -1143,7 +1144,8 @@ final class AutofillManagerServiceImpl { /** /** * Called by {@link Session} when service asked to disable autofill an app. * Called by {@link Session} when service asked to disable autofill an app. */ */ void disableAutofillForActivity(@NonNull ComponentName componentName, long duration) { void disableAutofillForActivity(@NonNull ComponentName componentName, long duration, boolean compatMode) { synchronized (mLock) { synchronized (mLock) { if (mDisabledActivities == null) { if (mDisabledActivities == null) { mDisabledActivities = new ArrayMap<>(1); mDisabledActivities = new ArrayMap<>(1); Loading @@ -1160,7 +1162,8 @@ final class AutofillManagerServiceImpl { mMetricsLogger.write(new LogMaker(MetricsEvent.AUTOFILL_SERVICE_DISABLED_ACTIVITY) mMetricsLogger.write(new LogMaker(MetricsEvent.AUTOFILL_SERVICE_DISABLED_ACTIVITY) .setComponentName(componentName) .setComponentName(componentName) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_SERVICE, getServicePackageName()) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_SERVICE, getServicePackageName()) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_DURATION, intDuration)); .addTaggedData(MetricsEvent.FIELD_AUTOFILL_DURATION, intDuration) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_COMPAT_MODE, compatMode ? 1 : 0)); } } } } Loading
services/autofill/java/com/android/server/autofill/Helper.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.annotation.Nullable; import android.app.assist.AssistStructure; import android.app.assist.AssistStructure; import android.app.assist.AssistStructure.ViewNode; import android.app.assist.AssistStructure.ViewNode; import android.metrics.LogMaker; import android.metrics.LogMaker; import android.os.Bundle; import android.service.autofill.Dataset; import android.service.autofill.Dataset; import android.util.ArrayMap; import android.util.ArrayMap; import android.util.ArraySet; import android.util.ArraySet; Loading @@ -35,10 +34,7 @@ import com.android.internal.util.ArrayUtils; import java.io.PrintWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.LinkedList; import java.util.Objects; import java.util.Set; public final class Helper { public final class Helper { Loading Loading @@ -119,6 +115,13 @@ public final class Helper { return log; return log; } } @NonNull public static LogMaker newLogMaker(int category, String packageName, String servicePackageName, boolean compatMode) { return newLogMaker(category, packageName, servicePackageName) .addTaggedData(MetricsEvent.FIELD_AUTOFILL_COMPAT_MODE, compatMode ? 1 : 0); } public static void printlnRedactedText(@NonNull PrintWriter pw, @Nullable CharSequence text) { public static void printlnRedactedText(@NonNull PrintWriter pw, @Nullable CharSequence text) { if (text == null) { if (text == null) { pw.println("null"); pw.println("null"); Loading
services/autofill/java/com/android/server/autofill/Session.java +10 −8 Original line number Original line Diff line number Diff line Loading @@ -644,9 +644,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState Slog.d(TAG, message.toString()); Slog.d(TAG, message.toString()); } } if ((flags & FillResponse.FLAG_DISABLE_ACTIVITY_ONLY) != 0) { if ((flags & FillResponse.FLAG_DISABLE_ACTIVITY_ONLY) != 0) { mService.disableAutofillForActivity(mComponentName, disableDuration); mService.disableAutofillForActivity(mComponentName, disableDuration, mCompatMode); } else { } else { mService.disableAutofillForApp(mComponentName.getPackageName(), disableDuration); mService.disableAutofillForApp(mComponentName.getPackageName(), disableDuration, mCompatMode); } } sessionFinishedState = AutofillManager.STATE_DISABLED_BY_SERVICE; sessionFinishedState = AutofillManager.STATE_DISABLED_BY_SERVICE; } } Loading Loading @@ -1251,7 +1252,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mService.logContextCommittedLocked(id, mClientState, mSelectedDatasetIds, mService.logContextCommittedLocked(id, mClientState, mSelectedDatasetIds, ignoredDatasets, changedFieldIds, changedDatasetIds, ignoredDatasets, changedFieldIds, changedDatasetIds, manuallyFilledFieldIds, manuallyFilledDatasetIds, manuallyFilledFieldIds, manuallyFilledDatasetIds, mComponentName.getPackageName()); mComponentName.getPackageName(), mCompatMode); } } } } Loading Loading @@ -1306,7 +1307,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mService.logContextCommittedLocked(id, mClientState, mSelectedDatasetIds, mService.logContextCommittedLocked(id, mClientState, mSelectedDatasetIds, ignoredDatasets, changedFieldIds, changedDatasetIds, ignoredDatasets, changedFieldIds, changedDatasetIds, manuallyFilledFieldIds, manuallyFilledDatasetIds, manuallyFilledFieldIds, manuallyFilledDatasetIds, mComponentName.getPackageName()); mComponentName.getPackageName(), mCompatMode); return; return; } } final Scores scores = result.getParcelable(EXTRA_SCORES); final Scores scores = result.getParcelable(EXTRA_SCORES); Loading Loading @@ -1371,7 +1372,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mService.logContextCommittedLocked(id, mClientState, mSelectedDatasetIds, mService.logContextCommittedLocked(id, mClientState, mSelectedDatasetIds, ignoredDatasets, changedFieldIds, changedDatasetIds, manuallyFilledFieldIds, ignoredDatasets, changedFieldIds, changedDatasetIds, manuallyFilledFieldIds, manuallyFilledDatasetIds, detectedFieldIds, detectedFieldClassifications, manuallyFilledDatasetIds, detectedFieldIds, detectedFieldClassifications, mComponentName.getPackageName()); mComponentName.getPackageName(), mCompatMode); }); }); fcStrategy.getScores(callback, algorithm, algorithmArgs, currentValues, userValues); fcStrategy.getScores(callback, algorithm, algorithmArgs, currentValues, userValues); Loading Loading @@ -1602,7 +1603,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState getUiForShowing().showSaveUi(mService.getServiceLabel(), mService.getServiceIcon(), getUiForShowing().showSaveUi(mService.getServiceLabel(), mService.getServiceIcon(), mService.getServicePackageName(), saveInfo, this, mService.getServicePackageName(), saveInfo, this, mComponentName.getPackageName(), this, mComponentName.getPackageName(), this, mPendingSaveUi); mPendingSaveUi, mCompatMode); if (client != null) { if (client != null) { try { try { client.setSaveUiState(id, true); client.setSaveUiState(id, true); Loading Loading @@ -2080,7 +2081,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState getUiForShowing().showFillUi(filledId, response, filterText, getUiForShowing().showFillUi(filledId, response, filterText, mService.getServicePackageName(), mComponentName.getPackageName(), mService.getServicePackageName(), mComponentName.getPackageName(), mService.getServiceLabel(), mService.getServiceIcon(), this); mService.getServiceLabel(), mService.getServiceIcon(), this, mCompatMode); synchronized (mLock) { synchronized (mLock) { if (mUiShownTime == 0) { if (mUiShownTime == 0) { Loading Loading @@ -2717,7 +2718,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } } private LogMaker newLogMaker(int category, String servicePackageName) { private LogMaker newLogMaker(int category, String servicePackageName) { return Helper.newLogMaker(category, mComponentName.getPackageName(), servicePackageName); return Helper.newLogMaker(category, mComponentName.getPackageName(), servicePackageName, mCompatMode); } } private void writeLog(int category) { private void writeLog(int category) { Loading