1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.credentials.metrics; 18 19 import com.android.server.credentials.metrics.shared.ResponseCollective; 20 21 import java.util.Map; 22 23 /** 24 * Encapsulates an authentication entry click atom, as a part of track 2. 25 * Contains information about what was collected from the authentication entry output. 26 */ 27 public class BrowsedAuthenticationMetric { 28 private static final String TAG = "AuthenticationMetric"; 29 // The session id of this provider known flow related metric 30 private final int mSessionIdProvider; 31 // The provider associated with the press, defaults to -1 32 private int mProviderUid = -1; 33 34 // The response objects collected for this authentication entry click, default empty 35 private ResponseCollective mAuthEntryCollective = new ResponseCollective(Map.of(), Map.of()); 36 37 // Indicates if an exception was thrown by this provider, false by default 38 private boolean mHasException = false; 39 // Indicates the framework only exception belonging to this provider, defaults to empty string 40 private String mFrameworkException = ""; 41 // The status of this particular provider 42 private int mProviderStatus = -1; 43 // Indicates if this provider returned from the authentication entry query, default false 44 private boolean mAuthReturned = false; 45 BrowsedAuthenticationMetric(int sessionIdProvider)46 public BrowsedAuthenticationMetric(int sessionIdProvider) { 47 mSessionIdProvider = sessionIdProvider; 48 } 49 getSessionIdProvider()50 public int getSessionIdProvider() { 51 return mSessionIdProvider; 52 } 53 setProviderUid(int providerUid)54 public void setProviderUid(int providerUid) { 55 mProviderUid = providerUid; 56 } 57 getProviderUid()58 public int getProviderUid() { 59 return mProviderUid; 60 } 61 setAuthEntryCollective( ResponseCollective authEntryCollective)62 public void setAuthEntryCollective( 63 ResponseCollective authEntryCollective) { 64 this.mAuthEntryCollective = authEntryCollective; 65 } 66 getAuthEntryCollective()67 public ResponseCollective getAuthEntryCollective() { 68 return mAuthEntryCollective; 69 } 70 setHasException(boolean hasException)71 public void setHasException(boolean hasException) { 72 mHasException = hasException; 73 } 74 setFrameworkException(String frameworkException)75 public void setFrameworkException(String frameworkException) { 76 mFrameworkException = frameworkException; 77 } 78 setProviderStatus(int providerStatus)79 public void setProviderStatus(int providerStatus) { 80 mProviderStatus = providerStatus; 81 } 82 setAuthReturned(boolean authReturned)83 public void setAuthReturned(boolean authReturned) { 84 mAuthReturned = authReturned; 85 } 86 isAuthReturned()87 public boolean isAuthReturned() { 88 return mAuthReturned; 89 } 90 getProviderStatus()91 public int getProviderStatus() { 92 return mProviderStatus; 93 } 94 getFrameworkException()95 public String getFrameworkException() { 96 return mFrameworkException; 97 } 98 isHasException()99 public boolean isHasException() { 100 return mHasException; 101 } 102 } 103