Merge "Migrate SyncStateSwitchPreference to SwitchPreferenceCompat" into main
diff --git a/aconfig/settings_accessibility_flag_declarations.aconfig b/aconfig/settings_accessibility_flag_declarations.aconfig
index 4363bfc..10b536d 100644
--- a/aconfig/settings_accessibility_flag_declarations.aconfig
+++ b/aconfig/settings_accessibility_flag_declarations.aconfig
@@ -6,6 +6,13 @@
 # flags with 'accessibility' to prevent naming collision.
 
 flag {
+  name: "accessibility_customize_text_reading_preview"
+  namespace: "accessibility"
+  description: "Pulls the accessibility text-reading preview pages from a config."
+  bug: "307481249"
+}
+
+flag {
   name: "accessibility_show_app_info_button"
   namespace: "accessibility"
   description: "Shows an 'app info' button on non-framework a11y Service and Activity pages."
diff --git a/res/drawable-night/content_protection_preference_illustration.xml b/res/drawable-night/content_protection_preference_illustration.xml
new file mode 100644
index 0000000..ebc7423
--- /dev/null
+++ b/res/drawable-night/content_protection_preference_illustration.xml
@@ -0,0 +1,95 @@
+<?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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
+    android:viewportWidth="412"
+    android:viewportHeight="300"
+    android:width="412dp"
+    android:height="300dp">
+    <path
+        android:pathData="M384.2 300H27.8C12.5 300 0 287.2 0 271.5V28.5C0 12.8 12.5 0 27.8 0H384.3C399.5 0 412 12.8 412 28.5V271.7C412 287.2 399.5 300 384.2 300Z"
+        android:fillColor="#000000" />
+    <path
+        android:pathData="M99.9008 50.3984C99.9132 46.1588 101.603 42.0963 104.601 39.0984C107.599 36.1005 111.661 34.4108 115.901 34.3984H299.601C303.84 34.4109 307.903 36.1005 310.901 39.0984C313.899 42.0963 315.588 46.1588 315.601 50.3984V299.598H319.601V237.998C319.601 237.998 319.601 234.102 319.601 233.998C319.601 233.998 319.598 231.058 319.601 229.998V198.098C319.598 197.039 319.601 194.098 319.601 194.098V190.098V158.198V154.198C319.601 154.198 319.598 151.258 319.601 150.198V142.198C319.598 141.139 319.601 138.198 319.601 138.198C319.601 135.602 319.601 134.198 319.601 134.198V50.3984C319.602 47.7718 319.085 45.1707 318.08 42.7439C317.075 40.3171 315.602 38.112 313.745 36.2547C311.887 34.3974 309.682 32.9242 307.255 31.9194C304.828 30.9145 302.227 30.3977 299.601 30.3984H115.801C113.174 30.3977 110.573 30.9145 108.146 31.9194C105.719 32.9242 103.514 34.3974 101.657 36.2547C99.7997 38.112 98.3265 40.3171 97.3217 42.7439C96.3169 45.1707 95.8001 47.7718 95.8008 50.3984V299.598H99.8008L99.9008 50.3984Z"
+        android:fillColor="#80868B" />
+    <path
+        android:pathData="M187.295 139.133C190.34 137.043 193.361 135.44 196.358 134.323C199.354 133.207 202.568 132.649 206 132.649C209.432 132.649 212.658 133.207 215.679 134.323C218.7 135.44 221.733 137.043 224.778 139.133C226.904 136.568 228.415 133.979 229.309 131.367C230.203 128.754 230.65 125.999 230.65 123.102C230.65 116.214 228.294 110.455 223.581 105.823C218.869 101.192 213.008 98.8766 206 98.8766C198.992 98.8766 193.131 101.192 188.419 105.823C183.706 110.455 181.35 116.214 181.35 123.102C181.35 125.999 181.809 128.754 182.727 131.367C183.646 133.979 185.168 136.568 187.295 139.133ZM205.987 125.239C203.192 125.239 200.84 124.297 198.931 122.411C197.022 120.526 196.068 118.211 196.068 115.465C196.068 112.718 197.027 110.407 198.945 108.531C200.863 106.655 203.219 105.717 206.013 105.717C208.808 105.717 211.16 106.659 213.069 108.544C214.978 110.429 215.932 112.745 215.932 115.491C215.932 118.237 214.973 120.548 213.055 122.425C211.137 124.301 208.781 125.239 205.987 125.239ZM206.034 151.602C202.048 151.602 198.291 150.853 194.763 149.357C191.234 147.861 188.153 145.818 185.519 143.23C182.885 140.641 180.806 137.618 179.284 134.162C177.761 130.706 177 127.012 177 123.083C177 119.153 177.761 115.466 179.284 112.022C180.806 108.578 182.885 105.562 185.519 102.973C188.153 100.385 191.229 98.3422 194.746 96.8459C198.263 95.3497 202.02 94.6016 206.019 94.6016C210.018 94.6016 213.77 95.3497 217.274 96.8459C220.778 98.3422 223.847 100.385 226.481 102.973C229.115 105.562 231.194 108.579 232.716 112.024C234.239 115.47 235 119.151 235 123.068C235 126.985 234.239 130.678 232.716 134.145C231.194 137.613 229.115 140.641 226.481 143.23C223.847 145.818 220.777 147.861 217.271 149.357C213.766 150.853 210.02 151.602 206.034 151.602Z"
+        android:fillColor="#CE4237" />
+    <path
+        android:pathData="M179 161.602H193V168.602H179V161.602Z"
+        android:fillColor="#FAD2CF" />
+    <path
+        android:pathData="M198 161.602H233V168.602H198V161.602Z"
+        android:fillColor="#CE4237" />
+    <path
+        android:pathData="M179 178.602H193V185.602H179V178.602Z"
+        android:fillColor="#FAD2CF" />
+    <path
+        android:pathData="M198 178.602H233V185.602H198V178.602Z"
+        android:fillColor="#CE4237" />
+    <path
+        android:pathData="M190 196.602H222V208.602H190V196.602Z"
+        android:fillColor="#FAD2CF" />
+    <path
+        android:pathData="M328.122 273.468L260.34 209.633L265.206 204.5L332.988 268.335L328.122 273.468Z"
+        android:fillType="evenOdd"
+        android:fillColor="#D2E3FC"
+        android:strokeColor="#D2E3FC"
+        android:strokeWidth="4"
+        android:strokeMiterLimit="10" />
+    <path
+        android:pathData="M332.506 289.4L275.852 236.043L292.078 218.93L348.732 272.287L332.506 289.4Z"
+        android:fillType="evenOdd"
+        android:fillColor="#5F6368" />
+    <path
+        android:pathData="M197.901 78.1597C157.127 82.8442 127.883 119.586 132.583 160.225C137.283 200.864 174.147 230.01 214.922 225.326C255.696 220.641 284.94 183.9 280.24 143.261C275.54 102.622 238.676 73.4752 197.901 78.1597ZM125.543 161.033C120.395 116.519 152.427 76.2741 197.09 71.1429C241.753 66.0116 282.132 97.9372 287.28 142.452C292.428 186.966 260.396 227.211 215.733 232.342C171.07 237.474 130.691 205.548 125.543 161.033Z"
+        android:fillType="evenOdd"
+        android:fillColor="#E8F0FE"
+        android:strokeColor="#E8F0FE"
+        android:strokeWidth="4"
+        android:strokeMiterLimit="10" />
+    <path
+        android:pathData="M304.503 154.91C327.804 154.91 346.693 136.068 346.693 112.826C346.693 89.5837 327.804 70.7422 304.503 70.7422C281.202 70.7422 262.312 89.5837 262.312 112.826C262.312 136.068 281.202 154.91 304.503 154.91Z"
+        android:fillColor="#000000" />
+    <path
+        android:pathData="M262.922 112.994C262.922 90.0243 281.615 71.5239 304.5 71.5239C327.385 71.5239 346.078 90.0243 346.078 112.994C346.078 135.966 327.536 154.464 304.5 154.464C281.464 154.464 262.922 135.966 262.922 112.994ZM269.639 112.842C269.639 131.957 285.342 147.617 304.5 147.617C323.656 147.617 339.361 132.112 339.361 112.842C339.361 93.7262 323.658 78.0663 304.5 78.0663C285.342 78.0663 269.639 93.7262 269.639 112.842Z"
+        android:fillColor="#669DF6"
+        android:strokeColor="#000000"
+        android:strokeWidth="1.84466" />
+    <path
+        android:pathData="M28.3587 77.319C31.3183 77.319 33.7175 74.9199 33.7175 71.9603C33.7175 69.0008 31.3183 66.6016 28.3587 66.6016C25.3992 66.6016 23 69.0008 23 71.9603C23 74.9199 25.3992 77.319 28.3587 77.319Z"
+        android:fillColor="#3C4043" />
+    <path
+        android:pathData="M73.455 148.202L66.4212 142.11C65.2517 141.166 63.437 141.804 63.1422 143.301L61.447 152.355C61.1523 153.853 62.6155 155.069 64.0854 154.657L72.8087 151.553C74.2785 151.142 74.63 149.288 73.455 148.202L66.4212 142.11C65.2517 141.166 63.437 141.804 63.1422 143.301L61.447 152.355C61.1523 153.853 62.6155 155.069 64.0854 154.657L72.8087 151.553C74.2785 151.142 74.63 149.288 73.455 148.202Z"
+        android:fillColor="#3C4043" />
+    <path
+        android:pathData="M355.172 221.081L361.415 214.181C362.385 213.032 361.786 211.204 360.295 210.877L351.28 208.986C349.789 208.658 348.542 210.095 348.922 211.573L351.835 220.362C352.215 221.84 354.061 222.232 355.172 221.081L361.415 214.181C362.385 213.032 361.786 211.204 360.295 210.877L351.28 208.986C349.789 208.658 348.542 210.095 348.922 211.573L351.835 220.362C352.215 221.84 354.061 222.232 355.172 221.081Z"
+        android:fillColor="#3C4043" />
+    <path
+        android:pathData="M375.237 77.1385C372.737 78.5385 369.537 77.5385 368.237 75.0385L365.637 70.2385C364.237 67.7385 365.237 64.5385 367.737 63.2385C370.237 61.8385 373.437 62.8385 374.737 65.3385L377.337 70.1385C378.637 72.6385 377.737 75.7385 375.237 77.1385Z"
+        android:fillColor="#3C4043" />
+    <path
+        android:pathData="M43.8011 251.431C42.1248 249.107 42.7529 245.814 45.0882 244.237L49.56 241.106C51.8838 239.43 55.177 240.058 56.754 242.393C58.4302 244.717 57.8021 248.01 55.4668 249.587L50.9951 252.718C48.6598 254.295 45.4773 253.755 43.8011 251.431Z"
+        android:fillColor="#3C4043" />
+    <path
+        android:pathData="M326.336 96.4466C326.336 94.6064 325.189 92.9795 323.456 92.3394L306.496 86.2053C305.536 85.8586 304.496 85.8586 303.536 86.2053L286.55 92.3394C284.817 92.9795 283.67 94.6064 283.67 96.4466V108.128C283.723 110.128 283.857 112.049 284.123 114.049C285.377 122.53 290.176 132.158 303.323 138.879C304.363 139.412 305.616 139.412 306.656 138.879C319.803 132.131 324.602 122.53 325.856 114.049C326.122 112.075 326.282 110.128 326.309 108.128V96.4466H326.336Z"
+        android:fillColor="#2F59D9" />
+    <path
+        android:pathData="M302.467 109.557C302.467 109.557 302.334 109.45 302.281 109.424C301.934 109.21 301.907 109.21 302.467 109.557Z"
+        android:fillColor="#000000" />
+    <path
+        android:pathData="M323.448 92.3394L306.489 86.2053C305.529 85.8586 304.489 85.8586 303.529 86.2053L302.862 86.4454C301.609 86.9521 300.062 87.8055 298.729 89.2991C296.942 91.2993 295.822 94.073 295.822 97.6468C295.822 97.7001 295.822 97.7268 295.822 97.7801C295.822 98.3402 295.902 101.301 297.662 104.474C299.156 107.141 301.102 108.661 302.275 109.462C303.315 110.128 307.422 112.742 308.969 113.942C311.235 115.729 312.915 117.116 314.169 119.49C316.435 123.703 315.635 127.944 315.529 128.557C314.649 133.011 311.742 135.705 310.089 136.958C320.648 130.398 324.728 121.756 325.875 114.076C326.142 112.102 326.302 110.155 326.328 108.155V96.4466C326.328 94.6064 325.182 92.9795 323.448 92.3394Z"
+        android:fillColor="#6792F8" />
+</vector>
diff --git a/res/drawable/content_protection_preference_illustration.xml b/res/drawable/content_protection_preference_illustration.xml
new file mode 100644
index 0000000..1083c1f
--- /dev/null
+++ b/res/drawable/content_protection_preference_illustration.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2015 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
+    android:viewportWidth="412"
+    android:viewportHeight="300"
+    android:width="412dp"
+    android:height="300dp">
+    <path
+        android:pathData="M384.2 300H27.8C12.5 300 0 287.2 0 271.5V28.5C0 12.8 12.5 0 27.8 0H384.3C399.5 0 412 12.8 412 28.5V271.7C412 287.2 399.5 300 384.2 300Z"
+        android:fillColor="#FFFFFF" />
+    <path
+        android:pathData="M99.9008 50.3984C99.9132 46.1588 101.603 42.0963 104.601 39.0984C107.599 36.1005 111.661 34.4108 115.901 34.3984H299.601C303.84 34.4109 307.903 36.1005 310.901 39.0984C313.899 42.0963 315.588 46.1588 315.601 50.3984V299.598H319.601V237.998C319.601 237.998 319.601 234.102 319.601 233.998C319.601 233.998 319.598 231.058 319.601 229.998V198.098C319.598 197.039 319.601 194.098 319.601 194.098V190.098V158.198V154.198C319.601 154.198 319.598 151.258 319.601 150.198V142.198C319.598 141.139 319.601 138.198 319.601 138.198C319.601 135.602 319.601 134.198 319.601 134.198V50.3984C319.602 47.7718 319.085 45.1707 318.08 42.7439C317.075 40.3171 315.602 38.112 313.745 36.2547C311.887 34.3974 309.682 32.9242 307.255 31.9194C304.828 30.9145 302.227 30.3977 299.601 30.3984H115.801C113.174 30.3977 110.573 30.9145 108.146 31.9194C105.719 32.9242 103.514 34.3974 101.657 36.2547C99.7997 38.112 98.3265 40.3171 97.3217 42.7439C96.3169 45.1707 95.8001 47.7718 95.8008 50.3984V299.598H99.8008L99.9008 50.3984Z"
+        android:fillColor="#DADCE0" />
+    <path
+        android:pathData="M187.295 139.133C190.34 137.043 193.361 135.44 196.358 134.323C199.354 133.207 202.568 132.649 206 132.649C209.432 132.649 212.658 133.207 215.679 134.323C218.7 135.44 221.733 137.043 224.778 139.133C226.904 136.568 228.415 133.979 229.309 131.367C230.203 128.754 230.65 125.999 230.65 123.102C230.65 116.214 228.294 110.455 223.581 105.823C218.869 101.192 213.008 98.8766 206 98.8766C198.992 98.8766 193.131 101.192 188.419 105.823C183.706 110.455 181.35 116.214 181.35 123.102C181.35 125.999 181.809 128.754 182.727 131.367C183.646 133.979 185.168 136.568 187.295 139.133ZM205.987 125.239C203.192 125.239 200.84 124.297 198.931 122.411C197.022 120.526 196.068 118.211 196.068 115.465C196.068 112.718 197.027 110.407 198.945 108.531C200.863 106.655 203.219 105.717 206.013 105.717C208.808 105.717 211.16 106.659 213.069 108.544C214.978 110.429 215.932 112.745 215.932 115.491C215.932 118.237 214.973 120.548 213.055 122.425C211.137 124.301 208.781 125.239 205.987 125.239ZM206.034 151.602C202.048 151.602 198.291 150.853 194.763 149.357C191.234 147.861 188.153 145.818 185.519 143.23C182.885 140.641 180.806 137.618 179.284 134.162C177.761 130.706 177 127.012 177 123.083C177 119.153 177.761 115.466 179.284 112.022C180.806 108.578 182.885 105.562 185.519 102.973C188.153 100.385 191.229 98.3422 194.746 96.8459C198.263 95.3497 202.02 94.6016 206.019 94.6016C210.018 94.6016 213.77 95.3497 217.274 96.8459C220.778 98.3422 223.847 100.385 226.481 102.973C229.115 105.562 231.194 108.579 232.716 112.024C234.239 115.47 235 119.151 235 123.068C235 126.985 234.239 130.678 232.716 134.145C231.194 137.613 229.115 140.641 226.481 143.23C223.847 145.818 220.777 147.861 217.271 149.357C213.766 150.853 210.02 151.602 206.034 151.602Z"
+        android:fillColor="#D93025" />
+    <path
+        android:pathData="M179 161.602H193V168.602H179V161.602Z"
+        android:fillColor="#EE675C" />
+    <path
+        android:pathData="M198 161.602H233V168.602H198V161.602Z"
+        android:fillColor="#D93025" />
+    <path
+        android:pathData="M179 178.602H193V185.602H179V178.602Z"
+        android:fillColor="#EE675C" />
+    <path
+        android:pathData="M198 178.602H233V185.602H198V178.602Z"
+        android:fillColor="#D93025" />
+    <path
+        android:pathData="M190 196.602H222V208.602H190V196.602Z"
+        android:fillColor="#EE675C" />
+    <path
+        android:pathData="M328.122 273.468L260.34 209.633L265.206 204.5L332.988 268.335L328.122 273.468Z"
+        android:fillType="evenOdd"
+        android:fillColor="#8AB4F8"
+        android:strokeColor="#8AB4F8"
+        android:strokeWidth="4"
+        android:strokeMiterLimit="10" />
+    <path
+        android:pathData="M332.506 289.4L275.852 236.043L292.078 218.93L348.732 272.287L332.506 289.4Z"
+        android:fillType="evenOdd"
+        android:fillColor="#BDC1C6" />
+    <path
+        android:pathData="M197.901 78.1597C157.127 82.8442 127.883 119.586 132.583 160.225C137.283 200.864 174.147 230.01 214.922 225.326C255.696 220.641 284.94 183.9 280.24 143.261C275.54 102.622 238.676 73.4752 197.901 78.1597ZM125.543 161.033C120.395 116.519 152.427 76.2741 197.09 71.1429C241.753 66.0116 282.132 97.9372 287.28 142.452C292.428 186.966 260.396 227.211 215.733 232.342C171.07 237.474 130.691 205.548 125.543 161.033Z"
+        android:fillType="evenOdd"
+        android:fillColor="#8AB4F8"
+        android:strokeColor="#8AB4F8"
+        android:strokeWidth="4"
+        android:strokeMiterLimit="10" />
+    <path
+        android:pathData="M28.3587 77.319C31.3183 77.319 33.7175 74.9199 33.7175 71.9603C33.7175 69.0008 31.3183 66.6016 28.3587 66.6016C25.3992 66.6016 23 69.0008 23 71.9603C23 74.9199 25.3992 77.319 28.3587 77.319Z"
+        android:fillColor="#E8EAED" />
+    <path
+        android:pathData="M73.455 148.202L66.4212 142.11C65.2517 141.166 63.437 141.804 63.1422 143.301L61.447 152.355C61.1523 153.853 62.6155 155.069 64.0854 154.657L72.8087 151.553C74.2785 151.142 74.63 149.288 73.455 148.202L66.4212 142.11C65.2517 141.166 63.437 141.804 63.1422 143.301L61.447 152.355C61.1523 153.853 62.6155 155.069 64.0854 154.657L72.8087 151.553C74.2785 151.142 74.63 149.288 73.455 148.202Z"
+        android:fillColor="#E8EAED" />
+    <path
+        android:pathData="M355.172 221.081L361.415 214.181C362.385 213.032 361.786 211.204 360.295 210.877L351.28 208.986C349.789 208.658 348.542 210.095 348.922 211.573L351.835 220.362C352.215 221.84 354.061 222.232 355.172 221.081L361.415 214.181C362.385 213.032 361.786 211.204 360.295 210.877L351.28 208.986C349.789 208.658 348.542 210.095 348.922 211.573L351.835 220.362C352.215 221.84 354.061 222.232 355.172 221.081Z"
+        android:fillColor="#E8EAED" />
+    <path
+        android:pathData="M375.237 77.1385C372.737 78.5385 369.537 77.5385 368.237 75.0385L365.637 70.2385C364.237 67.7385 365.237 64.5385 367.737 63.2385C370.237 61.8385 373.437 62.8385 374.737 65.3385L377.337 70.1385C378.637 72.6385 377.737 75.7385 375.237 77.1385Z"
+        android:fillColor="#E8EAED" />
+    <path
+        android:pathData="M43.8011 251.431C42.1248 249.107 42.7529 245.814 45.0882 244.237L49.56 241.106C51.8838 239.43 55.177 240.058 56.754 242.393C58.4302 244.717 57.8021 248.01 55.4668 249.587L50.9951 252.718C48.6598 254.295 45.4773 253.755 43.8011 251.431Z"
+        android:fillColor="#E8EAED" />
+    <path
+        android:pathData="M304.503 154.91C327.804 154.91 346.693 136.068 346.693 112.826C346.693 89.5837 327.804 70.7422 304.503 70.7422C281.202 70.7422 262.312 89.5837 262.312 112.826C262.312 136.068 281.202 154.91 304.503 154.91Z"
+        android:fillColor="#FFFFFF" />
+    <path
+        android:pathData="M262.922 112.994C262.922 90.0243 281.615 71.5239 304.5 71.5239C327.385 71.5239 346.078 90.0243 346.078 112.994C346.078 135.966 327.536 154.464 304.5 154.464C281.464 154.464 262.922 135.966 262.922 112.994ZM269.639 112.842C269.639 131.957 285.342 147.617 304.5 147.617C323.656 147.617 339.361 132.112 339.361 112.842C339.361 93.7262 323.658 78.0663 304.5 78.0663C285.342 78.0663 269.639 93.7262 269.639 112.842Z"
+        android:fillColor="#1A73E8"
+        android:strokeColor="#FFFFFF"
+        android:strokeWidth="1.84466" />
+    <path
+        android:pathData="M326.331 96.8293C326.331 94.9891 325.184 93.3623 323.451 92.7222L306.491 86.5882C305.531 86.2414 304.491 86.2414 303.531 86.5882L286.544 92.7222C284.811 93.3623 283.664 94.9891 283.664 96.8293V108.511C283.717 110.511 283.851 112.431 284.117 114.431C285.371 122.912 290.171 132.54 303.317 139.261C304.357 139.794 305.611 139.794 306.651 139.261C319.797 132.513 324.597 122.912 325.851 114.431C326.117 112.458 326.277 110.511 326.304 108.511V96.8293H326.331Z"
+        android:fillColor="#224FB4" />
+    <path
+        android:pathData="M302.469 109.955C302.469 109.955 302.336 109.849 302.283 109.822C301.936 109.609 301.909 109.609 302.469 109.955Z"
+        android:fillColor="#000000" />
+    <path
+        android:pathData="M323.451 92.7222L306.491 86.5882C305.531 86.2414 304.491 86.2414 303.531 86.5882L302.864 86.8282C301.611 87.3349 300.064 88.1883 298.731 89.6818C296.944 91.6821 295.824 94.4557 295.824 98.0294C295.824 98.0828 295.824 98.1095 295.824 98.1628C295.824 98.7229 295.904 101.683 297.664 104.857C299.158 107.524 301.104 109.044 302.278 109.844C303.318 110.511 307.424 113.124 308.971 114.325C311.238 116.111 312.918 117.498 314.171 119.872C316.438 124.086 315.638 128.326 315.531 128.94C314.651 133.393 311.744 136.087 310.091 137.341C320.651 130.78 324.731 122.139 325.878 114.458C326.144 112.484 326.304 110.538 326.331 108.537V96.8293C326.331 94.9891 325.184 93.3623 323.451 92.7222Z"
+        android:fillColor="#578BFF" />
+</vector>
diff --git a/res/layout/content_protection_preference_fragment.xml b/res/layout/content_protection_preference_fragment.xml
new file mode 100644
index 0000000..a412d86
--- /dev/null
+++ b/res/layout/content_protection_preference_fragment.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2023 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.
+-->
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res-auto"
+    android:title="@string/content_protection_preference_title">
+
+    <com.android.settingslib.widget.TopIntroPreference
+        android:key="content_protection_preference_top_intro"
+        android:title="@string/content_protection_preference_subpage_summary"
+        settings:searchable="false"/>
+
+    <com.android.settings.widget.SettingsMainSwitchPreference
+        android:key="content_protection_preference_user_consent_switch"
+        android:title="@string/content_protection_preference_user_consent_switch_title"
+        settings:controller=
+              "com.android.settings.security.ContentProtectionTogglePreferenceController"/>
+
+    <com.android.settingslib.widget.IllustrationPreference
+        android:key="content_protection_preference_subpage_illustration"
+        android:selectable="false"
+        settings:lottie_rawRes="@drawable/content_protection_preference_illustration"
+        settings:searchable="false" />
+
+    <SwitchPreference
+        android:key="content_protection_preference_user_consent_work_profile_switch"
+        android:title="@string/content_protection_preference_user_consent_work_profile_switch_title"
+        settings:isPreferenceVisible="false" />
+
+    <com.android.settingslib.widget.FooterPreference
+        android:key="content_protection_preference_subpage_footer"
+        android:title="@string/content_protection_preference_subpage_info" />
+</PreferenceScreen>
diff --git a/res/values/config.xml b/res/values/config.xml
index 4eba076..443f815 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -765,4 +765,11 @@
 
     <!-- Allowed packages to show the confirmation dialog for a system locale suggestion  -->
     <string-array name="allowed_packages_for_locale_confirmation_diallog" translatable="false"/>
+
+    <!-- Array of text reading preview layouts. Must contain at least 1 layout -->
+    <array name="config_text_reading_preview_samples">
+        <item>@layout/accessibility_text_reading_preview_app_grid</item>
+        <item>@layout/screen_zoom_preview_1</item>
+        <item>@layout/accessibility_text_reading_preview_mail_content</item>
+    </array>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3f6f65e..8673ec9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -12560,12 +12560,9 @@
     <string name="content_protection_preference_user_consent_switch_title">Use scanning</string>
     <!-- Title of the toggle switch of work apps on the subpage of content protection settings -->
     <string name="content_protection_preference_user_consent_work_profile_switch_title">Use scanning for work apps</string>
-    <!-- Summary of the subpage of content protection settings -->
-    <string name="content_protection_preference_subpage_summary">Scanning runs privately right on your device, checking app activity for phishing or other deceptive behavior. If it\’s detected, some app info is sent to Google Play Protect to confirm the threat and warn app users.</string>
-    <!-- Information at the bottom of the subpage of content protection settings -->
-    <string name="content_protection_preference_subpage_info">
-        <![CDATA[
-        This is a protected security feature. No device or personal info is shared with Google.
-        \n\nPhishing is an attempt to steal sign-in credentials or other personal info.
-        ]]></string>
+
+    <!-- Default summary of the subpage of content protection settings. Will be overlaid by OEM. -->
+    <string name="content_protection_preference_subpage_summary"></string>
+    <!-- Default information at the bottom of the subpage of content protection settings. Will be overlaid by OEM. -->
+    <string name="content_protection_preference_subpage_info"></string>
 </resources>
diff --git a/res/xml/configure_notification_settings.xml b/res/xml/configure_notification_settings.xml
index bfca03d..c52140c 100644
--- a/res/xml/configure_notification_settings.xml
+++ b/res/xml/configure_notification_settings.xml
@@ -174,7 +174,7 @@
             android:title="@string/notification_pulse_title"
             settings:controller="com.android.settings.notification.PulseNotificationPreferenceController"/>
 
-        <com.android.settingslib.PrimarySwitchPreference
+        <SwitchPreference
             android:key="notification_assistant"
             android:order="25"
             android:title="@string/notification_assistant_title"
diff --git a/res/xml/more_security_privacy_settings.xml b/res/xml/more_security_privacy_settings.xml
index 8358c73..822b03d 100644
--- a/res/xml/more_security_privacy_settings.xml
+++ b/res/xml/more_security_privacy_settings.xml
@@ -119,6 +119,15 @@
         android:key="security_category"
         android:title="@string/security_header" />
 
+    <Preference
+        android:order="230"
+        android:key="content_protection_preference"
+        android:title="@string/content_protection_preference_title"
+        android:summary="@string/content_protection_preference_summary"
+        android:fragment="com.android.settings.security.ContentProtectionPreferenceFragment"
+        settings:keywords="@string/content_protection_preference_title"
+        settings:controller="com.android.settings.security.ContentProtectionPreferenceController" />
+
     <PreferenceCategory
         android:order="240"
         android:key="security_settings_device_admin_category"
@@ -213,4 +222,4 @@
 
 
 
-</PreferenceScreen>
\ No newline at end of file
+</PreferenceScreen>
diff --git a/src/com/android/settings/accessibility/TextReadingPreviewController.java b/src/com/android/settings/accessibility/TextReadingPreviewController.java
index ffa156b..4ec0b3d 100644
--- a/src/com/android/settings/accessibility/TextReadingPreviewController.java
+++ b/src/com/android/settings/accessibility/TextReadingPreviewController.java
@@ -18,12 +18,14 @@
 
 import android.content.Context;
 import android.content.res.Configuration;
+import android.content.res.TypedArray;
 import android.os.SystemClock;
 import android.util.Log;
 import android.view.Choreographer;
 import android.view.View;
 
 import androidx.annotation.NonNull;
+import androidx.annotation.VisibleForTesting;
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
@@ -31,6 +33,7 @@
 import com.android.settings.core.BasePreferenceController;
 import com.android.settings.core.instrumentation.SettingsStatsLog;
 import com.android.settings.display.PreviewPagerAdapter;
+import com.android.settings.flags.Flags;
 import com.android.settings.widget.LabeledSeekBarPreference;
 
 import java.util.Objects;
@@ -44,11 +47,10 @@
     private static final String TAG = "TextReadingPreviewCtrl";
     private static final int LAYER_INITIAL_INDEX = 0;
     private static final int FRAME_INITIAL_INDEX = 0;
-    static final int[] PREVIEW_SAMPLE_RES_IDS = new int[]{
+    private static final int[] PREVIEW_SAMPLE_RES_IDS = new int[]{
             R.layout.accessibility_text_reading_preview_app_grid,
             R.layout.screen_zoom_preview_1,
             R.layout.accessibility_text_reading_preview_mail_content};
-
     private static final String PREVIEW_KEY = "preview";
     private static final String FONT_SIZE_KEY = "font_size";
     private static final String DISPLAY_SIZE_KEY = "display_size";
@@ -107,11 +109,12 @@
         final Configuration origConfig = mContext.getResources().getConfiguration();
         final boolean isLayoutRtl =
                 origConfig.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
+        final int[] previewSamples = getPreviewSampleLayouts(mContext);
         final PreviewPagerAdapter pagerAdapter = new PreviewPagerAdapter(mContext, isLayoutRtl,
-                PREVIEW_SAMPLE_RES_IDS, createConfig(origConfig));
+                previewSamples, createConfig(origConfig));
         mPreviewPreference.setPreviewAdapter(pagerAdapter);
         mPreviewPreference.setCurrentItem(
-                isLayoutRtl ? PREVIEW_SAMPLE_RES_IDS.length - 1 : FRAME_INITIAL_INDEX);
+                isLayoutRtl ? previewSamples.length - 1 : FRAME_INITIAL_INDEX);
 
         final int initialPagerIndex =
                 mLastFontProgress * mDisplaySizeData.getValues().size() + mLastDisplayProgress;
