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

Commit e05afb03 authored by Jonathan Basseri's avatar Jonathan Basseri
Browse files

Convert ICarrierService to oneway.

Change the carrier config AIDL used by CarrierService to a oneway call.
This is the IPC used to fetch carrier config bundles from carrier apps.
Converting to oneway allows CarrierConfigLoader to be non-blocking while
it fetches config.

Bug: 63176442
Test: runtest carrierconfig-unit & manual
(cherry picked from commit 49b54d64)
Merged-in: Iceaf0446321f719011f67897398da7d5998c5fc7
Change-Id: I436f6c920f68f8bbc0fd66a5ff10676ed1529383
parent db122f90
Loading
Loading
Loading
Loading
+23 −3
Original line number Diff line number Diff line
@@ -17,10 +17,13 @@ package android.service.carrier;
import android.annotation.CallSuper;
import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.os.PersistableBundle;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ServiceManager;
import android.util.Log;

import com.android.internal.telephony.ITelephonyRegistry;

@@ -48,6 +51,8 @@ import com.android.internal.telephony.ITelephonyRegistry;
 */
public abstract class CarrierService extends Service {

    private static final String LOG_TAG = "CarrierService";

    public static final String CARRIER_SERVICE_INTERFACE = "android.service.carrier.CarrierService";

    private static ITelephonyRegistry sRegistry;
@@ -133,11 +138,26 @@ public abstract class CarrierService extends Service {
    /**
     * A wrapper around ICarrierService that forwards calls to implementations of
     * {@link CarrierService}.
     * @hide
     */
    private class ICarrierServiceWrapper extends ICarrierService.Stub {
    public class ICarrierServiceWrapper extends ICarrierService.Stub {
        /** @hide */
        public static final int RESULT_OK = 0;
        /** @hide */
        public static final int RESULT_ERROR = 1;
        /** @hide */
        public static final String KEY_CONFIG_BUNDLE = "config_bundle";

        @Override
        public PersistableBundle getCarrierConfig(CarrierIdentifier id) {
            return CarrierService.this.onLoadConfig(id);
        public void getCarrierConfig(CarrierIdentifier id, ResultReceiver result) {
            try {
                Bundle data = new Bundle();
                data.putParcelable(KEY_CONFIG_BUNDLE, CarrierService.this.onLoadConfig(id));
                result.send(RESULT_OK, data);
            } catch (Exception e) {
                Log.e(LOG_TAG, "Error in onLoadConfig: " + e.getMessage(), e);
                result.send(RESULT_ERROR, null);
            }
        }
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.service.carrier;

import android.os.PersistableBundle;
import android.os.ResultReceiver;
import android.service.carrier.CarrierIdentifier;

/**
@@ -28,5 +29,5 @@ import android.service.carrier.CarrierIdentifier;
interface ICarrierService {

    /** @see android.service.carrier.CarrierService#onLoadConfig */
    PersistableBundle getCarrierConfig(in CarrierIdentifier id);
    oneway void getCarrierConfig(in CarrierIdentifier id, in ResultReceiver result);
}