summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2015-03-03 10:44:52 +0100
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-05-27 13:56:09 +0000
commitd4e6548e0ee391f841e28b7cd7056f0205f76d4d (patch)
treea03d32db48ff6744aba91618d49293efe5bcae38
parent5eb519b34e48f4ff7926931002294c3626f9de02 (diff)
downloadandroid_packages_apps_Camera2-d4e6548e0ee391f841e28b7cd7056f0205f76d4d.tar.gz
android_packages_apps_Camera2-d4e6548e0ee391f841e28b7cd7056f0205f76d4d.tar.bz2
android_packages_apps_Camera2-d4e6548e0ee391f841e28b7cd7056f0205f76d4d.zip
Introduce a 'device plugin' concept.
It allows device specific code to work with the camera while it's active. Change-Id: Iec78bf4d632c71f02e830eb2ac05504370bba660
-rw-r--r--Android.mk6
-rw-r--r--src/com/android/camera/CameraActivity.java7
-rw-r--r--src/com/android/camera/app/DevicePluginBase.java35
-rw-r--r--src_plugin/com/android/camera/app/DevicePluginImpl.java27
4 files changed, 75 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk
index 5f44e3938..7ea428200 100644
--- a/Android.mk
+++ b/Android.mk
@@ -13,6 +13,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 f96d63433..e9056d2d2 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -74,6 +74,7 @@ import com.android.camera.app.CameraAppUI;
import com.android.camera.app.CameraController;
import com.android.camera.app.CameraProvider;
import com.android.camera.app.CameraServices;
+import com.android.camera.app.DevicePluginImpl;
import com.android.camera.app.LocationManager;
import com.android.camera.app.MemoryManager;
import com.android.camera.app.MemoryQuery;
@@ -210,6 +211,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;
@@ -529,6 +531,7 @@ public class CameraActivity extends QuickActivity
}
Log.v(TAG, "invoking onChangeCamera");
mCameraAppUI.onChangeCamera();
+ mDevicePlugin.onCameraOpened(camera);
}
private void resetExposureCompensationToDefault(CameraAgent.CameraProxy camera) {
@@ -1409,6 +1412,9 @@ public class CameraActivity extends QuickActivity
GcamHelper.init(getContentResolver());
ModulesInfo.setupModules(mAppContext, mModuleManager);
+ mDevicePlugin = new DevicePluginImpl();
+ mDevicePlugin.onCreate(mAppContext);
+
mSettingsManager = getServices().getSettingsManager();
mSettingsManager.addListener(this);
initPowerShutter();
@@ -1943,6 +1949,7 @@ public class CameraActivity extends QuickActivity
getContentResolver().unregisterContentObserver(mLocalVideosObserver);
getServices().getCaptureSessionManager().removeSessionListener(mSessionListener);
mCameraAppUI.onDestroy();
+ mDevicePlugin.onDestroy();
mModeListView.setVisibilityChangedListener(null);
mCameraController = null;
mSettingsManager = 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() {
+ }
+}