summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2015-03-03 10:44:52 +0100
committerMichael Bestas <mikeioannina@gmail.com>2016-12-30 17:21:19 +0200
commitf9696408c977c55ce7f7d6b7a0738d2af834eab5 (patch)
tree7a93a447bfae5da5202801b421d19c6b379a4565
parent99d69dadd01ca044d5e4851707f18e1fe00ee624 (diff)
downloadandroid_packages_apps_Camera2-f9696408c977c55ce7f7d6b7a0738d2af834eab5.tar.gz
android_packages_apps_Camera2-f9696408c977c55ce7f7d6b7a0738d2af834eab5.tar.bz2
android_packages_apps_Camera2-f9696408c977c55ce7f7d6b7a0738d2af834eab5.zip
Introduce a 'device plugin' concept.
It allows device specific code to work with the camera while it's active. Change-Id: Iec78bf4d632c71f02e830eb2ac05504370bba660 camera2: Fix NPE * These values will be NULL when permissions haven't been accepted. Change-Id: I078deab9f7eff76f3d01087e2df7ff2f2a3c717d
-rw-r--r--Android.mk6
-rw-r--r--src/com/android/camera/CameraActivity.java9
-rw-r--r--src/com/android/camera/app/DevicePluginBase.java35
-rw-r--r--src_plugin/com/android/camera/app/DevicePluginImpl.java27
4 files changed, 77 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk
index 6deaffd48..a6b24bc59 100644
--- a/Android.mk
+++ b/Android.mk
@@ -15,6 +15,12 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += $(call all-java-files-under, src_pd)
LOCAL_SRC_FILES += $(call all-java-files-under, src_pd_gcam)
+ifneq ($(BOARD_CAMERA_PLUGIN),)
+ LOCAL_SRC_FILES += $(call all-java-files-under, ../../../$(BOARD_CAMERA_PLUGIN))
+else
+ LOCAL_SRC_FILES += $(call all-java-files-under, src_plugin)
+endif
+
LOCAL_RESOURCE_DIR += \
$(LOCAL_PATH)/res \
$(LOCAL_PATH)/res_p
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index d78590f18..a5bf0d747 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -73,6 +73,7 @@ import com.android.camera.app.CameraController;
import com.android.camera.app.CameraProvider;
import com.android.camera.app.CameraServices;
import com.android.camera.app.CameraServicesImpl;
+import com.android.camera.app.DevicePluginImpl;
import com.android.camera.app.FirstRunDialog;
import com.android.camera.app.LocationManager;
import com.android.camera.app.MemoryManager;
@@ -229,6 +230,7 @@ public class CameraActivity extends QuickActivity
private int mCurrentModeIndex;
private CameraModule mCurrentModule;
private ModuleManagerImpl mModuleManager;
+ private DevicePluginImpl mDevicePlugin;
private FrameLayout mAboveFilmstripControlLayout;
private FilmstripController mFilmstripController;
private boolean mFilmstripVisible;
@@ -538,6 +540,7 @@ public class CameraActivity extends QuickActivity
}
Log.v(TAG, "invoking onChangeCamera");
mCameraAppUI.onChangeCamera();
+ mDevicePlugin.onCameraOpened(camera);
}
private void resetExposureCompensationToDefault(CameraAgent.CameraProxy camera) {
@@ -1511,6 +1514,9 @@ public class CameraActivity extends QuickActivity
ModulesInfo.setupModules(mAppContext, mModuleManager, mFeatureConfig);
+ mDevicePlugin = new DevicePluginImpl();
+ mDevicePlugin.onCreate(mAppContext);
+
initPowerShutter();
initMaxBrightness();
@@ -2201,6 +2207,9 @@ public class CameraActivity extends QuickActivity
if (mModeListView != null) {
mModeListView.setVisibilityChangedListener(null);
}
+ if (mDevicePlugin != null) {
+ mDevicePlugin.onDestroy();
+ }
mCameraController = null;
mSettingsManager = null;
mOrientationManager = null;
diff --git a/src/com/android/camera/app/DevicePluginBase.java b/src/com/android/camera/app/DevicePluginBase.java
new file mode 100644
index 000000000..8f934dd64
--- /dev/null
+++ b/src/com/android/camera/app/DevicePluginBase.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2015 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.camera.app;
+
+import android.content.Context;
+
+import com.android.ex.camera2.portability.CameraAgent;
+
+/**
+ * The interface defining device-specific application hooks
+ */
+public class DevicePluginBase {
+ public void onCreate(Context context) {
+ }
+
+ public void onDestroy() {
+ }
+
+ public void onCameraOpened(CameraAgent.CameraProxy camera) {
+ }
+}
diff --git a/src_plugin/com/android/camera/app/DevicePluginImpl.java b/src_plugin/com/android/camera/app/DevicePluginImpl.java
new file mode 100644
index 000000000..c50648854
--- /dev/null
+++ b/src_plugin/com/android/camera/app/DevicePluginImpl.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2015 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.camera.app;
+
+import android.content.Context;
+
+import com.android.camera.app.DevicePluginBase;
+import com.android.ex.camera2.portability.CameraAgent;
+
+public class DevicePluginImpl extends DevicePluginBase {
+ public DevicePluginImpl() {
+ }
+}