Loading core/java/android/app/Notification.java +7 −0 Original line number Diff line number Diff line Loading @@ -1968,6 +1968,13 @@ public class Notification implements Parcelable @SystemApi public static final int SEMANTIC_ACTION_CONVERSATION_IS_PHISHING = 12; /** * {@link #extras} key to a boolean defining if this action requires special visual * treatment. * @hide */ public static final String EXTRA_IS_MAGIC = "android.extra.IS_MAGIC"; private final Bundle mExtras; @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) private Icon mIcon; Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/MagicActionBackgroundDrawable.kt 0 → 100644 +55 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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.systemui.statusbar.notification.row import android.content.Context import android.graphics.Canvas import android.graphics.ColorFilter import android.graphics.Paint import android.graphics.PixelFormat import android.graphics.drawable.Drawable /** * A background style for smarter-smart-actions. * * TODO(b/383567383) implement final UX */ class MagicActionBackgroundDrawable(context: Context) : Drawable() { private var _alpha: Int = 255 private var _colorFilter: ColorFilter? = null private val paint = Paint().apply { color = context.getColor(com.android.internal.R.color.materialColorPrimaryContainer) } override fun draw(canvas: Canvas) { canvas.drawRect(bounds, paint) } override fun setAlpha(alpha: Int) { _alpha = alpha invalidateSelf() } override fun setColorFilter(colorFilter: ColorFilter?) { _colorFilter = colorFilter invalidateSelf() } override fun getOpacity(): Int = PixelFormat.TRANSLUCENT } packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt +11 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.view.ViewGroup import android.view.accessibility.AccessibilityNodeInfo import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction import android.widget.Button import com.android.systemui.Flags import com.android.systemui.plugins.ActivityStarter import com.android.systemui.res.R import com.android.systemui.shared.system.ActivityManagerWrapper Loading @@ -52,6 +53,7 @@ import com.android.systemui.statusbar.SmartReplyController import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.headsup.HeadsUpManager import com.android.systemui.statusbar.notification.logging.NotificationLogger import com.android.systemui.statusbar.notification.row.MagicActionBackgroundDrawable import com.android.systemui.statusbar.phone.KeyguardDismissUtil import com.android.systemui.statusbar.policy.InflatedSmartReplyState.SuppressedActions import com.android.systemui.statusbar.policy.SmartReplyView.SmartActions Loading Loading @@ -400,6 +402,15 @@ constructor( .apply { text = action.title if (Flags.notificationMagicActionsTreatment()) { if ( smartActions.fromAssistant && action.extras.getBoolean(Notification.Action.EXTRA_IS_MAGIC, false) ) { background = MagicActionBackgroundDrawable(parent.context) } } // We received the Icon from the application - so use the Context of the application // to // reference icon resources. Loading Loading
core/java/android/app/Notification.java +7 −0 Original line number Diff line number Diff line Loading @@ -1968,6 +1968,13 @@ public class Notification implements Parcelable @SystemApi public static final int SEMANTIC_ACTION_CONVERSATION_IS_PHISHING = 12; /** * {@link #extras} key to a boolean defining if this action requires special visual * treatment. * @hide */ public static final String EXTRA_IS_MAGIC = "android.extra.IS_MAGIC"; private final Bundle mExtras; @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) private Icon mIcon; Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/MagicActionBackgroundDrawable.kt 0 → 100644 +55 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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.systemui.statusbar.notification.row import android.content.Context import android.graphics.Canvas import android.graphics.ColorFilter import android.graphics.Paint import android.graphics.PixelFormat import android.graphics.drawable.Drawable /** * A background style for smarter-smart-actions. * * TODO(b/383567383) implement final UX */ class MagicActionBackgroundDrawable(context: Context) : Drawable() { private var _alpha: Int = 255 private var _colorFilter: ColorFilter? = null private val paint = Paint().apply { color = context.getColor(com.android.internal.R.color.materialColorPrimaryContainer) } override fun draw(canvas: Canvas) { canvas.drawRect(bounds, paint) } override fun setAlpha(alpha: Int) { _alpha = alpha invalidateSelf() } override fun setColorFilter(colorFilter: ColorFilter?) { _colorFilter = colorFilter invalidateSelf() } override fun getOpacity(): Int = PixelFormat.TRANSLUCENT }
packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyStateInflater.kt +11 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.view.ViewGroup import android.view.accessibility.AccessibilityNodeInfo import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction import android.widget.Button import com.android.systemui.Flags import com.android.systemui.plugins.ActivityStarter import com.android.systemui.res.R import com.android.systemui.shared.system.ActivityManagerWrapper Loading @@ -52,6 +53,7 @@ import com.android.systemui.statusbar.SmartReplyController import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.headsup.HeadsUpManager import com.android.systemui.statusbar.notification.logging.NotificationLogger import com.android.systemui.statusbar.notification.row.MagicActionBackgroundDrawable import com.android.systemui.statusbar.phone.KeyguardDismissUtil import com.android.systemui.statusbar.policy.InflatedSmartReplyState.SuppressedActions import com.android.systemui.statusbar.policy.SmartReplyView.SmartActions Loading Loading @@ -400,6 +402,15 @@ constructor( .apply { text = action.title if (Flags.notificationMagicActionsTreatment()) { if ( smartActions.fromAssistant && action.extras.getBoolean(Notification.Action.EXTRA_IS_MAGIC, false) ) { background = MagicActionBackgroundDrawable(parent.context) } } // We received the Icon from the application - so use the Context of the application // to // reference icon resources. Loading