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

Commit 5ffb358f authored by Grant Menke's avatar Grant Menke
Browse files

Use different method for getting icon from resource.

There is a public API equivalent of this method; use it instead.

Test: Ran unit tests and CTS tests that cover this functionality.
Fixes: 308442615
Flag: com.android.server.telecom.flags.resolve_hidden_dependencies_two
Change-Id: Ice622ae833280af49e9757754e82c40d5693baaf
parent dc52a4b2
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.app.PendingIntent;
import android.app.Person;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
@@ -150,13 +151,32 @@ public class CallStreamingNotification extends CallsManagerListenerBase implemen
        mAsyncTaskExecutor.execute(() -> {
            Icon contactPhotoIcon = null;
            try {
                if (mFeatureFlags.resolveHiddenDependenciesTwo()) {
                    Resources resources = mContext.getResources();
                    String resPackage = null;
                    if (resources != null) {
                        resPackage = resources.getResourcePackageName(R.drawable.person_circle);
                    }
                    if (resPackage != null) {
                        contactPhotoIcon = Icon.createWithResource(
                                resPackage, R.drawable.person_circle);
                    } else {
                        contactPhotoIcon = Icon.createWithResource(mContext,
                                R.drawable.person_circle);
                    }
                } else {
                    contactPhotoIcon = Icon.createWithResource(mContext.getResources(),
                            R.drawable.person_circle);
                }
            } catch (Exception e) {
                // All loads of things can do wrong when working with bitmaps and images, so to
                // ensure Telecom doesn't crash, lets try/catch to be sure.
                Log.e(this, e, "enqueueStreamingNotification: Couldn't build avatar icon");
            }
            if (contactPhotoIcon == null) {
                Log.e(this, new Exception(), "enqueueStreamingNotification: "
                        + "contactPhotoIcon is null");
            }
            showStreamingNotification(call.getId(),
                    call.getAssociatedUser(), call.getCallerDisplayName(),
                    call.getHandle(), contactPhotoIcon,