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.Deque;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scheduler for biometric HAL operations. Maintains a queue of {@link BaseClientMonitor}
|
* 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
|
* @return the current operation
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
|
@Nullable
|
||||||
public BaseClientMonitor getCurrentClient() {
|
public BaseClientMonitor getCurrentClient() {
|
||||||
return mCurrentOperation != null ? mCurrentOperation.getClientMonitor() : null;
|
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
|
@Deprecated
|
||||||
@Nullable
|
@Nullable
|
||||||
public BaseClientMonitor getCurrentClientIfMatches(long requestId) {
|
public void getCurrentClientIfMatches(long requestId,
|
||||||
if (mCurrentOperation != null) {
|
@NonNull Consumer<BaseClientMonitor> clientMonitorConsumer) {
|
||||||
if (mCurrentOperation.isMatchingRequestId(requestId)) {
|
mHandler.post(() -> {
|
||||||
return mCurrentOperation.getClientMonitor();
|
if (mCurrentOperation != null) {
|
||||||
|
if (mCurrentOperation.isMatchingRequestId(requestId)) {
|
||||||
|
clientMonitorConsumer.accept(mCurrentOperation.getClientMonitor());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
clientMonitorConsumer.accept(null);
|
||||||
return null;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrentPendingCount() {
|
public int getCurrentPendingCount() {
|
||||||
|
|||||||
@@ -582,35 +582,35 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
|
|||||||
@Override
|
@Override
|
||||||
public void onPointerDown(long requestId, int sensorId, int x, int y,
|
public void onPointerDown(long requestId, int sensorId, int x, int y,
|
||||||
float minor, float major) {
|
float minor, float major) {
|
||||||
final BaseClientMonitor client =
|
mSensors.get(sensorId).getScheduler().getCurrentClientIfMatches(requestId, (client) -> {
|
||||||
mSensors.get(sensorId).getScheduler().getCurrentClientIfMatches(requestId);
|
if (!(client instanceof Udfps)) {
|
||||||
if (!(client instanceof Udfps)) {
|
Slog.e(getTag(), "onPointerDown received during client: " + client);
|
||||||
Slog.e(getTag(), "onPointerDown received during client: " + client);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
((Udfps) client).onPointerDown(x, y, minor, major);
|
||||||
((Udfps) client).onPointerDown(x, y, minor, major);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPointerUp(long requestId, int sensorId) {
|
public void onPointerUp(long requestId, int sensorId) {
|
||||||
final BaseClientMonitor client =
|
mSensors.get(sensorId).getScheduler().getCurrentClientIfMatches(requestId, (client) -> {
|
||||||
mSensors.get(sensorId).getScheduler().getCurrentClientIfMatches(requestId);
|
if (!(client instanceof Udfps)) {
|
||||||
if (!(client instanceof Udfps)) {
|
Slog.e(getTag(), "onPointerUp received during client: " + client);
|
||||||
Slog.e(getTag(), "onPointerUp received during client: " + client);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
((Udfps) client).onPointerUp();
|
||||||
((Udfps) client).onPointerUp();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUiReady(long requestId, int sensorId) {
|
public void onUiReady(long requestId, int sensorId) {
|
||||||
final BaseClientMonitor client =
|
mSensors.get(sensorId).getScheduler().getCurrentClientIfMatches(requestId, (client) -> {
|
||||||
mSensors.get(sensorId).getScheduler().getCurrentClientIfMatches(requestId);
|
if (!(client instanceof Udfps)) {
|
||||||
if (!(client instanceof Udfps)) {
|
Slog.e(getTag(), "onUiReady received during client: " + client);
|
||||||
Slog.e(getTag(), "onUiReady received during client: " + client);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
((Udfps) client).onUiReady();
|
||||||
((Udfps) client).onUiReady();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -794,32 +794,35 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
|
|||||||
@Override
|
@Override
|
||||||
public void onPointerDown(long requestId, int sensorId, int x, int y,
|
public void onPointerDown(long requestId, int sensorId, int x, int y,
|
||||||
float minor, float major) {
|
float minor, float major) {
|
||||||
final BaseClientMonitor client = mScheduler.getCurrentClientIfMatches(requestId);
|
mScheduler.getCurrentClientIfMatches(requestId, (client) -> {
|
||||||
if (!(client instanceof Udfps)) {
|
if (!(client instanceof Udfps)) {
|
||||||
Slog.w(TAG, "onFingerDown received during client: " + client);
|
Slog.w(TAG, "onFingerDown received during client: " + client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
((Udfps) client).onPointerDown(x, y, minor, major);
|
((Udfps) client).onPointerDown(x, y, minor, major);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPointerUp(long requestId, int sensorId) {
|
public void onPointerUp(long requestId, int sensorId) {
|
||||||
final BaseClientMonitor client = mScheduler.getCurrentClientIfMatches(requestId);
|
mScheduler.getCurrentClientIfMatches(requestId, (client) -> {
|
||||||
if (!(client instanceof Udfps)) {
|
if (!(client instanceof Udfps)) {
|
||||||
Slog.w(TAG, "onFingerDown received during client: " + client);
|
Slog.w(TAG, "onFingerDown received during client: " + client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
((Udfps) client).onPointerUp();
|
((Udfps) client).onPointerUp();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUiReady(long requestId, int sensorId) {
|
public void onUiReady(long requestId, int sensorId) {
|
||||||
final BaseClientMonitor client = mScheduler.getCurrentClientIfMatches(requestId);
|
mScheduler.getCurrentClientIfMatches(requestId, (client) -> {
|
||||||
if (!(client instanceof Udfps)) {
|
if (!(client instanceof Udfps)) {
|
||||||
Slog.w(TAG, "onUiReady received during client: " + client);
|
Slog.w(TAG, "onUiReady received during client: " + client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
((Udfps) client).onUiReady();
|
((Udfps) client).onUiReady();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user