Merge changes from topic "hotword_qpr" into tm-qpr-dev am: 7811c2b731
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19619190 Change-Id: I28658cfe6c943c8d06c86d5f335411d714280fe1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -83,11 +83,11 @@ public abstract class AttentionManagerInternal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Internal interface for proximity callback. */
|
/** Internal interface for proximity callback. */
|
||||||
public abstract static class ProximityUpdateCallbackInternal {
|
public interface ProximityUpdateCallbackInternal {
|
||||||
/**
|
/**
|
||||||
* @param distance the estimated distance of the user (in meter)
|
* @param distance the estimated distance of the user (in meter)
|
||||||
* The distance will be PROXIMITY_UNKNOWN if the proximity sensing was inconclusive.
|
* The distance will be PROXIMITY_UNKNOWN if the proximity sensing was inconclusive.
|
||||||
*/
|
*/
|
||||||
public abstract void onProximityUpdate(double distance);
|
void onProximityUpdate(double distance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -856,9 +856,6 @@ public class AttentionManagerService extends SystemService {
|
|||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
private void cancelAndUnbindLocked() {
|
private void cancelAndUnbindLocked() {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (mCurrentAttentionCheck == null && mCurrentProximityUpdate == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mCurrentAttentionCheck != null) {
|
if (mCurrentAttentionCheck != null) {
|
||||||
cancel();
|
cancel();
|
||||||
}
|
}
|
||||||
@@ -940,7 +937,7 @@ public class AttentionManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestableProximityUpdateCallbackInternal extends ProximityUpdateCallbackInternal {
|
class TestableProximityUpdateCallbackInternal implements ProximityUpdateCallbackInternal {
|
||||||
private double mLastCallbackCode = PROXIMITY_UNKNOWN;
|
private double mLastCallbackCode = PROXIMITY_UNKNOWN;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1072,6 +1069,7 @@ public class AttentionManagerService extends SystemService {
|
|||||||
private void resetStates() {
|
private void resetStates() {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
mCurrentProximityUpdate = null;
|
mCurrentProximityUpdate = null;
|
||||||
|
cancelAndUnbindLocked();
|
||||||
}
|
}
|
||||||
mComponentName = resolveAttentionService(mContext);
|
mComponentName = resolveAttentionService(mContext);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,14 +188,7 @@ final class HotwordDetectionConnection {
|
|||||||
@Nullable final AttentionManagerInternal mAttentionManagerInternal;
|
@Nullable final AttentionManagerInternal mAttentionManagerInternal;
|
||||||
|
|
||||||
final AttentionManagerInternal.ProximityUpdateCallbackInternal mProximityCallbackInternal =
|
final AttentionManagerInternal.ProximityUpdateCallbackInternal mProximityCallbackInternal =
|
||||||
new AttentionManagerInternal.ProximityUpdateCallbackInternal() {
|
this::setProximityMeters;
|
||||||
@Override
|
|
||||||
public void onProximityUpdate(double distance) {
|
|
||||||
synchronized (mLock) {
|
|
||||||
mProximityMeters = distance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
volatile HotwordDetectionServiceIdentity mIdentity;
|
volatile HotwordDetectionServiceIdentity mIdentity;
|
||||||
@@ -1227,6 +1220,12 @@ final class HotwordDetectionConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setProximityMeters(double proximityMeters) {
|
||||||
|
synchronized (mLock) {
|
||||||
|
mProximityMeters = proximityMeters;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void bestEffortClose(Closeable... closeables) {
|
private static void bestEffortClose(Closeable... closeables) {
|
||||||
for (Closeable closeable : closeables) {
|
for (Closeable closeable : closeables) {
|
||||||
bestEffortClose(closeable);
|
bestEffortClose(closeable);
|
||||||
|
|||||||
Reference in New Issue
Block a user