summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/PermissionsActivity.java
diff options
context:
space:
mode:
authormingwax <mingwax@codeaurora.org>2016-09-22 09:45:35 +0800
committermingwax <mingwax@codeaurora.org>2016-09-22 11:01:53 +0800
commit24b8d1a492bee334741210e20c67acdf13b82561 (patch)
treedf580dfd1c59fc5700c4d96d07d6014d8d635f7b /src/com/android/camera/PermissionsActivity.java
parentdaee7f193c91bee48ce3b12fc7a0e988aa8ce02f (diff)
downloadandroid_packages_apps_Snap-24b8d1a492bee334741210e20c67acdf13b82561.tar.gz
android_packages_apps_Snap-24b8d1a492bee334741210e20c67acdf13b82561.tar.bz2
android_packages_apps_Snap-24b8d1a492bee334741210e20c67acdf13b82561.zip
SnapdragonCamera: Fix FC for NullPointerException
Permission without the case of granted, through the mms to add attachments to enter the Camera, it will lead to call two times PermissionActivity, which led to FC and the wrong interface. Add a logical judgment to call one time PermissionActivity Change-Id: I8b3f287eecb1dfc8f8c5a26a9f0b9dbe187d8ce6 CRs-Fixed: 1069373
Diffstat (limited to 'src/com/android/camera/PermissionsActivity.java')
-rw-r--r--src/com/android/camera/PermissionsActivity.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/camera/PermissionsActivity.java b/src/com/android/camera/PermissionsActivity.java
index 741e1b021..013c02c29 100644
--- a/src/com/android/camera/PermissionsActivity.java
+++ b/src/com/android/camera/PermissionsActivity.java
@@ -11,6 +11,8 @@ import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import org.codeaurora.snapcam.R;
+import android.preference.PreferenceManager;
+import android.content.SharedPreferences;
/**
* Activity that shows permissions request dialogs and handles lack of critical permissions.
@@ -182,6 +184,7 @@ public class PermissionsActivity extends Activity {
private void handlePermissionsSuccess() {
if (mIntent != null) {
+ setRequestPermissionShow();
mIsReturnResult = true;
mIntent.setClass(this, CameraActivity.class);
mIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
@@ -217,4 +220,14 @@ public class PermissionsActivity extends Activity {
})
.show();
}
+
+ private void setRequestPermissionShow() {
+ final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ boolean isRequestShown = prefs.getBoolean(CameraSettings.KEY_REQUEST_PERMISSION, false);
+ if (!isRequestShown) {
+ SharedPreferences.Editor editor = prefs.edit();
+ editor.putBoolean(CameraSettings.KEY_REQUEST_PERMISSION, true);
+ editor.apply();
+ }
+ }
}