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

Commit c73a2814 authored by Tim Murray's avatar Tim Murray Committed by Collin Fijalkovich
Browse files

TelephonyManager: cache service handles

Instead of looking up service handles before every API call, cache service
handles and remove them on endpoint death.

Test: boots, works
bug 140788621

Change-Id: Ic455715f213550c7c6a180093762d5d52a10e560
parent 83e6bdd2
Loading
Loading
Loading
Loading
+4 −16
Original line number Diff line number Diff line
@@ -801,11 +801,7 @@ public final class SmsManager {
                    "Invalid pdu format. format must be either 3gpp or 3gpp2");
        }
        try {
            ISms iSms = ISms.Stub.asInterface(
                    TelephonyFrameworkInitializer
                            .getTelephonyServiceManager()
                            .getSmsServiceRegisterer()
                            .get());
            ISms iSms = TelephonyManager.getSmsService();
            if (iSms != null) {
                iSms.injectSmsPduForSubscriber(
                        getSubscriptionId(), pdu, format, receivedIntent);
@@ -1642,7 +1638,7 @@ public final class SmsManager {
     * the service does not exist.
     */
    private static ISms getISmsServiceOrThrow() {
        ISms iSms = getISmsService();
        ISms iSms = TelephonyManager.getSmsService();
        if (iSms == null) {
            throw new UnsupportedOperationException("Sms is not supported");
        }
@@ -1650,11 +1646,7 @@ public final class SmsManager {
    }

    private static ISms getISmsService() {
        return ISms.Stub.asInterface(
                TelephonyFrameworkInitializer
                        .getTelephonyServiceManager()
                        .getSmsServiceRegisterer()
                        .get());
        return TelephonyManager.getSmsService();
    }

    /**
@@ -2091,11 +2083,7 @@ public final class SmsManager {
    public boolean isSMSPromptEnabled() {
        ISms iSms = null;
        try {
            iSms = ISms.Stub.asInterface(
                    TelephonyFrameworkInitializer
                            .getTelephonyServiceManager()
                            .getSmsServiceRegisterer()
                            .get());
            iSms = TelephonyManager.getSmsService();
            return iSms.isSMSPromptEnabled();
        } catch (RemoteException ex) {
            return false;
+42 −210

File changed.

Preview size limit exceeded, changes collapsed.

+196 −33

File changed.

Preview size limit exceeded, changes collapsed.