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

Commit 909d3a21 authored by Peter Wang's avatar Peter Wang Committed by Android (Google) Code Review
Browse files

Merge "[Telephony Mainline] Removed IPackageManager reference"

parents da9a56b5 e8a2a843
Loading
Loading
Loading
Loading
+0 −26
Original line number Original line Diff line number Diff line
@@ -25,8 +25,6 @@ import android.annotation.StringDef;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.TestApi;
import android.annotation.WorkerThread;
import android.annotation.WorkerThread;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.os.Binder;
import android.os.Binder;
import android.os.RemoteException;
import android.os.RemoteException;
import android.telephony.CarrierConfigManager;
import android.telephony.CarrierConfigManager;
@@ -382,10 +380,6 @@ public class ProvisioningManager {
    @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    public void registerProvisioningChangedCallback(@NonNull @CallbackExecutor Executor executor,
    public void registerProvisioningChangedCallback(@NonNull @CallbackExecutor Executor executor,
            @NonNull Callback callback) throws ImsException {
            @NonNull Callback callback) throws ImsException {
        if (!isImsAvailableOnDevice()) {
            throw new ImsException("IMS not available on device.",
                    ImsException.CODE_ERROR_UNSUPPORTED_OPERATION);
        }
        callback.setExecutor(executor);
        callback.setExecutor(executor);
        try {
        try {
            getITelephony().registerImsProvisioningChangedCallback(mSubId, callback.getBinder());
            getITelephony().registerImsProvisioningChangedCallback(mSubId, callback.getBinder());
@@ -618,26 +612,6 @@ public class ProvisioningManager {


    }
    }


    private static boolean isImsAvailableOnDevice() {
        IPackageManager pm = IPackageManager.Stub.asInterface(
                TelephonyFrameworkInitializer
                        .getTelephonyServiceManager()
                        .getPackageManagerServiceRegisterer()
                        .get());
        if (pm == null) {
            // For some reason package manger is not available.. This will fail internally anyways,
            // so do not throw error and allow.
            return true;
        }
        try {
            return pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS, 0);
        } catch (RemoteException e) {
            // For some reason package manger is not available.. This will fail internally anyways,
            // so do not throw error and allow.
        }
        return true;
    }

    private static ITelephony getITelephony() {
    private static ITelephony getITelephony() {
        ITelephony binder = ITelephony.Stub.asInterface(
        ITelephony binder = ITelephony.Stub.asInterface(
                TelephonyFrameworkInitializer
                TelephonyFrameworkInitializer