diff options
71 files changed, 300 insertions, 1568 deletions
diff --git a/SafetyCenter/Config/Android.bp b/SafetyCenter/Config/Android.bp deleted file mode 100644 index e375e63b4..000000000 --- a/SafetyCenter/Config/Android.bp +++ /dev/null @@ -1,35 +0,0 @@ -// -// Copyright (C) 2021 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -java_library { - name: "safety-center-config", - srcs: [ - "java/**/*.java", - ], - libs: [ - "framework-annotations-lib", - ], - apex_available: [ - "com.android.permission", - "test_com.android.permission", - ], - installable: false, - min_sdk_version: "30", - sdk_version: "module_current", -} diff --git a/SafetyCenter/Config/tests/Android.bp b/SafetyCenter/Config/tests/Android.bp deleted file mode 100644 index 3538df46d..000000000 --- a/SafetyCenter/Config/tests/Android.bp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2022 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -android_test { - name: "SafetyCenterConfigTests", - defaults: ["mts-target-sdk-version-current"], - sdk_version: "test_current", - min_sdk_version: "30", - srcs: [ - "java/**/*.kt", - ], - static_libs: [ - "safety-center-config", - "compatibility-device-util-axt", - ], - test_suites: [ - "general-tests", - "mts-permission", - ], -} diff --git a/SafetyCenter/Config/tests/AndroidManifest.xml b/SafetyCenter/Config/tests/AndroidManifest.xml deleted file mode 100644 index 5ccda9508..000000000 --- a/SafetyCenter/Config/tests/AndroidManifest.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - ~ Copyright (C) 2022 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<manifest - xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.safetycenter.tests.config.safetycenterconfig"> - - <application android:label="Safety Center Config Tests"> - <uses-library android:name="android.test.runner" /> - </application> - - <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="com.android.safetycenter.tests.config.safetycenterconfig" - android:label="Tests for the Safety Center Config library" /> -</manifest> diff --git a/SafetyCenter/Config/tests/AndroidTest.xml b/SafetyCenter/Config/tests/AndroidTest.xml deleted file mode 100644 index 536174ae3..000000000 --- a/SafetyCenter/Config/tests/AndroidTest.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - ~ Copyright (C) 2022 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<configuration description="Runs unit tests for the Safety Center Config library."> - <option name="test-suite-tag" value="apct" /> - <option name="test-suite-tag" value="apct-instrumentation" /> - <option name="test-tag" value="SafetyCenterConfigTests" /> - <object type="module_controller" class="com.android.tradefed.testtype.suite.module.Sdk30ModuleController" /> - - <!-- Install test --> - <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup"> - <option name="test-file-name" value="SafetyCenterConfigTests.apk" /> - <option name="cleanup-apks" value="true" /> - </target_preparer> - - <test class="com.android.tradefed.testtype.AndroidJUnitTest" > - <option name="package" value="com.android.safetycenter.tests.config.safetycenterconfig" /> - <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" /> - </test> -</configuration> diff --git a/SafetyCenter/Config/tests/java/com/android/safetycenter/config/ConfigInvalidTest.kt b/SafetyCenter/Config/tests/java/com/android/safetycenter/config/ConfigInvalidTest.kt deleted file mode 100644 index c8c5fca96..000000000 --- a/SafetyCenter/Config/tests/java/com/android/safetycenter/config/ConfigInvalidTest.kt +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.safetycenter.config - -import android.content.Context -import androidx.test.core.app.ApplicationProvider.getApplicationContext -import com.android.safetycenter.tests.config.safetycenterconfig.R -import com.google.common.truth.Truth.assertThat -import org.junit.Assert.assertThrows -import org.junit.Test -import org.junit.runners.Parameterized -import org.junit.runner.RunWith - -@RunWith(Parameterized::class) -class ConfigInvalidTest { - private val context: Context = getApplicationContext() - - data class Params( - private val testName: String, - val configResourceId: Int, - val errorMessage: String, - val causeErrorMessage: String? - ) { - override fun toString() = testName - } - - @Parameterized.Parameter - lateinit var params: Params - - @Test - fun invalidConfig_throws() { - val parser = context.resources.getXml(params.configResourceId) - val thrown = assertThrows(Parser.ParseException::class.java) { - Parser.parseXmlResource(parser) - } - assertThat(thrown).hasMessageThat().isEqualTo(params.errorMessage) - if (params.causeErrorMessage != null) { - assertThat(thrown.cause).hasMessageThat().isEqualTo(params.causeErrorMessage) - } - } - - companion object { - @JvmStatic - @Parameterized.Parameters(name = "{0}") - fun parameters() = arrayOf( - Params( - "ConfigDynamicSafetySourceAllDisabledNoWork", - R.xml.config_dynamic_safety_source_all_disabled_no_work, - "Element dynamic-safety-source invalid", - "Required attribute titleForWork missing" - ), - Params( - "ConfigDynamicSafetySourceAllNoWork", - R.xml.config_dynamic_safety_source_all_no_work, - "Element dynamic-safety-source invalid", - "Required attribute titleForWork missing" - ), - Params( - "ConfigDynamicSafetySourceDisabledNoSummary", - R.xml.config_dynamic_safety_source_disabled_no_summary, - "Element dynamic-safety-source invalid", - "Required attribute summary missing" - ), - Params( - "ConfigDynamicSafetySourceDisabledNoTitle", - R.xml.config_dynamic_safety_source_disabled_no_title, - "Element dynamic-safety-source invalid", - "Required attribute title missing" - ), - Params( - "ConfigDynamicSafetySourceDuplicateKey", - R.xml.config_dynamic_safety_source_duplicate_key, - "Element safety-sources-config invalid", - "Duplicate id id among safety sources" - ), - Params( - "ConfigDynamicSafetySourceHiddenWithIntent", - R.xml.config_dynamic_safety_source_hidden_with_intent, - "Element dynamic-safety-source invalid", - "Prohibited attribute intentAction present" - ), - Params( - "ConfigDynamicSafetySourceHiddenWithSummary", - R.xml.config_dynamic_safety_source_hidden_with_summary, - "Element dynamic-safety-source invalid", - "Prohibited attribute summary present" - ), - Params( - "ConfigDynamicSafetySourceHiddenWithTitle", - R.xml.config_dynamic_safety_source_hidden_with_title, - "Element dynamic-safety-source invalid", - "Prohibited attribute title present" - ), - Params( - "ConfigDynamicSafetySourceInvalidDisplay", - R.xml.config_dynamic_safety_source_invalid_display, - "Attribute dynamic-safety-source.initialDisplayState invalid", - null - ), - Params( - "ConfigDynamicSafetySourceInvalidProfile", - R.xml.config_dynamic_safety_source_invalid_profile, - "Attribute dynamic-safety-source.profile invalid", - null - ), - Params( - "ConfigDynamicSafetySourceNoId", - R.xml.config_dynamic_safety_source_no_id, - "Element dynamic-safety-source invalid", - "Required attribute id missing" - ), - Params( - "ConfigDynamicSafetySourceNoIntent", - R.xml.config_dynamic_safety_source_no_intent, - "Element dynamic-safety-source invalid", - "Required attribute intentAction missing" - ), - Params( - "ConfigDynamicSafetySourceNoPackage", - R.xml.config_dynamic_safety_source_no_package, - "Element dynamic-safety-source invalid", - "Required attribute packageName missing" - ), - Params( - "ConfigDynamicSafetySourceNoProfile", - R.xml.config_dynamic_safety_source_no_profile, - "Element dynamic-safety-source invalid", - "Required attribute profile missing" - ), - Params( - "ConfigDynamicSafetySourceNoSummary", - R.xml.config_dynamic_safety_source_no_summary, - "Element dynamic-safety-source invalid", - "Required attribute summary missing" - ), - Params( - "ConfigDynamicSafetySourceNoTitle", - R.xml.config_dynamic_safety_source_no_title, - "Element dynamic-safety-source invalid", - "Required attribute title missing" - ), - Params( - "ConfigDynamicSafetySourcePrimaryHiddenWithWork", - R.xml.config_dynamic_safety_source_primary_hidden_with_work, - "Element dynamic-safety-source invalid", - "Prohibited attribute titleForWork present" - ), - Params( - "ConfigDynamicSafetySourcePrimaryWithWork", - R.xml.config_dynamic_safety_source_primary_with_work, - "Element dynamic-safety-source invalid", - "Prohibited attribute titleForWork present" - ), - Params( - "ConfigIssueOnlySafetySourceDuplicateKey", - R.xml.config_issue_only_safety_source_duplicate_key, - "Element safety-sources-config invalid", - "Duplicate id id among safety sources" - ), - Params( - "ConfigIssueOnlySafetySourceInvalidProfile", - R.xml.config_issue_only_safety_source_invalid_profile, - "Attribute issue-only-safety-source.profile invalid", - null - ), - Params( - "ConfigIssueOnlySafetySourceNoId", - R.xml.config_issue_only_safety_source_no_id, - "Element issue-only-safety-source invalid", - "Required attribute id missing" - ), - Params( - "ConfigIssueOnlySafetySourceNoPackage", - R.xml.config_issue_only_safety_source_no_package, - "Element issue-only-safety-source invalid", - "Required attribute packageName missing" - ), - Params( - "ConfigIssueOnlySafetySourceNoProfile", - R.xml.config_issue_only_safety_source_no_profile, - "Element issue-only-safety-source invalid", - "Required attribute profile missing" - ), - Params( - "ConfigIssueOnlySafetySourceWithDisplay", - R.xml.config_issue_only_safety_source_with_display, - "Element issue-only-safety-source invalid", - "Prohibited attribute initialDisplayState present" - ), - Params( - "ConfigIssueOnlySafetySourceWithIntent", - R.xml.config_issue_only_safety_source_with_intent, - "Element issue-only-safety-source invalid", - "Prohibited attribute intentAction present" - ), - Params( - "ConfigIssueOnlySafetySourceWithSearch", - R.xml.config_issue_only_safety_source_with_search, - "Element issue-only-safety-source invalid", - "Prohibited attribute searchTerms present" - ), - Params( - "ConfigIssueOnlySafetySourceWithSummary", - R.xml.config_issue_only_safety_source_with_summary, - "Element issue-only-safety-source invalid", - "Prohibited attribute summary present" - ), - Params( - "ConfigIssueOnlySafetySourceWithTitle", - R.xml.config_issue_only_safety_source_with_title, - "Element issue-only-safety-source invalid", - "Prohibited attribute title present" - ), - Params( - "ConfigIssueOnlySafetySourceWithWork", - R.xml.config_issue_only_safety_source_with_work, - "Element issue-only-safety-source invalid", - "Prohibited attribute titleForWork present" - ), - Params( - "ConfigMixedSafetySourceDuplicateKey", - R.xml.config_mixed_safety_source_duplicate_key, - "Element safety-sources-config invalid", - "Duplicate id id among safety sources" - ), - Params( - "ConfigReferenceInvalid", - R.xml.config_reference_invalid, - "Reference title in safety-sources-group.title missing or invalid", - null - ), - Params( - "ConfigSafetyCenterConfigMissing", - R.xml.config_safety_center_config_missing, - "Element safety-center-config missing", - null - ), - Params( - "ConfigSafetySourcesConfigEmpty", - R.xml.config_safety_sources_config_empty, - "Element safety-sources-config invalid", - "No safety sources groups present" - ), - Params( - "ConfigSafetySourcesConfigMissing", - R.xml.config_safety_sources_config_missing, - "Element safety-sources-config missing", - null - ), - Params( - "ConfigSafetySourcesGroupDuplicateId", - R.xml.config_safety_sources_group_duplicate_id, - "Element safety-sources-config invalid", - "Duplicate id id among safety sources groups" - ), - Params( - "ConfigSafetySourcesGroupEmpty", - R.xml.config_safety_sources_group_empty, - "Element safety-sources-group invalid", - "Safety sources group empty" - ), - Params( - "ConfigSafetySourcesGroupInvalidIcon", - R.xml.config_safety_sources_group_invalid_icon, - "Attribute safety-sources-group.statelessIconType invalid", - null - ), - Params( - "ConfigSafetySourcesGroupNoId", - R.xml.config_safety_sources_group_no_id, - "Element safety-sources-group invalid", - "Required attribute id missing" - ), - Params( - "ConfigSafetySourcesGroupNoTitle", - R.xml.config_safety_sources_group_no_title, - "Element safety-sources-group invalid", - "Required attribute title missing" - ), - Params( - "ConfigStaticSafetySourceDuplicateKey", - R.xml.config_static_safety_source_duplicate_key, - "Element safety-sources-config invalid", - "Duplicate id id among safety sources" - ), - Params( - "ConfigStaticSafetySourceInvalidProfile", - R.xml.config_static_safety_source_invalid_profile, - "Attribute static-safety-source.profile invalid", - null - ), - Params( - "ConfigStaticSafetySourceNoId", - R.xml.config_static_safety_source_no_id, - "Element static-safety-source invalid", - "Required attribute id missing" - ), - Params( - "ConfigStaticSafetySourceNoIntent", - R.xml.config_static_safety_source_no_intent, - "Element static-safety-source invalid", - "Required attribute intentAction missing" - ), - Params( - "ConfigStaticSafetySourceNoProfile", - R.xml.config_static_safety_source_no_profile, - "Element static-safety-source invalid", - "Required attribute profile missing" - ), - Params( - "ConfigStaticSafetySourceNoSummary", - R.xml.config_static_safety_source_no_summary, - "Element static-safety-source invalid", - "Required attribute summary missing" - ), - Params( - "ConfigStaticSafetySourceNoTitle", - R.xml.config_static_safety_source_no_title, - "Element static-safety-source invalid", - "Required attribute title missing" - ), - Params( - "ConfigStaticSafetySourceWithBroadcast", - R.xml.config_static_safety_source_with_broadcast, - "Element static-safety-source invalid", - "Prohibited attribute broadcastReceiverClassName present" - ), - Params( - "ConfigStaticSafetySourceWithDisplay", - R.xml.config_static_safety_source_with_display, - "Element static-safety-source invalid", - "Prohibited attribute initialDisplayState present" - ), - Params( - "ConfigStaticSafetySourceWithLogging", - R.xml.config_static_safety_source_with_logging, - "Element static-safety-source invalid", - "Prohibited attribute allowLogging present" - ), - Params( - "ConfigStaticSafetySourceWithPackage", - R.xml.config_static_safety_source_with_package, - "Element static-safety-source invalid", - "Prohibited attribute packageName present" - ), - Params( - "ConfigStaticSafetySourceWithPrimaryAndWork", - R.xml.config_static_safety_source_with_primary_and_work, - "Element static-safety-source invalid", - "Prohibited attribute titleForWork present" - ), - Params( - "ConfigStaticSafetySourceWithRefresh", - R.xml.config_static_safety_source_with_refresh, - "Element static-safety-source invalid", - "Prohibited attribute allowRefreshOnPageOpen present" - ), - Params( - "ConfigStaticSafetySourceWithSeverity", - R.xml.config_static_safety_source_with_severity, - "Element static-safety-source invalid", - "Prohibited attribute maxSeverityLevel present" - ) - ) - } -} diff --git a/SafetyCenter/Config/tests/java/com/android/safetycenter/config/ConfigValidTest.kt b/SafetyCenter/Config/tests/java/com/android/safetycenter/config/ConfigValidTest.kt deleted file mode 100644 index a07f3342f..000000000 --- a/SafetyCenter/Config/tests/java/com/android/safetycenter/config/ConfigValidTest.kt +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.safetycenter.config - -import android.content.Context -import androidx.test.core.app.ApplicationProvider.getApplicationContext -import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.android.safetycenter.tests.config.safetycenterconfig.R -import org.junit.Assert.assertEquals -import org.junit.Test -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class ConfigValidTest { - private val context: Context = getApplicationContext() - - @Test - fun validConfig_matchesExpected() { - val parser = context.resources.getXml(R.xml.config_valid) - val expected = SafetyCenterConfig.Builder() - .addSafetySourcesGroup(SafetySourcesGroup.Builder() - .setId("dynamic") - .setTitleResId(R.string.reference) - .setSummaryResId(R.string.reference) - .setStatelessIconType(SafetySourcesGroup.STATELESS_ICON_TYPE_PRIVACY) - .addSafetySource(SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_DYNAMIC) - .setId("dynamic_barebone") - .setPackageName("package") - .setTitleResId(R.string.reference) - .setSummaryResId(R.string.reference) - .setIntentAction("intent") - .setProfile(SafetySource.PROFILE_PRIMARY) - .build()) - .addSafetySource(SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_DYNAMIC) - .setId("dynamic_all_optional") - .setPackageName("package") - .setTitleResId(R.string.reference) - .setTitleForWorkResId(R.string.reference) - .setSummaryResId(R.string.reference) - .setIntentAction("intent") - .setProfile(SafetySource.PROFILE_ALL) - .setInitialDisplayState(SafetySource.INITIAL_DISPLAY_STATE_DISABLED) - .setMaxSeverityLevel(300) - .setSearchTermsResId(R.string.reference) - .setBroadcastReceiverClassName("broadcast") - .setAllowLogging(false) - .setAllowRefreshOnPageOpen(true) - .build()) - .addSafetySource(SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_DYNAMIC) - .setId("dynamic_hidden") - .setPackageName("package") - .setProfile(SafetySource.PROFILE_ALL) - .setInitialDisplayState(SafetySource.INITIAL_DISPLAY_STATE_HIDDEN) - .build()) - .build()) - .addSafetySourcesGroup(SafetySourcesGroup.Builder() - .setId("static") - .setTitleResId(R.string.reference) - .addSafetySource(SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_STATIC) - .setId("static_barebone") - .setTitleResId(R.string.reference) - .setSummaryResId(R.string.reference) - .setIntentAction("intent") - .setProfile(SafetySource.PROFILE_PRIMARY) - .build()) - .addSafetySource(SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_STATIC) - .setId("static_all_optional") - .setTitleResId(R.string.reference) - .setTitleForWorkResId(R.string.reference) - .setSummaryResId(R.string.reference) - .setIntentAction("intent") - .setProfile(SafetySource.PROFILE_ALL) - .setSearchTermsResId(R.string.reference) - .build()) - .build()) - .addSafetySourcesGroup(SafetySourcesGroup.Builder() - .setId("issue_only") - .addSafetySource(SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_ISSUE_ONLY) - .setId("issue_only_barebone") - .setPackageName("package") - .setProfile(SafetySource.PROFILE_PRIMARY) - .build()) - .addSafetySource(SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_ISSUE_ONLY) - .setId("issue_only_all_optional") - .setPackageName("package") - .setProfile(SafetySource.PROFILE_ALL) - .setBroadcastReceiverClassName("broadcast") - .setAllowLogging(false) - .setAllowRefreshOnPageOpen(true) - .build()) - .build()) - .addSafetySourcesGroup(SafetySourcesGroup.Builder() - .setId("mixed") - .setTitleResId(R.string.reference) - .addSafetySource(SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_DYNAMIC) - .setId("mixed_dynamic_barebone") - .setPackageName("package") - .setTitleResId(R.string.reference) - .setSummaryResId(R.string.reference) - .setIntentAction("intent") - .setProfile(SafetySource.PROFILE_PRIMARY) - .build()) - .addSafetySource(SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_ISSUE_ONLY) - .setId("mixed_issue_only_barebone") - .setPackageName("package") - .setProfile(SafetySource.PROFILE_PRIMARY) - .build()) - .addSafetySource(SafetySource.Builder(SafetySource.SAFETY_SOURCE_TYPE_STATIC) - .setId("mixed_static_barebone") - .setTitleResId(R.string.reference) - .setSummaryResId(R.string.reference) - .setIntentAction("intent") - .setProfile(SafetySource.PROFILE_PRIMARY) - .build()) - .build()) - .build() - assertEquals(expected, Parser.parseXmlResource(parser)) - } -} diff --git a/SafetyCenter/Config/tests/res/values/strings.xml b/SafetyCenter/Config/tests/res/values/strings.xml deleted file mode 100644 index 8ba7f04a8..000000000 --- a/SafetyCenter/Config/tests/res/values/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2022 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <!-- Test reference --> - <string name="reference" translatable="false">Reference</string> -</resources> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_all_disabled_no_work.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_all_disabled_no_work.xml deleted file mode 100644 index b2594c7ab..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_all_disabled_no_work.xml +++ /dev/null @@ -1,17 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="all_profiles" - initialDisplayState="disabled"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_all_no_work.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_all_no_work.xml deleted file mode 100644 index e582e0470..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_all_no_work.xml +++ /dev/null @@ -1,16 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="all_profiles"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_disabled_no_summary.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_disabled_no_summary.xml deleted file mode 100644 index 6d065992c..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_disabled_no_summary.xml +++ /dev/null @@ -1,16 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - intentAction="intent" - profile="primary_profile_only" - initialDisplayState="disabled"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_disabled_no_title.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_disabled_no_title.xml deleted file mode 100644 index 6d535766a..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_disabled_no_title.xml +++ /dev/null @@ -1,16 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only" - initialDisplayState="disabled"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_duplicate_key.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_duplicate_key.xml deleted file mode 100644 index be7114d61..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_duplicate_key.xml +++ /dev/null @@ -1,28 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id1" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - <safety-sources-group - id="id2" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_hidden_with_intent.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_hidden_with_intent.xml deleted file mode 100644 index b30a6d921..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_hidden_with_intent.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - intentAction="intent" - profile="primary_profile_only" - initialDisplayState="hidden"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_hidden_with_summary.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_hidden_with_summary.xml deleted file mode 100644 index c0fd18120..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_hidden_with_summary.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - summary="@string/reference" - profile="primary_profile_only" - initialDisplayState="hidden"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_hidden_with_title.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_hidden_with_title.xml deleted file mode 100644 index 190fcdc87..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_hidden_with_title.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - profile="primary_profile_only" - initialDisplayState="hidden"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_invalid_display.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_invalid_display.xml deleted file mode 100644 index 4c1d00a4c..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_invalid_display.xml +++ /dev/null @@ -1,17 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only" - initialDisplayState="invalid"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_invalid_profile.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_invalid_profile.xml deleted file mode 100644 index 303415b75..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_invalid_profile.xml +++ /dev/null @@ -1,16 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="invalid"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_id.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_id.xml deleted file mode 100644 index 8ace4ea4c..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_id.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - packageName="package" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_intent.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_intent.xml deleted file mode 100644 index 6119e4aca..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_intent.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - summary="@string/reference" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_package.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_package.xml deleted file mode 100644 index 2b40602b5..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_package.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_profile.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_profile.xml deleted file mode 100644 index f54d9400a..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_profile.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - summary="@string/reference" - intentAction="intent"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_summary.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_summary.xml deleted file mode 100644 index 0683f163a..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_summary.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_title.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_title.xml deleted file mode 100644 index 84f90e5d9..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_no_title.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_primary_hidden_with_work.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_primary_hidden_with_work.xml deleted file mode 100644 index ad7add545..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_primary_hidden_with_work.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - titleForWork="@string/reference" - profile="primary_profile_only" - initialDisplayState="hidden"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_primary_with_work.xml b/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_primary_with_work.xml deleted file mode 100644 index 3ecf80264..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_dynamic_safety_source_primary_with_work.xml +++ /dev/null @@ -1,17 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - titleForWork="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_duplicate_key.xml b/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_duplicate_key.xml deleted file mode 100644 index 9c00d5727..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_duplicate_key.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id"> - <issue-only-safety-source - id="id" - packageName="package" - profile="primary_profile_only"/> - <issue-only-safety-source - id="id" - packageName="package" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_invalid_profile.xml b/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_invalid_profile.xml deleted file mode 100644 index dd85d55a8..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_invalid_profile.xml +++ /dev/null @@ -1,11 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id"> - <issue-only-safety-source - id="id" - packageName="package" - profile="invalid"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_no_id.xml b/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_no_id.xml deleted file mode 100644 index d57db8e42..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_no_id.xml +++ /dev/null @@ -1,10 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id"> - <issue-only-safety-source - packageName="package" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_no_package.xml b/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_no_package.xml deleted file mode 100644 index d68b55740..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_no_package.xml +++ /dev/null @@ -1,10 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id"> - <issue-only-safety-source - id="id" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_no_profile.xml b/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_no_profile.xml deleted file mode 100644 index 7e7b6ef5f..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_no_profile.xml +++ /dev/null @@ -1,10 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id"> - <issue-only-safety-source - id="id" - packageName="package"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_display.xml b/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_display.xml deleted file mode 100644 index 1fab83913..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_display.xml +++ /dev/null @@ -1,12 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id"> - <issue-only-safety-source - id="id" - packageName="package" - profile="primary_profile_only" - initialDisplayState="disabled"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_intent.xml b/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_intent.xml deleted file mode 100644 index 9a7fa6bb1..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_intent.xml +++ /dev/null @@ -1,12 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id"> - <issue-only-safety-source - id="id" - packageName="package" - profile="primary_profile_only" - intentAction="intent"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_search.xml b/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_search.xml deleted file mode 100644 index b065a3898..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_search.xml +++ /dev/null @@ -1,12 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id"> - <issue-only-safety-source - id="id" - packageName="package" - profile="primary_profile_only" - searchTerms="@string/reference"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_summary.xml b/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_summary.xml deleted file mode 100644 index 7d010018b..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_summary.xml +++ /dev/null @@ -1,12 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id"> - <issue-only-safety-source - id="id" - packageName="package" - profile="primary_profile_only" - summary="@string/reference"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_title.xml b/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_title.xml deleted file mode 100644 index 3b46eeab7..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_title.xml +++ /dev/null @@ -1,12 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id"> - <issue-only-safety-source - id="id" - packageName="package" - profile="primary_profile_only" - title="@string/reference"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_work.xml b/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_work.xml deleted file mode 100644 index e50149008..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_issue_only_safety_source_with_work.xml +++ /dev/null @@ -1,12 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id"> - <issue-only-safety-source - id="id" - packageName="package" - profile="all_profiles" - titleForWork="@string/reference"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_mixed_safety_source_duplicate_key.xml b/SafetyCenter/Config/tests/res/xml/config_mixed_safety_source_duplicate_key.xml deleted file mode 100644 index e939a9c22..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_mixed_safety_source_duplicate_key.xml +++ /dev/null @@ -1,26 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id1" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - <safety-sources-group - id="id2" - title="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_reference_invalid.xml b/SafetyCenter/Config/tests/res/xml/config_reference_invalid.xml deleted file mode 100644 index 743172994..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_reference_invalid.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="title" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="1"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_safety_center_config_missing.xml b/SafetyCenter/Config/tests/res/xml/config_safety_center_config_missing.xml deleted file mode 100644 index 475791691..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_safety_center_config_missing.xml +++ /dev/null @@ -1,2 +0,0 @@ -<other-root> -</other-root> diff --git a/SafetyCenter/Config/tests/res/xml/config_safety_sources_config_empty.xml b/SafetyCenter/Config/tests/res/xml/config_safety_sources_config_empty.xml deleted file mode 100644 index b26ffc008..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_safety_sources_config_empty.xml +++ /dev/null @@ -1,4 +0,0 @@ -<safety-center-config> - <safety-sources-config> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_safety_sources_config_missing.xml b/SafetyCenter/Config/tests/res/xml/config_safety_sources_config_missing.xml deleted file mode 100644 index 12545759a..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_safety_sources_config_missing.xml +++ /dev/null @@ -1,4 +0,0 @@ -<safety-center-config> - <other-internal-config> - </other-internal-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_duplicate_id.xml b/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_duplicate_id.xml deleted file mode 100644 index 0ce73371e..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_duplicate_id.xml +++ /dev/null @@ -1,26 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id1" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id2" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_empty.xml b/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_empty.xml deleted file mode 100644 index a395152f8..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_empty.xml +++ /dev/null @@ -1,9 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_invalid_icon.xml b/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_invalid_icon.xml deleted file mode 100644 index 42b4c47d6..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_invalid_icon.xml +++ /dev/null @@ -1,16 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference" - statelessIconType="invalid"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_no_id.xml b/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_no_id.xml deleted file mode 100644 index eaee6731a..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_no_id.xml +++ /dev/null @@ -1,14 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_no_title.xml b/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_no_title.xml deleted file mode 100644 index de3ce82b9..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_safety_sources_group_no_title.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - summary="@string/reference"> - <dynamic-safety-source - id="id" - packageName="package" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_duplicate_key.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_duplicate_key.xml deleted file mode 100644 index 4fe5e1e65..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_duplicate_key.xml +++ /dev/null @@ -1,26 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id1" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - <safety-sources-group - id="id2" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_invalid_profile.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_invalid_profile.xml deleted file mode 100644 index 7c135e782..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_invalid_profile.xml +++ /dev/null @@ -1,15 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="invalid"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_id.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_id.xml deleted file mode 100644 index 7b919343b..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_id.xml +++ /dev/null @@ -1,14 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_intent.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_intent.xml deleted file mode 100644 index 9e97efbc9..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_intent.xml +++ /dev/null @@ -1,14 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_profile.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_profile.xml deleted file mode 100644 index 32d23c789..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_profile.xml +++ /dev/null @@ -1,14 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_summary.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_summary.xml deleted file mode 100644 index fa92f0bd8..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_summary.xml +++ /dev/null @@ -1,14 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_title.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_title.xml deleted file mode 100644 index 654a486a5..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_no_title.xml +++ /dev/null @@ -1,14 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_broadcast.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_broadcast.xml deleted file mode 100644 index 090bd5795..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_broadcast.xml +++ /dev/null @@ -1,16 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only" - broadcastReceiverClassName="broadcast"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_display.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_display.xml deleted file mode 100644 index 69c9ca215..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_display.xml +++ /dev/null @@ -1,16 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only" - initialDisplayState="disabled"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_logging.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_logging.xml deleted file mode 100644 index 019832ddb..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_logging.xml +++ /dev/null @@ -1,16 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only" - allowLogging="false"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_package.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_package.xml deleted file mode 100644 index 2a982b4cc..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_package.xml +++ /dev/null @@ -1,16 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only" - packageName="package"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_primary_and_work.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_primary_and_work.xml deleted file mode 100644 index 296e2bc4a..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_primary_and_work.xml +++ /dev/null @@ -1,16 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - titleForWork="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_refresh.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_refresh.xml deleted file mode 100644 index 5e46a44c1..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_refresh.xml +++ /dev/null @@ -1,16 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only" - allowRefreshOnPageOpen="true"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_severity.xml b/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_severity.xml deleted file mode 100644 index a9f5d9b89..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_static_safety_source_with_severity.xml +++ /dev/null @@ -1,16 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="id" - title="@string/reference" - summary="@string/reference"> - <static-safety-source - id="id" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only" - maxSeverityLevel="300"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/SafetyCenter/Config/tests/res/xml/config_valid.xml b/SafetyCenter/Config/tests/res/xml/config_valid.xml deleted file mode 100644 index 5abba01ac..000000000 --- a/SafetyCenter/Config/tests/res/xml/config_valid.xml +++ /dev/null @@ -1,89 +0,0 @@ -<safety-center-config> - <safety-sources-config> - <safety-sources-group - id="dynamic" - title="@string/reference" - summary="@string/reference" - statelessIconType="privacy"> - <dynamic-safety-source - id="dynamic_barebone" - packageName="package" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - <dynamic-safety-source - id="dynamic_all_optional" - packageName="package" - title="@string/reference" - titleForWork="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="all_profiles" - initialDisplayState="disabled" - maxSeverityLevel="300" - searchTerms="@string/reference" - broadcastReceiverClassName="broadcast" - allowLogging="false" - allowRefreshOnPageOpen="true"/> - <dynamic-safety-source - id="dynamic_hidden" - packageName="package" - profile="all_profiles" - initialDisplayState="hidden"/> - </safety-sources-group> - <safety-sources-group - id="static" - title="@string/reference"> - <static-safety-source - id="static_barebone" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - <static-safety-source - id="static_all_optional" - title="@string/reference" - titleForWork="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="all_profiles" - searchTerms="@string/reference"/> - </safety-sources-group> - <safety-sources-group - id="issue_only"> - <issue-only-safety-source - id="issue_only_barebone" - packageName="package" - profile="primary_profile_only"/> - <issue-only-safety-source - id="issue_only_all_optional" - packageName="package" - profile="all_profiles" - broadcastReceiverClassName="broadcast" - allowLogging="false" - allowRefreshOnPageOpen="true"/> - </safety-sources-group> - <safety-sources-group - id="mixed" - title="@string/reference"> - <dynamic-safety-source - id="mixed_dynamic_barebone" - packageName="package" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - <issue-only-safety-source - id="mixed_issue_only_barebone" - packageName="package" - profile="primary_profile_only"/> - <static-safety-source - id="mixed_static_barebone" - title="@string/reference" - summary="@string/reference" - intentAction="intent" - profile="primary_profile_only"/> - </safety-sources-group> - </safety-sources-config> -</safety-center-config> diff --git a/framework-s/api/system-current.txt b/framework-s/api/system-current.txt index 913fcad50..8c3550b11 100644 --- a/framework-s/api/system-current.txt +++ b/framework-s/api/system-current.txt @@ -393,3 +393,103 @@ package android.safetycenter { } +package android.safetycenter.config { + + public final class Parser { + method @NonNull public static android.safetycenter.config.SafetyCenterConfig parseXmlResource(@NonNull android.content.res.XmlResourceParser) throws android.safetycenter.config.Parser.ParseException; + } + + public static final class Parser.ParseException extends java.lang.Exception { + ctor public Parser.ParseException(@NonNull String); + ctor public Parser.ParseException(@NonNull String, @NonNull Throwable); + } + + public final class SafetyCenterConfig implements android.os.Parcelable { + method public int describeContents(); + method @NonNull public java.util.List<android.safetycenter.config.SafetySourcesGroup> getSafetySourcesGroups(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.safetycenter.config.SafetyCenterConfig> CREATOR; + } + + public static final class SafetyCenterConfig.Builder { + ctor public SafetyCenterConfig.Builder(); + method @NonNull public android.safetycenter.config.SafetyCenterConfig.Builder addSafetySourcesGroup(@NonNull android.safetycenter.config.SafetySourcesGroup); + method @NonNull public android.safetycenter.config.SafetyCenterConfig build(); + } + + public final class SafetySource implements android.os.Parcelable { + method public int describeContents(); + method @Nullable public String getBroadcastReceiverClassName(); + method @NonNull public String getId(); + method public int getInitialDisplayState(); + method @NonNull public String getIntentAction(); + method public int getMaxSeverityLevel(); + method @NonNull public String getPackageName(); + method public int getProfile(); + method @IdRes public int getSearchTermsResId(); + method @IdRes public int getSummaryResId(); + method @IdRes public int getTitleForWorkResId(); + method @IdRes public int getTitleResId(); + method public int getType(); + method public boolean isAllowLogging(); + method public boolean isAllowRefreshOnPageOpen(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.safetycenter.config.SafetySource> CREATOR; + field public static final int INITIAL_DISPLAY_STATE_DISABLED = 1; // 0x1 + field public static final int INITIAL_DISPLAY_STATE_ENABLED = 0; // 0x0 + field public static final int INITIAL_DISPLAY_STATE_HIDDEN = 2; // 0x2 + field public static final int PROFILE_ALL = 2; // 0x2 + field public static final int PROFILE_NONE = 0; // 0x0 + field public static final int PROFILE_PRIMARY = 1; // 0x1 + field public static final int SAFETY_SOURCE_TYPE_DYNAMIC = 2; // 0x2 + field public static final int SAFETY_SOURCE_TYPE_ISSUE_ONLY = 3; // 0x3 + field public static final int SAFETY_SOURCE_TYPE_STATIC = 1; // 0x1 + } + + public static final class SafetySource.Builder { + ctor public SafetySource.Builder(int); + method @NonNull public android.safetycenter.config.SafetySource build(); + method @NonNull public android.safetycenter.config.SafetySource.Builder setAllowLogging(boolean); + method @NonNull public android.safetycenter.config.SafetySource.Builder setAllowRefreshOnPageOpen(boolean); + method @NonNull public android.safetycenter.config.SafetySource.Builder setBroadcastReceiverClassName(@Nullable String); + method @NonNull public android.safetycenter.config.SafetySource.Builder setId(@Nullable String); + method @NonNull public android.safetycenter.config.SafetySource.Builder setInitialDisplayState(int); + method @NonNull public android.safetycenter.config.SafetySource.Builder setIntentAction(@Nullable String); + method @NonNull public android.safetycenter.config.SafetySource.Builder setMaxSeverityLevel(int); + method @NonNull public android.safetycenter.config.SafetySource.Builder setPackageName(@Nullable String); + method @NonNull public android.safetycenter.config.SafetySource.Builder setProfile(int); + method @NonNull public android.safetycenter.config.SafetySource.Builder setSearchTermsResId(@IdRes int); + method @NonNull public android.safetycenter.config.SafetySource.Builder setSummaryResId(@IdRes int); + method @NonNull public android.safetycenter.config.SafetySource.Builder setTitleForWorkResId(@IdRes int); + method @NonNull public android.safetycenter.config.SafetySource.Builder setTitleResId(@IdRes int); + } + + public final class SafetySourcesGroup implements android.os.Parcelable { + method public int describeContents(); + method @NonNull public String getId(); + method @NonNull public java.util.List<android.safetycenter.config.SafetySource> getSafetySources(); + method public int getStatelessIconType(); + method @IdRes public int getSummaryResId(); + method @IdRes public int getTitleResId(); + method public int getType(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.safetycenter.config.SafetySourcesGroup> CREATOR; + field public static final int SAFETY_SOURCES_GROUP_TYPE_COLLAPSIBLE = 0; // 0x0 + field public static final int SAFETY_SOURCES_GROUP_TYPE_HIDDEN = 2; // 0x2 + field public static final int SAFETY_SOURCES_GROUP_TYPE_RIGID = 1; // 0x1 + field public static final int STATELESS_ICON_TYPE_NONE = 0; // 0x0 + field public static final int STATELESS_ICON_TYPE_PRIVACY = 1; // 0x1 + } + + public static final class SafetySourcesGroup.Builder { + ctor public SafetySourcesGroup.Builder(); + method @NonNull public android.safetycenter.config.SafetySourcesGroup.Builder addSafetySource(@NonNull android.safetycenter.config.SafetySource); + method @NonNull public android.safetycenter.config.SafetySourcesGroup build(); + method @NonNull public android.safetycenter.config.SafetySourcesGroup.Builder setId(@Nullable String); + method @NonNull public android.safetycenter.config.SafetySourcesGroup.Builder setStatelessIconType(int); + method @NonNull public android.safetycenter.config.SafetySourcesGroup.Builder setSummaryResId(@IdRes int); + method @NonNull public android.safetycenter.config.SafetySourcesGroup.Builder setTitleResId(@IdRes int); + } + +} + diff --git a/SafetyCenter/Config/java/com/android/safetycenter/config/BuilderUtils.java b/framework-s/java/android/safetycenter/config/BuilderUtils.java index 10981733a..b94f9fe54 100644 --- a/SafetyCenter/Config/java/com/android/safetycenter/config/BuilderUtils.java +++ b/framework-s/java/android/safetycenter/config/BuilderUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.safetycenter.config; +package android.safetycenter.config; import android.annotation.IdRes; import android.annotation.NonNull; diff --git a/SafetyCenter/Config/java/com/android/safetycenter/config/Parser.java b/framework-s/java/android/safetycenter/config/Parser.java index 99108839d..0f6c219b2 100644 --- a/SafetyCenter/Config/java/com/android/safetycenter/config/Parser.java +++ b/framework-s/java/android/safetycenter/config/Parser.java @@ -14,7 +14,9 @@ * limitations under the License. */ -package com.android.safetycenter.config; +package android.safetycenter.config; + +import static android.os.Build.VERSION_CODES.TIRAMISU; import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT; import static org.xmlpull.v1.XmlPullParser.END_TAG; @@ -27,20 +29,27 @@ import static java.util.Objects.requireNonNull; import android.annotation.IdRes; import android.annotation.NonNull; -import android.annotation.Nullable; +import android.annotation.SystemApi; import android.content.res.Resources; import android.content.res.XmlResourceParser; +import android.safetycenter.config.SafetySource.InitialDisplayState; +import android.safetycenter.config.SafetySource.Profile; +import android.safetycenter.config.SafetySource.SafetySourceType; +import android.safetycenter.config.SafetySourcesGroup.StatelessIconType; -import com.android.safetycenter.config.SafetySource.InitialDisplayState; -import com.android.safetycenter.config.SafetySource.Profile; -import com.android.safetycenter.config.SafetySource.SafetySourceType; -import com.android.safetycenter.config.SafetySourcesGroup.StatelessIconType; +import androidx.annotation.RequiresApi; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; -/** Utility class to parse and validate a Safety Center Config */ +/** + * Utility class to parse and validate a Safety Center Config + * + * @hide + */ +@SystemApi +@RequiresApi(TIRAMISU) public final class Parser { private Parser() { } @@ -97,9 +106,12 @@ public final class Parser { /** * Parses and validates the given XML resource into a {@link SafetyCenterConfig} object. * + * <p>It throws a {@link ParseException} if the given XML resource does not comply with the + * safety_center_config.xsd schema. + * * @param parser the XML resource parsing interface */ - @Nullable + @NonNull public static SafetyCenterConfig parseXmlResource(@NonNull XmlResourceParser parser) throws ParseException { requireNonNull(parser); diff --git a/SafetyCenter/Config/java/com/android/safetycenter/config/SafetyCenterConfig.java b/framework-s/java/android/safetycenter/config/SafetyCenterConfig.java index 8f8fc78ae..235fa99f8 100644 --- a/SafetyCenter/Config/java/com/android/safetycenter/config/SafetyCenterConfig.java +++ b/framework-s/java/android/safetycenter/config/SafetyCenterConfig.java @@ -14,11 +14,18 @@ * limitations under the License. */ -package com.android.safetycenter.config; +package android.safetycenter.config; + +import static android.os.Build.VERSION_CODES.TIRAMISU; import static java.util.Objects.requireNonNull; import android.annotation.NonNull; +import android.annotation.SystemApi; +import android.os.Parcel; +import android.os.Parcelable; + +import androidx.annotation.RequiresApi; import java.util.ArrayList; import java.util.Collections; @@ -27,8 +34,14 @@ import java.util.List; import java.util.Objects; import java.util.Set; -/** Data class used to represent the initial configuration and current state of the Safety Center */ -public final class SafetyCenterConfig { +/** + * Data class used to represent the initial configuration of the Safety Center + * + * @hide + */ +@SystemApi +@RequiresApi(TIRAMISU) +public final class SafetyCenterConfig implements Parcelable { @NonNull private final List<SafetySourcesGroup> mSafetySourcesGroups; @@ -62,6 +75,34 @@ public final class SafetyCenterConfig { + '}'; } + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeParcelableList(mSafetySourcesGroups, flags); + } + + @NonNull + public static final Parcelable.Creator<SafetyCenterConfig> CREATOR = + new Parcelable.Creator<SafetyCenterConfig>() { + @Override + public SafetyCenterConfig createFromParcel(Parcel in) { + List<SafetySourcesGroup> safetySourcesGroups = new ArrayList<>(); + in.readParcelableList(safetySourcesGroups, + SafetySourcesGroup.class.getClassLoader()); + return new SafetyCenterConfig( + Collections.unmodifiableList(safetySourcesGroups)); + } + + @Override + public SafetyCenterConfig[] newArray(int size) { + return new SafetyCenterConfig[size]; + } + }; + /** Builder class for {@link SafetyCenterConfig}. */ public static final class Builder { @NonNull diff --git a/SafetyCenter/Config/java/com/android/safetycenter/config/SafetySource.java b/framework-s/java/android/safetycenter/config/SafetySource.java index cc46c7930..dce0fac43 100644 --- a/SafetyCenter/Config/java/com/android/safetycenter/config/SafetySource.java +++ b/framework-s/java/android/safetycenter/config/SafetySource.java @@ -14,20 +14,33 @@ * limitations under the License. */ -package com.android.safetycenter.config; +package android.safetycenter.config; + +import static android.os.Build.VERSION_CODES.TIRAMISU; import android.annotation.IdRes; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.SystemApi; import android.content.res.Resources; +import android.os.Parcel; +import android.os.Parcelable; + +import androidx.annotation.RequiresApi; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Objects; -/** Data class used to represent a generic safety source */ -public final class SafetySource { +/** + * Data class used to represent the initial configuration of a safety source + * + * @hide + */ +@SystemApi +@RequiresApi(TIRAMISU) +public final class SafetySource implements Parcelable { /** Static safety source. */ public static final int SAFETY_SOURCE_TYPE_STATIC = 1; @@ -248,7 +261,6 @@ public final class SafetySource { } /** Returns the maximum severity level of this safety source. */ - @Profile public int getMaxSeverityLevel() { if (mType == SAFETY_SOURCE_TYPE_STATIC) { throw new UnsupportedOperationException( @@ -307,6 +319,7 @@ public final class SafetySource { && Objects.equals(mId, that.mId) && Objects.equals(mPackageName, that.mPackageName) && mTitleResId == that.mTitleResId + && mTitleForWorkResId == that.mTitleForWorkResId && mSummaryResId == that.mSummaryResId && Objects.equals(mIntentAction, that.mIntentAction) && mProfile == that.mProfile @@ -320,9 +333,10 @@ public final class SafetySource { @Override public int hashCode() { - return Objects.hash(mType, mId, mPackageName, mTitleResId, mSummaryResId, mIntentAction, - mProfile, mInitialDisplayState, mMaxSeverityLevel, mSearchTermsResId, - mBroadcastReceiverClassName, mAllowLogging, mAllowRefreshOnPageOpen); + return Objects.hash(mType, mId, mPackageName, mTitleResId, mTitleForWorkResId, + mSummaryResId, mIntentAction, mProfile, mInitialDisplayState, mMaxSeverityLevel, + mSearchTermsResId, mBroadcastReceiverClassName, mAllowLogging, + mAllowRefreshOnPageOpen); } @Override @@ -332,6 +346,7 @@ public final class SafetySource { + ", mId='" + mId + '\'' + ", mPackageName='" + mPackageName + '\'' + ", mTitleResId=" + mTitleResId + + ", mTitleForWorkResId=" + mTitleForWorkResId + ", mSummaryResId=" + mSummaryResId + ", mIntentAction='" + mIntentAction + '\'' + ", mProfile=" + mProfile @@ -344,6 +359,60 @@ public final class SafetySource { + '}'; } + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeInt(mType); + dest.writeString(mId); + dest.writeString(mPackageName); + dest.writeInt(mTitleResId); + dest.writeInt(mTitleForWorkResId); + dest.writeInt(mSummaryResId); + dest.writeString(mIntentAction); + dest.writeInt(mProfile); + dest.writeInt(mInitialDisplayState); + dest.writeInt(mMaxSeverityLevel); + dest.writeInt(mSearchTermsResId); + dest.writeString(mBroadcastReceiverClassName); + dest.writeBoolean(mAllowLogging); + dest.writeBoolean(mAllowRefreshOnPageOpen); + } + + @NonNull + public static final Parcelable.Creator<SafetySource> CREATOR = + new Parcelable.Creator<SafetySource>() { + @Override + public SafetySource createFromParcel(Parcel in) { + int type = in.readInt(); + String id = in.readString(); + String packageName = in.readString(); + int titleResId = in.readInt(); + int titleForWorkResId = in.readInt(); + int summaryResId = in.readInt(); + String intentAction = in.readString(); + int profile = in.readInt(); + int initialDisplayState = in.readInt(); + int maxSeverityLevel = in.readInt(); + int searchTermsResId = in.readInt(); + String broadcastReceiverClassName = in.readString(); + boolean allowLogging = in.readBoolean(); + boolean allowRefreshOnPageOpen = in.readBoolean(); + return new SafetySource(type, id, packageName, titleResId, titleForWorkResId, + summaryResId, intentAction, profile, initialDisplayState, + maxSeverityLevel, searchTermsResId, broadcastReceiverClassName, + allowLogging, allowRefreshOnPageOpen); + } + + @Override + public SafetySource[] newArray(int size) { + return new SafetySource[size]; + } + }; + /** Builder class for {@link SafetySource}. */ public static final class Builder { @SafetySourceType diff --git a/SafetyCenter/Config/java/com/android/safetycenter/config/SafetySourcesGroup.java b/framework-s/java/android/safetycenter/config/SafetySourcesGroup.java index ee6b391ea..0e4f11d7c 100644 --- a/SafetyCenter/Config/java/com/android/safetycenter/config/SafetySourcesGroup.java +++ b/framework-s/java/android/safetycenter/config/SafetySourcesGroup.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package com.android.safetycenter.config; +package android.safetycenter.config; -import static com.android.safetycenter.config.SafetySource.SAFETY_SOURCE_TYPE_ISSUE_ONLY; +import static android.os.Build.VERSION_CODES.TIRAMISU; import static java.util.Objects.requireNonNull; @@ -24,7 +24,12 @@ import android.annotation.IdRes; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.SystemApi; import android.content.res.Resources; +import android.os.Parcel; +import android.os.Parcelable; + +import androidx.annotation.RequiresApi; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -33,8 +38,14 @@ import java.util.Collections; import java.util.List; import java.util.Objects; -/** Data class used to represent a group of mixed safety sources */ -public final class SafetySourcesGroup { +/** + * Data class used to represent the initial configuration of a group of safety sources + * + * @hide + */ +@SystemApi +@RequiresApi(TIRAMISU) +public final class SafetySourcesGroup implements Parcelable { /** * Indicates that the safety sources group should be displayed as a collapsible group with an @@ -182,6 +193,41 @@ public final class SafetySourcesGroup { + '}'; } + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeString(mId); + dest.writeInt(mTitleResId); + dest.writeInt(mSummaryResId); + dest.writeInt(mStatelessIconType); + dest.writeParcelableList(mSafetySources, flags); + } + + @NonNull + public static final Parcelable.Creator<SafetySourcesGroup> CREATOR = + new Parcelable.Creator<SafetySourcesGroup>() { + @Override + public SafetySourcesGroup createFromParcel(Parcel in) { + String id = in.readString(); + int titleResId = in.readInt(); + int summaryResId = in.readInt(); + int statelessIconType = in.readInt(); + List<SafetySource> safetySources = new ArrayList<>(); + in.readParcelableList(safetySources, SafetySource.class.getClassLoader()); + return new SafetySourcesGroup(id, titleResId, summaryResId, statelessIconType, + Collections.unmodifiableList(safetySources)); + } + + @Override + public SafetySourcesGroup[] newArray(int size) { + return new SafetySourcesGroup[size]; + } + }; + /** Builder class for {@link SafetySourcesGroup}. */ public static final class Builder { @Nullable @@ -248,7 +294,7 @@ public final class SafetySourcesGroup { int safetySourcesSize = mSafetySources.size(); for (int i = 0; i < safetySourcesSize; i++) { int type = mSafetySources.get(i).getType(); - if (type != SAFETY_SOURCE_TYPE_ISSUE_ONLY) { + if (type != SafetySource.SAFETY_SOURCE_TYPE_ISSUE_ONLY) { titleRequired = true; break; } diff --git a/service/Android.bp b/service/Android.bp index fcb7f6739..b55992108 100644 --- a/service/Android.bp +++ b/service/Android.bp @@ -104,7 +104,6 @@ java_sdk_library { "kotlin-stdlib", "modules-utils-backgroundthread", "modules-utils-os", - "safety-center-config", "safety-center-resources-lib", "service-permission-shared", ], diff --git a/service/java/com/android/safetycenter/SafetyCenterConfigReader.java b/service/java/com/android/safetycenter/SafetyCenterConfigReader.java index 4fc4d338f..df695a0d6 100644 --- a/service/java/com/android/safetycenter/SafetyCenterConfigReader.java +++ b/service/java/com/android/safetycenter/SafetyCenterConfigReader.java @@ -24,12 +24,12 @@ import android.annotation.StringRes; import android.content.Context; import android.content.res.Resources; import android.content.res.XmlResourceParser; +import android.safetycenter.config.Parser; +import android.safetycenter.config.SafetyCenterConfig; import android.util.Log; import androidx.annotation.RequiresApi; -import com.android.safetycenter.config.Parser; -import com.android.safetycenter.config.SafetyCenterConfig; import com.android.safetycenter.resources.SafetyCenterResourcesContext; /** diff --git a/service/java/com/android/safetycenter/SafetyCenterDataTracker.java b/service/java/com/android/safetycenter/SafetyCenterDataTracker.java index beffd9d08..f54cc2b4e 100644 --- a/service/java/com/android/safetycenter/SafetyCenterDataTracker.java +++ b/service/java/com/android/safetycenter/SafetyCenterDataTracker.java @@ -39,14 +39,13 @@ import android.safetycenter.SafetyCenterStatus; import android.safetycenter.SafetySourceData; import android.safetycenter.SafetySourceIssue; import android.safetycenter.SafetySourceStatus; +import android.safetycenter.config.SafetyCenterConfig; +import android.safetycenter.config.SafetySource; +import android.safetycenter.config.SafetySourcesGroup; import android.util.Log; import androidx.annotation.RequiresApi; -import com.android.safetycenter.config.SafetyCenterConfig; -import com.android.safetycenter.config.SafetySource; -import com.android.safetycenter.config.SafetySourcesGroup; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/service/java/com/android/safetycenter/SafetyCenterRefreshManager.java b/service/java/com/android/safetycenter/SafetyCenterRefreshManager.java index ab89c9167..ff6085a96 100644 --- a/service/java/com/android/safetycenter/SafetyCenterRefreshManager.java +++ b/service/java/com/android/safetycenter/SafetyCenterRefreshManager.java @@ -27,8 +27,7 @@ import static android.safetycenter.SafetyCenterManager.EXTRA_REFRESH_REQUEST_TYP import static android.safetycenter.SafetyCenterManager.EXTRA_REFRESH_SAFETY_SOURCES_REQUEST_TYPE; import static android.safetycenter.SafetyCenterManager.REFRESH_REASON_PAGE_OPEN; import static android.safetycenter.SafetyCenterManager.REFRESH_REASON_RESCAN_BUTTON_CLICK; - -import static com.android.safetycenter.config.SafetySource.SAFETY_SOURCE_TYPE_STATIC; +import static android.safetycenter.config.SafetySource.SAFETY_SOURCE_TYPE_STATIC; import android.annotation.NonNull; import android.app.BroadcastOptions; @@ -37,13 +36,12 @@ import android.content.Context; import android.content.Intent; import android.os.UserHandle; import android.safetycenter.SafetyCenterManager.RefreshReason; +import android.safetycenter.config.SafetyCenterConfig; +import android.safetycenter.config.SafetySource; import android.util.Log; import androidx.annotation.RequiresApi; -import com.android.safetycenter.config.SafetyCenterConfig; -import com.android.safetycenter.config.SafetySource; - import java.time.Duration; import java.util.ArrayList; import java.util.List; |