diff options
author | Jay Wang <jaywang@codeaurora.org> | 2016-07-19 18:11:05 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-08-18 15:07:20 -0700 |
commit | 7d7a688e13c9ae8e958387ba0207c7a4af0e4df0 (patch) | |
tree | 666b825fc98eb5dbcb7f71bd9cd83448b7c74db8 /src/com/android/camera/PhotoModule.java | |
parent | 219fbf4d3d7c47039c79822af26bace2849375e4 (diff) | |
download | android_packages_apps_Snap-7d7a688e13c9ae8e958387ba0207c7a4af0e4df0.tar.gz android_packages_apps_Snap-7d7a688e13c9ae8e958387ba0207c7a4af0e4df0.tar.bz2 android_packages_apps_Snap-7d7a688e13c9ae8e958387ba0207c7a4af0e4df0.zip |
SnapdragonCamera: Remove custom location permission request window
When user enables the GPS locaion setting, use Android's run-time
permission request interface to get the permission.
Change-Id: Ib17171aeff5ccf20e2b00da08243dee1a3383611
CRs-Fixed: 1038039
Diffstat (limited to 'src/com/android/camera/PhotoModule.java')
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index ea717a449..e12ffc5a2 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -110,6 +110,7 @@ public class PhotoModule ShutterButton.OnShutterButtonListener, MediaSaveService.Listener, OnCountDownFinishedListener, + LocationManager.Listener, SensorEventListener { private static final String TAG = "CAM_PhotoModule"; @@ -571,7 +572,7 @@ public class PhotoModule mUI = new PhotoUI(activity, this, parent); initializeControlByIntent(); mQuickCapture = mActivity.getIntent().getBooleanExtra(EXTRA_QUICK_CAPTURE, false); - mLocationManager = new LocationManager(mActivity, mUI); + mLocationManager = new LocationManager(mActivity, this); mSensorManager = (SensorManager)(mActivity.getSystemService(Context.SENSOR_SERVICE)); Storage.setSaveSDCard( @@ -620,13 +621,23 @@ public class PhotoModule } mLocationPromptTriggered = true; - mUI.showLocationDialog(); + + /* Enable the location at the begining, always. + If the user denies the permission, it will be disabled + right away due to exception */ + enableRecordingLocation(true); + } + + @Override + public void waitingLocationPermissionResult(boolean result) { + mLocationManager.waitingLocationPermissionResult(result); } @Override public void enableRecordingLocation(boolean enable) { setLocationPreference(enable ? RecordLocationPreference.VALUE_ON : RecordLocationPreference.VALUE_OFF); + mLocationManager.recordLocation(enable); } @Override @@ -672,7 +683,9 @@ public class PhotoModule .apply(); // TODO: Fix this to use the actual onSharedPreferencesChanged listener // instead of invoking manually - onSharedPreferenceChanged(); + if (mUI.mMenuInitialized) { + onSharedPreferenceChanged(); + } } private void onCameraOpened() { @@ -4732,4 +4745,9 @@ public class PhotoModule return ((mCameraState == LONGSHOT) && (mLongshotSnapNum == mReceivedSnapNum) && !mLongshotActive); } + + @Override + public void onErrorListener(int error) { + enableRecordingLocation(false); + } } |