自訂安全中心

啟用或停用安全中心

如要啟用或停用安全中心,請在 frameworks/base/core/res/res/values/config.xml 檔案中使用可重疊的 config_enableSafetyCenter 布林值欄位。

在大多數裝置上,安全中心預設為支援手機和平板電腦等裝置。在某些板型規格上,安全中心預設為停用狀態,例如在 Android Auto、Android TV 和 Android Wear 上。

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <!-- ... -->
   <!-- Determines whether SafetyCenter feature is enabled. -->
    <bool name="config_enableSafetyCenter">true</bool>
    <!-- ... -->
</resources>

如要支援安全中心,請將 config_enableSafetyCenter 設為 true。如果您不想支援 Safety Center,請將這個值設為 false 來停用。

停用安全中心後,任何嘗試重新導向至「安全性與隱私權」頁面的操作都會改為開啟「設定」應用程式。任何嘗試與 API 互動的行為都會遭到靜默忽略,或傳回預設值。視安全中心是否已啟用而定,系統也會顯示或隱藏相關的「快速設定」方塊和「設定」項目。

DeviceConfig 旗標

除了使用 config_enableSafetyCenter 設定啟用安全中心,您還可以使用 DeviceConfig 標記 (safety_center_is_enabled) 從遠端啟用或停用安全中心。

在 Android 14 以上版本中,這個標記預設為 true,因此您不需要採取進一步行動。

在 Android 13 中,安全中心預設為在伺服器端停用,並透過使用此標記的許可清單啟用。提交裝置指紋,並與 TAM 聯絡,要求對方將您加入許可清單。請注意,您必須將主線程式版本 M-2022-11 以上版本加入許可清單。針對本機開發和測試,您可以使用 adb 指令在本機啟用或停用標記 (直到重新啟動為止)。例如,如要啟用旗標:

adb root
adb shell device_config set_sync_disabled_for_tests until_reboot
adb shell device_config put privacy safety_center_is_enabled true

如要確認是否已啟用安全中心,請按照下列步驟操作:

adb root
adb shell cmd safety_center enabled

輸出內容會傳回裝置是否已正確啟用安全中心。

更新設定檔

使用 safety_center_config.xml 設定檔修改安全中心畫面的內容。只要符合自訂需求,您就可以疊加這個檔案。

重疊設定檔

如要疊加 safety_center_config.xml 檔案,請參閱「在執行階段變更應用程式資源的值」,瞭解如何修改執行階段資源疊加層 (RRO)。

在 Android 14 中,請務必疊加 res/raw-v34/safety_center_config.xml 檔案,而非 res/raw/safety_center_config.xml,因為前者具有優先順序 (這也適用於 v34 的其他範圍檔案,例如 res/values-v34/strings.xml)。疊加套件必須具有低於 34 的最低 SDK,否則 v34 限定詞可能會在最佳化期間遭到移除。此外,請務必使用靜態疊加層,因為這個值會在開機期間載入。

如果是 Android 開放原始碼計畫 (AOSP) 裝置,請指定 com.android.safetycenter.resources 套件。沒有要套用的重疊設定。所有資源皆可重疊,且內容不受限制。

如果 GMS 裝置已設定為接收 Mainline 更新,請指定 com.google.android.safetycenter.resources 套件。指定設定 SafetyCenterConfig。這項設定要求疊加套件必須位於 productsystemvendor 分區。GMS 原始設備製造商 (OEM) 應複製 Google 提供的 safety_center_config.xml 檔案,並將修改限制在 GTS 測試允許的範圍內。疊加定義應類似以下內容:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="your.overlay.package"
    android:versionCode="1"
    android:versionName="1.0">
    <application android:hasCode="false" />
    <overlay
      android:targetPackage="com.google.android.safetycenter.resources"
      android:targetName="SafetyCenterConfig"
      android:isStatic="true"
      android:priority="0"/>
</manifest>

如果 GMS 裝置未設定接收 Mainline 更新,請指定 com.android.safetycenter.resources 套件。沒有要指定的疊加層設定。疊加套件必須使用套件名稱 com.google.android.safetycenter.resources

GMS 原始設備製造商應複製 Google 提供的 safety_center_config.xml 檔案,並僅修改 GTS 測試允許的部分。GMS OEM 也必須定義 XML 設定中使用的字串。

檔案結構

大致來說,safety_center_config.xml 檔案是安全性來源的清單。這些安全來源會以群組方式排列,以便管理安全中心畫面上的信號,例如應用程式安全性或螢幕鎖定。這個清單的順序會決定顯示順序:

<safety-center-config> <!-- Wrapper for the Safety Center configuration -->
    <safety-sources-config>< !-- Wrapper for the safety sources groups -->
        <safety-sources-group> <!-- Contains information about a safety sources group -->
            <dynamic-safety-source /> <!-- Contains information about a safety source -->
            <!-- More safety sources in the group -->
        </safety-sources-group> <!-- More safety sources groups -->
    </safety-sources-config>
</safety-center-config>

Google 設定檔

AOSP 設定檔位於 packages/modules/Permission/SafetyCenter/Resources/res/raw/safety_center_config.xml 中。

在 Android 13 中,Google 設定檔為:

