diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 6577ebc8cd3f..bbbd88ddb67f 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -3838,6 +3838,11 @@ Performance is impacted. To disable, check bootloader. + + Experimental MTE enabled + + Performance and stability might be impacted. Reboot to disable. If enabled using arm64.memtag.bootctl, set it to "none" beforehand. + Liquid or debris in USB port diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 5e8851976556..b1a4206d3b9d 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2091,6 +2091,8 @@ + + diff --git a/proto/src/system_messages.proto b/proto/src/system_messages.proto index 196c6aaa7fcb..3648593e5dd5 100644 --- a/proto/src/system_messages.proto +++ b/proto/src/system_messages.proto @@ -282,6 +282,10 @@ message SystemMessage { // Notify the user to set up dream NOTE_SETUP_DREAM = 68; + // Inform the user that MTE override is active. + // Package: android + NOTE_MTE_OVERRIDE_ENABLED = 69; + // ADD_NEW_IDS_ABOVE_THIS_LINE // Legacy IDs with arbitrary values appear below // Legacy IDs existed as stable non-conflicting constants prior to the O release diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index f67e732b47dd..5a49fb2c0504 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -4948,6 +4948,7 @@ public class ActivityManagerService extends IActivityManager.Stub } // UART is on if init's console service is running, send a warning notification. showConsoleNotificationIfActive(); + showMteOverrideNotificationIfActive(); t.traceEnd(); } @@ -4982,6 +4983,35 @@ public class ActivityManagerService extends IActivityManager.Stub } + private void showMteOverrideNotificationIfActive() { + if (!SystemProperties.getBoolean("ro.arm64.memtag.bootctl_supported", false) + || !com.android.internal.os.Zygote.nativeSupportsMemoryTagging()) { + return; + } + String title = mContext + .getString(com.android.internal.R.string.mte_override_notification_title); + String message = mContext + .getString(com.android.internal.R.string.mte_override_notification_message); + Notification notification = + new Notification.Builder(mContext, SystemNotificationChannels.DEVELOPER) + .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb) + .setOngoing(true) + .setTicker(title) + .setDefaults(0) // please be quiet + .setColor(mContext.getColor( + com.android.internal.R.color + .system_notification_accent_color)) + .setContentTitle(title) + .setContentText(message) + .setVisibility(Notification.VISIBILITY_PUBLIC) + .build(); + + NotificationManager notificationManager = + mContext.getSystemService(NotificationManager.class); + notificationManager.notifyAsUser( + null, SystemMessage.NOTE_MTE_OVERRIDE_ENABLED, notification, UserHandle.ALL); + } + @Override public void bootAnimationComplete() { if (DEBUG_ALL) Slog.d(TAG, "bootAnimationComplete: Callers=" + Debug.getCallers(4));