summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/PermissionsActivity.java
diff options
context:
space:
mode:
authorjunjiez <junjiez@codeaurora.org>2016-08-05 10:59:39 +0800
committerjunjiez <junjiez@codeaurora.org>2016-08-08 09:33:49 +0800
commit9a4e6d0253792dea4e52cd180f3fd74cc9d65ab3 (patch)
tree9e59407a1080bd8702e7281c7d4f660d5684ad07 /src/com/android/camera/PermissionsActivity.java
parent9f65ee95c61d70d6f7c34cd8bedea61ff1cdf2d1 (diff)
downloadandroid_packages_apps_Snap-9a4e6d0253792dea4e52cd180f3fd74cc9d65ab3.tar.gz
android_packages_apps_Snap-9a4e6d0253792dea4e52cd180f3fd74cc9d65ab3.tar.bz2
android_packages_apps_Snap-9a4e6d0253792dea4e52cd180f3fd74cc9d65ab3.zip
SnapdragonCamera: fix invoke camera failture caused by permissions
When the other apps want to invoke camera by intent, if the permission needed by camera is not granted, camera will restart and the intent will be lost, so check the permission first before invoke camera with intents Change-Id: I2c403d2cd78453cc8afcda374969dac87a6becf6 CRs-Fixed: 1047924
Diffstat (limited to 'src/com/android/camera/PermissionsActivity.java')
-rw-r--r--src/com/android/camera/PermissionsActivity.java26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/com/android/camera/PermissionsActivity.java b/src/com/android/camera/PermissionsActivity.java
index 2b5901a58..785ee805a 100644
--- a/src/com/android/camera/PermissionsActivity.java
+++ b/src/com/android/camera/PermissionsActivity.java
@@ -33,16 +33,20 @@ public class PermissionsActivity extends Activity {
private boolean mFlagHasMicrophonePermission;
private boolean mFlagHasStoragePermission;
private boolean mCriticalPermissionDenied;
+ private Intent mIntent;
+ private boolean mIsReturnResult;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ mIntent = getIntent();
+ mIsReturnResult = false;
}
@Override
protected void onResume() {
super.onResume();
- if (!mCriticalPermissionDenied) {
+ if (!mCriticalPermissionDenied && !mIsReturnResult) {
mNumPermissionsToRequest = 0;
checkPermissions();
} else {
@@ -156,9 +160,16 @@ public class PermissionsActivity extends Activity {
}
private void handlePermissionsSuccess() {
- Intent intent = new Intent(this, CameraActivity.class);
- startActivity(intent);
- finish();
+ if (mIntent != null) {
+ mIsReturnResult = true;
+ mIntent.setClass(this, CameraActivity.class);
+ startActivityForResult(mIntent, 1);
+ } else {
+ mIsReturnResult = false;
+ Intent intent = new Intent(this, CameraActivity.class);
+ startActivity(intent);
+ finish();
+ }
}
private void handlePermissionsFailure() {
@@ -183,4 +194,11 @@ public class PermissionsActivity extends Activity {
})
.show();
}
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ setResult(resultCode, data);
+ finish();
+ }
}