<safety-center-config>
    <safety-sources-config>
        <safety-sources-group
            id="GoogleAppSecuritySources"
            title="@com.google.android.safetycenter.resources:string/google_app_security_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_app_security_sources_summary">
            <dynamic-safety-source
                id="GooglePlayProtect"
                packageName="com.android.vending"
                profile="all_profiles"
                intentAction="com.google.android.finsky.PLAY_PROTECT"
                title="@com.google.android.safetycenter.resources:string/google_play_protect_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_play_protect_title_for_work"
                summary="@com.google.android.safetycenter.resources:string/google_play_protect_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_play_protect_search_terms"
                refreshOnPageOpenAllowed="true"/>
            <dynamic-safety-source
                id="GoogleAppProtectionService"
                packageName="com.google.android.odad"
                profile="primary_profile_only"
                initialDisplayState="hidden"
                loggingAllowed="false"/>
        </safety-sources-group>
        <safety-sources-group
            id="AndroidLockScreenSources"
            title="@com.google.android.safetycenter.resources:string/google_lock_screen_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_lock_screen_sources_summary">
            <dynamic-safety-source
                id="AndroidLockScreen"
                packageName="com.android.settings"
                profile="primary_profile_only"
                title="@com.google.android.safetycenter.resources:string/google_lock_screen_title"
                summary="@com.google.android.safetycenter.resources:string/google_lock_screen_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_lock_screen_search_terms"
                initialDisplayState="disabled"
                maxSeverityLevel="300"
                refreshOnPageOpenAllowed="true"/>
            <dynamic-safety-source
                id="AndroidBiometrics"
                packageName="com.android.settings"
                profile="primary_profile_only"
                title="@com.google.android.safetycenter.resources:string/google_biometrics_title"
                summary="@com.google.android.safetycenter.resources:string/google_biometrics_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_biometrics_search_terms"
                initialDisplayState="@com.google.android.safetycenter.resources:string/google_biometrics_initial_display_state"
                maxSeverityLevel="0"
                refreshOnPageOpenAllowed="true"/>
        </safety-sources-group>
        <safety-sources-group
            id="GoogleAccountsSources"
            title="@com.google.android.safetycenter.resources:string/google_accounts_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_accounts_sources_summary">
            <dynamic-safety-source
                id="GoogleSecurityCheckup"
                packageName="com.google.android.gms"
                profile="all_profiles"
                intentAction="com.google.android.gms.accountsettings.action.SAFETY_CENTER_SECURITY_CHECKUP"
                title="@com.google.android.safetycenter.resources:string/google_security_checkup_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_security_checkup_title_for_work"
                summary="@com.google.android.safetycenter.resources:string/google_security_checkup_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_security_checkup_search_terms"
                refreshOnPageOpenAllowed="true"/>
        </safety-sources-group>
        <safety-sources-group
            id="GoogleDeviceFinderSources"
            title="@com.google.android.safetycenter.resources:string/google_device_finder_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_device_finder_sources_summary">
            <dynamic-safety-source
                id="GoogleFindMyDevice"
                packageName="com.google.android.gms"
                profile="primary_profile_only"
                intentAction="com.google.android.gms.settings.FIND_MY_DEVICE_SETTINGS"
                title="@com.google.android.safetycenter.resources:string/google_find_my_device_title"
                summary="@com.google.android.safetycenter.resources:string/google_find_my_device_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_find_my_device_search_terms"
                refreshOnPageOpenAllowed="true"/>
            <dynamic-safety-source
                id="GoogleRogueTag"
                packageName="com.google.android.gms"
                profile="primary_profile_only"
                initialDisplayState="hidden"
                refreshOnPageOpenAllowed="true"/>
        </safety-sources-group>
        <safety-sources-group
            id="GoogleUpdateSources"
            title="@com.google.android.safetycenter.resources:string/google_updates_title"
            summary="@com.google.android.safetycenter.resources:string/google_updates_summary">
            <dynamic-safety-source
                id="GoogleSecurityUpdates"
                packageName="com.google.android.gms"
                profile="primary_profile_only"
                intentAction="@com.google.android.safetycenter.resources:string/google_security_updates_intent"
                title="@com.google.android.safetycenter.resources:string/google_security_updates_title"
                summary="@com.google.android.safetycenter.resources:string/google_security_updates_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_security_updates_search_terms"
                refreshOnPageOpenAllowed="true"/>
            <dynamic-safety-source
                id="GooglePlaySystemUpdate"
                packageName="com.android.vending"
                profile="primary_profile_only"
                intentAction="android.settings.MODULE_UPDATE_SETTINGS"
                title="@com.google.android.safetycenter.resources:string/google_play_system_update_title"
                summary="@com.google.android.safetycenter.resources:string/google_play_system_update_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_play_system_update_search_terms"
                refreshOnPageOpenAllowed="true"/>
        </safety-sources-group>
        <safety-sources-group
            id="AndroidPrivacySources"
            title="@com.google.android.safetycenter.resources:string/google_privacy_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_privacy_sources_summary"
            statelessIconType="privacy">
            <static-safety-source
                id="AndroidPermissionUsage"
                profile="primary_profile_only"
                intentAction="android.intent.action.REVIEW_PERMISSION_USAGE"
                title="@com.google.android.safetycenter.resources:string/google_permission_usage_title"
                summary="@com.google.android.safetycenter.resources:string/google_permission_usage_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_permission_usage_search_terms"/>
            <static-safety-source
                id="AndroidPermissionManager"
                profile="primary_profile_only"
                intentAction="android.intent.action.MANAGE_PERMISSIONS"
                title="@com.google.android.safetycenter.resources:string/google_permission_manager_title"
                summary="@com.google.android.safetycenter.resources:string/google_permission_manager_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_permission_manager_search_terms"/>
            <static-safety-source
                id="AndroidPrivacyControls"
                profile="primary_profile_only"
                intentAction="android.settings.PRIVACY_CONTROLS"
                title="@com.google.android.safetycenter.resources:string/google_privacy_controls_title"
                summary="@com.google.android.safetycenter.resources:string/google_privacy_controls_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_privacy_controls_search_terms"/>
            <issue-only-safety-source
                id="AndroidAccessibility"
                packageName="com.google.android.permissioncontroller"
                profile="all_profiles"
                refreshOnPageOpenAllowed="true"/>
            <issue-only-safety-source
                id="AndroidNotificationListener"
                packageName="com.google.android.permissioncontroller"
                profile="primary_profile_only"
                refreshOnPageOpenAllowed="true"/>
            <issue-only-safety-source
                id="AndroidBackgroundLocation"
                packageName="com.google.android.permissioncontroller"
                profile="all_profiles"
                refreshOnPageOpenAllowed="true"/>
            <issue-only-safety-source
                id="AndroidPermissionAutoRevoke"
                packageName="com.google.android.permissioncontroller"
                profile="all_profiles"
                refreshOnPageOpenAllowed="true"/>
        </safety-sources-group>
        <safety-sources-group
            id="AndroidAdvancedSources"
            title="@com.google.android.safetycenter.resources:string/google_advanced_title">
            <dynamic-safety-source
                id="AndroidWorkPolicyInfo"
                packageName="com.google.android.permissioncontroller"
                profile="primary_profile_only"
                initialDisplayState="hidden"
                refreshOnPageOpenAllowed="true"/>
            <static-safety-source
                id="AndroidAdvancedSecurity"
                profile="primary_profile_only"
                intentAction="com.android.settings.security.SECURITY_ADVANCED_SETTINGS"
                title="@com.google.android.safetycenter.resources:string/google_advanced_security_title"
                summary="@com.google.android.safetycenter.resources:string/google_advanced_security_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_advanced_security_search_terms"/>
            <static-safety-source
                id="AndroidAdvancedPrivacy"
                profile="primary_profile_only"
                intentAction="android.settings.PRIVACY_ADVANCED_SETTINGS"
                title="@com.google.android.safetycenter.resources:string/google_advanced_privacy_title"
                summary="@com.google.android.safetycenter.resources:string/google_advanced_privacy_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_advanced_privacy_search_terms"/>
        </safety-sources-group>
    </safety-sources-config>
</safety-center-config>

在 Android 14 中,Google 設定檔為:

