Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f753ea6c authored by Andrii Kulian's avatar Andrii Kulian Committed by Charles Chen
Browse files

Do not verify display context in DecorContext constructor

Non-activity context can be passed to DecorContext, so an exception
can be thrown when Context#getDisplay() call does verification.
An example is that a free dialog uses Application context as its context.

Bug: 149928768
Test: manual: test crashed apps reported in bugs before/after this patch.
Change-Id: Ib302c23cb8e2e388e7468f37f1b63b83ef52ef0e
parent e078ee50
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -46,9 +46,10 @@ public class DecorContext extends ContextThemeWrapper {

    private WeakReference<Context> mActivityContext;

    // TODO(b/149928768): Non-activity context can be passed.
    @VisibleForTesting
    public DecorContext(Context context, Context activityContext) {
        super(context.createDisplayContext(activityContext.getDisplay()), null);
        super(context.createDisplayContext(activityContext.getDisplayNoVerify()), null);
        mActivityContext = new WeakReference<>(activityContext);
        mActivityResources = activityContext.getResources();
    }