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

Commit dfcf2e00 authored by Evan Severson's avatar Evan Severson Committed by Android (Google) Code Review
Browse files

Merge "Add carrier privileged apps to fg capable apps" into rvc-dev

parents 10297c4a 0f5ffaa0
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.service.carrier.CarrierService;
import android.telephony.TelephonyManager;
import android.text.Html;
import android.text.TextUtils;
import android.text.format.DateFormat;
@@ -1065,6 +1067,18 @@ public final class Utils {
            return true;
        }

        // Carrier privileged apps implementing the carrier service
        final TelephonyManager telephonyManager =
                context.getSystemService(TelephonyManager.class);
        int numPhones = telephonyManager.getActiveModemCount();
        for (int phoneId = 0; phoneId < numPhones; phoneId++) {
            List<String> packages = telephonyManager.getCarrierPackageNamesForIntentAndPhone(
                    new Intent(CarrierService.CARRIER_SERVICE_INTERFACE), phoneId);
            if (packages != null && packages.contains(packageName)) {
                return true;
            }
        }

        return false;
    }
}