<safety-center-config>
    <safety-sources-config>
        <safety-sources-group
            id="GoogleAppSecuritySources"
            title="@com.google.android.safetycenter.resources:string/google_app_security_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_app_security_sources_summary">
            <dynamic-safety-source
                id="GooglePlayProtect"
                packageName="com.android.vending"
                profile="all_profiles"
                intentAction="com.google.android.finsky.PLAY_PROTECT"
                title="@com.google.android.safetycenter.resources:string/google_play_protect_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_play_protect_title_for_work"
                summary="@com.google.android.safetycenter.resources:string/google_play_protect_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_play_protect_search_terms"
                notificationsAllowed="true"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                deduplicationGroup="AppSecurity"/>
            <issue-only-safety-source
                id="GoogleAppProtectionService"
                packageName="com.google.android.odad"
                profile="primary_profile_only"
                loggingAllowed="false"
                deduplicationGroup="AppSecurity"/>
        </safety-sources-group>
        <safety-sources-group
            id="AndroidLockScreenSources"
            title="@com.google.android.safetycenter.resources:string/google_lock_screen_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_lock_screen_sources_summary">
            <dynamic-safety-source
                id="AndroidLockScreen"
                packageName="com.android.settings"
                profile="primary_profile_only"
                title="@com.google.android.safetycenter.resources:string/google_lock_screen_title"
                summary="@com.google.android.safetycenter.resources:string/google_lock_screen_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_lock_screen_search_terms"
                initialDisplayState="disabled"
                notificationsAllowed="true"
                maxSeverityLevel="300"/>
            <dynamic-safety-source
                id="AndroidBiometrics"
                packageName="com.android.settings"
                profile="all_profiles"
                title="@com.google.android.safetycenter.resources:string/google_biometrics_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_biometrics_title_for_work"
                summary="@com.google.android.safetycenter.resources:string/google_biometrics_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_biometrics_search_terms"
                initialDisplayState="@com.google.android.safetycenter.resources:string/google_biometrics_initial_display_state"
                maxSeverityLevel="0"/>
        </safety-sources-group>
        <safety-sources-group
            id="GoogleAccountsSources"
            title="@com.google.android.safetycenter.resources:string/google_accounts_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_accounts_sources_summary">
            <dynamic-safety-source
                id="GoogleSecurityCheckup"
                packageName="com.google.android.gms"
                profile="all_profiles"
                intentAction="com.google.android.gms.accountsettings.action.SAFETY_CENTER_SECURITY_CHECKUP"
                title="@com.google.android.safetycenter.resources:string/google_security_checkup_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_security_checkup_title_for_work"
                summary="@com.google.android.safetycenter.resources:string/google_security_checkup_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_security_checkup_search_terms"
                deduplicationGroup="AccountRequired"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                refreshOnPageOpenAllowed="true"/>
            <dynamic-safety-source
                id="GooglePasswordCheckup"
                packageName="com.google.android.gms"
                profile="all_profiles"
                title="@com.google.android.safetycenter.resources:string/google_password_checkup_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_password_checkup_title_for_work"
                searchTerms="@com.google.android.safetycenter.resources:string/google_password_checkup_search_terms"
                initialDisplayState="hidden"
                notificationsAllowed="true"
                deduplicationGroup="AccountRequired"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                refreshOnPageOpenAllowed="false"/>
        </safety-sources-group>
        <safety-sources-group
            id="GoogleDeviceFinderSources"
            title="@com.google.android.safetycenter.resources:string/google_device_finder_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_device_finder_sources_summary">
            <dynamic-safety-source
                id="GoogleFindMyDevice"
                packageName="com.google.android.gms"
                profile="primary_profile_only"
                intentAction="com.google.android.gms.settings.FIND_MY_DEVICE_SETTINGS"
                title="@com.google.android.safetycenter.resources:string/google_find_my_device_title"
                summary="@com.google.android.safetycenter.resources:string/google_find_my_device_summary"
                notificationsAllowed="true"
                deduplicationGroup="AccountRequired"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                searchTerms="@com.google.android.safetycenter.resources:string/google_find_my_device_search_terms"/>
            <dynamic-safety-source
                id="GoogleRogueTag"
                packageName="com.google.android.gms"
                profile="primary_profile_only"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                initialDisplayState="hidden"/>
        </safety-sources-group>
        <safety-sources-group
            id="GoogleUpdateSources"
            title="@com.google.android.safetycenter.resources:string/google_updates_title"
            summary="@com.google.android.safetycenter.resources:string/google_updates_summary">
            <dynamic-safety-source
                id="GoogleSecurityUpdates"
                packageName="com.google.android.gms"
                profile="primary_profile_only"
                intentAction="@com.google.android.safetycenter.resources:string/google_security_updates_intent"
                title="@com.google.android.safetycenter.resources:string/google_security_updates_title"
                summary="@com.google.android.safetycenter.resources:string/google_security_updates_summary"
                notificationsAllowed="true"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                searchTerms="@com.google.android.safetycenter.resources:string/google_security_updates_search_terms"/>
            <dynamic-safety-source
                id="GooglePlaySystemUpdate"
                packageName="com.android.vending"
                profile="primary_profile_only"
                intentAction="android.settings.MODULE_UPDATE_SETTINGS"
                title="@com.google.android.safetycenter.resources:string/google_play_system_update_title"
                summary="@com.google.android.safetycenter.resources:string/google_play_system_update_summary"
                notificationsAllowed="true"
                deduplicationGroup="AccountRequired"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                searchTerms="@com.google.android.safetycenter.resources:string/google_play_system_update_search_terms"/>
            <dynamic-safety-source
                id="GoogleBackupAndRestore"
                packageName="com.google.android.gms"
                profile="primary_profile_only"
                initialDisplayState="hidden"
                title="@com.google.android.safetycenter.resources:string/google_backup_title"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                searchTerms="@com.google.android.safetycenter.resources:string/google_backup_search_terms"/>
        </safety-sources-group>
        <safety-sources-group
            id="AndroidPrivacySources"
            title="@com.google.android.safetycenter.resources:string/google_privacy_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_privacy_sources_summary"
            statelessIconType="privacy">
            <static-safety-source
                id="AndroidPermissionManager"
                profile="primary_profile_only"
                intentAction="android.intent.action.MANAGE_PERMISSIONS"
                title="@com.google.android.safetycenter.resources:string/google_permission_manager_title"
                summary="@com.google.android.safetycenter.resources:string/google_permission_manager_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_permission_manager_search_terms"/>
            <static-safety-source
                id="AndroidPermissionUsage"
                profile="primary_profile_only"
                intentAction="android.intent.action.REVIEW_PERMISSION_USAGE"
                title="@com.google.android.safetycenter.resources:string/google_permission_usage_title"
                summary="@com.google.android.safetycenter.resources:string/google_permission_usage_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_permission_usage_search_terms"/>
            <static-safety-source
                id="GoogleAdsIdentity"
                profile="all_profiles"
                packageName="com.google.android.gms"
                intentAction="com.google.android.gms.adsidentity.ACTION_ADS_IDENTITY_SETTINGS"
                title="@com.google.android.safetycenter.resources:string/google_ads_identity_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_ads_identity_title_for_work"
                summary="@com.google.android.safetycenter.resources:string/google_ads_identity_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_ads_identity_search_terms"/>
            <dynamic-safety-source
                id="AndroidHealthConnect"
                profile="primary_profile_only"
                packageName="com.google.android.healthconnect.controller"
                initialDisplayState="hidden"
                refreshOnPageOpenAllowed="false"
                title="@com.google.android.safetycenter.resources:string/google_health_connect_title"
                searchTerms="@com.google.android.safetycenter.resources:string/google_health_connect_search_terms"/>
            <dynamic-safety-source
                id="AndroidPrivacyAppDataSharingUpdates"
                packageName="com.google.android.permissioncontroller"
                profile="primary_profile_only"
                initialDisplayState="hidden"
                refreshOnPageOpenAllowed="true"
                title="@com.google.android.safetycenter.resources:string/google_app_data_sharing_updates_title"
                searchTerms="@com.google.android.safetycenter.resources:string/google_app_data_sharing_updates_search_terms"/>
            <static-safety-source
                id="AndroidPrivacyControls"
                profile="primary_profile_only"
                intentAction="android.settings.PRIVACY_CONTROLS"
                title="@com.google.android.safetycenter.resources:string/google_privacy_controls_title"
                summary="@com.google.android.safetycenter.resources:string/google_privacy_controls_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_privacy_controls_search_terms"/>
            <static-safety-source
                id="GoogleActivityControls"
                profile="all_profiles"
                packageName="com.google.android.gms"
                intentAction="com.google.android.gms.accountsettings.action.ACTIVITY_CONTROLS"
                title="@com.google.android.safetycenter.resources:string/google_activity_controls_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_activity_controls_title_for_work"
                summary="@com.google.android.safetycenter.resources:string/google_activity_controls_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_activity_controls_search_terms"/>
            <issue-only-safety-source
                id="AndroidAccessibility"
                packageName="com.google.android.permissioncontroller"
                profile="all_profiles"
                notificationsAllowed="true"
                refreshOnPageOpenAllowed="true"/>
            <issue-only-safety-source
                id="AndroidNotificationListener"
                packageName="com.google.android.permissioncontroller"
                profile="primary_profile_only"
                notificationsAllowed="true"
                refreshOnPageOpenAllowed="true"/>
            <issue-only-safety-source
                id="AndroidBackgroundLocation"
                packageName="com.google.android.permissioncontroller"
                profile="all_profiles"
                notificationsAllowed="true"
                refreshOnPageOpenAllowed="true"/>
            <issue-only-safety-source
                id="AndroidPermissionAutoRevoke"
                packageName="com.google.android.permissioncontroller"
                profile="all_profiles"
                notificationsAllowed="true"
                refreshOnPageOpenAllowed="true"/>
        </safety-sources-group>
        <safety-sources-group
            id="AndroidAdvancedSources"
            title="@com.google.android.safetycenter.resources:string/google_advanced_title">
            <dynamic-safety-source
                id="AndroidWorkPolicyInfo"
                packageName="com.google.android.permissioncontroller"
                profile="primary_profile_only"
                title="@com.google.android.safetycenter.resources:string/google_work_policy_title"
                initialDisplayState="hidden"
                refreshOnPageOpenAllowed="true"/>
            <static-safety-source
                id="AndroidMoreSettings"
                profile="primary_profile_only"
                intentAction="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS"
                title="@com.google.android.safetycenter.resources:string/google_more_settings_title"
                summary="@com.google.android.safetycenter.resources:string/google_more_settings_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_more_settings_search_terms"/>
        </safety-sources-group>
    </safety-sources-config>
