diff options
| author | Sascha Haeberling <haeberling@google.com> | 2013-04-24 10:58:58 -0700 |
|---|---|---|
| committer | Sascha Haeberling <haeberling@google.com> | 2013-04-24 10:58:58 -0700 |
| commit | 3224646e36b0838c6c07c8ff5e6281eca3cd040d (patch) | |
| tree | a3f6e3ed7b8dddb03060aadb5b87c54ea45b9499 /src | |
| parent | 0c71308c9d2a72d4a3faf00242707de773d5beba (diff) | |
| download | android_packages_apps_Gallery2-3224646e36b0838c6c07c8ff5e6281eca3cd040d.tar.gz android_packages_apps_Gallery2-3224646e36b0838c6c07c8ff5e6281eca3cd040d.tar.bz2 android_packages_apps_Gallery2-3224646e36b0838c6c07c8ff5e6281eca3cd040d.zip | |
Store location for SRI panoramas.
Bug: 8692005
Change-Id: I1499de0103e518ee321ebb0c566b9fb4a7a853d3
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/camera/PanoramaModule.java | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/com/android/camera/PanoramaModule.java b/src/com/android/camera/PanoramaModule.java index c83bf825d..007ea7a4c 100644 --- a/src/com/android/camera/PanoramaModule.java +++ b/src/com/android/camera/PanoramaModule.java @@ -35,6 +35,7 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.hardware.Camera.Parameters; import android.hardware.Camera.Size; +import android.location.Location; import android.net.Uri; import android.os.AsyncTask; import android.os.Handler; @@ -176,6 +177,9 @@ public class PanoramaModule implements CameraModule, private boolean mPaused; private boolean mIsCreatingRenderer; + private LocationManager mLocationManager; + private ComboPreferences mPreferences; + private class MosaicJpeg { public MosaicJpeg(byte[] data, int width, int height) { this.data = data; @@ -279,6 +283,10 @@ public class PanoramaModule implements CameraModule, mGLRootView = (GLRootView) mActivity.getGLRoot(); + mPreferences = new ComboPreferences(mActivity); + CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal()); + mLocationManager = new LocationManager(mActivity, null); + mMainHandler = new Handler() { @Override public void handleMessage(Message msg) { @@ -902,6 +910,7 @@ public class PanoramaModule implements CameraModule, mActivity.getResources().getString(R.string.pano_file_name_format), mTimeTaken); String filepath = Storage.generateFilepath(filename); + Location loc = mLocationManager.getCurrentLocation(); ExifInterface exif = new ExifInterface(); try { exif.readExif(jpegData); @@ -910,19 +919,27 @@ public class PanoramaModule implements CameraModule, TimeZone.getDefault()); exif.setTag(exif.buildTag(ExifInterface.TAG_ORIENTATION, ExifInterface.getOrientationValueForRotation(orientation))); + writeLocation(loc, exif); exif.writeExif(jpegData, filepath); } catch (IOException e) { Log.e(TAG, "Cannot set exif for " + filepath, e); Storage.writeFile(filepath, jpegData); } - int jpegLength = (int) (new File(filepath).length()); return Storage.addImage(mContentResolver, filename, mTimeTaken, - null, orientation, jpegLength, filepath, width, height); + loc, orientation, jpegLength, filepath, width, height); } return null; } + private static void writeLocation(Location location, ExifInterface exif) { + if (location == null) { + return; + } + exif.addGpsTags(location.getLatitude(), location.getLongitude()); + exif.setTag(exif.buildTag(ExifInterface.TAG_GPS_PROCESSING_METHOD, location.getProvider())); + } + private void clearMosaicFrameProcessorIfNeeded() { if (!mPaused || mThreadRunning) return; // Only clear the processor if it is initialized by this activity @@ -943,6 +960,7 @@ public class PanoramaModule implements CameraModule, @Override public void onPauseBeforeSuper() { mPaused = true; + if (mLocationManager != null) mLocationManager.recordLocation(false); } @Override @@ -1059,6 +1077,11 @@ public class PanoramaModule implements CameraModule, } keepScreenOnAwhile(); + // Initialize location service. + boolean recordLocation = RecordLocationPreference.get(mPreferences, + mContentResolver); + mLocationManager.recordLocation(recordLocation); + // Dismiss open menu if exists. PopupManager.getInstance(mActivity).notifyShowPopup(null); mRootView.requestLayout(); |
