summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSanjeev Garg <sangarg@codeaurora.org>2015-08-06 16:40:12 +0530
committerSanjeev Garg <sangarg@codeaurora.org>2015-08-06 16:40:12 +0530
commit58f6005c3b3a355f6065248947d88f04477397fa (patch)
tree65087e7135958d21ce5aa48856f4f055dd598189 /src
parenta7444215df8b707c4ccd505805d9e85b59266596 (diff)
downloadandroid_packages_apps_Snap-58f6005c3b3a355f6065248947d88f04477397fa.tar.gz
android_packages_apps_Snap-58f6005c3b3a355f6065248947d88f04477397fa.tar.bz2
android_packages_apps_Snap-58f6005c3b3a355f6065248947d88f04477397fa.zip
SnapdragonCamera: Improvement in open camera latency
setContentView(R.layout.camera_filmstrip) call in the app takes ~40 msec before actual openCamera call is made. This is adding to the total APP camera open latency. So Opening camera in parallel to the call to setContentView(R.layout.camera_filmstrip) to save this time. Change-Id: I8e3797e65d17021853e0e04873178a372f12f195
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/CameraActivity.java70
1 files changed, 36 insertions, 34 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 3f845db05..4209c5e62 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -1443,6 +1443,42 @@ public class CameraActivity extends Activity
mAudioManager.setMasterVolume(mShutterVol,0);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
+
+ LayoutInflater inflater = getLayoutInflater();
+ View rootLayout = inflater.inflate(R.layout.camera, null, false);
+ mCameraModuleRootView = rootLayout.findViewById(R.id.camera_app_root);
+
+ int moduleIndex = -1;
+ if (MediaStore.INTENT_ACTION_VIDEO_CAMERA.equals(getIntent().getAction())
+ || MediaStore.ACTION_VIDEO_CAPTURE.equals(getIntent().getAction())) {
+ moduleIndex = ModuleSwitcher.VIDEO_MODULE_INDEX;
+ } else if (MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA.equals(getIntent().getAction())
+ || MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE.equals(getIntent()
+ .getAction())) {
+ moduleIndex = ModuleSwitcher.PHOTO_MODULE_INDEX;
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ if (prefs.getInt(CameraSettings.KEY_STARTUP_MODULE_INDEX, -1)
+ == ModuleSwitcher.GCAM_MODULE_INDEX && GcamHelper.hasGcamCapture()) {
+ moduleIndex = ModuleSwitcher.GCAM_MODULE_INDEX;
+ }
+ } else if (MediaStore.ACTION_IMAGE_CAPTURE.equals(getIntent().getAction())
+ || MediaStore.ACTION_IMAGE_CAPTURE_SECURE.equals(getIntent().getAction())) {
+ moduleIndex = ModuleSwitcher.PHOTO_MODULE_INDEX;
+ } else {
+ // If the activity has not been started using an explicit intent,
+ // read the module index from the last time the user changed modes
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ moduleIndex = prefs.getInt(CameraSettings.KEY_STARTUP_MODULE_INDEX, -1);
+ if ((moduleIndex == ModuleSwitcher.GCAM_MODULE_INDEX &&
+ !GcamHelper.hasGcamCapture()) || moduleIndex < 0) {
+ moduleIndex = ModuleSwitcher.PHOTO_MODULE_INDEX;
+ }
+ }
+
+ mOrientationListener = new MyOrientationEventListener(this);
+ setModuleFromIndex(moduleIndex);
+ mCurrentModule.init(this, mCameraModuleRootView);
+
setContentView(R.layout.camera_filmstrip);
mActionBar = getActionBar();
@@ -1466,9 +1502,6 @@ public class CameraActivity extends Activity
.getGcamProcessingManager();
mPanoramaManager.addTaskListener(mStitchingListener);
mPlaceholderManager.addTaskListener(mPlaceholderListener);
- LayoutInflater inflater = getLayoutInflater();
- View rootLayout = inflater.inflate(R.layout.camera, null, false);
- mCameraModuleRootView = rootLayout.findViewById(R.id.camera_app_root);
mPanoStitchingPanel = findViewById(R.id.pano_stitching_progress_panel);
mBottomProgress = (ProgressBar) findViewById(R.id.pano_stitching_progress_bar);
mCameraPreviewData = new CameraPreviewData(rootLayout,
@@ -1488,37 +1521,6 @@ public class CameraActivity extends Activity
// Set up the camera preview first so the preview shows up ASAP.
mFilmStripView.setListener(mFilmStripListener);
- int moduleIndex = -1;
- if (MediaStore.INTENT_ACTION_VIDEO_CAMERA.equals(getIntent().getAction())
- || MediaStore.ACTION_VIDEO_CAPTURE.equals(getIntent().getAction())) {
- moduleIndex = ModuleSwitcher.VIDEO_MODULE_INDEX;
- } else if (MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA.equals(getIntent().getAction())
- || MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE.equals(getIntent()
- .getAction())) {
- moduleIndex = ModuleSwitcher.PHOTO_MODULE_INDEX;
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
- if (prefs.getInt(CameraSettings.KEY_STARTUP_MODULE_INDEX, -1)
- == ModuleSwitcher.GCAM_MODULE_INDEX && GcamHelper.hasGcamCapture()) {
- moduleIndex = ModuleSwitcher.GCAM_MODULE_INDEX;
- }
- } else if (MediaStore.ACTION_IMAGE_CAPTURE.equals(getIntent().getAction())
- || MediaStore.ACTION_IMAGE_CAPTURE_SECURE.equals(getIntent().getAction())) {
- moduleIndex = ModuleSwitcher.PHOTO_MODULE_INDEX;
- } else {
- // If the activity has not been started using an explicit intent,
- // read the module index from the last time the user changed modes
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
- moduleIndex = prefs.getInt(CameraSettings.KEY_STARTUP_MODULE_INDEX, -1);
- if ((moduleIndex == ModuleSwitcher.GCAM_MODULE_INDEX &&
- !GcamHelper.hasGcamCapture()) || moduleIndex < 0) {
- moduleIndex = ModuleSwitcher.PHOTO_MODULE_INDEX;
- }
- }
-
- mOrientationListener = new MyOrientationEventListener(this);
- setModuleFromIndex(moduleIndex);
- mCurrentModule.init(this, mCameraModuleRootView);
-
if (!mSecureCamera) {
mDataAdapter = mWrappedDataAdapter;
mFilmStripView.setDataAdapter(mDataAdapter);