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

Commit a54c3d72 authored by Fan Zhang's avatar Fan Zhang
Browse files

Guard against disabled app when launcing emergency dialer

OEMs can override emergency dialer, and they can be disabled. Telecomm
service should not fail when that happens.

Fixes: 144312317
Test: manual
Change-Id: Ieb554db8506a38b38b01f3e992d140d0f3150978
Merged-In: Ieb554db8506a38b38b01f3e992d140d0f3150978
parent d00e54b1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Binder;
import android.os.Build;
@@ -1473,6 +1474,11 @@ public class TelecomServiceImpl {
                    com.android.internal.R.string.config_emergency_dialer_package);
            Intent intent = new Intent(Intent.ACTION_DIAL_EMERGENCY)
                    .setPackage(packageName);
            ResolveInfo resolveInfo = mPackageManager.resolveActivity(intent, 0 /* flags*/);
            if (resolveInfo == null) {
                // No matching activity from config, fallback to default platform implementation
                intent.setPackage(null);
            }
            if (!TextUtils.isEmpty(number) && TextUtils.isDigitsOnly(number)) {
                intent.setData(Uri.parse("tel:" + number));
            }