Merge "Convert ICarrierService to oneway." into oc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
806af68f5d
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user