• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.adservices.service.consent;
18 
19 import com.android.adservices.service.common.compat.FileCompatUtils;
20 
21 /** ConsentManager related Constants. */
22 public class ConsentConstants {
23 
24     public static final String NOTIFICATION_DISPLAYED_ONCE = "NOTIFICATION-DISPLAYED-ONCE";
25 
26     public static final String GA_UX_NOTIFICATION_DISPLAYED_ONCE =
27             "GA-UX-NOTIFICATION-DISPLAYED-ONCE";
28 
29     public static final String DEFAULT_CONSENT = "DEFAULT_CONSENT";
30 
31     public static final String TOPICS_DEFAULT_CONSENT = "TOPICS_DEFAULT_CONSENT";
32 
33     public static final String FLEDGE_DEFAULT_CONSENT = "FLEDGE_DEFAULT_CONSENT";
34 
35     public static final String MEASUREMENT_DEFAULT_CONSENT = "MEASUREMENT_DEFAULT_CONSENT";
36 
37     public static final String DEFAULT_AD_ID_STATE = "DEFAULT_AD_ID_STATE";
38 
39     public static final String MANUAL_INTERACTION_WITH_CONSENT_RECORDED =
40             "MANUAL_INTERACTION_WITH_CONSENT_RECORDED";
41 
42     public static final String CONSENT_KEY = "CONSENT";
43 
44     // When persisting data to AppSearch, the key cannot be a proper subset of other keys since
45     // Search does not support full match.
46     public static final String CONSENT_KEY_FOR_ALL = "CONSENT-ALL";
47 
48     // Internal datastore version
49     static final int STORAGE_VERSION = 1;
50 
51     // Internal datastore filename. The name should be unique to avoid multiple threads or
52     // processes to update the same file.
53     static final String STORAGE_XML_IDENTIFIER =
54             FileCompatUtils.getAdservicesFilename("ConsentManagerStorageIdentifier.xml");
55 
56     // The name of shared preferences file to store status of one-time migrations.
57     // Once a migration has happened, it marks corresponding shared preferences to prevent it
58     // happens again.
59     static final String SHARED_PREFS_CONSENT = "PPAPI_Consent";
60 
61     // Shared preferences to mark whether consent data from AppSearch has migrated to AdServices.
62     public static final String SHARED_PREFS_KEY_APPSEARCH_HAS_MIGRATED =
63             "CONSENT_HAS_MIGRATED_FROM_APPSEARCH";
64 
65     // Shared preferences to mark whether PPAPI consent has been migrated to system server
66     public static final String SHARED_PREFS_KEY_HAS_MIGRATED =
67             "CONSENT_HAS_MIGRATED_TO_SYSTEM_SERVER";
68 
69     // Shared preferences to mark whether AdExtData has been migrated to system server
70     public static final String SHARED_PREFS_KEY_MIGRATED_FROM_ADEXTDATA_TO_SYSTEM_SERVER =
71             "CONSENT_HAS_MIGRATED_FROM_ADEXTDATA_TO_SYSTEM_SERVER";
72 
73     // Shared preferences to mark whether PPAPI consent has been cleared.
74     static final String SHARED_PREFS_KEY_PPAPI_HAS_CLEARED = "CONSENT_HAS_CLEARED_IN_PPAPI";
75 
76     static final String ERROR_MESSAGE_WHILE_GET_CONTENT =
77             "getConsent method failed. Revoked consent is returned as fallback.";
78 
79     static final String ERROR_MESSAGE_WHILE_SET_CONTENT = "setConsent method failed.";
80 
81     static final String ERROR_MESSAGE_INVALID_CONSENT_SOURCE_OF_TRUTH =
82             "Invalid type of consent source of truth.";
83 
84     public static final String ERROR_MESSAGE_INVALID_BLOCKED_TOPICS_SOURCE_OF_TRUTH =
85             "Invalid type of blocked topics source of truth.";
86 
87     public static final String ERROR_MESSAGE_APPSEARCH_FAILURE =
88             "Failed to persist data to AppSearch.";
89 
90     public static final String IS_AD_ID_ENABLED = "IS_AD_ID_ENABLED";
91 
92     public static final String IS_U18_ACCOUNT = "IS_U18_ACCOUNT";
93 
94     public static final String IS_ENTRY_POINT_ENABLED = "IS_ENTRY_POINT_ENABLED";
95 
96     public static final String IS_ADULT_ACCOUNT = "IS_ADULT_ACCOUNT";
97 
98     public static final String WAS_U18_NOTIFICATION_DISPLAYED = "WAS_U18_NOTIFICATION_DISPLAYED";
99 
100     public static final String PAS_NOTIFICATION_DISPLAYED_ONCE = "PAS_NOTIFICATION_DISPLAYED_ONCE";
101 
102     public static final String PAS_NOTIFICATION_OPENED = "PAS_NOTIFICATION_OPENED";
103 
104     public static final String IS_MEASUREMENT_DATA_RESET = "IS_MEASUREMENT_DATA_RESET";
105 
106     public static final String IS_PA_DATA_RESET = "IS_PA_DATA_RESET";
107 
108     public static final String MODULE_ENROLLMENT_STATE = "MODULE_ENROLLMENT_STATE";
109 
110     public enum EndUserUx {
111         UNKNOWN,
112         GA,
113         U18,
114         GA_WITH_PAS
115     }
116 }
117