Merge "Decouple the ImsFeature status listener from creating the feature"
This commit is contained in:
@@ -137,18 +137,30 @@ public class ImsService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IImsMmTelFeature createMmTelFeature(int slotId, IImsFeatureStatusCallback c) {
|
public IImsMmTelFeature createMmTelFeature(int slotId) {
|
||||||
return createMmTelFeatureInternal(slotId, c);
|
return createMmTelFeatureInternal(slotId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IImsRcsFeature createRcsFeature(int slotId, IImsFeatureStatusCallback c) {
|
public IImsRcsFeature createRcsFeature(int slotId) {
|
||||||
return createRcsFeatureInternal(slotId, c);
|
return createRcsFeatureInternal(slotId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeImsFeature(int slotId, int featureType, IImsFeatureStatusCallback c) {
|
public void addFeatureStatusCallback(int slotId, int featureType,
|
||||||
ImsService.this.removeImsFeature(slotId, featureType, c);
|
IImsFeatureStatusCallback c) {
|
||||||
|
ImsService.this.addImsFeatureStatusCallback(slotId, featureType, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeFeatureStatusCallback(int slotId, int featureType,
|
||||||
|
IImsFeatureStatusCallback c) {
|
||||||
|
ImsService.this.removeImsFeatureStatusCallback(slotId, featureType, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeImsFeature(int slotId, int featureType) {
|
||||||
|
ImsService.this.removeImsFeature(slotId, featureType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -204,11 +216,10 @@ public class ImsService extends Service {
|
|||||||
return mFeaturesBySlot.get(slotId);
|
return mFeaturesBySlot.get(slotId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IImsMmTelFeature createMmTelFeatureInternal(int slotId,
|
private IImsMmTelFeature createMmTelFeatureInternal(int slotId) {
|
||||||
IImsFeatureStatusCallback c) {
|
|
||||||
MmTelFeature f = createMmTelFeature(slotId);
|
MmTelFeature f = createMmTelFeature(slotId);
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
setupFeature(f, slotId, ImsFeature.FEATURE_MMTEL, c);
|
setupFeature(f, slotId, ImsFeature.FEATURE_MMTEL);
|
||||||
return f.getBinder();
|
return f.getBinder();
|
||||||
} else {
|
} else {
|
||||||
Log.e(LOG_TAG, "createMmTelFeatureInternal: null feature returned.");
|
Log.e(LOG_TAG, "createMmTelFeatureInternal: null feature returned.");
|
||||||
@@ -216,11 +227,10 @@ public class ImsService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IImsRcsFeature createRcsFeatureInternal(int slotId,
|
private IImsRcsFeature createRcsFeatureInternal(int slotId) {
|
||||||
IImsFeatureStatusCallback c) {
|
|
||||||
RcsFeature f = createRcsFeature(slotId);
|
RcsFeature f = createRcsFeature(slotId);
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
setupFeature(f, slotId, ImsFeature.FEATURE_RCS, c);
|
setupFeature(f, slotId, ImsFeature.FEATURE_RCS);
|
||||||
return f.getBinder();
|
return f.getBinder();
|
||||||
} else {
|
} else {
|
||||||
Log.e(LOG_TAG, "createRcsFeatureInternal: null feature returned.");
|
Log.e(LOG_TAG, "createRcsFeatureInternal: null feature returned.");
|
||||||
@@ -228,13 +238,45 @@ public class ImsService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupFeature(ImsFeature f, int slotId, int featureType,
|
private void setupFeature(ImsFeature f, int slotId, int featureType) {
|
||||||
IImsFeatureStatusCallback c) {
|
|
||||||
f.initialize(this, slotId);
|
f.initialize(this, slotId);
|
||||||
f.addImsFeatureStatusCallback(c);
|
|
||||||
addImsFeature(slotId, featureType, f);
|
addImsFeature(slotId, featureType, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addImsFeatureStatusCallback(int slotId, int featureType,
|
||||||
|
IImsFeatureStatusCallback c) {
|
||||||
|
synchronized (mFeaturesBySlot) {
|
||||||
|
// get ImsFeature associated with the slot/feature
|
||||||
|
SparseArray<ImsFeature> features = mFeaturesBySlot.get(slotId);
|
||||||
|
if (features == null) {
|
||||||
|
Log.w(LOG_TAG, "Can not add ImsFeatureStatusCallback - no features on slot "
|
||||||
|
+ slotId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ImsFeature f = features.get(featureType);
|
||||||
|
if (f != null) {
|
||||||
|
f.addImsFeatureStatusCallback(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeImsFeatureStatusCallback(int slotId, int featureType,
|
||||||
|
IImsFeatureStatusCallback c) {
|
||||||
|
synchronized (mFeaturesBySlot) {
|
||||||
|
// get ImsFeature associated with the slot/feature
|
||||||
|
SparseArray<ImsFeature> features = mFeaturesBySlot.get(slotId);
|
||||||
|
if (features == null) {
|
||||||
|
Log.w(LOG_TAG, "Can not remove ImsFeatureStatusCallback - no features on slot "
|
||||||
|
+ slotId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ImsFeature f = features.get(featureType);
|
||||||
|
if (f != null) {
|
||||||
|
f.removeImsFeatureStatusCallback(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addImsFeature(int slotId, int featureType, ImsFeature f) {
|
private void addImsFeature(int slotId, int featureType, ImsFeature f) {
|
||||||
synchronized (mFeaturesBySlot) {
|
synchronized (mFeaturesBySlot) {
|
||||||
// Get SparseArray for Features, by querying slot Id
|
// Get SparseArray for Features, by querying slot Id
|
||||||
@@ -248,8 +290,7 @@ public class ImsService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeImsFeature(int slotId, int featureType,
|
private void removeImsFeature(int slotId, int featureType) {
|
||||||
IImsFeatureStatusCallback c) {
|
|
||||||
synchronized (mFeaturesBySlot) {
|
synchronized (mFeaturesBySlot) {
|
||||||
// get ImsFeature associated with the slot/feature
|
// get ImsFeature associated with the slot/feature
|
||||||
SparseArray<ImsFeature> features = mFeaturesBySlot.get(slotId);
|
SparseArray<ImsFeature> features = mFeaturesBySlot.get(slotId);
|
||||||
@@ -264,7 +305,6 @@ public class ImsService extends Service {
|
|||||||
+ featureType + " exists on slot " + slotId);
|
+ featureType + " exists on slot " + slotId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
f.removeImsFeatureStatusCallback(c);
|
|
||||||
f.onFeatureRemoved();
|
f.onFeatureRemoved();
|
||||||
features.remove(featureType);
|
features.remove(featureType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,12 +31,14 @@ import com.android.ims.internal.IImsFeatureStatusCallback;
|
|||||||
*/
|
*/
|
||||||
interface IImsServiceController {
|
interface IImsServiceController {
|
||||||
void setListener(IImsServiceControllerListener l);
|
void setListener(IImsServiceControllerListener l);
|
||||||
IImsMmTelFeature createMmTelFeature(int slotId, in IImsFeatureStatusCallback c);
|
IImsMmTelFeature createMmTelFeature(int slotId);
|
||||||
IImsRcsFeature createRcsFeature(int slotId, in IImsFeatureStatusCallback c);
|
IImsRcsFeature createRcsFeature(int slotId);
|
||||||
ImsFeatureConfiguration querySupportedImsFeatures();
|
ImsFeatureConfiguration querySupportedImsFeatures();
|
||||||
|
void addFeatureStatusCallback(int slotId, int featureType, in IImsFeatureStatusCallback c);
|
||||||
|
void removeFeatureStatusCallback(int slotId, int featureType, in IImsFeatureStatusCallback c);
|
||||||
// Synchronous call to ensure the ImsService is ready before continuing with feature creation.
|
// Synchronous call to ensure the ImsService is ready before continuing with feature creation.
|
||||||
void notifyImsServiceReadyForFeatureCreation();
|
void notifyImsServiceReadyForFeatureCreation();
|
||||||
void removeImsFeature(int slotId, int featureType, in IImsFeatureStatusCallback c);
|
void removeImsFeature(int slotId, int featureType);
|
||||||
IImsConfig getConfig(int slotId);
|
IImsConfig getConfig(int slotId);
|
||||||
IImsRegistration getRegistration(int slotId);
|
IImsRegistration getRegistration(int slotId);
|
||||||
oneway void enableIms(int slotId);
|
oneway void enableIms(int slotId);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import android.app.Service;
|
|||||||
import android.compat.annotation.UnsupportedAppUsage;
|
import android.compat.annotation.UnsupportedAppUsage;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.RemoteException;
|
|
||||||
import android.telephony.CarrierConfigManager;
|
import android.telephony.CarrierConfigManager;
|
||||||
import android.telephony.ims.compat.feature.ImsFeature;
|
import android.telephony.ims.compat.feature.ImsFeature;
|
||||||
import android.telephony.ims.compat.feature.MMTelFeature;
|
import android.telephony.ims.compat.feature.MMTelFeature;
|
||||||
@@ -91,25 +90,35 @@ public class ImsService extends Service {
|
|||||||
protected final IBinder mImsServiceController = new IImsServiceController.Stub() {
|
protected final IBinder mImsServiceController = new IImsServiceController.Stub() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IImsMMTelFeature createEmergencyMMTelFeature(int slotId,
|
public IImsMMTelFeature createEmergencyMMTelFeature(int slotId) {
|
||||||
|
return createEmergencyMMTelFeatureInternal(slotId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IImsMMTelFeature createMMTelFeature(int slotId) {
|
||||||
|
return createMMTelFeatureInternal(slotId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IImsRcsFeature createRcsFeature(int slotId) {
|
||||||
|
return createRcsFeatureInternal(slotId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeImsFeature(int slotId, int featureType) {
|
||||||
|
ImsService.this.removeImsFeature(slotId, featureType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addFeatureStatusCallback(int slotId, int featureType,
|
||||||
IImsFeatureStatusCallback c) {
|
IImsFeatureStatusCallback c) {
|
||||||
return createEmergencyMMTelFeatureInternal(slotId, c);
|
addImsFeatureStatusCallback(slotId, featureType, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IImsMMTelFeature createMMTelFeature(int slotId, IImsFeatureStatusCallback c) {
|
public void removeFeatureStatusCallback(int slotId, int featureType,
|
||||||
return createMMTelFeatureInternal(slotId, c);
|
IImsFeatureStatusCallback c) {
|
||||||
}
|
removeImsFeatureStatusCallback(slotId, featureType, c);
|
||||||
|
|
||||||
@Override
|
|
||||||
public IImsRcsFeature createRcsFeature(int slotId, IImsFeatureStatusCallback c) {
|
|
||||||
return createRcsFeatureInternal(slotId, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeImsFeature(int slotId, int featureType, IImsFeatureStatusCallback c)
|
|
||||||
throws RemoteException {
|
|
||||||
ImsService.this.removeImsFeature(slotId, featureType, c);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -137,46 +146,40 @@ public class ImsService extends Service {
|
|||||||
return mFeaturesBySlot.get(slotId);
|
return mFeaturesBySlot.get(slotId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IImsMMTelFeature createEmergencyMMTelFeatureInternal(int slotId,
|
private IImsMMTelFeature createEmergencyMMTelFeatureInternal(int slotId) {
|
||||||
IImsFeatureStatusCallback c) {
|
|
||||||
MMTelFeature f = onCreateEmergencyMMTelImsFeature(slotId);
|
MMTelFeature f = onCreateEmergencyMMTelImsFeature(slotId);
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
setupFeature(f, slotId, ImsFeature.EMERGENCY_MMTEL, c);
|
setupFeature(f, slotId, ImsFeature.EMERGENCY_MMTEL);
|
||||||
return f.getBinder();
|
return f.getBinder();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IImsMMTelFeature createMMTelFeatureInternal(int slotId,
|
private IImsMMTelFeature createMMTelFeatureInternal(int slotId) {
|
||||||
IImsFeatureStatusCallback c) {
|
|
||||||
MMTelFeature f = onCreateMMTelImsFeature(slotId);
|
MMTelFeature f = onCreateMMTelImsFeature(slotId);
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
setupFeature(f, slotId, ImsFeature.MMTEL, c);
|
setupFeature(f, slotId, ImsFeature.MMTEL);
|
||||||
return f.getBinder();
|
return f.getBinder();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IImsRcsFeature createRcsFeatureInternal(int slotId,
|
private IImsRcsFeature createRcsFeatureInternal(int slotId) {
|
||||||
IImsFeatureStatusCallback c) {
|
|
||||||
RcsFeature f = onCreateRcsFeature(slotId);
|
RcsFeature f = onCreateRcsFeature(slotId);
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
setupFeature(f, slotId, ImsFeature.RCS, c);
|
setupFeature(f, slotId, ImsFeature.RCS);
|
||||||
return f.getBinder();
|
return f.getBinder();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupFeature(ImsFeature f, int slotId, int featureType,
|
private void setupFeature(ImsFeature f, int slotId, int featureType) {
|
||||||
IImsFeatureStatusCallback c) {
|
|
||||||
f.setContext(this);
|
f.setContext(this);
|
||||||
f.setSlotId(slotId);
|
f.setSlotId(slotId);
|
||||||
f.addImsFeatureStatusCallback(c);
|
|
||||||
addImsFeature(slotId, featureType, f);
|
addImsFeature(slotId, featureType, f);
|
||||||
// TODO: Remove once new onFeatureReady AIDL is merged in.
|
|
||||||
f.onFeatureReady();
|
f.onFeatureReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,8 +196,41 @@ public class ImsService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeImsFeature(int slotId, int featureType,
|
private void addImsFeatureStatusCallback(int slotId, int featureType,
|
||||||
IImsFeatureStatusCallback c) {
|
IImsFeatureStatusCallback c) {
|
||||||
|
synchronized (mFeaturesBySlot) {
|
||||||
|
// get ImsFeature associated with the slot/feature
|
||||||
|
SparseArray<ImsFeature> features = mFeaturesBySlot.get(slotId);
|
||||||
|
if (features == null) {
|
||||||
|
Log.w(LOG_TAG, "Can not add ImsFeatureStatusCallback. No ImsFeatures exist on"
|
||||||
|
+ " slot " + slotId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ImsFeature f = features.get(featureType);
|
||||||
|
if (f != null) {
|
||||||
|
f.addImsFeatureStatusCallback(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeImsFeatureStatusCallback(int slotId, int featureType,
|
||||||
|
IImsFeatureStatusCallback c) {
|
||||||
|
synchronized (mFeaturesBySlot) {
|
||||||
|
// get ImsFeature associated with the slot/feature
|
||||||
|
SparseArray<ImsFeature> features = mFeaturesBySlot.get(slotId);
|
||||||
|
if (features == null) {
|
||||||
|
Log.w(LOG_TAG, "Can not remove ImsFeatureStatusCallback. No ImsFeatures exist on"
|
||||||
|
+ " slot " + slotId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ImsFeature f = features.get(featureType);
|
||||||
|
if (f != null) {
|
||||||
|
f.removeImsFeatureStatusCallback(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeImsFeature(int slotId, int featureType) {
|
||||||
synchronized (mFeaturesBySlot) {
|
synchronized (mFeaturesBySlot) {
|
||||||
// get ImsFeature associated with the slot/feature
|
// get ImsFeature associated with the slot/feature
|
||||||
SparseArray<ImsFeature> features = mFeaturesBySlot.get(slotId);
|
SparseArray<ImsFeature> features = mFeaturesBySlot.get(slotId);
|
||||||
@@ -209,7 +245,6 @@ public class ImsService extends Service {
|
|||||||
+ featureType + " exists on slot " + slotId);
|
+ featureType + " exists on slot " + slotId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
f.removeImsFeatureStatusCallback(c);
|
|
||||||
f.onFeatureRemoved();
|
f.onFeatureRemoved();
|
||||||
features.remove(featureType);
|
features.remove(featureType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,10 @@ import com.android.ims.internal.IImsRcsFeature;
|
|||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
interface IImsServiceController {
|
interface IImsServiceController {
|
||||||
IImsMMTelFeature createEmergencyMMTelFeature(int slotId, in IImsFeatureStatusCallback c);
|
IImsMMTelFeature createEmergencyMMTelFeature(int slotId);
|
||||||
IImsMMTelFeature createMMTelFeature(int slotId, in IImsFeatureStatusCallback c);
|
IImsMMTelFeature createMMTelFeature(int slotId);
|
||||||
IImsRcsFeature createRcsFeature(int slotId, in IImsFeatureStatusCallback c);
|
IImsRcsFeature createRcsFeature(int slotId);
|
||||||
void removeImsFeature(int slotId, int featureType, in IImsFeatureStatusCallback c);
|
void removeImsFeature(int slotId, int featureType);
|
||||||
|
void addFeatureStatusCallback(int slotId, int featureType, in IImsFeatureStatusCallback c);
|
||||||
|
void removeFeatureStatusCallback(int slotId, int featureType, in IImsFeatureStatusCallback c);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user