summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/FocusStateListener.java
diff options
context:
space:
mode:
authorByunghun Jeon <bjeon@codeaurora.org>2016-03-09 17:54:54 -0800
committerJay Wang <jaywang@codeaurora.org>2016-03-30 15:55:15 -0700
commitecbee10d740381d11df172de027ef76a6136ace3 (patch)
treec211caa8691209e7e78d5bdbb7c5c614a4460b9f /src/com/android/camera/FocusStateListener.java
parent0095c4455f5bba6352abe0476948ef99b42a0c96 (diff)
downloadandroid_packages_apps_Snap-ecbee10d740381d11df172de027ef76a6136ace3.tar.gz
android_packages_apps_Snap-ecbee10d740381d11df172de027ef76a6136ace3.tar.bz2
android_packages_apps_Snap-ecbee10d740381d11df172de027ef76a6136ace3.zip
SnapdragonCamera: Camera2 add touch to focus
Add touch to focus to Camera2 CRs-Fixed: 989750 Change-Id: I5c7c85dcc12eefb11e5f1b5e6a823a327b2647e4
Diffstat (limited to 'src/com/android/camera/FocusStateListener.java')
-rw-r--r--src/com/android/camera/FocusStateListener.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/com/android/camera/FocusStateListener.java b/src/com/android/camera/FocusStateListener.java
new file mode 100644
index 000000000..42edd5c34
--- /dev/null
+++ b/src/com/android/camera/FocusStateListener.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.android.camera;
+
+import android.hardware.camera2.CaptureResult;
+
+public class FocusStateListener {
+ private CaptureUI mUI;
+
+ public FocusStateListener(CaptureUI ui) {
+ mUI = ui;
+ }
+
+ public void onFocusStatusUpdate(int focusState) {
+ switch (focusState) {
+ case CaptureResult.CONTROL_AF_STATE_ACTIVE_SCAN:
+ mUI.onFocusStarted();
+ break;
+ case CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED:
+ mUI.onFocusSucceeded(true);
+ break;
+ case CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED:
+ mUI.onFocusFailed(true);
+ break;
+ case CaptureResult.CONTROL_AF_STATE_PASSIVE_FOCUSED:
+ mUI.onFocusSucceeded(true);
+ break;
+ case CaptureResult.CONTROL_AF_STATE_PASSIVE_SCAN:
+ mUI.onFocusStarted();
+ break;
+ case CaptureResult.CONTROL_AF_STATE_PASSIVE_UNFOCUSED:
+ mUI.onFocusFailed(true);
+ break;
+ case CaptureResult.CONTROL_AF_STATE_INACTIVE:
+ mUI.clearFocus();
+ break;
+ }
+ }
+}