summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2015-03-03 10:44:52 +0100
committerMichael Bestas <mikeioannina@gmail.com>2015-12-03 23:59:56 +0200
commit8b2cd20977404af09251a5734808dcf6b09899e5 (patch)
treed6b1ca5245e62bab1d326875e42b6348ffd72a5f /src
parentb25f7ac91dfec0ef82013526c63fdab35e5fb54a (diff)
downloadandroid_packages_apps_Camera2-8b2cd20977404af09251a5734808dcf6b09899e5.tar.gz
android_packages_apps_Camera2-8b2cd20977404af09251a5734808dcf6b09899e5.tar.bz2
android_packages_apps_Camera2-8b2cd20977404af09251a5734808dcf6b09899e5.zip
Introduce a 'device plugin' concept.
It allows device specific code to work with the camera while it's active. Change-Id: Iec78bf4d632c71f02e830eb2ac05504370bba660
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/CameraActivity.java7
-rw-r--r--src/com/android/camera/app/DevicePluginBase.java35
2 files changed, 42 insertions, 0 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index d78590f18..80a931999 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,7 @@ public class CameraActivity extends QuickActivity
if (mModeListView != null) {
mModeListView.setVisibilityChangedListener(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) {
+ }
+}