summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--telephony/java/android/telephony/ims/feature/ImsFeature.java45
-rw-r--r--telephony/java/android/telephony/ims/stub/ImsConfigImplBase.java96
-rw-r--r--telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java152
3 files changed, 167 insertions, 126 deletions
diff --git a/telephony/java/android/telephony/ims/feature/ImsFeature.java b/telephony/java/android/telephony/ims/feature/ImsFeature.java
index b56aa9687aee..f5b158fedd37 100644
--- a/telephony/java/android/telephony/ims/feature/ImsFeature.java
+++ b/telephony/java/android/telephony/ims/feature/ImsFeature.java
@@ -375,12 +375,16 @@ public abstract class ImsFeature {
*/
@SystemApi
public final void setFeatureState(@ImsState int state) {
+ boolean isNotify = false;
synchronized (mLock) {
if (mState != state) {
mState = state;
- notifyFeatureState(state);
+ isNotify = true;
}
}
+ if (isNotify) {
+ notifyFeatureState(state);
+ }
}
/**
@@ -412,14 +416,16 @@ public abstract class ImsFeature {
* Internal method called by ImsFeature when setFeatureState has changed.
*/
private void notifyFeatureState(@ImsState int state) {
- mStatusCallbacks.broadcastAction((c) -> {
- try {
- c.notifyImsFeatureStatus(state);
- } catch (RemoteException e) {
- Log.w(LOG_TAG, e + " notifyFeatureState() - Skipping "
- + "callback.");
- }
- });
+ synchronized (mStatusCallbacks) {
+ mStatusCallbacks.broadcastAction((c) -> {
+ try {
+ c.notifyImsFeatureStatus(state);
+ } catch (RemoteException e) {
+ Log.w(LOG_TAG, e + " notifyFeatureState() - Skipping "
+ + "callback.");
+ }
+ });
+ }
}
/**
@@ -491,14 +497,19 @@ public abstract class ImsFeature {
synchronized (mLock) {
mCapabilityStatus = caps.copy();
}
- mCapabilityCallbacks.broadcastAction((callback) -> {
- try {
- callback.onCapabilitiesStatusChanged(caps.mCapabilities);
- } catch (RemoteException e) {
- Log.w(LOG_TAG, e + " notifyCapabilitiesStatusChanged() - Skipping "
- + "callback.");
- }
- });
+
+ synchronized (mCapabilityCallbacks) {
+ mCapabilityCallbacks.broadcastAction((callback) -> {
+ try {
+ Log.d(LOG_TAG, "ImsFeature notifyCapabilitiesStatusChanged Capabilities = "
+ + caps.mCapabilities);
+ callback.onCapabilitiesStatusChanged(caps.mCapabilities);
+ } catch (RemoteException e) {
+ Log.w(LOG_TAG, e + " notifyCapabilitiesStatusChanged() - Skipping "
+ + "callback.");
+ }
+ });
+ }
}
/**
diff --git a/telephony/java/android/telephony/ims/stub/ImsConfigImplBase.java b/telephony/java/android/telephony/ims/stub/ImsConfigImplBase.java
index 11fc328a42c7..f371ec3a28a7 100644
--- a/telephony/java/android/telephony/ims/stub/ImsConfigImplBase.java
+++ b/telephony/java/android/telephony/ims/stub/ImsConfigImplBase.java
@@ -587,13 +587,15 @@ public class ImsConfigImplBase {
if (mCallbacks == null) {
return;
}
- mCallbacks.broadcastAction(c -> {
- try {
- c.onIntConfigChanged(item, value);
- } catch (RemoteException e) {
- Log.w(TAG, "notifyConfigChanged(int): dead binder in notify, skipping.");
- }
- });
+ synchronized (mCallbacks) {
+ mCallbacks.broadcastAction(c -> {
+ try {
+ c.onIntConfigChanged(item, value);
+ } catch (RemoteException e) {
+ Log.w(TAG, "notifyConfigChanged(int): dead binder in notify, skipping.");
+ }
+ });
+ }
}
private void notifyConfigChanged(int item, String value) {
@@ -601,13 +603,15 @@ public class ImsConfigImplBase {
if (mCallbacks == null) {
return;
}
- mCallbacks.broadcastAction(c -> {
- try {
- c.onStringConfigChanged(item, value);
- } catch (RemoteException e) {
- Log.w(TAG, "notifyConfigChanged(string): dead binder in notify, skipping.");
- }
- });
+ synchronized (mCallbacks) {
+ mCallbacks.broadcastAction(c -> {
+ try {
+ c.onStringConfigChanged(item, value);
+ } catch (RemoteException e) {
+ Log.w(TAG, "notifyConfigChanged(string): dead binder in notify, skipping.");
+ }
+ });
+ }
}
private void addRcsConfigCallback(IRcsConfigCallback c) {
@@ -635,13 +639,15 @@ public class ImsConfigImplBase {
// can be null in testing
if (mRcsCallbacks != null) {
- mRcsCallbacks.broadcastAction(c -> {
- try {
- c.onConfigurationChanged(mRcsConfigData);
- } catch (RemoteException e) {
- Log.w(TAG, "dead binder in notifyRcsAutoConfigurationReceived, skipping.");
- }
- });
+ synchronized (mRcsCallbacks) {
+ mRcsCallbacks.broadcastAction(c -> {
+ try {
+ c.onConfigurationChanged(mRcsConfigData);
+ } catch (RemoteException e) {
+ Log.w(TAG, "dead binder in notifyRcsAutoConfigurationReceived, skipping.");
+ }
+ });
+ }
}
notifyRcsAutoConfigurationReceived(config, isCompressed);
}
@@ -649,13 +655,15 @@ public class ImsConfigImplBase {
private void onNotifyRcsAutoConfigurationRemoved() {
mRcsConfigData = null;
if (mRcsCallbacks != null) {
- mRcsCallbacks.broadcastAction(c -> {
- try {
- c.onConfigurationReset();
- } catch (RemoteException e) {
- Log.w(TAG, "dead binder in notifyRcsAutoConfigurationRemoved, skipping.");
- }
- });
+ synchronized (mRcsCallbacks) {
+ mRcsCallbacks.broadcastAction(c -> {
+ try {
+ c.onConfigurationReset();
+ } catch (RemoteException e) {
+ Log.w(TAG, "dead binder in notifyRcsAutoConfigurationRemoved, skipping.");
+ }
+ });
+ }
}
notifyRcsAutoConfigurationRemoved();
}
@@ -801,13 +809,15 @@ public class ImsConfigImplBase {
if (mRcsCallbacks == null) {
return;
}
- mRcsCallbacks.broadcastAction(c -> {
- try {
- c.onAutoConfigurationErrorReceived(errorCode, errorString);
- } catch (RemoteException e) {
- Log.w(TAG, "dead binder in notifyAutoConfigurationErrorReceived, skipping.");
- }
- });
+ synchronized (mRcsCallbacks) {
+ mRcsCallbacks.broadcastAction(c -> {
+ try {
+ c.onAutoConfigurationErrorReceived(errorCode, errorString);
+ } catch (RemoteException e) {
+ Log.w(TAG, "dead binder in notifyAutoConfigurationErrorReceived, skipping.");
+ }
+ });
+ }
}
/**
@@ -825,13 +835,15 @@ public class ImsConfigImplBase {
if (mRcsCallbacks == null) {
return;
}
- mRcsCallbacks.broadcastAction(c -> {
- try {
- c.onPreProvisioningReceived(configXml);
- } catch (RemoteException e) {
- Log.w(TAG, "dead binder in notifyPreProvisioningReceived, skipping.");
- }
- });
+ synchronized (mRcsCallbacks) {
+ mRcsCallbacks.broadcastAction(c -> {
+ try {
+ c.onPreProvisioningReceived(configXml);
+ } catch (RemoteException e) {
+ Log.w(TAG, "dead binder in notifyPreProvisioningReceived, skipping.");
+ }
+ });
+ }
}
/**
diff --git a/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java b/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java
index 2783e299236b..fb997d118419 100644
--- a/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java
+++ b/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java
@@ -219,22 +219,25 @@ public class ImsSmsImplBase {
*/
public final void onSmsReceived(int token, @SmsMessage.Format String format, byte[] pdu)
throws RuntimeException {
+ IImsSmsListener listener = null;
synchronized (mLock) {
- if (mListener == null) {
- throw new RuntimeException("Feature not ready.");
- }
- try {
- mListener.onSmsReceived(token, format, pdu);
- } catch (RemoteException e) {
- Log.e(LOG_TAG, "Can not deliver sms: " + e.getMessage());
- SmsMessage message = SmsMessage.createFromPdu(pdu, format);
- if (message != null && message.mWrappedSmsMessage != null) {
- acknowledgeSms(token, message.mWrappedSmsMessage.mMessageRef,
- DELIVER_STATUS_ERROR_GENERIC);
- } else {
- Log.w(LOG_TAG, "onSmsReceived: Invalid pdu entered.");
- acknowledgeSms(token, 0, DELIVER_STATUS_ERROR_GENERIC);
- }
+ listener = mListener;
+ }
+
+ if (listener == null) {
+ throw new RuntimeException("Feature not ready.");
+ }
+ try {
+ listener.onSmsReceived(token, format, pdu);
+ } catch (RemoteException e) {
+ Log.e(LOG_TAG, "Can not deliver sms: " + e.getMessage());
+ SmsMessage message = SmsMessage.createFromPdu(pdu, format);
+ if (message != null && message.mWrappedSmsMessage != null) {
+ acknowledgeSms(token, message.mWrappedSmsMessage.mMessageRef,
+ DELIVER_STATUS_ERROR_GENERIC);
+ } else {
+ Log.w(LOG_TAG, "onSmsReceived: Invalid pdu entered.");
+ acknowledgeSms(token, 0, DELIVER_STATUS_ERROR_GENERIC);
}
}
}
@@ -254,16 +257,19 @@ public class ImsSmsImplBase {
*/
public final void onSendSmsResultSuccess(int token,
@IntRange(from = 0, to = 65535) int messageRef) throws RuntimeException {
+ IImsSmsListener listener = null;
synchronized (mLock) {
- if (mListener == null) {
- throw new RuntimeException("Feature not ready.");
- }
- try {
- mListener.onSendSmsResult(token, messageRef, SEND_STATUS_OK,
- SmsManager.RESULT_ERROR_NONE, RESULT_NO_NETWORK_ERROR);
- } catch (RemoteException e) {
- e.rethrowFromSystemServer();
- }
+ listener = mListener;
+ }
+
+ if (listener == null) {
+ throw new RuntimeException("Feature not ready.");
+ }
+ try {
+ listener.onSendSmsResult(token, messageRef, SEND_STATUS_OK,
+ SmsManager.RESULT_ERROR_NONE, RESULT_NO_NETWORK_ERROR);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
}
}
@@ -288,16 +294,19 @@ public class ImsSmsImplBase {
@Deprecated
public final void onSendSmsResult(int token, @IntRange(from = 0, to = 65535) int messageRef,
@SendStatusResult int status, @SmsManager.Result int reason) throws RuntimeException {
+ IImsSmsListener listener = null;
synchronized (mLock) {
- if (mListener == null) {
- throw new RuntimeException("Feature not ready.");
- }
- try {
- mListener.onSendSmsResult(token, messageRef, status, reason,
- RESULT_NO_NETWORK_ERROR);
- } catch (RemoteException e) {
- e.rethrowFromSystemServer();
- }
+ listener = mListener;
+ }
+
+ if (listener == null) {
+ throw new RuntimeException("Feature not ready.");
+ }
+ try {
+ listener.onSendSmsResult(token, messageRef, status, reason,
+ RESULT_NO_NETWORK_ERROR);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
}
}
@@ -322,15 +331,18 @@ public class ImsSmsImplBase {
public final void onSendSmsResultError(int token,
@IntRange(from = 0, to = 65535) int messageRef, @SendStatusResult int status,
@SmsManager.Result int reason, int networkErrorCode) throws RuntimeException {
+ IImsSmsListener listener = null;
synchronized (mLock) {
- if (mListener == null) {
- throw new RuntimeException("Feature not ready.");
- }
- try {
- mListener.onSendSmsResult(token, messageRef, status, reason, networkErrorCode);
- } catch (RemoteException e) {
- e.rethrowFromSystemServer();
- }
+ listener = mListener;
+ }
+
+ if (listener == null) {
+ throw new RuntimeException("Feature not ready.");
+ }
+ try {
+ listener.onSendSmsResult(token, messageRef, status, reason, networkErrorCode);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
}
}
@@ -357,16 +369,19 @@ public class ImsSmsImplBase {
public final void onSmsStatusReportReceived(int token,
@IntRange(from = 0, to = 65535) int messageRef, @SmsMessage.Format String format,
byte[] pdu) throws RuntimeException {
+ IImsSmsListener listener = null;
synchronized (mLock) {
- if (mListener == null) {
- throw new RuntimeException("Feature not ready.");
- }
- try {
- mListener.onSmsStatusReportReceived(token, format, pdu);
- } catch (RemoteException e) {
- Log.e(LOG_TAG, "Can not process sms status report: " + e.getMessage());
- acknowledgeSmsReport(token, messageRef, STATUS_REPORT_STATUS_ERROR);
- }
+ listener = mListener;
+ }
+
+ if (listener == null) {
+ throw new RuntimeException("Feature not ready.");
+ }
+ try {
+ listener.onSmsStatusReportReceived(token, format, pdu);
+ } catch (RemoteException e) {
+ Log.e(LOG_TAG, "Can not process sms status report: " + e.getMessage());
+ acknowledgeSmsReport(token, messageRef, STATUS_REPORT_STATUS_ERROR);
}
}
@@ -386,24 +401,27 @@ public class ImsSmsImplBase {
*/
public final void onSmsStatusReportReceived(int token, @SmsMessage.Format String format,
byte[] pdu) throws RuntimeException {
+ IImsSmsListener listener = null;
synchronized (mLock) {
- if (mListener == null) {
- throw new RuntimeException("Feature not ready.");
- }
- try {
- mListener.onSmsStatusReportReceived(token, format, pdu);
- } catch (RemoteException e) {
- Log.e(LOG_TAG, "Can not process sms status report: " + e.getMessage());
- SmsMessage message = SmsMessage.createFromPdu(pdu, format);
- if (message != null && message.mWrappedSmsMessage != null) {
- acknowledgeSmsReport(
- token,
- message.mWrappedSmsMessage.mMessageRef,
- STATUS_REPORT_STATUS_ERROR);
- } else {
- Log.w(LOG_TAG, "onSmsStatusReportReceived: Invalid pdu entered.");
- acknowledgeSmsReport(token, 0, STATUS_REPORT_STATUS_ERROR);
- }
+ listener = mListener;
+ }
+
+ if (listener == null) {
+ throw new RuntimeException("Feature not ready.");
+ }
+ try {
+ listener.onSmsStatusReportReceived(token, format, pdu);
+ } catch (RemoteException e) {
+ Log.e(LOG_TAG, "Can not process sms status report: " + e.getMessage());
+ SmsMessage message = SmsMessage.createFromPdu(pdu, format);
+ if (message != null && message.mWrappedSmsMessage != null) {
+ acknowledgeSmsReport(
+ token,
+ message.mWrappedSmsMessage.mMessageRef,
+ STATUS_REPORT_STATUS_ERROR);
+ } else {
+ Log.w(LOG_TAG, "onSmsStatusReportReceived: Invalid pdu entered.");
+ acknowledgeSmsReport(token, 0, STATUS_REPORT_STATUS_ERROR);
}
}
}