Loading telephony/java/android/telephony/ims/ImsService.java +21 −1 Original line number Diff line number Diff line Loading @@ -502,6 +502,9 @@ public class ImsService extends Service { } private void removeImsFeature(int slotId, int featureType) { // clear cached data notifySubscriptionRemoved(slotId); synchronized (mFeaturesBySlot) { // get ImsFeature associated with the slot/feature SparseArray<ImsFeature> features = mFeaturesBySlot.get(slotId); Loading @@ -519,7 +522,6 @@ public class ImsService extends Service { f.onFeatureRemoved(); features.remove(featureType); } } /** Loading Loading @@ -692,6 +694,24 @@ public class ImsService extends Service { disableIms(slotId); } /** * The subscription has removed. The ImsService should notify ImsRegistrationImplBase and * ImsConfigImplBase the SIM state was changed. * @param slotId The slot ID which has removed. */ private void notifySubscriptionRemoved(int slotId) { ImsRegistrationImplBase registrationImplBase = getRegistration(slotId); if (registrationImplBase != null) { registrationImplBase.clearRegistrationCache(); } ImsConfigImplBase imsConfigImplBase = getConfig(slotId); if (imsConfigImplBase != null) { imsConfigImplBase.clearConfigurationCache(); } } /** * The framework has enabled IMS for the slot specified, the ImsService should register for IMS * and perform all appropriate initialization to bring up all ImsFeatures. Loading telephony/java/android/telephony/ims/stub/ImsConfigImplBase.java +51 −11 Original line number Diff line number Diff line Loading @@ -481,6 +481,17 @@ public class ImsConfigImplBase { } } /** * Clear cached configuration value. */ public void clearCachedValue() { Log.i(TAG, "clearCachedValue"); synchronized (mLock) { mProvisionedIntValue.clear(); mProvisionedStringValue.clear(); } } // Call the methods with a clean calling identity on the executor and wait indefinitely for // the future to return. private void executeMethodAsync(Runnable r, String errorLogName) throws RemoteException { Loading Loading @@ -538,6 +549,7 @@ public class ImsConfigImplBase { private final RemoteCallbackListExt<IRcsConfigCallback> mRcsCallbacks = new RemoteCallbackListExt<>(); private byte[] mRcsConfigData; private final Object mRcsConfigDataLock = new Object(); ImsConfigStub mImsConfigStub; /** Loading Loading @@ -616,14 +628,22 @@ public class ImsConfigImplBase { private void addRcsConfigCallback(IRcsConfigCallback c) { mRcsCallbacks.register(c); if (mRcsConfigData != null) { // This is used to avoid calling the binder out of the synchronized scope. byte[] cloneRcsConfigData; synchronized (mRcsConfigDataLock) { if (mRcsConfigData == null) { return; } cloneRcsConfigData = mRcsConfigData.clone(); } try { c.onConfigurationChanged(mRcsConfigData); c.onConfigurationChanged(cloneRcsConfigData); } catch (RemoteException e) { Log.w(TAG, "dead binder to call onConfigurationChanged, skipping."); } } } private void removeRcsConfigCallback(IRcsConfigCallback c) { mRcsCallbacks.unregister(c); Loading @@ -631,18 +651,23 @@ public class ImsConfigImplBase { private void onNotifyRcsAutoConfigurationReceived(byte[] config, boolean isCompressed) { // cache uncompressed config config = isCompressed ? RcsConfig.decompressGzip(config) : config; final byte[] rcsConfigData = isCompressed ? RcsConfig.decompressGzip(config) : config; synchronized (mRcsConfigDataLock) { if (Arrays.equals(mRcsConfigData, config)) { return; } mRcsConfigData = config; mRcsConfigData = rcsConfigData; } // can be null in testing if (mRcsCallbacks != null) { synchronized (mRcsCallbacks) { mRcsCallbacks.broadcastAction(c -> { try { c.onConfigurationChanged(mRcsConfigData); // config is cloned here so modifications to the config passed to the // vendor do not accidentally modify the cache. c.onConfigurationChanged(rcsConfigData.clone()); } catch (RemoteException e) { Log.w(TAG, "dead binder in notifyRcsAutoConfigurationReceived, skipping."); } Loading @@ -653,7 +678,9 @@ public class ImsConfigImplBase { } private void onNotifyRcsAutoConfigurationRemoved() { synchronized (mRcsConfigDataLock) { mRcsConfigData = null; } if (mRcsCallbacks != null) { synchronized (mRcsCallbacks) { mRcsCallbacks.broadcastAction(c -> { Loading Loading @@ -857,4 +884,17 @@ public class ImsConfigImplBase { mImsConfigStub.mExecutor = executor; } } /** * Clear all cached config data. This will be called when the config data is no longer valid * such as when the SIM was removed. * @hide */ public final void clearConfigurationCache() { mImsConfigStub.clearCachedValue(); synchronized (mRcsConfigDataLock) { mRcsConfigData = null; } } } Loading
telephony/java/android/telephony/ims/ImsService.java +21 −1 Original line number Diff line number Diff line Loading @@ -502,6 +502,9 @@ public class ImsService extends Service { } private void removeImsFeature(int slotId, int featureType) { // clear cached data notifySubscriptionRemoved(slotId); synchronized (mFeaturesBySlot) { // get ImsFeature associated with the slot/feature SparseArray<ImsFeature> features = mFeaturesBySlot.get(slotId); Loading @@ -519,7 +522,6 @@ public class ImsService extends Service { f.onFeatureRemoved(); features.remove(featureType); } } /** Loading Loading @@ -692,6 +694,24 @@ public class ImsService extends Service { disableIms(slotId); } /** * The subscription has removed. The ImsService should notify ImsRegistrationImplBase and * ImsConfigImplBase the SIM state was changed. * @param slotId The slot ID which has removed. */ private void notifySubscriptionRemoved(int slotId) { ImsRegistrationImplBase registrationImplBase = getRegistration(slotId); if (registrationImplBase != null) { registrationImplBase.clearRegistrationCache(); } ImsConfigImplBase imsConfigImplBase = getConfig(slotId); if (imsConfigImplBase != null) { imsConfigImplBase.clearConfigurationCache(); } } /** * The framework has enabled IMS for the slot specified, the ImsService should register for IMS * and perform all appropriate initialization to bring up all ImsFeatures. Loading
telephony/java/android/telephony/ims/stub/ImsConfigImplBase.java +51 −11 Original line number Diff line number Diff line Loading @@ -481,6 +481,17 @@ public class ImsConfigImplBase { } } /** * Clear cached configuration value. */ public void clearCachedValue() { Log.i(TAG, "clearCachedValue"); synchronized (mLock) { mProvisionedIntValue.clear(); mProvisionedStringValue.clear(); } } // Call the methods with a clean calling identity on the executor and wait indefinitely for // the future to return. private void executeMethodAsync(Runnable r, String errorLogName) throws RemoteException { Loading Loading @@ -538,6 +549,7 @@ public class ImsConfigImplBase { private final RemoteCallbackListExt<IRcsConfigCallback> mRcsCallbacks = new RemoteCallbackListExt<>(); private byte[] mRcsConfigData; private final Object mRcsConfigDataLock = new Object(); ImsConfigStub mImsConfigStub; /** Loading Loading @@ -616,14 +628,22 @@ public class ImsConfigImplBase { private void addRcsConfigCallback(IRcsConfigCallback c) { mRcsCallbacks.register(c); if (mRcsConfigData != null) { // This is used to avoid calling the binder out of the synchronized scope. byte[] cloneRcsConfigData; synchronized (mRcsConfigDataLock) { if (mRcsConfigData == null) { return; } cloneRcsConfigData = mRcsConfigData.clone(); } try { c.onConfigurationChanged(mRcsConfigData); c.onConfigurationChanged(cloneRcsConfigData); } catch (RemoteException e) { Log.w(TAG, "dead binder to call onConfigurationChanged, skipping."); } } } private void removeRcsConfigCallback(IRcsConfigCallback c) { mRcsCallbacks.unregister(c); Loading @@ -631,18 +651,23 @@ public class ImsConfigImplBase { private void onNotifyRcsAutoConfigurationReceived(byte[] config, boolean isCompressed) { // cache uncompressed config config = isCompressed ? RcsConfig.decompressGzip(config) : config; final byte[] rcsConfigData = isCompressed ? RcsConfig.decompressGzip(config) : config; synchronized (mRcsConfigDataLock) { if (Arrays.equals(mRcsConfigData, config)) { return; } mRcsConfigData = config; mRcsConfigData = rcsConfigData; } // can be null in testing if (mRcsCallbacks != null) { synchronized (mRcsCallbacks) { mRcsCallbacks.broadcastAction(c -> { try { c.onConfigurationChanged(mRcsConfigData); // config is cloned here so modifications to the config passed to the // vendor do not accidentally modify the cache. c.onConfigurationChanged(rcsConfigData.clone()); } catch (RemoteException e) { Log.w(TAG, "dead binder in notifyRcsAutoConfigurationReceived, skipping."); } Loading @@ -653,7 +678,9 @@ public class ImsConfigImplBase { } private void onNotifyRcsAutoConfigurationRemoved() { synchronized (mRcsConfigDataLock) { mRcsConfigData = null; } if (mRcsCallbacks != null) { synchronized (mRcsCallbacks) { mRcsCallbacks.broadcastAction(c -> { Loading Loading @@ -857,4 +884,17 @@ public class ImsConfigImplBase { mImsConfigStub.mExecutor = executor; } } /** * Clear all cached config data. This will be called when the config data is no longer valid * such as when the SIM was removed. * @hide */ public final void clearConfigurationCache() { mImsConfigStub.clearCachedValue(); synchronized (mRcsConfigDataLock) { mRcsConfigData = null; } } }