Skip to content

Commit 514afa1

Browse files
authored
feat(liveness): Liveness connected component
2 parents 5c87c76 + 2ee1c46 commit 514afa1

File tree

92 files changed

+8179
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+8179
-0
lines changed

liveness/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
/buildNative

liveness/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## [Release 1.0.0](https://github.com/aws-amplify/amplify-ui-android/releases/tag/release_liveness_v1.0.0)
2+
3+
### Features
4+
- **liveness:** Initial Liveness Release ([#6](https://github.com/aws-amplify/amplify-ui-android/issues/6))

liveness/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Face Liveness
2+
3+
Amplify UI Face Liveness provides a UI component (FaceLivenessDetector) that helps developers deter fraud and scams during face-based identity checks by validating that users are physically present in front of the camera at that moment, and not an imposter spoofing the user's face.
4+
5+
More information on setting up and using the FaceLivenessDetector is in the [Amplify UI Face Liveness documentation](https://ui.docs.amplify.aws/android/connected-components/liveness).

liveness/build.gradle

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
apply plugin: 'com.android.library'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'org.jetbrains.kotlin.plugin.serialization'
4+
apply from: rootProject.file("configuration/publishing.gradle")
5+
6+
group = POM_GROUP
7+
8+
android {
9+
namespace 'com.amplifyframework.ui.liveness'
10+
defaultConfig {
11+
externalNativeBuild {
12+
cmake {
13+
cppFlags "-std=c++17"
14+
arguments "-DCMAKE_VERBOSE_MAKEFILE=ON"
15+
}
16+
}
17+
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
18+
}
19+
20+
externalNativeBuild {
21+
cmake {
22+
// AGP doesn't allow us to use project.buildDir (or subdirs) for CMake's generated
23+
// build files (ninja build files, CMakeCache.txt, etc.). Use a staging directory that
24+
// lives alongside the project's buildDir.
25+
buildStagingDirectory "${project.buildDir}/../buildNative"
26+
path "src/main/cpp/CMakeLists.txt"
27+
version "3.22.1"
28+
}
29+
}
30+
31+
buildFeatures {
32+
mlModelBinding true
33+
}
34+
35+
androidResources {
36+
noCompress 'tflite'
37+
}
38+
39+
publishing {
40+
singleVariant("release") {
41+
withSourcesJar()
42+
}
43+
}
44+
}
45+
46+
dependencies {
47+
48+
api dependency.amplify.auth
49+
api dependency.amplify.predictions
50+
51+
implementation dependency.androidx.camera.core
52+
implementation dependency.androidx.camera.camera2
53+
implementation dependency.androidx.camera.lifecycle
54+
implementation dependency.androidx.futures
55+
implementation dependency.androidx.material
56+
implementation dependency.androidx.uiTooling
57+
implementation dependency.androidx.lifecycle_ktx
58+
59+
implementation dependency.kotlin.serializationJson
60+
61+
implementation dependency.tensorFlow
62+
implementation dependency.tensorFlowSupport
63+
64+
testImplementation dependency.test.androidx.espresso
65+
testImplementation dependency.test.androidx.junit
66+
testImplementation dependency.test.junit
67+
testImplementation dependency.test.robolectric
68+
testImplementation dependency.test.mockk
69+
}

liveness/gradle.properties

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#
2+
# Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License").
5+
# You may not use this file except in compliance with the License.
6+
# A copy of the License is located at
7+
#
8+
# http://aws.amazon.com/apache2.0
9+
#
10+
# or in the "license" file accompanying this file. This file is distributed
11+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
# express or implied. See the License for the specific language governing
13+
# permissions and limitations under the License.
14+
#
15+
16+
POM_ARTIFACT_ID=liveness
17+
POM_NAME=Amplify UI Framework for Android - Liveness
18+
POM_DESCRIPTION=Amplify UI Framework for Android - Liveness Plugin
19+
POM_PACKAGING=aar
20+
VERSION_NAME=1.0.0
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License").
6+
~ You may not use this file except in compliance with the License.
7+
~ A copy of the License is located at
8+
~
9+
~ http://aws.amazon.com/apache2.0
10+
~
11+
~ or in the "license" file accompanying this file. This file is distributed
12+
~ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13+
~ express or implied. See the License for the specific language governing
14+
~ permissions and limitations under the License.
15+
-->
16+
17+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
18+
19+
<uses-feature android:name="android.hardware.camera.any" />
20+
<uses-permission android:name="android.permission.CAMERA" />
21+
<uses-permission android:name="android.permission.INTERNET" />
22+
23+
</manifest>
224 KB
Binary file not shown.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#
2+
# Copyright (C) 2020 The Android Open Source Project
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
# use this file except in compliance with the License. You may obtain a copy of
6+
# the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
# License for the specific language governing permissions and limitations under
14+
# the License.
15+
#
16+
project (liveness-native)
17+
18+
cmake_minimum_required(VERSION 3.4.1)
19+
20+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
21+
22+
add_library(
23+
liveness_opengl_renderer_jni SHARED
24+
liveness_jni_hooks.cpp
25+
liveness_opengl_renderer_jni.cpp)
26+
27+
find_library(log-lib log)
28+
find_library(android-lib android)
29+
find_library(opengl-lib GLESv2)
30+
find_library(egl-lib EGL)
31+
32+
33+
target_link_libraries(liveness_opengl_renderer_jni ${log-lib} ${android-lib} ${opengl-lib} ${egl-lib})
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2020 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <jni.h>
18+
19+
extern "C" {
20+
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
21+
return JNI_VERSION_1_6;
22+
}
23+
}

0 commit comments

Comments
 (0)