From 4796ae6f6a65af130cdb6e0cf5e0845ce8ebedeb Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Wed, 3 Apr 2019 16:17:16 -0700 Subject: [PATCH 1/3] Fix mMaxOffset not initialized. Test: bit GtsIncidentManagerTestCases:* Bug: 129884655 Change-Id: Ic65566c02a255d1f52ce6876152383126afbfaef --- libs/protoutil/src/ProtoFileReader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/protoutil/src/ProtoFileReader.cpp b/libs/protoutil/src/ProtoFileReader.cpp index 074170a6e2c33..4017979fd4fc2 100644 --- a/libs/protoutil/src/ProtoFileReader.cpp +++ b/libs/protoutil/src/ProtoFileReader.cpp @@ -55,6 +55,7 @@ ProtoFileReader::ProtoFileReader(int fd) mSize(get_file_size(fd)), mPos(0), mOffset(0), + mMaxOffset(0), mChunkSize(sizeof(mBuffer)) { } From 108413a9d61a983bd55fa6c5ae975ed00db75a29 Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Wed, 3 Apr 2019 18:20:52 -0700 Subject: [PATCH 2/3] Add additional system properties that can disable the face debugging codepath Test: treehugger Bug: 123543706 Change-Id: I3fe2dea3a44a789d86dc9beb1bb319b0552011ec --- .../com/android/server/biometrics/face/FaceService.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/core/java/com/android/server/biometrics/face/FaceService.java b/services/core/java/com/android/server/biometrics/face/FaceService.java index c573bbb2e1f0e..14ba70aa5eac8 100644 --- a/services/core/java/com/android/server/biometrics/face/FaceService.java +++ b/services/core/java/com/android/server/biometrics/face/FaceService.java @@ -44,6 +44,7 @@ import android.os.Environment; import android.os.IBinder; import android.os.RemoteException; import android.os.SELinux; +import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.service.restricted_image.RestrictedImageProto; @@ -1091,6 +1092,13 @@ public class FaceService extends BiometricServiceBase { return; } + // Additionally, this flag allows turning off face for a device + // (either permanently through the build or on an individual device). + if (SystemProperties.getBoolean("ro.face.disable_debug_data", false) + || SystemProperties.getBoolean("persist.face.disable_debug_data", false)) { + return; + } + final ProtoOutputStream proto = new ProtoOutputStream(fd); final long setToken = proto.start(RestrictedImagesDumpProto.SETS); From 9bd5db7a68b7e91d97d3b7b0dfc70a1dd45f9abb Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Wed, 3 Apr 2019 18:19:43 -0700 Subject: [PATCH 3/3] Make libplatformprotos-static, which is safe to use when you don't have shared libraries. Bug: 123543706 Test: treehugger Change-Id: I9706478e99bee914b200a39f08274ecc2dc07951 --- Android.bp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Android.bp b/Android.bp index 5b8e6e1b8d322..4e25717c59da6 100644 --- a/Android.bp +++ b/Android.bp @@ -1048,6 +1048,35 @@ cc_library { }, } +// This library is meant for vendor code that needs to output protobuf. It links +// against the static version of libprotobuf-cpp-lite, for which we can not guarantee +// binary compatibility. +cc_library { + name: "libplatformprotos-static", + defaults: ["libplatformprotos-defaults"], + host_supported: false, + + // This is okay because this library is only built as a static library. The C++ + // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council, + // but is not authorized to be used outside of debugging. + vendor_available: true, + + target: { + android: { + proto: { + type: "lite", + }, + static_libs: [ + "libprotobuf-cpp-lite", + ], + shared: { + enabled: false, + }, + }, + }, +} + + // This is the full proto version of libplatformprotos. It may only // be used by test code that is not shipped on the device. cc_library {