diff options
author | Sanjeev Garg <sangarg@codeaurora.org> | 2015-08-06 16:40:12 +0530 |
---|---|---|
committer | Daniel Hillenbrand <codeworkx@cyanogenmod.org> | 2016-01-08 22:48:35 -0800 |
commit | 04f6b228b29b1ea1b891df5e0a21a43527d1ef53 (patch) | |
tree | c5ba3fdd6e0c75f63c66747ed76b5dcab10a9691 | |
parent | 9f076a3133f830ca5df8f2c395436413a8771b0d (diff) | |
download | android_packages_apps_Snap-04f6b228b29b1ea1b891df5e0a21a43527d1ef53.tar.gz android_packages_apps_Snap-04f6b228b29b1ea1b891df5e0a21a43527d1ef53.tar.bz2 android_packages_apps_Snap-04f6b228b29b1ea1b891df5e0a21a43527d1ef53.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
-rw-r--r-- | src/com/android/camera/CameraActivity.java | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index a9a6e219b..24535a6ac 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -1422,6 +1422,42 @@ public class CameraActivity extends Activity */ 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(); @@ -1445,9 +1481,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, @@ -1467,37 +1500,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); |