Fix parameter order of Lnb.addCallback()

Moving the callback argument to the last.

Bug: 222095579
Test: android.media.tv.tuner.cts.TunerTest
Change-Id: I4d5348588659b17284770a89d32c7b03431daa00
This commit is contained in:
Kensuke Miyagi
2022-03-03 19:24:59 -08:00
parent 43be2221af
commit 5739f2027d
3 changed files with 11 additions and 9 deletions

View File

@@ -6943,7 +6943,7 @@ package android.media.tv.tuner {
}
public class Lnb implements java.lang.AutoCloseable {
method public void addCallback(@NonNull android.media.tv.tuner.LnbCallback, @NonNull java.util.concurrent.Executor);
method public void addCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.tv.tuner.LnbCallback);
method public void close();
method public boolean removeCallback(@NonNull android.media.tv.tuner.LnbCallback);
method public int sendDiseqcMessage(@NonNull byte[]);

View File

@@ -167,10 +167,10 @@ public class Lnb implements AutoCloseable {
private Lnb() {}
void setCallbackAndOwner(Executor executor, @Nullable LnbCallback callback, Tuner tuner) {
void setCallbackAndOwner(Tuner tuner, Executor executor, @Nullable LnbCallback callback) {
synchronized (mCallbackLock) {
if (callback != null && executor != null) {
addCallback(callback, executor);
addCallback(executor, callback);
}
}
setOwner(tuner);
@@ -179,12 +179,12 @@ public class Lnb implements AutoCloseable {
/**
* Adds LnbCallback
*
* @param callback the callback to receive notifications from LNB.
* @param executor the executor on which callback will be invoked. Cannot be null.
* @param callback the callback to receive notifications from LNB.
*/
public void addCallback(@NonNull LnbCallback callback, @NonNull Executor executor) {
Objects.requireNonNull(callback, "callback must not be null");
public void addCallback(@NonNull Executor executor, @NonNull LnbCallback callback) {
Objects.requireNonNull(executor, "executor must not be null");
Objects.requireNonNull(callback, "callback must not be null");
synchronized (mCallbackLock) {
mCallbackMap.put(callback, executor);
}

View File

@@ -62,7 +62,9 @@ import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.util.Log;
import com.android.internal.util.FrameworkStatsLog;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
@@ -2147,12 +2149,12 @@ public class Tuner implements AutoCloseable {
Objects.requireNonNull(executor, "executor must not be null");
Objects.requireNonNull(cb, "LnbCallback must not be null");
if (mLnb != null) {
mLnb.setCallbackAndOwner(executor, cb, this);
mLnb.setCallbackAndOwner(this, executor, cb);
return mLnb;
}
if (checkResource(TunerResourceManager.TUNER_RESOURCE_TYPE_LNB, mLnbLock)
&& mLnb != null) {
mLnb.setCallbackAndOwner(executor, cb, this);
mLnb.setCallbackAndOwner(this, executor, cb);
setLnb(mLnb);
return mLnb;
}
@@ -2186,7 +2188,7 @@ public class Tuner implements AutoCloseable {
mLnbHandle = null;
}
mLnb = newLnb;
mLnb.setCallbackAndOwner(executor, cb, this);
mLnb.setCallbackAndOwner(this, executor, cb);
setLnb(mLnb);
}
return mLnb;