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

Commit 03de12c4 authored by Insun Kang's avatar Insun Kang
Browse files

Resolve hidden API usage of Handler constructor

Previous code uses hidden constructor of Handler to set its messages
to be asynchronous. This replaces it with Message#setAsynchronous(),
which is public.

Bug: 122047488
Test: build
Change-Id: Icaeffcbcba5bc82a9162cdd17df7190d72a43bdd
parent 26ac00d3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1142,8 +1142,7 @@ public final class MediaController {
        private boolean mRegistered = false;

        public MessageHandler(Looper looper, MediaController.Callback cb) {
            //TODO:(b/119539849) Uncomment below line and resolve the error.
            // super(looper, null, true);
            super(looper);
            mCallback = cb;
        }

@@ -1182,6 +1181,7 @@ public final class MediaController {

        public void post(int what, Object obj, Bundle data) {
            Message msg = obtainMessage(what, obj);
            msg.setAsynchronous(true);
            msg.setData(data);
            msg.sendToTarget();
        }
+2 −2
Original line number Diff line number Diff line
@@ -1458,8 +1458,7 @@ public final class MediaSession {
        private RemoteUserInfo mCurrentControllerInfo;

        public CallbackMessageHandler(Looper looper, MediaSession.Callback callback) {
            //TODO:(b/119539849) Uncomment below line and resolve the error.
            //super(looper, null, true);
            super(looper);
            mCallback = callback;
            mCallback.mHandler = this;
        }
@@ -1467,6 +1466,7 @@ public final class MediaSession {
        public void post(RemoteUserInfo caller, int what, Object obj, Bundle data, long delayMs) {
            Pair<RemoteUserInfo, Object> objWithCaller = Pair.create(caller, obj);
            Message msg = obtainMessage(what, objWithCaller);
            msg.setAsynchronous(true);
            msg.setData(data);
            if (delayMs > 0) {
                sendMessageDelayed(msg, delayMs);