diff options
author | 2023-01-30 07:52:25 +0000 | |
---|---|---|
committer | 2023-01-30 18:24:42 +0000 | |
commit | e81e9ac64b29663fcefb6ae87516a06feb0a863d (patch) | |
tree | c09c47b527b836fb8dccd384b37433c21b479dfb | |
parent | 258ed5b6a9380265caf2459de31994c280439d2d (diff) |
Update safety label contants to lowercase
Test: atest CtsPermission3TestCases
Bug: 266594414
Bug: 266824947
Change-Id: Ic4c833f6ea05495ca3a9640f0562b72704289c49
5 files changed, 59 insertions, 59 deletions
diff --git a/PermissionController/tests/mocking/src/com/android/permissioncontroller/tests/mocking/safetylabel/AppsSafetyLabelHistoryTest.kt b/PermissionController/tests/mocking/src/com/android/permissioncontroller/tests/mocking/safetylabel/AppsSafetyLabelHistoryTest.kt index e96f50631..c8cdd71ea 100644 --- a/PermissionController/tests/mocking/src/com/android/permissioncontroller/tests/mocking/safetylabel/AppsSafetyLabelHistoryTest.kt +++ b/PermissionController/tests/mocking/src/com/android/permissioncontroller/tests/mocking/safetylabel/AppsSafetyLabelHistoryTest.kt @@ -88,7 +88,7 @@ class AppsSafetyLabelHistoryTest { private const val PACKAGE_NAME_1 = "package_name_1" private const val PACKAGE_NAME_2 = "package_name_2" private const val LOCATION_CATEGORY = "location" - private const val APPROX_LOCATION = "APPROX_LOCATION" + private const val APPROX_LOCATION = "approx_location" private const val PURPOSE_FRAUD_PREVENTION_SECURITY = 4 private const val PURPOSE_ADVERTISING = 5 private const val SAFETY_LABEL_KEY = "safety_labels" diff --git a/SafetyLabel/java/com/android/permission/safetylabel/DataType.java b/SafetyLabel/java/com/android/permission/safetylabel/DataType.java index cc63b07ac..68770f823 100644 --- a/SafetyLabel/java/com/android/permission/safetylabel/DataType.java +++ b/SafetyLabel/java/com/android/permission/safetylabel/DataType.java @@ -36,19 +36,19 @@ import java.util.Set; */ public class DataType { @VisibleForTesting static final String KEY_PURPOSES = "purposes"; - @VisibleForTesting static final String KEY_USER_CONTROL = "user_control"; + @VisibleForTesting static final String KEY_IS_COLLECTION_OPTIONAL = "is_collection_optional"; @VisibleForTesting static final String KEY_EPHEMERAL = "ephemeral"; @Purpose private final Set<Integer> mPurposeSet; - private final Boolean mUserControl; + private final Boolean mIsCollectionOptional; private final Boolean mEphemeral; private DataType( @NonNull @Purpose Set<Integer> purposeSet, - @Nullable Boolean userControl, + @Nullable Boolean isCollectionOptional, @Nullable Boolean ephemeral) { this.mPurposeSet = purposeSet; - this.mUserControl = userControl; + this.mIsCollectionOptional = isCollectionOptional; this.mEphemeral = ephemeral; } @@ -109,12 +109,12 @@ public class DataType { } // Only set/expected for DATA COLLECTED. DATA SHARED should be null - Boolean userControl = null; + Boolean isCollectionOptional = null; Boolean ephemeral = null; if (DataLabelConstants.DATA_USAGE_COLLECTED.equals(dataUsage)) { - userControl = - dataTypeBundle.containsKey(KEY_USER_CONTROL) - ? dataTypeBundle.getBoolean(KEY_USER_CONTROL) + isCollectionOptional = + dataTypeBundle.containsKey(KEY_IS_COLLECTION_OPTIONAL) + ? dataTypeBundle.getBoolean(KEY_IS_COLLECTION_OPTIONAL) : null; ephemeral = dataTypeBundle.containsKey(KEY_EPHEMERAL) @@ -122,7 +122,7 @@ public class DataType { : null; } - return new DataType(purposeSet, userControl, ephemeral); + return new DataType(purposeSet, isCollectionOptional, ephemeral); } /** @@ -139,8 +139,8 @@ public class DataType { * data usage is required. Should return {@code null} for data-shared. */ @Nullable - public Boolean getUserControl() { - return mUserControl; + public Boolean getIsCollectionOptional() { + return mIsCollectionOptional; } /** diff --git a/SafetyLabel/java/com/android/permission/safetylabel/DataTypeConstants.java b/SafetyLabel/java/com/android/permission/safetylabel/DataTypeConstants.java index 1b4819c41..2154aceec 100644 --- a/SafetyLabel/java/com/android/permission/safetylabel/DataTypeConstants.java +++ b/SafetyLabel/java/com/android/permission/safetylabel/DataTypeConstants.java @@ -54,17 +54,17 @@ public class DataTypeConstants { }) public @interface PersonalType {} - public static final String PERSONAL_NAME = "NAME"; - public static final String PERSONAL_EMAIL_ADDRESS = "EMAIL_ADDRESS"; - public static final String PERSONAL_PHYSICAL_ADDRESS = "PHYSICAL_ADDRESS"; - public static final String PERSONAL_PHONE_NUMBER = "PHONE_NUMBER"; - public static final String PERSONAL_RACE_ETHNICITY = "RACE_ETHNICITY"; + public static final String PERSONAL_NAME = "name"; + public static final String PERSONAL_EMAIL_ADDRESS = "email_address"; + public static final String PERSONAL_PHYSICAL_ADDRESS = "physical_address"; + public static final String PERSONAL_PHONE_NUMBER = "phone_number"; + public static final String PERSONAL_RACE_ETHNICITY = "race_ethnicity"; public static final String PERSONAL_POLITICAL_OR_RELIGIOUS_BELIEFS = - "POLITICAL_OR_RELIGIOUS_BELIEFS"; + "political_or_religious_beliefs"; public static final String PERSONAL_SEXUAL_ORIENTATION_OR_GENDER_IDENTITY = - "SEXUAL_ORIENTATION_OR_GENDER_IDENTITY"; - public static final String PERSONAL_IDENTIFIERS = "PERSONAL_IDENTIFIERS"; - public static final String PERSONAL_OTHER = "OTHER"; + "sexual_orientation_or_gender_identity"; + public static final String PERSONAL_IDENTIFIERS = "personal_identifiers"; + public static final String PERSONAL_OTHER = "other"; @PersonalType private static final Set<String> VALID_TYPES_PERSONAL = @@ -96,10 +96,10 @@ public class DataTypeConstants { }) public @interface FinancialType {} - public static final String FINANCIAL_CARD_BANK_ACCOUNT = "CARD_BANK_ACCOUNT"; - public static final String FINANCIAL_PURCHASE_HISTORY = "PURCHASE_HISTORY"; - public static final String FINANCIAL_CREDIT_SCORE = "CREDIT_SCORE"; - public static final String FINANCIAL_OTHER = "OTHER"; + public static final String FINANCIAL_CARD_BANK_ACCOUNT = "card_bank_account"; + public static final String FINANCIAL_PURCHASE_HISTORY = "purchase_history"; + public static final String FINANCIAL_CREDIT_SCORE = "credit_score"; + public static final String FINANCIAL_OTHER = "other"; @FinancialType private static final Set<String> VALID_TYPES_FINANCIAL = @@ -124,8 +124,8 @@ public class DataTypeConstants { }) public @interface LocationType {} - public static final String LOCATION_APPROX_LOCATION = "APPROX_LOCATION"; - public static final String LOCATION_PRECISE_LOCATION = "PRECISE_LOCATION"; + public static final String LOCATION_APPROX_LOCATION = "approx_location"; + public static final String LOCATION_PRECISE_LOCATION = "precise_location"; @LocationType private static final Set<String> VALID_TYPES_LOCATION = @@ -147,9 +147,9 @@ public class DataTypeConstants { }) public @interface EmailTextMessageType {} - public static final String EMAIL_TEXT_MESSAGE_EMAILS = "EMAILS"; - public static final String EMAIL_TEXT_MESSAGE_TEXT_MESSAGES = "TEXT_MESSAGES"; - public static final String EMAIL_TEXT_MESSAGE_OTHER = "OTHER"; + public static final String EMAIL_TEXT_MESSAGE_EMAILS = "emails"; + public static final String EMAIL_TEXT_MESSAGE_TEXT_MESSAGES = "text_messages"; + public static final String EMAIL_TEXT_MESSAGE_OTHER = "other"; @EmailTextMessageType private static final Set<String> VALID_TYPES_EMAIL_TEXT_MESSAGE = @@ -173,8 +173,8 @@ public class DataTypeConstants { }) public @interface PhotoVideoType {} - public static final String PHOTO_VIDEO_PHOTOS = "PHOTOS"; - public static final String PHOTO_VIDEO_VIDEOS = "VIDEOS"; + public static final String PHOTO_VIDEO_PHOTOS = "photos"; + public static final String PHOTO_VIDEO_VIDEOS = "videos"; @PhotoVideoType private static final Set<String> VALID_TYPES_PHOTO_VIDEO = @@ -191,9 +191,9 @@ public class DataTypeConstants { value = {AUDIO_SOUND_RECORDINGS, AUDIO_MUSIC_FILES, AUDIO_OTHER}) public @interface AudioType {} - public static final String AUDIO_SOUND_RECORDINGS = "SOUND_RECORDINGS"; - public static final String AUDIO_MUSIC_FILES = "MUSIC_FILES"; - public static final String AUDIO_OTHER = "OTHER"; + public static final String AUDIO_SOUND_RECORDINGS = "sound_recordings"; + public static final String AUDIO_MUSIC_FILES = "music_files"; + public static final String AUDIO_OTHER = "other"; @AudioType private static final Set<String> VALID_TYPES_AUDIO = @@ -213,7 +213,7 @@ public class DataTypeConstants { }) public @interface StorageType {} - public static final String STORAGE_FILES_DOCS = "FILES_DOCS"; + public static final String STORAGE_FILES_DOCS = "files_docs"; @StorageType private static final Set<String> VALID_TYPES_STORAGE = @@ -232,8 +232,8 @@ public class DataTypeConstants { }) public @interface HealthFitnessType {} - public static final String HEALTH_FITNESS_HEALTH = "HEALTH"; - public static final String HEALTH_FITNESS_FITNESS = "FITNESS"; + public static final String HEALTH_FITNESS_HEALTH = "health"; + public static final String HEALTH_FITNESS_FITNESS = "fitness"; @HealthFitnessType private static final Set<String> VALID_TYPES_HEALTH_FITNESS = @@ -252,7 +252,7 @@ public class DataTypeConstants { }) public @interface ContactsType {} - public static final String CONTACTS_CONTACTS = "CONTACTS"; + public static final String CONTACTS_CONTACTS = "contacts"; @ContactsType private static final Set<String> VALID_TYPES_CONTACTS = @@ -270,7 +270,7 @@ public class DataTypeConstants { }) public @interface CalendarType {} - public static final String CALENDAR_CALENDAR = "CALENDAR"; + public static final String CALENDAR_CALENDAR = "calendar"; @CalendarType private static final Set<String> VALID_TYPES_CALENDAR = @@ -288,7 +288,7 @@ public class DataTypeConstants { }) public @interface IdentifiersType {} - public static final String IDENTIFIERS_OTHER = "OTHER"; + public static final String IDENTIFIERS_OTHER = "other"; @IdentifiersType private static final Set<String> VALID_TYPES_IDENTIFIERS = @@ -308,9 +308,9 @@ public class DataTypeConstants { }) public @interface AppPerformanceType {} - public static final String APP_PERFORMANCE_CRASH_LOGS = "CRASH_LOGS"; - public static final String APP_PERFORMANCE_PERFORMANCE_DIAGNOSTICS = "PERFORMANCE_DIAGNOSTICS"; - public static final String APP_PERFORMANCE_OTHER = "OTHER"; + public static final String APP_PERFORMANCE_CRASH_LOGS = "crash_logs"; + public static final String APP_PERFORMANCE_PERFORMANCE_DIAGNOSTICS = "performance_diagnostics"; + public static final String APP_PERFORMANCE_OTHER = "other"; @AppPerformanceType private static final Set<String> VALID_TYPES_APP_PERFORMANCE = @@ -337,11 +337,11 @@ public class DataTypeConstants { }) public @interface ActionsInAppType {} - public static final String ACTIONS_IN_APP_USER_INTERACTION = "USER_INTERACTION"; - public static final String ACTIONS_IN_APP_IN_APP_SEARCH_HISTORY = "IN_APP_SEARCH_HISTORY"; - public static final String ACTIONS_IN_APP_INSTALLED_APPS = "INSTALLED_APPS"; - public static final String ACTIONS_IN_APP_USER_GENERATED_CONTENT = "USER_GENERATED_CONTENT"; - public static final String ACTIONS_IN_APP_OTHER = "OTHER"; + public static final String ACTIONS_IN_APP_USER_INTERACTION = "user_interaction"; + public static final String ACTIONS_IN_APP_IN_APP_SEARCH_HISTORY = "in_app_search_history"; + public static final String ACTIONS_IN_APP_INSTALLED_APPS = "installed_apps"; + public static final String ACTIONS_IN_APP_USER_GENERATED_CONTENT = "user_generated_content"; + public static final String ACTIONS_IN_APP_OTHER = "other"; @ActionsInAppType private static final Set<String> VALID_TYPES_ACTIONS_IN_APP = @@ -366,7 +366,7 @@ public class DataTypeConstants { }) public @interface SearchAndBrowsingType {} - public static final String SEARCH_AND_BROWSING_WEB_BROWSING_HISTORY = "WEB_BROWSING_HISTORY"; + public static final String SEARCH_AND_BROWSING_WEB_BROWSING_HISTORY = "web_browsing_history"; @SearchAndBrowsingType private static final Set<String> VALID_TYPES_SEARCH_AND_BROWSING = diff --git a/SafetyLabel/tests/java/com/android/permission/safetylabel/DataTypeTest.kt b/SafetyLabel/tests/java/com/android/permission/safetylabel/DataTypeTest.kt index bfc9be726..66d0db9f8 100644 --- a/SafetyLabel/tests/java/com/android/permission/safetylabel/DataTypeTest.kt +++ b/SafetyLabel/tests/java/com/android/permission/safetylabel/DataTypeTest.kt @@ -23,7 +23,7 @@ import com.android.permission.safetylabel.DataPurposeConstants.PURPOSE_ADVERTISI import com.android.permission.safetylabel.DataPurposeConstants.PURPOSE_APP_FUNCTIONALITY import com.android.permission.safetylabel.DataType.KEY_EPHEMERAL import com.android.permission.safetylabel.DataType.KEY_PURPOSES -import com.android.permission.safetylabel.DataType.KEY_USER_CONTROL +import com.android.permission.safetylabel.DataType.KEY_IS_COLLECTION_OPTIONAL import com.android.permission.safetylabel.DataTypeConstants.LOCATION_APPROX_LOCATION import com.android.permission.safetylabel.SafetyLabelTestPersistableBundles.INVALID_KEY import com.android.permission.safetylabel.SafetyLabelTestPersistableBundles.createInvalidTypeMapPersistableBundle @@ -168,7 +168,7 @@ class DataTypeTest { assertThat(dataTypeMap).containsKey(LOCATION_APPROX_LOCATION) val type = dataTypeMap[LOCATION_APPROX_LOCATION]!! assertThat(type.purposeSet).containsExactly(PURPOSE_APP_FUNCTIONALITY, PURPOSE_ADVERTISING) - assertThat(type.userControl).isTrue() + assertThat(type.isCollectionOptional).isTrue() assertThat(type.ephemeral).isTrue() } @@ -184,7 +184,7 @@ class DataTypeTest { assertThat(dataTypeMap).containsKey(LOCATION_APPROX_LOCATION) val type = dataTypeMap[LOCATION_APPROX_LOCATION]!! assertThat(type.purposeSet).containsExactly(PURPOSE_APP_FUNCTIONALITY, PURPOSE_ADVERTISING) - assertThat(type.userControl).isNull() + assertThat(type.isCollectionOptional).isNull() assertThat(type.ephemeral).isNull() } @@ -206,7 +206,7 @@ class DataTypeTest { assertThat(dataType).isNotNull() assertThat(dataType?.purposeSet) .containsExactly(PURPOSE_APP_FUNCTIONALITY, PURPOSE_ADVERTISING) - assertThat(dataType?.userControl).isTrue() + assertThat(dataType?.isCollectionOptional).isTrue() assertThat(dataType?.ephemeral).isTrue() } @@ -219,7 +219,7 @@ class DataTypeTest { assertThat(dataType).isNotNull() assertThat(dataType?.purposeSet) .containsExactly(PURPOSE_APP_FUNCTIONALITY, PURPOSE_ADVERTISING) - assertThat(dataType?.userControl).isNull() + assertThat(dataType?.isCollectionOptional).isNull() assertThat(dataType?.ephemeral).isNull() } @@ -266,7 +266,7 @@ class DataTypeTest { @Test fun getDataType_dataCollected_validDataType_noUserControl_noEphemeral() { val bundle = createTypePersistableBundle() - bundle.remove(KEY_USER_CONTROL) + bundle.remove(KEY_IS_COLLECTION_OPTIONAL) bundle.remove(KEY_EPHEMERAL) val dataType = DataType.getDataType(bundle, DataLabelConstants.DATA_USAGE_COLLECTED) @@ -274,7 +274,7 @@ class DataTypeTest { assertThat(dataType).isNotNull() assertThat(dataType?.purposeSet) .containsExactly(PURPOSE_APP_FUNCTIONALITY, PURPOSE_ADVERTISING) - assertThat(dataType?.userControl).isNull() + assertThat(dataType?.isCollectionOptional).isNull() assertThat(dataType?.ephemeral).isNull() } } diff --git a/SafetyLabel/tests/java/com/android/permission/safetylabel/SafetyLabelTestPersistableBundles.kt b/SafetyLabel/tests/java/com/android/permission/safetylabel/SafetyLabelTestPersistableBundles.kt index 482323f6a..ae4459b44 100644 --- a/SafetyLabel/tests/java/com/android/permission/safetylabel/SafetyLabelTestPersistableBundles.kt +++ b/SafetyLabel/tests/java/com/android/permission/safetylabel/SafetyLabelTestPersistableBundles.kt @@ -26,7 +26,7 @@ import com.android.permission.safetylabel.DataPurposeConstants.PURPOSE_ADVERTISI import com.android.permission.safetylabel.DataPurposeConstants.PURPOSE_APP_FUNCTIONALITY import com.android.permission.safetylabel.DataType.KEY_EPHEMERAL import com.android.permission.safetylabel.DataType.KEY_PURPOSES -import com.android.permission.safetylabel.DataType.KEY_USER_CONTROL +import com.android.permission.safetylabel.DataType.KEY_IS_COLLECTION_OPTIONAL import com.android.permission.safetylabel.SafetyLabel.KEY_VERSION /** A class that facilitates creating test safety label persistable bundles. */ @@ -341,7 +341,7 @@ object SafetyLabelTestPersistableBundles { fun createTypePersistableBundle(): PersistableBundle { return PersistableBundle().apply { putIntArray(KEY_PURPOSES, intArrayOf(PURPOSE_APP_FUNCTIONALITY, PURPOSE_ADVERTISING)) - putBoolean(KEY_USER_CONTROL, true) + putBoolean(KEY_IS_COLLECTION_OPTIONAL, true) putBoolean(KEY_EPHEMERAL, true) } } |