1 /* 2 * Copyright (C) 2024 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 static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_FINAL_NO_UID_REPORTED__OEM_UI_USAGE_STATUS__OEM_UI_USAGE_STATUS_UNKNOWN; 20 import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_FINAL_NO_UID_REPORTED__OEM_UI_USAGE_STATUS__OEM_UI_USAGE_STATUS_SUCCESS; 21 import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_FINAL_NO_UID_REPORTED__OEM_UI_USAGE_STATUS__OEM_UI_USAGE_STATUS_NOT_SPECIFIED; 22 import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_FINAL_NO_UID_REPORTED__OEM_UI_USAGE_STATUS__OEM_UI_USAGE_STATUS_SPECIFIED_BUT_NOT_FOUND; 23 import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_FINAL_NO_UID_REPORTED__OEM_UI_USAGE_STATUS__OEM_UI_USAGE_STATUS_SPECIFIED_BUT_NOT_ENABLED; 24 25 import android.credentials.selection.IntentCreationResult; 26 27 /** 28 * Result of attempting to use the config_oemCredentialManagerDialogComponent as the Credential 29 * Manager UI. 30 */ 31 public enum OemUiUsageStatus { 32 UNKNOWN(CREDENTIAL_MANAGER_FINAL_NO_UID_REPORTED__OEM_UI_USAGE_STATUS__OEM_UI_USAGE_STATUS_UNKNOWN), 33 SUCCESS(CREDENTIAL_MANAGER_FINAL_NO_UID_REPORTED__OEM_UI_USAGE_STATUS__OEM_UI_USAGE_STATUS_SUCCESS), 34 FAILURE_NOT_SPECIFIED(CREDENTIAL_MANAGER_FINAL_NO_UID_REPORTED__OEM_UI_USAGE_STATUS__OEM_UI_USAGE_STATUS_NOT_SPECIFIED), 35 FAILURE_SPECIFIED_BUT_NOT_FOUND(CREDENTIAL_MANAGER_FINAL_NO_UID_REPORTED__OEM_UI_USAGE_STATUS__OEM_UI_USAGE_STATUS_SPECIFIED_BUT_NOT_FOUND), 36 FAILURE_SPECIFIED_BUT_NOT_ENABLED(CREDENTIAL_MANAGER_FINAL_NO_UID_REPORTED__OEM_UI_USAGE_STATUS__OEM_UI_USAGE_STATUS_SPECIFIED_BUT_NOT_ENABLED); 37 38 private final int mLoggingInt; 39 OemUiUsageStatus(int loggingInt)40 OemUiUsageStatus(int loggingInt) { 41 mLoggingInt = loggingInt; 42 } 43 getLoggingInt()44 public int getLoggingInt() { 45 return mLoggingInt; 46 } 47 48 /** Factory method. */ createFrom(IntentCreationResult.OemUiUsageStatus from)49 public static OemUiUsageStatus createFrom(IntentCreationResult.OemUiUsageStatus from) { 50 switch (from) { 51 case UNKNOWN: 52 return OemUiUsageStatus.UNKNOWN; 53 case SUCCESS: 54 return OemUiUsageStatus.SUCCESS; 55 case OEM_UI_CONFIG_NOT_SPECIFIED: 56 return OemUiUsageStatus.FAILURE_NOT_SPECIFIED; 57 case OEM_UI_CONFIG_SPECIFIED_BUT_NOT_FOUND: 58 return OemUiUsageStatus.FAILURE_SPECIFIED_BUT_NOT_FOUND; 59 case OEM_UI_CONFIG_SPECIFIED_FOUND_BUT_NOT_ENABLED: 60 return OemUiUsageStatus.FAILURE_SPECIFIED_BUT_NOT_ENABLED; 61 } 62 return OemUiUsageStatus.UNKNOWN; 63 } 64 } 65