Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50f76874 authored by Ahaan Ugale's avatar Ahaan Ugale
Browse files

Fix UiTranslationManager ErrorProne error.

"Must store Binder.clearCallingIdentity() token as final variable.."

Restoring identity isn't really needed here, but it's better to have to
be defensive -- in case we do add something later for which the calling
identity needs to be restored.

Bug: 177500482
Bug: 182896753
Test: mmma frameworks/base/ RUN_ERROR_PRONE=true
Change-Id: I72acc40f8776d46b3f875cde1759fe03a25e222b
parent 93b9882e
Loading
Loading
Loading
Loading
+21 −20
Original line number Diff line number Diff line
@@ -404,8 +404,10 @@ public final class UiTranslationManager {

        @Override
        public void sendResult(Bundle bundle) {
            Binder.clearCallingIdentity();
            mExecutor.execute(() -> {
            Binder.withCleanCallingIdentity(() -> mExecutor.execute(() -> onStateChange(bundle)));
        }

        private void onStateChange(Bundle bundle) {
            int state = bundle.getInt(EXTRA_STATE);
            switch (state) {
                case STATE_UI_TRANSLATION_STARTED:
@@ -423,7 +425,6 @@ public final class UiTranslationManager {
                default:
                    Log.wtf(TAG, "Unexpected translation state:" + state);
            }
            });
        }
    }
}