Merge "Fix parameter order of Lnb.addCallback()" into tm-dev am: 4f782d2a2a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17085423

Change-Id: I7c376289a885bb06bf5cc6365d0b3018b5754993
This commit is contained in:
Kensuke Miyagi
2022-03-09 23:54:35 +00:00
committed by Automerger Merge Worker
3 changed files with 11 additions and 9 deletions

View File

@@ -6946,7 +6946,7 @@ package android.media.tv.tuner {
} }
public class Lnb implements java.lang.AutoCloseable { 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 void close();
method public boolean removeCallback(@NonNull android.media.tv.tuner.LnbCallback); method public boolean removeCallback(@NonNull android.media.tv.tuner.LnbCallback);
method public int sendDiseqcMessage(@NonNull byte[]); method public int sendDiseqcMessage(@NonNull byte[]);

View File

@@ -167,10 +167,10 @@ public class Lnb implements AutoCloseable {
private Lnb() {} private Lnb() {}
void setCallbackAndOwner(Executor executor, @Nullable LnbCallback callback, Tuner tuner) { void setCallbackAndOwner(Tuner tuner, Executor executor, @Nullable LnbCallback callback) {
synchronized (mCallbackLock) { synchronized (mCallbackLock) {
if (callback != null && executor != null) { if (callback != null && executor != null) {
addCallback(callback, executor); addCallback(executor, callback);
} }
} }
setOwner(tuner); setOwner(tuner);
@@ -179,12 +179,12 @@ public class Lnb implements AutoCloseable {
/** /**
* Adds LnbCallback * 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 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) { public void addCallback(@NonNull Executor executor, @NonNull LnbCallback callback) {
Objects.requireNonNull(callback, "callback must not be null");
Objects.requireNonNull(executor, "executor must not be null"); Objects.requireNonNull(executor, "executor must not be null");
Objects.requireNonNull(callback, "callback must not be null");
synchronized (mCallbackLock) { synchronized (mCallbackLock) {
mCallbackMap.put(callback, executor); mCallbackMap.put(callback, executor);
} }

View File

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