</safety-center-config>

在 Android 15 中,Google 設定檔為:

<safety-center-config>
    <safety-sources-config>
        <safety-sources-group
            id="GoogleAppSecuritySources"
            title="@com.google.android.safetycenter.resources:string/google_app_security_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_app_security_sources_summary">
            <dynamic-safety-source
                id="GooglePlayProtect"
                packageName="com.android.vending"
                profile="all_profiles"
                intentAction="com.google.android.finsky.PLAY_PROTECT"
                title="@com.google.android.safetycenter.resources:string/google_play_protect_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_play_protect_title_for_work"
                titleForPrivateProfile="@com.google.android.safetycenter.resources:string/google_play_protect_title_for_private_profile"
                summary="@com.google.android.safetycenter.resources:string/google_play_protect_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_play_protect_search_terms"
                notificationsAllowed="true"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                deduplicationGroup="AppSecurity"/>
            <issue-only-safety-source
                id="GoogleAppProtectionService"
                packageName="com.google.android.odad"
                profile="primary_profile_only"
                loggingAllowed="false"
                deduplicationGroup="AppSecurity"/>
        </safety-sources-group>
        <safety-sources-group
            id="AndroidLockScreenSources"
            title="@com.google.android.safetycenter.resources:string/google_lock_screen_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_lock_screen_sources_summary">
            <dynamic-safety-source
                id="AndroidLockScreen"
                packageName="com.android.settings"
                profile="primary_profile_only"
                title="@com.google.android.safetycenter.resources:string/google_lock_screen_title"
                summary="@com.google.android.safetycenter.resources:string/google_lock_screen_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_lock_screen_search_terms"
                initialDisplayState="disabled"
                notificationsAllowed="true"
                maxSeverityLevel="300"/>
            <dynamic-safety-source
                id="AndroidBiometrics"
                packageName="com.android.settings"
                profile="all_profiles"
                title="@com.google.android.safetycenter.resources:string/google_biometrics_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_biometrics_title_for_work"
                titleForPrivateProfile="@com.google.android.safetycenter.resources:string/google_biometrics_title_for_private_profile"
                summary="@com.google.android.safetycenter.resources:string/google_biometrics_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_biometrics_search_terms"
                initialDisplayState="@com.google.android.safetycenter.resources:string/google_biometrics_initial_display_state"
                maxSeverityLevel="0"/>
            <dynamic-safety-source
                id="GoogleAutoLock"
                packageName="com.google.android.gms"
                profile="primary_profile_only"
                initialDisplayState="hidden"
                maxSeverityLevel="0"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"/>
        </safety-sources-group>
        <safety-sources-group
            id="GoogleAccountsSources"
            title="@com.google.android.safetycenter.resources:string/google_accounts_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_accounts_sources_summary">
            <dynamic-safety-source
                id="GoogleSecurityCheckup"
                packageName="com.google.android.gms"
                profile="all_profiles"
                intentAction="com.google.android.gms.accountsettings.action.SAFETY_CENTER_SECURITY_CHECKUP"
                title="@com.google.android.safetycenter.resources:string/google_security_checkup_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_security_checkup_title_for_work"
                titleForPrivateProfile="@com.google.android.safetycenter.resources:string/google_security_checkup_title_for_private_profile"
                summary="@com.google.android.safetycenter.resources:string/google_security_checkup_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_security_checkup_search_terms"
                deduplicationGroup="AccountRequired"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                refreshOnPageOpenAllowed="true"/>
            <dynamic-safety-source
                id="GooglePasswordCheckup"
                packageName="com.google.android.gms"
                profile="all_profiles"
                title="@com.google.android.safetycenter.resources:string/google_password_checkup_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_password_checkup_title_for_work"
                titleForPrivateProfile="@com.google.android.safetycenter.resources:string/google_password_checkup_title_for_private_profile"
                searchTerms="@com.google.android.safetycenter.resources:string/google_password_checkup_search_terms"
                initialDisplayState="hidden"
                notificationsAllowed="true"
                deduplicationGroup="AccountRequired"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                refreshOnPageOpenAllowed="false"/>
        </safety-sources-group>
        <safety-sources-group
            id="GoogleDeviceFinderSources"
            title="@com.google.android.safetycenter.resources:string/google_device_finder_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_device_finder_sources_summary">
            <dynamic-safety-source
                id="GoogleFindMyDevice"
                packageName="com.google.android.gms"
                profile="primary_profile_only"
                intentAction="com.google.android.gms.settings.FIND_MY_DEVICE_SETTINGS"
                title="@com.google.android.safetycenter.resources:string/google_find_my_device_title"
                summary="@com.google.android.safetycenter.resources:string/google_find_my_device_summary"
                notificationsAllowed="true"
                deduplicationGroup="AccountRequired"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                searchTerms="@com.google.android.safetycenter.resources:string/google_find_my_device_search_terms"/>
            <dynamic-safety-source
                id="GoogleRogueTag"
                packageName="com.google.android.gms"
                profile="primary_profile_only"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                initialDisplayState="hidden"/>
        </safety-sources-group>
        <safety-sources-group
            id="GoogleUpdateSources"
            title="@com.google.android.safetycenter.resources:string/google_updates_title"
            summary="@com.google.android.safetycenter.resources:string/google_updates_summary">
            <dynamic-safety-source
                id="GoogleSecurityUpdates"
                packageName="com.google.android.gms"
                profile="primary_profile_only"
                intentAction="@com.google.android.safetycenter.resources:string/google_security_updates_intent"
                title="@com.google.android.safetycenter.resources:string/google_security_updates_title"
                summary="@com.google.android.safetycenter.resources:string/google_security_updates_summary"
                notificationsAllowed="true"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                searchTerms="@com.google.android.safetycenter.resources:string/google_security_updates_search_terms"/>
            <dynamic-safety-source
                id="GooglePlaySystemUpdate"
                packageName="com.android.vending"
                profile="primary_profile_only"
                intentAction="android.settings.MODULE_UPDATE_SETTINGS"
                title="@com.google.android.safetycenter.resources:string/google_play_system_update_title"
                summary="@com.google.android.safetycenter.resources:string/google_play_system_update_summary"
                notificationsAllowed="true"
                deduplicationGroup="AccountRequired"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                searchTerms="@com.google.android.safetycenter.resources:string/google_play_system_update_search_terms"/>
            <dynamic-safety-source
                id="GoogleBackupAndRestore"
                packageName="com.google.android.gms"
                profile="primary_profile_only"
                initialDisplayState="hidden"
                title="@com.google.android.safetycenter.resources:string/google_backup_title"
                packageCertificateHashes="1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83,d22cc500299fb22873a01a010de1c82fbe4d061119b94814dd301dab50cb7678,7ce83c1b71f3d572fed04c8d40c5cb10ff75e6d87d9df6fbd53f0468c2905053"
                searchTerms="@com.google.android.safetycenter.resources:string/google_backup_search_terms"/>
        </safety-sources-group>
        <safety-sources-group
            id="AndroidCellularNetworkSecuritySources"
            title="@com.google.android.safetycenter.resources:string/google_cellular_network_security_title"
            summary="@com.google.android.safetycenter.resources:string/google_cellular_network_security_summary">
            <dynamic-safety-source
                id="AndroidCellularNetworkSecurity"
                packageName="com.android.phone"
                profile="primary_profile_only"
                notificationsAllowed="true"
                initialDisplayState="hidden"/>
        </safety-sources-group>
        <safety-sources-group
            id="AndroidPrivacySources"
            title="@com.google.android.safetycenter.resources:string/google_privacy_sources_title"
            summary="@com.google.android.safetycenter.resources:string/google_privacy_sources_summary">
            <static-safety-source
                id="AndroidPermissionManager"
                profile="primary_profile_only"
                intentAction="android.intent.action.MANAGE_PERMISSIONS"
                title="@com.google.android.safetycenter.resources:string/google_permission_manager_title"
                summary="@com.google.android.safetycenter.resources:string/google_permission_manager_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_permission_manager_search_terms"/>
            <static-safety-source
                id="GoogleAdsIdentity"
                profile="all_profiles"
                packageName="com.google.android.gms"
                intentAction="com.google.android.gms.adsidentity.ACTION_ADS_IDENTITY_SETTINGS"
                title="@com.google.android.safetycenter.resources:string/google_ads_identity_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_ads_identity_title_for_work"
                titleForPrivateProfile="@com.google.android.safetycenter.resources:string/google_ads_identity_title_for_private_profile"
                summary="@com.google.android.safetycenter.resources:string/google_ads_identity_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_ads_identity_search_terms"/>
            <dynamic-safety-source
                id="AndroidHealthConnect"
                profile="primary_profile_only"
                packageName="com.google.android.healthconnect.controller"
                initialDisplayState="hidden"
                refreshOnPageOpenAllowed="false"
                title="@com.google.android.safetycenter.resources:string/google_health_connect_title"
                searchTerms="@com.google.android.safetycenter.resources:string/google_health_connect_search_terms"/>
            <dynamic-safety-source
                id="AndroidPrivacyAppDataSharingUpdates"
                packageName="com.google.android.permissioncontroller"
                profile="primary_profile_only"
                initialDisplayState="hidden"
                refreshOnPageOpenAllowed="true"
                title="@com.google.android.safetycenter.resources:string/google_app_data_sharing_updates_title"
                searchTerms="@com.google.android.safetycenter.resources:string/google_app_data_sharing_updates_search_terms"/>
            <static-safety-source
                id="AndroidPrivacyControls"
                profile="primary_profile_only"
                intentAction="android.settings.PRIVACY_CONTROLS"
                title="@com.google.android.safetycenter.resources:string/google_privacy_controls_title"
                summary="@com.google.android.safetycenter.resources:string/google_privacy_controls_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_privacy_controls_search_terms"/>
            <static-safety-source
                id="GoogleActivityControls"
                profile="all_profiles"
                packageName="com.google.android.gms"
                intentAction="com.google.android.gms.accountsettings.action.ACTIVITY_CONTROLS"
                title="@com.google.android.safetycenter.resources:string/google_activity_controls_title"
                titleForWork="@com.google.android.safetycenter.resources:string/google_activity_controls_title_for_work"
                titleForPrivateProfile="@com.google.android.safetycenter.resources:string/google_activity_controls_title_for_private_profile"
                summary="@com.google.android.safetycenter.resources:string/google_activity_controls_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_activity_controls_search_terms"/>
            <issue-only-safety-source
                id="AndroidAccessibility"
                packageName="com.google.android.permissioncontroller"
                profile="all_profiles"
                notificationsAllowed="true"
                refreshOnPageOpenAllowed="true"/>
            <issue-only-safety-source
                id="AndroidNotificationListener"
                packageName="com.google.android.permissioncontroller"
                profile="primary_profile_only"
                notificationsAllowed="true"
                refreshOnPageOpenAllowed="true"/>
            <issue-only-safety-source
                id="AndroidBackgroundLocation"
                packageName="com.google.android.permissioncontroller"
                profile="all_profiles"
                notificationsAllowed="true"
                refreshOnPageOpenAllowed="true"/>
            <issue-only-safety-source
                id="AndroidPermissionAutoRevoke"
                packageName="com.google.android.permissioncontroller"
                profile="all_profiles"
                notificationsAllowed="true"
                refreshOnPageOpenAllowed="true"/>
        </safety-sources-group>
        <safety-sources-group
            id="AndroidPrivacySourcesAdditional"
            title="@com.google.android.safetycenter.resources:string/google_privacy_additional_title">
            <static-safety-source
                id="AndroidPermissionUsage"
                profile="primary_profile_only"
                intentAction="android.intent.action.REVIEW_PERMISSION_USAGE"
                title="@com.google.android.safetycenter.resources:string/google_permission_usage_title"
                summary="@com.google.android.safetycenter.resources:string/google_permission_usage_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_permission_usage_search_terms"/>
            <dynamic-safety-source
                id="AndroidPrivateSpace"
                packageName="com.android.settings"
                profile="primary_profile_only"
                title="@com.google.android.safetycenter.resources:string/google_private_space_title"
                summary="@com.google.android.safetycenter.resources:string/google_private_space_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_private_space_search_terms"
                initialDisplayState="hidden"
                maxSeverityLevel="0"/>
        </safety-sources-group>
        <safety-sources-group
            id="AndroidAdvancedSources"
            title="@com.google.android.safetycenter.resources:string/google_advanced_title">
            <dynamic-safety-source
                id="AndroidWorkPolicyInfo"
                packageName="com.google.android.permissioncontroller"
                profile="primary_profile_only"
                title="@com.google.android.safetycenter.resources:string/google_work_policy_title"
                initialDisplayState="hidden"
                refreshOnPageOpenAllowed="true"/>
            <static-safety-source
                id="AndroidMoreSettings"
                profile="primary_profile_only"
                intentAction="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS"
                title="@com.google.android.safetycenter.resources:string/google_more_settings_title"
                summary="@com.google.android.safetycenter.resources:string/google_more_settings_summary"
                searchTerms="@com.google.android.safetycenter.resources:string/google_more_settings_search_terms"/>
        </safety-sources-group>
    </safety-sources-config>
