Merge "Access mCurrentOperation in main handler" into tm-dev
This commit is contained in:
@@ -46,6 +46,7 @@ import java.util.Date;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* A scheduler for biometric HAL operations. Maintains a queue of {@link BaseClientMonitor}
|
||||
@@ -457,22 +458,33 @@ public class BiometricScheduler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current operation <code>BaseClientMonitor</code>
|
||||
* @deprecated TODO: b/229994966, encapsulate client monitors
|
||||
* @return the current operation
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable
|
||||
public BaseClientMonitor getCurrentClient() {
|
||||
return mCurrentOperation != null ? mCurrentOperation.getClientMonitor() : null;
|
||||
}
|
||||
|
||||
/** The current operation if the requestId is set and matches. */
|
||||
/**
|
||||
* The current operation if the requestId is set and matches.
|
||||
* @deprecated TODO: b/229994966, encapsulate client monitors
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable
|
||||
public BaseClientMonitor getCurrentClientIfMatches(long requestId) {
|
||||
if (mCurrentOperation != null) {
|
||||
if (mCurrentOperation.isMatchingRequestId(requestId)) {
|
||||
return mCurrentOperation.getClientMonitor();
|
||||
public void getCurrentClientIfMatches(long requestId,
|
||||
@NonNull Consumer<BaseClientMonitor> clientMonitorConsumer) {
|
||||
mHandler.post(() -> {
|
||||
if (mCurrentOperation != null) {
|
||||
if (mCurrentOperation.isMatchingRequestId(requestId)) {
|
||||
clientMonitorConsumer.accept(mCurrentOperation.getClientMonitor());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
clientMonitorConsumer.accept(null);
|
||||
});
|
||||
}
|
||||
|
||||
public int getCurrentPendingCount() {
|
||||
|
||||
@@ -582,35 +582,35 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
|
||||
@Override
|
||||
public void onPointerDown(long requestId, int sensorId, int x, int y,
|
||||
float minor, float major) {
|
||||
final BaseClientMonitor client =
|
||||
mSensors.get(sensorId).getScheduler().getCurrentClientIfMatches(requestId);
|
||||
if (!(client instanceof Udfps)) {
|
||||
Slog.e(getTag(), "onPointerDown received during client: " + client);
|
||||
return;
|
||||
}
|
||||
((Udfps) client).onPointerDown(x, y, minor, major);
|
||||
mSensors.get(sensorId).getScheduler().getCurrentClientIfMatches(requestId, (client) -> {
|
||||
if (!(client instanceof Udfps)) {
|
||||
Slog.e(getTag(), "onPointerDown received during client: " + client);
|
||||
return;
|
||||
}
|
||||
((Udfps) client).onPointerDown(x, y, minor, major);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerUp(long requestId, int sensorId) {
|
||||
final BaseClientMonitor client =
|
||||
mSensors.get(sensorId).getScheduler().getCurrentClientIfMatches(requestId);
|
||||
if (!(client instanceof Udfps)) {
|
||||
Slog.e(getTag(), "onPointerUp received during client: " + client);
|
||||
return;
|
||||
}
|
||||
((Udfps) client).onPointerUp();
|
||||
mSensors.get(sensorId).getScheduler().getCurrentClientIfMatches(requestId, (client) -> {
|
||||
if (!(client instanceof Udfps)) {
|
||||
Slog.e(getTag(), "onPointerUp received during client: " + client);
|
||||
return;
|
||||
}
|
||||
((Udfps) client).onPointerUp();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUiReady(long requestId, int sensorId) {
|
||||
final BaseClientMonitor client =
|
||||
mSensors.get(sensorId).getScheduler().getCurrentClientIfMatches(requestId);
|
||||
if (!(client instanceof Udfps)) {
|
||||
Slog.e(getTag(), "onUiReady received during client: " + client);
|
||||
return;
|
||||
}
|
||||
((Udfps) client).onUiReady();
|
||||
mSensors.get(sensorId).getScheduler().getCurrentClientIfMatches(requestId, (client) -> {
|
||||
if (!(client instanceof Udfps)) {
|
||||
Slog.e(getTag(), "onUiReady received during client: " + client);
|
||||
return;
|
||||
}
|
||||
((Udfps) client).onUiReady();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -794,32 +794,35 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
|
||||
@Override
|
||||
public void onPointerDown(long requestId, int sensorId, int x, int y,
|
||||
float minor, float major) {
|
||||
final BaseClientMonitor client = mScheduler.getCurrentClientIfMatches(requestId);
|
||||
if (!(client instanceof Udfps)) {
|
||||
Slog.w(TAG, "onFingerDown received during client: " + client);
|
||||
return;
|
||||
}
|
||||
((Udfps) client).onPointerDown(x, y, minor, major);
|
||||
mScheduler.getCurrentClientIfMatches(requestId, (client) -> {
|
||||
if (!(client instanceof Udfps)) {
|
||||
Slog.w(TAG, "onFingerDown received during client: " + client);
|
||||
return;
|
||||
}
|
||||
((Udfps) client).onPointerDown(x, y, minor, major);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerUp(long requestId, int sensorId) {
|
||||
final BaseClientMonitor client = mScheduler.getCurrentClientIfMatches(requestId);
|
||||
if (!(client instanceof Udfps)) {
|
||||
Slog.w(TAG, "onFingerDown received during client: " + client);
|
||||
return;
|
||||
}
|
||||
((Udfps) client).onPointerUp();
|
||||
mScheduler.getCurrentClientIfMatches(requestId, (client) -> {
|
||||
if (!(client instanceof Udfps)) {
|
||||
Slog.w(TAG, "onFingerDown received during client: " + client);
|
||||
return;
|
||||
}
|
||||
((Udfps) client).onPointerUp();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUiReady(long requestId, int sensorId) {
|
||||
final BaseClientMonitor client = mScheduler.getCurrentClientIfMatches(requestId);
|
||||
if (!(client instanceof Udfps)) {
|
||||
Slog.w(TAG, "onUiReady received during client: " + client);
|
||||
return;
|
||||
}
|
||||
((Udfps) client).onUiReady();
|
||||
mScheduler.getCurrentClientIfMatches(requestId, (client) -> {
|
||||
if (!(client instanceof Udfps)) {
|
||||
Slog.w(TAG, "onUiReady received during client: " + client);
|
||||
return;
|
||||
}
|
||||
((Udfps) client).onUiReady();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user