From 367758c24f18ea83a17a5ce600a043876b7af11d Mon Sep 17 00:00:00 2001 From: mingwax Date: Thu, 22 Sep 2016 09:45:35 +0800 Subject: 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 --- src/com/android/camera/PermissionsActivity.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/com/android/camera/PermissionsActivity.java b/src/com/android/camera/PermissionsActivity.java index 2bb5f0f7c..e8df5c571 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); @@ -216,4 +219,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(); + } + } } -- cgit v1.2.3