Change the resource ID of advanced protection help URI

Change-Id I3c6d24e3e9a4358ab1adb342dbee8fc56ac16794 added advanced
protection help URI to frameworks/base/core/res/res/values/config.xml,
so this change removes the duplicate resource from Settings and updates
ActionDisabledByAdvancedProtectionDialog to use the framework resource.

Bug: 401233918
Test: manual
Test: atest ActionDisabledByAdvancedProtectionDialog
Flag: EXEMPT bug fix
Change-Id: Ic84909f4c16d3449bd9981be6659987b1963a26a
This commit is contained in:
Azhara Assanova
2025-03-11 16:35:22 +00:00
parent bfab8a80d9
commit 96c6ed59a6
4 changed files with 129 additions and 9 deletions

View File

@@ -14,21 +14,23 @@
* limitations under the License.
*/
package com.android.settings.security;
package com.android.settings.security
import android.content.Intent
import android.content.pm.PackageManager
import android.security.advancedprotection.AdvancedProtectionManager
import android.security.advancedprotection.AdvancedProtectionManager.EXTRA_SUPPORT_DIALOG_FEATURE
import android.security.advancedprotection.AdvancedProtectionManager.EXTRA_SUPPORT_DIALOG_TYPE
import android.security.advancedprotection.AdvancedProtectionManager.FEATURE_ID_DISALLOW_CELLULAR_2G
import android.security.advancedprotection.AdvancedProtectionManager.FEATURE_ID_DISALLOW_INSTALL_UNKNOWN_SOURCES
import android.security.advancedprotection.AdvancedProtectionManager.FEATURE_ID_DISALLOW_WEP
import android.content.pm.PackageManager
import android.security.advancedprotection.AdvancedProtectionManager.FEATURE_ID_ENABLE_MTE
import android.security.advancedprotection.AdvancedProtectionManager.SUPPORT_DIALOG_TYPE_BLOCKED_INTERACTION
import android.security.advancedprotection.AdvancedProtectionManager.SUPPORT_DIALOG_TYPE_DISABLED_SETTING
import android.security.advancedprotection.AdvancedProtectionManager.SUPPORT_DIALOG_TYPE_UNKNOWN
import android.util.Log
import android.view.WindowManager
import androidx.annotation.VisibleForTesting
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -38,7 +40,6 @@ import com.android.settingslib.spa.SpaDialogWindowTypeActivity
import com.android.settingslib.spa.widget.dialog.AlertDialogButton
import com.android.settingslib.spa.widget.dialog.SettingsAlertDialogContent
import com.android.settingslib.wifi.WifiUtils.Companion.DIALOG_WINDOW_TYPE
import android.security.advancedprotection.AdvancedProtectionManager
class ActionDisabledByAdvancedProtectionDialog : SpaDialogWindowTypeActivity() {
@@ -85,9 +86,12 @@ class ActionDisabledByAdvancedProtectionDialog : SpaDialogWindowTypeActivity() {
return getString(messageId)
}
private fun getSupportButtonIfExists(): AlertDialogButton? {
@VisibleForTesting
fun getSupportButtonIfExists(): AlertDialogButton? {
try {
val helpIntentUri = getString(R.string.help_url_action_disabled_by_advanced_protection)
val helpIntentUri = getString(
com.android.internal.R.string.config_help_url_action_disabled_by_advanced_protection
)
val helpIntent = Intent.parseUri(helpIntentUri, Intent.URI_INTENT_SCHEME)
if (helpIntent == null) return null
val helpActivityInfo = packageManager.resolveActivity(helpIntent, /* flags */ 0)