|
25 | 25 | #include <android-base/logging.h> |
26 | 26 | #include <android/binder_manager.h> |
27 | 27 | #include <android/binder_process.h> |
| 28 | + |
| 29 | +#pragma clang diagnostic push |
| 30 | +#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
28 | 31 | #include <android/hardware/radio/1.6/IRadio.h> |
29 | 32 | #include <android/hardware/radio/1.6/IRadioIndication.h> |
30 | 33 | #include <android/hardware/radio/1.6/IRadioResponse.h> |
31 | 34 | #include <android/hardware/radio/1.6/types.h> |
| 35 | +#include <android/hardware/radio/deprecated/1.0/IOemHook.h> |
32 | 36 | #include <libradiocompat/CallbackManager.h> |
33 | 37 | #include <libradiocompat/RadioData.h> |
34 | 38 | #include <libradiocompat/RadioIms.h> |
|
37 | 41 | #include <libradiocompat/RadioModem.h> |
38 | 42 | #include <libradiocompat/RadioSim.h> |
39 | 43 | #include <libradiocompat/RadioVoice.h> |
40 | | - |
41 | | -#include <android/hardware/radio/deprecated/1.0/IOemHook.h> |
| 44 | +#pragma clang diagnostic pop |
42 | 45 |
|
43 | 46 | #include <hwbinder/IPCThreadState.h> |
44 | 47 | #include <hwbinder/ProcessState.h> |
@@ -105,15 +108,15 @@ sp<RadioImpl_1_6> radioService[SIM_COUNT]; |
105 | 108 | sp<OemHookImpl> oemHookService[SIM_COUNT]; |
106 | 109 | int64_t nitzTimeReceived[SIM_COUNT]; |
107 | 110 | // counter used for synchronization. It is incremented every time response callbacks are updated. |
108 | | -volatile int32_t mCounterRadio[SIM_COUNT]; |
109 | | -volatile int32_t mCounterOemHook[SIM_COUNT]; |
| 111 | +std::atomic_int32_t mCounterRadio[SIM_COUNT]; |
| 112 | +std::atomic_int32_t mCounterOemHook[SIM_COUNT]; |
110 | 113 | #else |
111 | 114 | sp<RadioImpl_1_6> radioService[1]; |
112 | 115 | sp<OemHookImpl> oemHookService[1]; |
113 | 116 | int64_t nitzTimeReceived[1]; |
114 | 117 | // counter used for synchronization. It is incremented every time response callbacks are updated. |
115 | | -volatile int32_t mCounterRadio[1]; |
116 | | -volatile int32_t mCounterOemHook[1]; |
| 118 | +std::atomic_int32_t mCounterRadio[1]; |
| 119 | +std::atomic_int32_t mCounterOemHook[1]; |
117 | 120 | hidl_vec<uint8_t> osAppIdVec; |
118 | 121 | #endif |
119 | 122 |
|
@@ -991,7 +994,8 @@ void checkReturnStatus(int32_t slotId, Return<void>& ret, bool isRadioService) { |
991 | 994 | // Caller should already hold rdlock, release that first |
992 | 995 | // note the current counter to avoid overwriting updates made by another thread before |
993 | 996 | // write lock is acquired. |
994 | | - int counter = isRadioService ? mCounterRadio[slotId] : mCounterOemHook[slotId]; |
| 997 | + auto counter = |
| 998 | + isRadioService ? mCounterRadio[slotId].load() : mCounterOemHook[slotId].load(); |
995 | 999 | pthread_rwlock_t *radioServiceRwlockPtr = radio_1_6::getRadioServiceRwlock(slotId); |
996 | 1000 | int ret = pthread_rwlock_unlock(radioServiceRwlockPtr); |
997 | 1001 | CHECK_EQ(ret, 0); |
|
0 commit comments