</safety-center-config>

自訂安全中心來源

安全中心來源類型

來源可以是動態、僅問題或靜態,這取決於來源提供給安全中心的資料類型。

動態來源

如果安全性來源可為 Safety Center 提供動態資料,包括項目和潛在的警告卡,請將其標示為 dynamic-safety-source

<dynamic-safety-source
    id="AndroidLockScreen"
    packageName="com.android.settings"
    profile="primary_profile_only"
    title="@com.google.android.safetycenter.resources:string/google_lock_screen_title"
    summary="@com.google.android.safetycenter.resources:string/google_lock_screen_summary"
    searchTerms="@com.google.android.safetycenter.resources:string/google_lock_screen_search_terms"
    initialDisplayState="disabled"
    maxSeverityLevel="300"
    refreshOnPageOpenAllowed="true"/>

僅限問題來源

如果沒有相關設定項目,但仍提供警告,請將來源標示為 issue-only-safety-source。您只能提供警告,提供設定項目會導致錯誤:

<issue-only-safety-source
    id="AndroidAccessibility"
    packageName="com.google.android.permissioncontroller"
    profile="all_profiles"
    refreshOnPageOpenAllowed="true"/>

靜態來源

如果來源是沒有動態資料的重新導向項目,請將其標示為 static-safety-source

