From 8f7c7b8a99ec004eabb84a2f3bdada78c8245cfc Mon Sep 17 00:00:00 2001 From: Behnam Heydarshahi Date: Tue, 5 Dec 2023 22:12:46 +0000 Subject: Allow SystemUIDialog.Factory to create with context from client Change-Id: I00438cff0525337f8f35ce19991cdf5fa39d7f91 Flag: None Fixes: 315029242 Test: atest SystemUIDialogTest --- .../android/systemui/statusbar/phone/SystemUIDialog.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java index 93bc96022292..af6da3fb6e51 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java @@ -146,7 +146,7 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh * When you just need a dialog, call this. */ public SystemUIDialog create() { - return create(new DialogDelegate<>(){}); + return create(new DialogDelegate<>(){}, mContext); } /** @@ -155,13 +155,18 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh * * When you need to customize the dialog, pass it a delegate. */ + public SystemUIDialog create(Delegate delegate, Context context) { + return create((DialogDelegate) delegate, context); + } + public SystemUIDialog create(Delegate delegate) { - return create((DialogDelegate) delegate); + return create(delegate, mContext); } - private SystemUIDialog create(DialogDelegate dialogDelegate) { + private SystemUIDialog create(DialogDelegate dialogDelegate, + Context context) { return new SystemUIDialog( - mContext, + context, DEFAULT_THEME, DEFAULT_DISMISS_ON_DEVICE_LOCK, mFeatureFlags, -- cgit v1.2.3-59-g8ed1b