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

Commit fa47a329 authored by Bill Lin's avatar Bill Lin
Browse files

Improve stability - return null when LastAccessedProvider no longer exist

From OEM's feedback, there is a suggestion for stability enahncement
In case to prevent NPE in for loop, we check ResolveInfo before add

Change-Id: I574c5cab7a3a1af1f5400c9b10c2d836c7d360d4
Fix: 122817012
Test: atest DocumentsUITests
parent 9cee68f8
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.FileUtils;
import android.provider.DocumentsContract;
import android.text.TextUtils;
import android.util.Log;

import com.android.documentsui.base.DocumentStack;
@@ -191,8 +192,10 @@ public class LastAccessedProvider extends ContentProvider {
            final Set<String> knownAuth = new HashSet<>();
            for (ResolveInfo info : getContext()
                    .getPackageManager().queryIntentContentProviders(intent, 0)) {
                if (info != null && !TextUtils.isEmpty(info.providerInfo.authority)) {
                    knownAuth.add(info.providerInfo.authority);
                }
            }

            purgeByAuthority(new Predicate<String>() {
                @Override