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

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

Merge "[Telephony Mainline] Refactored ServiceManager calls"

parents 7c8e648a 1f823dc5
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.telephony.Annotation.DataFailureCause;
import android.telephony.Annotation.RadioPowerState;
import android.telephony.Annotation.SrvccState;
@@ -32,6 +31,7 @@ import android.telephony.PreciseCallState;
import android.telephony.PreciseDataConnectionState;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.TelephonyFrameworkInitializer;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyRegistryManager;
import android.telephony.data.ApnSetting;
@@ -56,8 +56,11 @@ public class DefaultPhoneNotifier implements PhoneNotifier {


    public DefaultPhoneNotifier(Context context) {
        mRegistry = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService(
            "telephony.registry"));
        mRegistry = ITelephonyRegistry.Stub.asInterface(
                TelephonyFrameworkInitializer
                        .getTelephonyServiceManager()
                        .getTelephonyRegistryServiceRegisterer()
                        .get());
        mTelephonyRegistryMgr = (TelephonyRegistryManager) context.getSystemService(
            Context.TELEPHONY_REGISTRY_SERVICE);
    }
+17 −5
Original line number Diff line number Diff line
@@ -25,10 +25,10 @@ import android.database.MatrixCursor;
import android.database.MergeCursor;
import android.net.Uri;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.telephony.Rlog;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyFrameworkInitializer;
import android.text.TextUtils;

import com.android.internal.telephony.uicc.AdnRecord;
@@ -405,7 +405,10 @@ public class IccProvider extends ContentProvider {
        List<AdnRecord> adnRecords = null;
        try {
            IIccPhoneBook iccIpb = IIccPhoneBook.Stub.asInterface(
                    ServiceManager.getService("simphonebook"));
                    TelephonyFrameworkInitializer
                            .getTelephonyServiceManager()
                            .getIccPhoneBookServiceRegisterer()
                            .get());
            if (iccIpb != null) {
                adnRecords = iccIpb.getAdnRecordsInEfForSubscriber(subId, efType);
            }
@@ -447,7 +450,10 @@ public class IccProvider extends ContentProvider {

        try {
            IIccPhoneBook iccIpb = IIccPhoneBook.Stub.asInterface(
                    ServiceManager.getService("simphonebook"));
                    TelephonyFrameworkInitializer
                            .getTelephonyServiceManager()
                            .getIccPhoneBookServiceRegisterer()
                            .get());
            if (iccIpb != null) {
                success = iccIpb.updateAdnRecordsInEfBySearchForSubscriber(subId, efType,
                        "", "", name, number, pin2);
@@ -473,7 +479,10 @@ public class IccProvider extends ContentProvider {

        try {
            IIccPhoneBook iccIpb = IIccPhoneBook.Stub.asInterface(
                    ServiceManager.getService("simphonebook"));
                    TelephonyFrameworkInitializer
                            .getTelephonyServiceManager()
                            .getIccPhoneBookServiceRegisterer()
                            .get());
            if (iccIpb != null) {
                success = iccIpb.updateAdnRecordsInEfBySearchForSubscriber(subId, efType, oldName,
                        oldNumber, newName, newNumber, pin2);
@@ -499,7 +508,10 @@ public class IccProvider extends ContentProvider {

        try {
            IIccPhoneBook iccIpb = IIccPhoneBook.Stub.asInterface(
                    ServiceManager.getService("simphonebook"));
                    TelephonyFrameworkInitializer
                            .getTelephonyServiceManager()
                            .getIccPhoneBookServiceRegisterer()
                            .get());
            if (iccIpb != null) {
                success = iccIpb.updateAdnRecordsInEfBySearchForSubscriber(subId, efType,
                          name, number, "", "", pin2);
+5 −1
Original line number Diff line number Diff line
@@ -665,7 +665,11 @@ public abstract class InboundSmsHandler extends StateMachine {
//        // onlyCore indicates if the device is in cryptkeeper
//        boolean onlyCore = false;
//        try {
//            onlyCore = IPackageManager.Stub.asInterface(ServiceManager.getService("package")).
//            onlyCore = IPackageManager.Stub.asInterface(
//                    TelephonyFrameworkInitializer
//                            .getTelephonyServiceManager()
//                            .getPackageManagerServiceRegisterer()
//                            .get()).
//                    isOnlyCoreApps();
//        } catch (RemoteException e) {
//        }
+7 −3
Original line number Diff line number Diff line
@@ -29,11 +29,12 @@ import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Binder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.TelephonyServiceManager.ServiceRegisterer;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.PhoneNumberUtils;
import android.telephony.Rlog;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyFrameworkInitializer;

import com.android.internal.telephony.uicc.IsimRecords;
import com.android.internal.telephony.uicc.UiccCard;
@@ -49,8 +50,11 @@ public class PhoneSubInfoController extends IPhoneSubInfo.Stub {
    private final AppOpsManager mAppOps;

    public PhoneSubInfoController(Context context) {
        if (ServiceManager.getService("iphonesubinfo") == null) {
            ServiceManager.addService("iphonesubinfo", this);
        ServiceRegisterer phoneSubServiceRegisterer = TelephonyFrameworkInitializer
                .getTelephonyServiceManager()
                .getPhoneSubServiceRegisterer();
        if (phoneSubServiceRegisterer.get() == null) {
            phoneSubServiceRegisterer.register(this);
        }
        mContext = context;
        mAppOps = (AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE);
+7 −3
Original line number Diff line number Diff line
@@ -30,13 +30,14 @@ import android.net.Uri;
import android.os.BaseBundle;
import android.os.Binder;
import android.os.Bundle;
import android.os.ServiceManager;
import android.os.TelephonyServiceManager.ServiceRegisterer;
import android.provider.Telephony.Sms.Intents;
import android.telephony.CarrierConfigManager;
import android.telephony.Rlog;
import android.telephony.SmsManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyFrameworkInitializer;
import android.telephony.TelephonyManager;

import com.android.internal.util.IndentingPrintWriter;
@@ -56,8 +57,11 @@ public class SmsController extends ISmsImplBase {

    protected SmsController(Context context) {
        mContext = context;
        if (ServiceManager.getService("isms") == null) {
            ServiceManager.addService("isms", this);
        ServiceRegisterer smsServiceRegisterer = TelephonyFrameworkInitializer
                .getTelephonyServiceManager()
                .getSmsServiceRegisterer();
        if (smsServiceRegisterer.get() == null) {
            smsServiceRegisterer.register(this);
        }
    }

Loading