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

Commit 42c9a08e authored by Matt Pietal's avatar Matt Pietal
Browse files

Catch exception on onBindSlice for keyguard

This is a legacy codepath that can fail on startup. Attempt
a blind fix to catch the exception and log it.

Fixes: 333359610
Test: manual - check test output to see if it is resolved
Flag: None
Change-Id: I9b808bd50666638a54010b17deac6c421997dffb
parent 8bdef1f0
Loading
Loading
Loading
Loading
+20 −13
Original line number Original line Diff line number Diff line
@@ -37,6 +37,7 @@ import android.provider.Settings;
import android.service.notification.ZenModeConfig;
import android.service.notification.ZenModeConfig;
import android.text.TextUtils;
import android.text.TextUtils;
import android.text.style.StyleSpan;
import android.text.style.StyleSpan;
import android.util.Log;


import androidx.core.graphics.drawable.IconCompat;
import androidx.core.graphics.drawable.IconCompat;
import androidx.slice.Slice;
import androidx.slice.Slice;
@@ -212,10 +213,12 @@ public class KeyguardSliceProvider extends SliceProvider implements
    @AnyThread
    @AnyThread
    @Override
    @Override
    public Slice onBindSlice(Uri sliceUri) {
    public Slice onBindSlice(Uri sliceUri) {
        Slice slice = null;
        try {
            Trace.beginSection("KeyguardSliceProvider#onBindSlice");
            Trace.beginSection("KeyguardSliceProvider#onBindSlice");
        Slice slice;
            synchronized (this) {
            synchronized (this) {
            ListBuilder builder = new ListBuilder(getContext(), mSliceUri, ListBuilder.INFINITY);
                ListBuilder builder = new ListBuilder(getContext(), mSliceUri,
                        ListBuilder.INFINITY);
                if (needsMediaLocked()) {
                if (needsMediaLocked()) {
                    addMediaLocked(builder);
                    addMediaLocked(builder);
                } else {
                } else {
@@ -226,7 +229,11 @@ public class KeyguardSliceProvider extends SliceProvider implements
                addPrimaryActionLocked(builder);
                addPrimaryActionLocked(builder);
                slice = builder.build();
                slice = builder.build();
            }
            }
        } catch (IllegalStateException e) {
            Log.w(TAG, "Could not initialize slice", e);
        } finally {
            Trace.endSection();
            Trace.endSection();
        }
        return slice;
        return slice;
    }
    }