<static-safety-source
    id="AndroidAdvancedSecurity"
    profile="primary_profile_only"
    intentAction="com.google.android.settings.security.SECURITY_ADVANCED_SETTINGS"
    title="@com.google.android.safetycenter.resources:string/google_advanced_security_title"
    summary="@com.google.android.safetycenter.resources:string/google_advanced_security_summary"
    searchTerms="@com.google.android.safetycenter.resources:string/google_advanced_security_search_terms"/>

Safety Center 來源設定

視 Safety Center 來源類型和其他不變量而定,設定檔欄位可選、必填或禁止,且可自訂:

  • id
    • 安全來源的專屬 ID,必須在整個檔案中不重複,且只能由英文字母字元 (a-z、A-Z) 組成,且區分大小寫
    • 字串類型
    • 所有安全性來源類型皆為必填
  • packageName
    • 擁有此安全來源的套件名稱,例如 com.google.android.permissioncontroller
    • 字串類型
    • 動態安全性來源和僅限問題的安全性來源皆需要這項屬性
    • 在 Android 13 中,此值不適用於靜態安全性來源;在 Android 14 中,您可以選擇將其設為明確而非隱含地指定來源的 intentAction (詳情請參閱意圖解析說明文件)
  • initialDisplayState
    • 安全性來源未提供資料時,如何顯示 UI 項目
    • 以字串表示的列舉類型必須是下列其中一種:
      • enabled (預設值,正常顯示)
      • disabled (顯示為灰色,無法點選)
      • hidden (不會顯示)
    • 動態安全性來源的選用值 (預設為 enabled)
    • 禁止使用於僅限問題和靜態安全性來源
  • profile
    • 這個安全性來源是否會與使用者的受管理設定檔互動
    • 以字串表示的列舉類型必須是下列其中一種:
      • primary_profile_only (僅與設定檔父項互動)
      • all_profiles (也可以與受管理的資料夾互動,並從 Android 15 開始使用私人資料夾)
    • all_profiles 上,系統會產生多個 UI 項目 (一個用於設定檔父項,一個用於每個受管理的設定檔);安全性來源可為每個設定檔提供不同的資料
    • 所有安全性來源都必須提供
  • searchTerms
    • 在「設定」應用程式中使用搜尋功能時,對應至安全中心項目的搜尋字詞清單
    • 資源 ID 以完整資源名稱表示,例如 @package:string/my_search_terms
    • 動態和靜態安全性來源的選用項目 (預設為不含搜尋字詞)
    • 禁止用於僅提供問題的安全性來源
  • title
    • UI 項目的預設標題,在來源未動態提供資料時使用
    • 資源 ID 以完整資源名稱表示,例如 @package:string/my_title
    • 動態和靜態安全性來源皆需要 (除非是沒有 searchTermsinitialDisplayState="hidden")
    • 禁止用於僅提供問題的安全性來源
  • titleForWork
    • 當來源未動態提供資料時,所使用的受管理設定檔使用者介面項目的預設標題
    • 資源 ID 以完整資源名稱表示,例如 @package:string/my_title_for_work
    • 針對已指定 profile="all_profiles" 的動態和靜態安全性來源為必填 (除非 initialDisplayState="hidden" 沒有 searchTerms)
    • 禁止使用僅限問題安全來源,或含有 profile="primary_profile_only" 的來源
  • summary
    • UI 項目的預設摘要 (這是顯示在標題下方的較長文字說明),用於來源未動態提供資料時
    • 資源 ID 以完整資源名稱表示,例如 @package:string/my_summary
    • 靜態安全性來源的選用項目 (預設為不提供摘要)
    • 動態安全性來源必須使用此屬性 (除非 initialDisplayStatehidden)
    • 禁止用於僅提供問題的安全性來源
  • intentAction
    • 點選 UI 項目時觸發的動作
    • 字串類型 (例如 com.google.android.settings.security.SECURITY_ADVANCED_SETTINGS),或以完整合格資源名稱表示的資源 ID (例如 @package:string/my_intent_action)
    • 如果此意圖動作無法針對指定的 packageName (如有) 解析,UI 項目的行為會與 initialDisplayState="disabled" 相同
    • 適用於靜態安全性來源和具有 initialDisplayState="enabled"dynamic 安全性來源
    • 禁止用於僅提供問題的安全性來源
  • maxSeverityLevel
    • Safety Center 來源可提供的最高嚴重性等級
    • 整數以字串表示,例如 300
    • 動態和僅限問題安全性來源的選用項目 (預設為無上限)
    • 禁止用於靜態安全性來源
  • loggingAllowed
    • 安全中心是否可以記錄與此來源相關的互動或資料
    • 以字串表示的布林值,例如 false
    • 動態和僅限問題安全來源的選用值 (預設為 true)
    • 禁止用於靜態安全性來源
  • refreshOnPageOpenAllowed
    • 在開啟 Safety Center 畫面時,是否應傳送信號至安全來源,以便更新資料
    • 以字串表示的布林值,例如 true
    • 動態和僅限問題安全來源的選用值 (預設為 false)
    • 禁止用於靜態安全性來源
  • notificationsAllowed (自 Android 14 起)
    • 安全來源是否可在回報問題時提供通知
    • 以字串表示的布林值,例如 true
    • 動態和僅限問題安全來源的選用值 (預設為 false)
    • 禁止用於靜態安全性來源
  • deduplicationGroup (自 Android 14 起)
    • 可能的不重複 ID,可用於刪除來自不同來源的問題。同一個去重群組中的來源可以傳送附帶選用去重 ID 的問題。即使有多個來源傳送相同的去重 ID,UI 仍只會顯示一次。
    • 字串類型
    • 動態和僅限問題安全性來源的選用項目 (預設為不重複)
    • 禁止用於靜態安全性來源
  • packageCertificateHashes (自 Android 14 起)
    • 以逗號分隔的清單,列出指定 packageName 的憑證雜湊。如果設定此選項,系統會在與安全性來源互動時,針對指定 packageName 的特定 packageCertificateHashes 執行憑證檢查,以確保安全性。
    • 字串類型
    • 動態和僅限發行安全來源的選用項目 (預設為不檢查憑證)
    • 禁止用於靜態安全性來源
  • titleForPrivateProfile (自 Android 15 起)
    • 私人設定檔的 UI 項目預設標題,在來源未動態提供資料時使用
    • 資源 ID 以完整資源名稱表示,例如 @package:string/my_title_for_private_profile
    • 適用於已指定 profile="all_profiles" 的動態和靜態安全性來源 (除非 initialDisplayState="hidden" 沒有 searchTerms)
    • 禁止用於僅限問題的安全性來源,或含有 profile="primary_profile_only" 的來源

