diff options
| author | 2019-08-05 23:28:54 +0000 | |
|---|---|---|
| committer | 2019-08-05 23:28:54 +0000 | |
| commit | ac7caa95250cf1a6a72b15b140b5df947600282c (patch) | |
| tree | d4d9b1666f9de40baa982bd7107f545b3924c98e /libs/binder/Stability.cpp | |
| parent | 9759952af54d91c2be53a8d46ea779d6603f9195 (diff) | |
| parent | 2a9f32f1a21e012dfaddc571a741658eaef0d9da (diff) | |
Merge "Set stability for unset interfaces."
Diffstat (limited to 'libs/binder/Stability.cpp')
| -rw-r--r-- | libs/binder/Stability.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/libs/binder/Stability.cpp b/libs/binder/Stability.cpp index d6d312a842..f18bdca1fd 100644 --- a/libs/binder/Stability.cpp +++ b/libs/binder/Stability.cpp @@ -13,29 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include <binder/Stability.h> namespace android { namespace internal { void Stability::markCompilationUnit(IBinder* binder) { -#ifdef __ANDROID_VNDK__ -constexpr Stability::Level kLocalStability = Stability::Level::VENDOR; -#else -constexpr Stability::Level kLocalStability = Stability::Level::SYSTEM; -#endif - - status_t result = set(binder, kLocalStability); + status_t result = set(binder, kLocalStability, true /*log*/); LOG_ALWAYS_FATAL_IF(result != OK, "Should only mark known object."); } void Stability::markVintf(IBinder* binder) { - status_t result = set(binder, Level::VINTF); + status_t result = set(binder, Level::VINTF, true /*log*/); LOG_ALWAYS_FATAL_IF(result != OK, "Should only mark known object."); } -status_t Stability::set(IBinder* binder, int32_t stability) { +void Stability::tryMarkCompilationUnit(IBinder* binder) { + (void) set(binder, kLocalStability, false /*log*/); +} + +status_t Stability::set(IBinder* binder, int32_t stability, bool log) { Level currentStability = get(binder); // null binder is always written w/ 'UNDECLARED' stability @@ -43,23 +40,26 @@ status_t Stability::set(IBinder* binder, int32_t stability) { if (stability == UNDECLARED) { return OK; } else { - ALOGE("Null binder written with stability %s.", stabilityString(stability).c_str()); + if (log) { + ALOGE("Null binder written with stability %s.", + stabilityString(stability).c_str()); + } return BAD_TYPE; } } if (!isDeclaredStability(stability)) { - // There are UNDECLARED sets because some binder interfaces don't set their stability, and - // then UNDECLARED stability is sent on the other side. - if (stability != UNDECLARED) { + if (log) { ALOGE("Can only set known stability, not %d.", stability); - return BAD_TYPE; } + return BAD_TYPE; } if (currentStability != Level::UNDECLARED && currentStability != stability) { - ALOGE("Interface being set with %s but it is already marked as %s.", - stabilityString(stability).c_str(), stabilityString(stability).c_str()); + if (log) { + ALOGE("Interface being set with %s but it is already marked as %s.", + stabilityString(stability).c_str(), stabilityString(stability).c_str()); + } return BAD_TYPE; } |