@@ -178,6 +181,22 @@
         choreographer.postFrameCallbackDelayed(mCommit, commitDelayMs);
     }
 
+    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+    static int[] getPreviewSampleLayouts(Context context) {
+        if (!Flags.accessibilityCustomizeTextReadingPreview()) {
+            return PREVIEW_SAMPLE_RES_IDS;
+        }
+        TypedArray previews = context.getResources().obtainTypedArray(
+                R.array.config_text_reading_preview_samples);
+        int previewCount = previews.length();
+        int[] previewSamples = new int[previewCount];
+        for (int i = 0; i < previewCount; i++) {
+            previewSamples[i] = previews.getResourceId(i, R.layout.screen_zoom_preview_1);
+        }
+        previews.recycle();
+        return previewSamples;
+    }
+
     private int getPagerIndex() {
         final int displayDataSize = mDisplaySizeData.getValues().size();
         final int fontSizeProgress = mFontSizePreference.getProgress();
diff --git a/src/com/android/settings/applications/AppCounter.java b/src/com/android/settings/applications/AppCounter.java
index ce2be84..d536932 100644
--- a/src/com/android/settings/applications/AppCounter.java
+++ b/src/com/android/settings/applications/AppCounter.java
@@ -16,33 +16,49 @@
 
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.FeatureFlags;
+import android.content.pm.FeatureFlagsImpl;
 import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.ApplicationInfoFlags;
 import android.content.pm.UserInfo;
 import android.os.AsyncTask;
 import android.os.UserHandle;
 import android.os.UserManager;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.VisibleForTesting;
+
 import java.util.List;
 
 public abstract class AppCounter extends AsyncTask<Void, Void, Integer> {
 
     protected final PackageManager mPm;
     protected final UserManager mUm;
+    protected final FeatureFlags mFf;
 
-    public AppCounter(Context context, PackageManager packageManager) {
+    @VisibleForTesting
+    AppCounter(@NonNull Context context, @NonNull PackageManager packageManager,
+            @NonNull FeatureFlags featureFlags) {
         mPm = packageManager;
-        mUm = (UserManager) context.getSystemService(Context.USER_SERVICE);
+        mUm = context.getSystemService(UserManager.class);
+        mFf = featureFlags;
+    }
+
+    public AppCounter(@NonNull Context context, @NonNull PackageManager packageManager) {
+        this(context, packageManager, new FeatureFlagsImpl());
     }
 
     @Override
     protected Integer doInBackground(Void... params) {
         int count = 0;
         for (UserInfo user : mUm.getProfiles(UserHandle.myUserId())) {
+            long flags = PackageManager.GET_DISABLED_COMPONENTS
+                    | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS
+                    | (mFf.archiving() ? PackageManager.MATCH_ARCHIVED_PACKAGES : 0)
+                    | (user.isAdmin() ? PackageManager.MATCH_ANY_USER : 0);
+            ApplicationInfoFlags infoFlags = ApplicationInfoFlags.of(flags);
             final List<ApplicationInfo> list =
-                    mPm.getInstalledApplicationsAsUser(PackageManager.GET_DISABLED_COMPONENTS
-                            | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS
-                            | (user.isAdmin() ? PackageManager.MATCH_ANY_USER : 0),
-                            user.id);
+                    mPm.getInstalledApplicationsAsUser(infoFlags, user.id);
             for (ApplicationInfo info : list) {
                 if (includeInCount(info)) {
                     count++;
@@ -62,5 +78,6 @@
     }
 
     protected abstract void onCountComplete(int num);
+
     protected abstract boolean includeInCount(ApplicationInfo info);
 }
diff --git a/src/com/android/settings/applications/InstalledAppCounter.java b/src/com/android/settings/applications/InstalledAppCounter.java
index aeac26e..9da4c9a 100644
--- a/src/com/android/settings/applications/InstalledAppCounter.java
+++ b/src/com/android/settings/applications/InstalledAppCounter.java
@@ -17,10 +17,15 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.FeatureFlags;
+import android.content.pm.FeatureFlagsImpl;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.os.UserHandle;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.VisibleForTesting;
+
 import java.util.List;
 
 public abstract class InstalledAppCounter extends AppCounter {
@@ -32,9 +37,15 @@
 
     private final int mInstallReason;
 
-    public InstalledAppCounter(Context context, int installReason,
-            PackageManager packageManager) {
-        super(context, packageManager);
+    public InstalledAppCounter(@NonNull Context context, int installReason,
+            @NonNull PackageManager packageManager) {
+        this(context, installReason, packageManager, new FeatureFlagsImpl());
+    }
+
+    @VisibleForTesting
+    InstalledAppCounter(@NonNull Context context, int installReason,
+            @NonNull PackageManager packageManager, @NonNull FeatureFlags featureFlags) {
+        super(context, packageManager, featureFlags);
         mInstallReason = installReason;
     }
 
diff --git a/src/com/android/settings/network/apn/ApnEditPageProvider.kt b/src/com/android/settings/network/apn/ApnEditPageProvider.kt
index 753de22..0e23a0e 100644
--- a/src/com/android/settings/network/apn/ApnEditPageProvider.kt
+++ b/src/com/android/settings/network/apn/ApnEditPageProvider.kt
@@ -99,7 +99,13 @@
         title = stringResource(id = R.string.apn_edit),
         actions = {
             IconButton(onClick = {
-                validateAndSaveApnData(apnDataInit, apnData, context, uriInit)
+                validateAndSaveApnData(
+                    apnDataInit,
+                    apnData,
+                    context,
+                    uriInit,
+                    networkTypeSelectedOptionsState
+                )
             }) { Icon(imageVector = Icons.Outlined.Done, contentDescription = "Save APN") }
         }
     ) {
@@ -154,7 +160,6 @@
                 label = stringResource(R.string.apn_mms_port),
                 enabled = apnData.mmsPortEnabled
             ) { apnData = apnData.copy(mmsPort = it) }
-            // Warning: apnProtocol, apnRoaming, mvnoType string2Int
             SettingsExposedDropdownMenuBox(
                 label = stringResource(R.string.apn_auth_type),
                 options = authTypeOptions,
diff --git a/src/com/android/settings/network/apn/ApnNetworkTypes.kt b/src/com/android/settings/network/apn/ApnNetworkTypes.kt
index 560449a..0ccd33a 100644
--- a/src/com/android/settings/network/apn/ApnNetworkTypes.kt
+++ b/src/com/android/settings/network/apn/ApnNetworkTypes.kt
@@ -50,10 +50,22 @@
     fun getNetworkTypeSelectedOptionsState(networkType: Long): SnapshotStateList<Int> {
         val networkTypeSelectedOptionsState = mutableStateListOf<Int>()
         Types.forEachIndexed { index, type ->
-            if (networkType and TelephonyManager.getBitMaskForNetworkType(type) == 1L) {
+            if (networkType and TelephonyManager.getBitMaskForNetworkType(type) != 0L) {
                 networkTypeSelectedOptionsState.add(index)
             }
         }
         return networkTypeSelectedOptionsState
     }
+
+    /**
+     * Gets the network type according to the selected Network type Selected Options.
+     * @param networkTypeSelectedOptionsState the selected Network type Selected Options.
+     */
+    fun getNetworkType(networkTypeSelectedOptionsState: SnapshotStateList<Int>): Long {
+        var networkType = 0L
+        networkTypeSelectedOptionsState.forEach { option ->
+            networkType = networkType or TelephonyManager.getBitMaskForNetworkType(Types[option])
+        }
+        return networkType
+    }
 }
diff --git a/src/com/android/settings/network/apn/ApnStatus.kt b/src/com/android/settings/network/apn/ApnStatus.kt
index 991529a..3ccd71e 100644
--- a/src/com/android/settings/network/apn/ApnStatus.kt
+++ b/src/com/android/settings/network/apn/ApnStatus.kt
@@ -25,8 +25,10 @@
 import android.telephony.TelephonyManager
 import android.text.TextUtils
 import android.util.Log
+import androidx.compose.runtime.snapshots.SnapshotStateList
 import com.android.internal.util.ArrayUtils
 import com.android.settings.R
+import com.android.settings.network.apn.ApnNetworkTypes.getNetworkType
 import java.util.Locale
 
 data class ApnData(
@@ -211,9 +213,6 @@
 
 /**
  * Validates the apn data and save it to the database if it's valid.
- *
- *
- *
  * A dialog with error message will be displayed if the APN data is invalid.
  *
  * @return true if there is no error
@@ -222,7 +221,8 @@
     apnDataInit: ApnData,
     apnData: ApnData,
     context: Context,
-    uriInit: Uri
+    uriInit: Uri,
+    networkTypeSelectedOptionsState: SnapshotStateList<Int>
 ): Boolean {
     // Nothing to do if it's a read only APN
     if (apnData.customizedConfig.readOnlyApn) {
@@ -233,9 +233,15 @@
         //TODO: showError(this)
         return false
     }
-    if (apnData.newApn || (apnData != apnDataInit)) {
-        Log.d(TAG, "validateAndSaveApnData: apnData ${apnData.name}")
-        updateApnDataToDatabase(apnData.newApn, apnData.getContentValues(context), context, uriInit)
+    val newApnData = apnData.copy(networkType = getNetworkType(networkTypeSelectedOptionsState))
+    if (newApnData.newApn || (newApnData != apnDataInit)) {
+        Log.d(TAG, "[validateAndSaveApnData] newApnData.networkType: ${newApnData.networkType}")
+        updateApnDataToDatabase(
+            newApnData.newApn,
+            newApnData.getContentValues(context),
+            context,
+            uriInit
+        )
     }
     return true
 }
diff --git a/src/com/android/settings/notification/NotificationAssistantPreferenceController.java b/src/com/android/settings/notification/NotificationAssistantPreferenceController.java
index 069a6e0..3274aec 100644
--- a/src/com/android/settings/notification/NotificationAssistantPreferenceController.java
+++ b/src/com/android/settings/notification/NotificationAssistantPreferenceController.java
@@ -131,30 +131,12 @@
         return (mFragment != null && mFragment instanceof ConfigureNotificationSettings);
     }
 
-    private boolean isNASSettingActivityAvailable() {
-        final List<ResolveInfo> resolved = mPackageManager.queryIntentActivities(mNASSettingIntent,
-                PackageManager.ResolveInfoFlags.of(PackageManager.MATCH_ALL));
-        return (resolved != null && !resolved.isEmpty());
-    }
-
     @Override
     public void updateState(Preference preference) {
         super.updateState(preference);
         if (mDefaultNASComponent == null) {
             preference.setEnabled(false);
             ((PrimarySwitchPreference) preference).setSwitchEnabled(false);
-        } else if (isNASSettingActivityAvailable()) {
-            preference.setIntent(mNASSettingIntent);
-        } else {
-            // Cannot find settings activity from the default NAS app
-            preference.setIntent(null);
-            preference.setOnPreferenceClickListener(
-                    preference1 -> {
-                        onPreferenceChange(preference1, !isChecked());
-                        ((PrimarySwitchPreference) preference1).setChecked(isChecked());
-                        return true;
-                    }
-            );
         }
     }
 }
diff --git a/src/com/android/settings/privatespace/PrivateSpaceEducation.java b/src/com/android/settings/privatespace/PrivateSpaceEducation.java
index 817765f..96d0aa2 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceEducation.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceEducation.java
@@ -56,7 +56,7 @@
                         .setListener(onCancel())
                         .setButtonType(FooterButton.ButtonType.CANCEL)
                         .setTheme(
-                                com.google.android.setupdesign.R.style
+                                androidx.appcompat.R.style
                                         .Base_TextAppearance_AppCompat_Widget_Button)
                         .build());
         mixin.getSecondaryButtonView().setFilterTouchesWhenObscured(true);
diff --git a/src/com/android/settings/security/ContentProtectionPreferenceController.java b/src/com/android/settings/security/ContentProtectionPreferenceController.java
new file mode 100644
index 0000000..0129800
--- /dev/null
+++ b/src/com/android/settings/security/ContentProtectionPreferenceController.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2023 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.settings.security;
+
+import static android.view.contentprotection.flags.Flags.settingUiEnabled;
+
+import android.content.Context;
+
+import androidx.annotation.NonNull;
+
+import com.android.settings.core.BasePreferenceController;
+
+public class ContentProtectionPreferenceController extends BasePreferenceController {
+
+    public ContentProtectionPreferenceController(@NonNull Context context, @NonNull String key) {
+        super(context, key);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+      // TODO(b/306565942): Add a resource value check.
+      return settingUiEnabled() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+    }
+}
diff --git a/src/com/android/settings/security/ContentProtectionPreferenceFragment.java b/src/com/android/settings/security/ContentProtectionPreferenceFragment.java
new file mode 100644
index 0000000..a58f6e5
--- /dev/null
+++ b/src/com/android/settings/security/ContentProtectionPreferenceFragment.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2023 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.settings.security;
+
+import android.content.Context;
+import android.app.settings.SettingsEnums;
+
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.search.SearchIndexable;
+
+import android.os.Bundle;
+
+@SearchIndexable
+public class ContentProtectionPreferenceFragment extends DashboardFragment {
+    private static final String TAG = "ContentProtectionPreferenceFragment";
+
+    // Required by @SearchIndexable to make the fragment and preferences to be indexed.
+    // Do not rename.
+    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+            new BaseSearchIndexProvider(R.layout.content_protection_preference_fragment);
+
+    @Override
+    public void onAttach(Context context) {
+        super.onAttach(context);
+    }
+
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+	// TODO(b/304681048): Update the toggles' behavior according to user's profile
+    }
+
+    @Override
+    public int getMetricsCategory() {
+        return SettingsEnums.CONTENT_PROTECTION_PREFERENCE;
+    }
+
+    @Override
+    protected int getPreferenceScreenResId() {
+        return R.layout.content_protection_preference_fragment;
+    }
+
+    @Override
+    protected String getLogTag() {
+        return TAG;
+    }
+}
diff --git a/src/com/android/settings/widget/FilterTouchesRestrictedSwitchPreference.java b/src/com/android/settings/widget/FilterTouchesRestrictedSwitchPreference.java
index f4c3a14..9745e31 100644
--- a/src/com/android/settings/widget/FilterTouchesRestrictedSwitchPreference.java
+++ b/src/com/android/settings/widget/FilterTouchesRestrictedSwitchPreference.java
@@ -50,7 +50,7 @@
     @Override
     public void onBindViewHolder(PreferenceViewHolder holder) {
         super.onBindViewHolder(holder);
-        final View switchView = holder.findViewById(android.R.id.switch_widget);
+        final View switchView = holder.findViewById(androidx.preference.R.id.switchWidget);
         if (switchView != null) {
             final View rootView = switchView.getRootView();
             rootView.setFilterTouchesWhenObscured(true);
diff --git a/tests/robotests/src/com/android/settings/accessibility/TextReadingPreviewPreferenceTest.java b/tests/robotests/src/com/android/settings/accessibility/TextReadingPreviewPreferenceTest.java
index 1688142..0162d26 100644
--- a/tests/robotests/src/com/android/settings/accessibility/TextReadingPreviewPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/TextReadingPreviewPreferenceTest.java
@@ -16,8 +16,6 @@
 
 package com.android.settings.accessibility;
 
-import static com.android.settings.accessibility.TextReadingPreviewController.PREVIEW_SAMPLE_RES_IDS;
-
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -39,6 +37,7 @@
 import com.android.settings.R;
 import com.android.settings.display.PreviewPagerAdapter;
 
+import org.junit.Assume;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -54,15 +53,18 @@
     private PreferenceViewHolder mHolder;
     private ViewPager mViewPager;
     private PreviewPagerAdapter mPreviewPagerAdapter;
+    private int mPreviewSampleCount;
 
     @Before
     public void setUp() {
         final Context context = ApplicationProvider.getApplicationContext();
-        final Configuration[] configurations = createConfigurations(PREVIEW_SAMPLE_RES_IDS.length);
+        final int[] previewSamples = TextReadingPreviewController.getPreviewSampleLayouts(context);
+        mPreviewSampleCount = previewSamples.length;
+        final Configuration[] configurations = createConfigurations(mPreviewSampleCount);
         mTextReadingPreviewPreference = new TextReadingPreviewPreference(context);
         mPreviewPagerAdapter =
                 spy(new PreviewPagerAdapter(context, /* isLayoutRtl= */ false,
-                        PREVIEW_SAMPLE_RES_IDS, configurations));
+                        previewSamples, configurations));
         final LayoutInflater inflater = LayoutInflater.from(context);
         final View view =
                 inflater.inflate(mTextReadingPreviewPreference.getLayoutResource(),
@@ -81,7 +83,7 @@
 
     @Test
     public void setPreviewAdapterWithNull_resetCurrentItem() {
-        final int currentItem = 2;
+        final int currentItem = mPreviewSampleCount - 1;
         mTextReadingPreviewPreference.setPreviewAdapter(mPreviewPagerAdapter);
         mTextReadingPreviewPreference.setCurrentItem(currentItem);
         mTextReadingPreviewPreference.onBindViewHolder(mHolder);
@@ -94,7 +96,7 @@
 
     @Test
     public void setCurrentItem_success() {
-        final int currentItem = 1;
+        final int currentItem = mPreviewSampleCount - 1;
         mTextReadingPreviewPreference.setPreviewAdapter(mPreviewPagerAdapter);
         mTextReadingPreviewPreference.onBindViewHolder(mHolder);
 
@@ -106,21 +108,25 @@
 
     @Test(expected = NullPointerException.class)
     public void setCurrentItemBeforeSetPreviewAdapter_throwNPE() {
-        final int currentItem = 5;
+        final int currentItem = mPreviewSampleCount + 2;
 
         mTextReadingPreviewPreference.setCurrentItem(currentItem);
     }
 
     @Test(expected = NullPointerException.class)
     public void updatePagerWithoutPreviewAdapter_throwNPE() {
-        final int index = 1;
+        final int index = mPreviewSampleCount - 1;
 
         mTextReadingPreviewPreference.notifyPreviewPagerChanged(index);
     }
 
     @Test
     public void notifyPreviewPager_setPreviewLayer() {
-        final int index = 2;
+        // The preview pager cannot switch page if there is only one preview layout, so skip the
+        // test if so
+        Assume.assumeTrue(mPreviewSampleCount > 1);
+
+        final int index = mPreviewSampleCount - 1;
         mTextReadingPreviewPreference.setPreviewAdapter(mPreviewPagerAdapter);
         mTextReadingPreviewPreference.onBindViewHolder(mHolder);
 
@@ -131,7 +137,7 @@
 
     @Test
     public void afterPagerChange_updateCurrentItem() {
-        final int currentItem = 2;
+        final int currentItem = mPreviewSampleCount - 1;
         mTextReadingPreviewPreference.setPreviewAdapter(mPreviewPagerAdapter);
         mTextReadingPreviewPreference.onBindViewHolder(mHolder);
 
diff --git a/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java b/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java
index cd9cdd6..78cfd36 100644
--- a/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java
+++ b/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java
@@ -32,7 +32,11 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.FakeFeatureFlagsImpl;
+import android.content.pm.FeatureFlags;
+import android.content.pm.Flags;
 import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.ApplicationInfoFlags;
 import android.content.pm.ResolveInfo;
 import android.content.pm.UserInfo;
 import android.os.UserHandle;
@@ -51,18 +55,20 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.List;
 import java.util.Set;
 
 @RunWith(RobolectricTestRunner.class)
 @LooperMode(LooperMode.Mode.LEGACY)
 public final class InstalledAppCounterTest {
 
-    private final String APP_1 = "app1";
-    private final String APP_2 = "app2";
-    private final String APP_3 = "app3";
-    private final String APP_4 = "app4";
-    private final String APP_5 = "app5";
-    private final String APP_6 = "app6";
+    private static final String APP_1 = "app1";
+    private static final String APP_2 = "app2";
+    private static final String APP_3 = "app3";
+    private static final String APP_4 = "app4";
+    private static final String APP_5 = "app5";
+    private static final String APP_6 = "app6";
+    private static final String APP_7 = "app7";
 
     private final int MAIN_USER_ID = 0;
     private final int MANAGED_PROFILE_ID = 10;
@@ -85,11 +91,16 @@
     private ApplicationInfo mApp4;
     private ApplicationInfo mApp5;
     private ApplicationInfo mApp6;
+    private ApplicationInfo mApp7;
+
+    private FakeFeatureFlagsImpl mFakeFeatureFlags;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
+        mFakeFeatureFlags = new FakeFeatureFlagsImpl();
+        mFakeFeatureFlags.setFlag(Flags.FLAG_ARCHIVING, true);
 
         mApp1 = buildInfo(MAIN_USER_APP_UID, APP_1,
                 ApplicationInfo.FLAG_UPDATED_SYSTEM_APP, 0 /* targetSdkVersion */);
@@ -103,6 +114,9 @@
                 0 /* targetSdkVersion */);
         mApp6 = buildInfo(MANAGED_PROFILE_APP_UID, APP_6, ApplicationInfo.FLAG_SYSTEM,
                 0 /* targetSdkVersion */);
+        mApp7 = buildInfo(MAIN_USER_APP_UID, APP_7, 0 /* flags */,
+                0 /* targetSdkVersion */);
+        mApp7.isArchived = true;
     }
 
     private void expectQueryIntentActivities(int userId, String packageName, boolean launchable) {
@@ -128,8 +142,14 @@
 
         // Verify that installed packages were retrieved the current user and the user's managed
         // profile only.
-        verify(mPackageManager).getInstalledApplicationsAsUser(anyInt(), eq(MAIN_USER_ID));
-        verify(mPackageManager).getInstalledApplicationsAsUser(anyInt(), eq(MANAGED_PROFILE_ID));
+        verify(mPackageManager)
+                .getInstalledApplicationsAsUser(
+                        any(ApplicationInfoFlags.class),
+                        eq(MAIN_USER_ID));
+        verify(mPackageManager)
+                .getInstalledApplicationsAsUser(
+                        any(ApplicationInfoFlags.class),
+                        eq(MANAGED_PROFILE_ID));
         verify(mPackageManager, atLeast(0))
             .queryIntentActivitiesAsUser(any(Intent.class), anyInt(), anyInt());
         verifyNoMoreInteractions(mPackageManager);
@@ -179,6 +199,48 @@
         testCountInstalledAppsAcrossAllUsers(true /* async */);
     }
 
+    @Test
+    public void testCountInstalledApps_archivingDisabled() {
+        when(mUserManager.getProfiles(UserHandle.myUserId())).thenReturn(List.of(
+                new UserInfo(MAIN_USER_ID, "main", UserInfo.FLAG_ADMIN)));
+        // The user has four apps installed:
+        // * app2 is a user-installed app. It should be counted.
+        // * app7 is a user-archived app. It should not be counted.
+        when(mPackageManager.getInstalledApplicationsAsUser(
+                argThat(isApplicationInfoFlagsEqualTo(
+                        ApplicationInfoFlags.of(
+                                PackageManager.GET_DISABLED_COMPONENTS
+                                        | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS
+                                        | PackageManager.MATCH_ANY_USER))),
+                eq(MAIN_USER_ID))).thenReturn(Arrays.asList(mApp2));
+
+        mFakeFeatureFlags.setFlag(Flags.FLAG_ARCHIVING, false);
+        // Count the number of all apps installed, irrespective of install reason.
+        count(InstalledAppCounter.IGNORE_INSTALL_REASON, mFakeFeatureFlags);
+        assertThat(mInstalledAppCount).isEqualTo(1);
+    }
+
+    @Test
+    public void testCountInstalledApps_archivingEnabled() {
+        when(mUserManager.getProfiles(UserHandle.myUserId())).thenReturn(List.of(
+                new UserInfo(MAIN_USER_ID, "main", UserInfo.FLAG_ADMIN)));
+        // The user has four apps installed:
+        // * app2 is a user-installed app. It should be counted.
+        // * app7 is a user-archived app. It should be counted.
+        when(mPackageManager.getInstalledApplicationsAsUser(
+                argThat(isApplicationInfoFlagsEqualTo(
+                        ApplicationInfoFlags.of(
+                                PackageManager.GET_DISABLED_COMPONENTS
+                                        | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS
+                                        | PackageManager.MATCH_ANY_USER
+                                        | PackageManager.MATCH_ARCHIVED_PACKAGES))),
+                eq(MAIN_USER_ID))).thenReturn(Arrays.asList(mApp2, mApp7));
+
+        // Count the number of all apps installed, irrespective of install reason.
+        count(InstalledAppCounter.IGNORE_INSTALL_REASON, mFakeFeatureFlags);
+        assertThat(mInstalledAppCount).isEqualTo(2);
+    }
+
     private void count(int installReason, boolean async) {
         mInstalledAppCount = -1;
         final InstalledAppCounterTestable counter = new InstalledAppCounterTestable(installReason);
@@ -191,16 +253,27 @@
         }
     }
 
+    private void count(int installReason, FeatureFlags featureFlags) {
+        mInstalledAppCount = -1;
+        final InstalledAppCounterTestable counter =
+                new InstalledAppCounterTestable(installReason, featureFlags);
+        counter.executeInForeground();
+    }
+
     private void configurePackageManager() {
         // The first user has four apps installed:
         // * app1 is an updated system app. It should be counted.
         // * app2 is a user-installed app. It should be counted.
         // * app3 is a system app that provides a launcher icon. It should be counted.
         // * app4 is a system app that provides no launcher icon. It should not be counted.
-        when(mPackageManager.getInstalledApplicationsAsUser(PackageManager.GET_DISABLED_COMPONENTS
-                | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS
-                | PackageManager.MATCH_ANY_USER,
-                MAIN_USER_ID)).thenReturn(Arrays.asList(mApp1, mApp2, mApp3, mApp4));
+        ApplicationInfoFlags infoFlags1 = ApplicationInfoFlags.of(
+                PackageManager.GET_DISABLED_COMPONENTS
+                        | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS
+                        | PackageManager.MATCH_ANY_USER);
+        when(mPackageManager.getInstalledApplicationsAsUser(
+                argThat(isApplicationInfoFlagsEqualTo(infoFlags1)),
+                eq(MAIN_USER_ID))
+        ).thenReturn(Arrays.asList(mApp1, mApp2, mApp3, mApp4));
         // For system apps, InstalledAppCounter checks whether they handle the default launcher
         // intent to decide whether to include them in the count of installed apps or not.
         expectQueryIntentActivities(MAIN_USER_ID, APP_3, true /* launchable */);
@@ -220,9 +293,12 @@
         // The second user has two apps installed:
         // * app5 is a user-installed app. It should be counted.
         // * app6 is a system app that provides a launcher icon. It should be counted.
-        when(mPackageManager.getInstalledApplicationsAsUser(PackageManager.GET_DISABLED_COMPONENTS
-                | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS,MANAGED_PROFILE_ID))
-                .thenReturn(Arrays.asList(mApp5, mApp6));
+        ApplicationInfoFlags infoFlags2 = ApplicationInfoFlags.of(
+                PackageManager.GET_DISABLED_COMPONENTS
+                        | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS);
+        when(mPackageManager.getInstalledApplicationsAsUser(
+                argThat(isApplicationInfoFlagsEqualTo(infoFlags2)), eq(MANAGED_PROFILE_ID))
+        ).thenReturn(Arrays.asList(mApp5, mApp6));
         expectQueryIntentActivities(MANAGED_PROFILE_ID, APP_6, true /* launchable */);
 
         // app5 is installed by enterprise policy.
@@ -238,6 +314,10 @@
             super(mContext, installReason, mPackageManager);
         }
 
+        private InstalledAppCounterTestable(int installReason, FeatureFlags featureFlags) {
+            super(mContext, installReason, mPackageManager, featureFlags);
+        }
+
         @Override
         protected void onCountComplete(int num) {
             mInstalledAppCount = num;
@@ -263,4 +343,14 @@
             return true;
         };
     }
+
+    private ArgumentMatcher<ApplicationInfoFlags> isApplicationInfoFlagsEqualTo(
+            ApplicationInfoFlags infoFlags) {
+        return flags -> {
+            if (flags == null) {
+                return false;
+            }
+            return flags.getValue() == infoFlags.getValue();
+        };
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/NotificationAssistantPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/NotificationAssistantPreferenceControllerTest.java
index 54a6bd4..5f506b8 100644
--- a/tests/robotests/src/com/android/settings/notification/NotificationAssistantPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/NotificationAssistantPreferenceControllerTest.java
@@ -155,34 +155,6 @@
     }
 
     @Test
-    public void testUpdateState_SettingActivityAvailable() throws Exception {
-        mPreferenceController.updateState(mPreference);
-        assertNotNull(mPreference.getIntent());
-
-        mPreference.performClick();
-        Intent nextIntent = Shadows.shadowOf(
-                (Application) ApplicationProvider.getApplicationContext()).getNextStartedActivity();
-        assertEquals(nextIntent.getAction(), ACTION_NOTIFICATION_ASSISTANT_DETAIL_SETTINGS);
-    }
-
-    @Test
-    public void testUpdateState_SettingActivityUnavailable() throws Exception {
-        when(mPackageManager.queryIntentActivities(any(Intent.class), any()))
-                .thenReturn(null);
-        mPreferenceController.updateState(mPreference);
-        assertNull(mPreference.getIntent());
-
-        mPreference.performClick();
-        Intent nextIntent = Shadows.shadowOf(
-                (Application) ApplicationProvider.getApplicationContext()).getNextStartedActivity();
-        assertNull(nextIntent);
-        // Verify a dialog is shown
-        verify(mFragmentTransaction).add(
-                any(NotificationAssistantDialogFragment.class), anyString());
-        verify(mBackend, times(0)).setNotificationAssistantGranted(any());
-    }
-
-    @Test
     @Config(shadows = ShadowSecureSettings.class)
     public void testMigrationFromSetting_userEnable_multiProfile() throws Exception {
         Settings.Secure.putIntForUser(mContext.getContentResolver(),
@@ -229,14 +201,4 @@
         verify(mBackend, never())
                 .setNASMigrationDoneAndResetDefault(eq(10), anyBoolean());
     }
-
-    @Test
-    public void testNASUnavailable_settingDisabled() throws Exception {
-        when(mBackend.getDefaultNotificationAssistant()).thenReturn(null);
-        mPreferenceController.getDefaultNASIntent();
-        mPreferenceController.updateState(mPreference);
-
-        verify(mPreference, atLeastOnce()).setSwitchEnabled(eq(false));
-        assertFalse(mPreference.isEnabled());
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/security/ContentProtectionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/ContentProtectionPreferenceControllerTest.java
new file mode 100644
index 0000000..5cc931e
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/security/ContentProtectionPreferenceControllerTest.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2023 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.settings.security;
+
+import static android.view.contentprotection.flags.Flags.FLAG_SETTING_UI_ENABLED;
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.platform.test.flag.junit.SetFlagsRule;
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+
+import com.android.settings.R;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+@RunWith(RobolectricTestRunner.class)
+public class ContentProtectionPreferenceControllerTest {
+
+    @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
+
+    private Context mContext;
+    private ContentProtectionPreferenceController mController;
+    private Preference mPreference;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+        mController = new ContentProtectionPreferenceController(mContext, "key");
+        mPreference = new Preference(mContext);
+        mPreference.setKey(mController.getPreferenceKey());
+    }
+
+    @Test
+    public void isAvailable_flagSettingUiDisabled_isFalse() {
+        mSetFlagsRule.disableFlags(FLAG_SETTING_UI_ENABLED);
+        assertThat(mController.isAvailable()).isFalse();
+    }
+
+    @Test
+    public void isAvailable_flagSettingUiEnabled_isTrue() {
+        mSetFlagsRule.enableFlags(FLAG_SETTING_UI_ENABLED);
+        assertThat(mController.isAvailable()).isTrue();
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/security/ContentProtectionPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/security/ContentProtectionPreferenceFragmentTest.java
new file mode 100644
index 0000000..431dd0c
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/security/ContentProtectionPreferenceFragmentTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2023 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.settings.security;
+
+import static android.app.settings.SettingsEnums.CONTENT_PROTECTION_PREFERENCE;
+import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+
+import android.content.Context;
+import android.provider.SearchIndexableResource;
+
+import com.android.settings.R;
+import com.android.settings.testutils.XmlTestUtils;
+import com.android.settings.testutils.shadow.ShadowDashboardFragment;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+import java.util.List;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(shadows = ShadowDashboardFragment.class)
+public class ContentProtectionPreferenceFragmentTest {
+
+    @Mock
+    private ContentProtectionPreferenceFragment mMockFragment;
+    private Context mContext;
+
+    @Before
+    public void setUp() throws Exception {
+        MockitoAnnotations.initMocks(this);
+        mContext = spy(RuntimeEnvironment.application);
+        mMockFragment = spy(new ContentProtectionPreferenceFragment());
+
+        doReturn(mContext).when(mMockFragment).getContext();
+    }
+
+    @Test
+    public void getMetricsCategory() {
+        assertThat(mMockFragment.getMetricsCategory()).isEqualTo(CONTENT_PROTECTION_PREFERENCE);
+    }
+
+    @Test
+    public void getPreferenceScreenResId(){
+       assertThat(mMockFragment.getPreferenceScreenResId())
+               .isEqualTo(R.layout.content_protection_preference_fragment);
+    }
+
+    @Test
+    public void getNonIndexableKeys_existInXmlLayout() {
+        final List<String> nonIndexableKeys =
+                             ContentProtectionPreferenceFragment.SEARCH_INDEX_DATA_PROVIDER
+                .getNonIndexableKeys(mContext);
+        final List<String> allKeys =
+                XmlTestUtils.getKeysFromPreferenceXml(mContext,
+                        R.layout.content_protection_preference_fragment);
+
+        assertThat(allKeys).containsAtLeastElementsIn(nonIndexableKeys);
+    }
+
+    @Test
+    public void searchIndexProvider_shouldIndexResource() {
+        final List<SearchIndexableResource> indexRes =
+                ContentProtectionPreferenceFragment.SEARCH_INDEX_DATA_PROVIDER
+                        .getXmlResourcesToIndex(mContext, /* enabled = */ true);
+
+        assertThat(indexRes).isNotNull();
+        assertThat(indexRes).isNotEmpty();
+        assertThat(indexRes.get(0).xmlResId).isEqualTo(mMockFragment.getPreferenceScreenResId());
+    }
+}
diff --git a/tests/uitests/Android.bp b/tests/uitests/Android.bp
index 4a47c90..f3f5201 100644
--- a/tests/uitests/Android.bp
+++ b/tests/uitests/Android.bp
@@ -47,7 +47,7 @@
         "settings-helper",
         "sysui-helper",
         "timeresult-helper-lib",
-        "truth-prebuilt",
+        "truth",
         "flag-junit",
     ],