自訂安全中心來源群組

安全中心來源必須包含在安全中心來源群組中。每個來源群組會依照檔案中來源群組的列出順序,在 UI 中顯示。每個來源會依照檔案中來源的列表順序顯示在群組中。如果群組包含單一安全來源,系統會以單一項目而非群組的形式顯示該來源。

Safety Center 來源群組設定

使用下列變數自訂 Safety Center 來源群組:

  • id
    • 安全性來源群組的專屬 ID,在整個檔案中不得重複
    • 字串類型
    • 必填
  • title
    • UI 中群組的標題
    • 資源 ID 以完整資源名稱表示,例如 @package:string/my_title
    • 如果群組中至少有一個動態或靜態安全性來源 (即群組不是 type="hidden"),就必須使用此屬性
  • summary
    • 使用者介面中群組的簡短說明,會顯示在標題下方。在特定情況下顯示,通常是在未提供資料時顯示;否則,系統會根據群組內來源提供的資料計算摘要。
    • 資源 ID 以完整資源名稱表示,例如 @package:string/my_summary
    • 選用 (預設為無摘要)
  • statelessIconType
    • 當安全來源未提供狀態時 (例如靜態項目),系統會為群組顯示的圖示類型
    • 以字串表示的列舉型別,必須是 noneprivacy (隱私權圖示類型)
    • 選用 (預設為 none)
  • type (自 Android 14 起)
    • 明確的類型,用於說明這個群組與 Safety Center 的互動方式
    • 以字串表示的列舉類型必須是下列其中一種:
      • stateful (顯示並影響整體安全中心狀態)
      • stateless (會顯示,但不會影響整體安全中心狀態)
      • hidden (不會顯示,所有來源都必須是「僅限發行」)
    • 選用,預設會使用群組中包含的安全性來源,以及 summarystatelessIconType 進行推論。如果指定 type,系統會強制執行一些額外的不變量,確保該值與群組中遇到的來源相符 (例如,如果群組包含使用者可見的項目,則該群組無法為 hidden)

安全中心來源群組類型

Safety Center 來源群組會根據特定欄位的狀態,歸類為有狀態、無狀態或隱藏狀態。

有狀態群組

群組同時具有標題和摘要,或 stateLessIconType="privacy" 視為有狀態,會影響整體安全中心狀態:

<safety-sources-group
    id="GoogleAppSecuritySources"
    title="@com.google.android.safetycenter.resources:string/google_app_security_sources_title"
    summary="@com.google.android.safetycenter.resources:string/google_app_security_sources_summary">
    <dynamic-safety-source
        id="GooglePlayProtect"
        packageName="com.android.vending"
        profile="all_profiles"
        intentAction="com.google.android.finsky.PLAY_PROTECT"
        title="@com.google.android.safetycenter.resources:string/google_play_protect_title"
        titleForWork="@com.google.android.safetycenter.resources:string/google_play_protect_title_for_work"
        summary="@com.google.android.safetycenter.resources:string/google_play_protect_summary"
        searchTerms="@com.google.android.safetycenter.resources:string/google_play_protect_search_terms"
        refreshOnPageOpenAllowed="true"/>
    <dynamic-safety-source
        id="GoogleAppProtectionService"
        packageName="com.google.android.odad"
        profile="primary_profile_only"
        initialDisplayState="hidden"
        loggingAllowed="false"/>
</safety-sources-group>

在 Android 13 中,這類群組會在 UI 中顯示為可摺疊的項目。在 Android 14 中,這會顯示為具有自身狀態的項目,可重新導向至子頁面。

無狀態群組

群組有標題但沒有摘要,且 stateLessIconType="none" 會視為無狀態,不會影響整體安全中心狀態:

<safety-sources-group
    id="AndroidPrivacySources"
    title="@com.google.android.safetycenter.resources:string/google_privacy_sources_title"
    summary="@com.google.android.safetycenter.resources:string/google_privacy_sources_summary"
    statelessIconType="privacy">
    <static-safety-source
        id="AndroidPermissionUsage"
        profile="primary_profile_only"
        intentAction="android.intent.action.REVIEW_PERMISSION_USAGE"
        title="@com.google.android.safetycenter.resources:string/google_permission_usage_title"
        summary="@com.google.android.safetycenter.resources:string/google_permission_usage_summary"
        searchTerms="@com.google.android.safetycenter.resources:string/google_permission_usage_search_terms"/>
    <static-safety-source
        id="AndroidPermissionManager"
        profile="primary_profile_only"
        intentAction="android.intent.action.MANAGE_PERMISSIONS"
        title="@com.google.android.safetycenter.resources:string/google_permission_manager_title"
        summary="@com.google.android.safetycenter.resources:string/google_permission_manager_summary"
        searchTerms="@com.google.android.safetycenter.resources:string/google_permission_manager_search_terms"/>
    <static-safety-source
        id="AndroidPrivacyControls"
        profile="primary_profile_only"
        intentAction="android.settings.PRIVACY_CONTROLS"
        title="@com.google.android.safetycenter.resources:string/google_privacy_controls_title"
        summary="@com.google.android.safetycenter.resources:string/google_privacy_controls_summary"
        searchTerms="@com.google.android.safetycenter.resources:string/google_privacy_controls_search_terms"/>
    <issue-only-safety-source
        id="AndroidAccessibility"
        packageName="com.google.android.permissioncontroller"
        profile="all_profiles"
        refreshOnPageOpenAllowed="true"/>
    <issue-only-safety-source
        id="AndroidNotificationListener"
        packageName="com.google.android.permissioncontroller"
        profile="primary_profile_only"
        refreshOnPageOpenAllowed="true"/>
    <issue-only-safety-source
        id="AndroidBackgroundLocation"
        packageName="com.google.android.permissioncontroller"
        profile="all_profiles"
        refreshOnPageOpenAllowed="true"/>
    <issue-only-safety-source
        id="AndroidPermissionAutoRevoke"
        packageName="com.google.android.permissioncontroller"
        profile="all_profiles"
        refreshOnPageOpenAllowed="true"/>
