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

Commit 9b902f58 authored by twyen's avatar twyen Committed by Copybara-Service
Browse files

Handle null returned from TelecomManager.getCallCapablePhoneAccounts()

Usually it is non-null, but not true for some OEMs.

TEST=TAP
Bug: 73905236
Test: TAP
PiperOrigin-RevId: 197076980
Change-Id: Ie58ecf2ab392e3393d190cefe9815b6bb8542800
parent f7d0833a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ import java.util.concurrent.ConcurrentHashMap;
 * perform the required check and return the fallback default if the permission is missing,
 * otherwise return the value from TelecomManager.
 */
@SuppressWarnings("MissingPermission")
@SuppressWarnings({"MissingPermission", "Guava"})
public abstract class TelecomUtil {

  private static final String TAG = "TelecomUtil";
@@ -145,7 +145,8 @@ public abstract class TelecomUtil {

  public static List<PhoneAccountHandle> getCallCapablePhoneAccounts(Context context) {
    if (hasReadPhoneStatePermission(context)) {
      return getTelecomManager(context).getCallCapablePhoneAccounts();
      return Optional.fromNullable(getTelecomManager(context).getCallCapablePhoneAccounts())
          .or(new ArrayList<>());
    }
    return new ArrayList<>();
  }