</safety-sources-group>

這樣的群組會在 UI 中顯示為固定的項目清單。

隱藏群組

隱藏群組只包含專門處理問題的安全性來源,且沒有標題。隱藏的群組不會顯示在 UI 中:

<safety-sources-group
    id="HiddenGroup">
    <issue-only-safety-source
        id="AndroidAccessibility"
        packageName="com.google.android.permissioncontroller"
        profile="all_profiles"
        refreshOnPageOpenAllowed="true"/>
</safety-sources-group>

靜態項目的動態資料

您可以將動態 Safety Center 來源顯示為靜態項目,這樣一來,系統就能根據某些條件推送重新導向項目,並在執行階段自訂內容。在無狀態群組中定義動態來源,例如依據工作政策資訊項目。

以下範例顯示動態安全性來源,由於位於無狀態群組中,因此未提供安全性信號:

<safety-sources-group
    id="AndroidAdvancedSources"
    title="@com.google.android.safetycenter.resources:string/google_advanced_title">
    <dynamic-safety-source
        id="AndroidWorkPolicyInfo"
        packageName="com.google.android.permissioncontroller"
        profile="primary_profile_only"
        initialDisplayState="hidden"
        refreshOnPageOpenAllowed="true"/>
            <!--  -->
</safety-sources-group>

在這個範例中,來源只能推送綠色警告卡片,並提供未指定的狀態。如要提供其他資料,來源必須位於有狀態群組中。

自訂字串和覆疊欄位

如果 GMS 裝置未設定為接收 Mainline 更新,您可以疊加六個字串資源,以滿足所有自訂需求,而非疊加整個設定檔。表格中列出重疊的字串資源。

字串資源 說明
google_lock_screen_sources_summary 重疊這個值,即可定義靜態摘要,當群組中的所有來源處於良好狀態 (資訊或未指定的嚴重性層級) 時,系統就會為 AndroidLockScreenSources 群組顯示這項摘要。根據預設,安全中心會將群組中所有來源的標題連結起來,做為群組的摘要。
google_biometrics_title 重疊這個值,為 com.android.settings 套件所擁有的生物特徵辨識來源定義靜態標題,當來源未提供動態資料時,就會使用這個標題。當您同時疊加 com.android.settings 套件中來源動態提供的標題時,請使用此方法。由於來源的初始顯示狀態為 hidden,因此系統預設會忽略這項資訊。
google_biometrics_summary 重疊這個值,即可為 com.android.settings 套件所擁有的生物辨識資料來源定義靜態摘要,當來源未提供動態資料時,這個摘要就會用到。由於來源的初始顯示狀態為 hidden,因此系統會預設忽略這項資訊。
google_biometrics_search_terms 重疊這個值,定義 com.android.settings 套件所擁有的生物特徵辨識來源的搜尋字詞清單。
google_biometrics_initial_display_state 當來源未提供動態資料時,您可以重疊這個值,為 com.android.settings 套件擁有的生物特徵辨識來源顯示 UI 項目。預設值為 hidden
google_security_updates_intent 疊加這個值,即可變更開啟活動所需的意圖,讓使用者檢查及安裝安全性更新。此意圖動作必須與匯出的活動相關聯。預設值為 android.settings.SYSTEM_UPDATE_SETTINGS

com.google.android.safetycenter.resources 套件中的其他字串都無法重疊。

對於 AOSP 裝置,com.android.safetycenter.resources 套件中的所有資源皆可重疊,且內容不受限制。

如果 GMS 裝置未設定接收 Mainline 更新,請建立 com.google.android.safetycenter.resources 套件,取代或覆蓋 com.android.safetycenter.resources,定義 GTS 測試預期的所有字串。

這些字串如下:

  • google_app_security_sources_title
  • google_app_security_sources_summary
  • google_play_protect_title
  • google_play_protect_title_for_work
  • google_play_protect_summary
  • google_play_protect_search_terms
  • google_lock_screen_sources_title
  • google_lock_screen_sources_summary
  • google_lock_screen_title
  • google_lock_screen_summary
  • google_lock_screen_search_terms
  • google_biometrics_title
  • google_biometrics_summary
  • google_biometrics_search_terms
  • google_biometrics_initial_display_state
  • google_accounts_sources_title
  • google_accounts_sources_summary
  • google_security_checkup_title
  • google_security_checkup_title_for_work
  • google_security_checkup_summary
  • google_security_checkup_search_terms
  • google_device_finder_sources_title
  • google_device_finder_sources_summary
  • google_find_my_device_title
  • google_find_my_device_summary
  • google_find_my_device_search_terms
  • google_updates_title
  • google_updates_summary
  • google_security_updates_title
  • google_security_updates_summary
  • google_security_updates_search_terms
  • google_security_updates_intent
  • google_play_system_update_title
  • google_play_system_update_summary
  • google_play_system_update_search_terms
  • google_privacy_sources_title
  • google_privacy_sources_summary
  • google_permission_usage_title
  • google_permission_usage_summary
  • google_permission_usage_search_terms
  • google_permission_manager_title
  • google_permission_manager_summary
  • google_permission_manager_search_terms
  • google_privacy_controls_title
  • google_privacy_controls_summary
  • google_privacy_controls_search_terms
  • google_advanced_title
  • google_advanced_security_title
  • google_advanced_security_summary
  • google_advanced_security_search_terms
  • google_advanced_privacy_title
  • google_advanced_privacy_summary
  • google_advanced_privacy_search_terms

自訂需求

檔案格式規定

設定檔必須是 XML 檔案,並遵循「更新設定檔」一節所述的格式。檔案必須位於 raw 資料夾中。必須符合「自訂安全中心來源」和「自訂安全中心來源群組」所述的變異數。如果設定檔的格式不符合上述規定,功能就會完全停用。剖析這個檔案時,系統也會使用 CTS 和 GTS 測試,以便在檔案格式不正確時提供額外的背景資訊 (在 logcat 裝置記錄之上)。

Google 服務裝置

在 GMS 裝置上,這個檔案會受到一些限制。GTS 測試支援這項功能。

Android 開放原始碼計畫裝置

在 AOSP 裝置上,設定檔必須正確格式化,並通過 Safety Center 的 CTS 測試。這些測試可驗證檔案格式是否正確。GMS 裝置也必須通過這些測試。