summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzafir <zafir@google.com>2015-07-18 00:40:10 (GMT)
committerAndroid Git Automerger <android-git-automerger@android.com>2015-07-18 00:40:10 (GMT)
commit5619957164de0211e7a8fde5cae199ae4e4cb874 (patch)
treedbd799bdc02a11cbea1f3bacdd641182745f9475
parente972aa8f5ed95b8f58afe8e05084cd5f3e6f8aa7 (diff)
parent63704a163384b4e9c610e81a7eab4c6a634dbd36 (diff)
downloadandroid_packages_apps_Camera2-5619957164de0211e7a8fde5cae199ae4e4cb874.zip
android_packages_apps_Camera2-5619957164de0211e7a8fde5cae199ae4e4cb874.tar.gz
android_packages_apps_Camera2-5619957164de0211e7a8fde5cae199ae4e4cb874.tar.bz2
am 63704a16: am 2506ff92: am ac0e2425: Fixes to M permissions.
* commit '63704a163384b4e9c610e81a7eab4c6a634dbd36': Fixes to M permissions.
-rw-r--r--src/com/android/camera/CameraActivity.java24
-rw-r--r--src/com/android/camera/PermissionsActivity.java5
2 files changed, 13 insertions, 16 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 1897b28..3997705 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -1440,6 +1440,12 @@ public class CameraActivity extends QuickActivity
mFeatureConfig = OneCameraFeatureConfigCreator.createDefault(getContentResolver(),
getServices().getMemoryManager());
mFatalErrorHandler = new FatalErrorHandlerImpl(this);
+ checkPermissions();
+ if (!mHasCriticalPermissions) {
+ Log.v(TAG, "onCreate: Missing critical permissions.");
+ finish();
+ return;
+ }
profile.mark();
if (!Glide.isSetup()) {
Context context = getAndroidContext();
@@ -1621,6 +1627,8 @@ public class CameraActivity extends QuickActivity
mCurrentModule.init(this, isSecureCamera(), isCaptureIntent());
profile.mark("Init CurrentModule");
+ preloadFilmstripItems();
+
setupNfcBeamPush();
mLocalImagesObserver = new FilmstripContentObserver();
@@ -1850,7 +1858,8 @@ public class CameraActivity extends QuickActivity
mPaused = false;
checkPermissions();
if (!mHasCriticalPermissions) {
- Log.v(TAG, "Missing critical permissions.");
+ Log.v(TAG, "onResume: Missing critical permissions.");
+ finish();
return;
}
if (!mSecureCamera) {
@@ -1897,18 +1906,8 @@ public class CameraActivity extends QuickActivity
!mSettingsManager.getBoolean(SettingsManager.SCOPE_GLOBAL, Keys.KEY_HAS_SEEN_PERMISSIONS_DIALOGS)) ||
!mHasCriticalPermissions) {
Intent intent = new Intent(this, PermissionsActivity.class);
- startActivityForResult(intent, PERMISSIONS_ACTIVITY_REQUEST_CODE);
- }
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- // Close the app if critical permissions are missing.
- if (requestCode == PERMISSIONS_ACTIVITY_REQUEST_CODE && resultCode == PERMISSIONS_RESULT_CODE_FAILED) {
+ startActivity(intent);
finish();
- } else if (requestCode == PERMISSIONS_ACTIVITY_REQUEST_CODE && resultCode == PERMISSIONS_RESULT_CODE_OK) {
- mHasCriticalPermissions = true;
}
}
@@ -1964,7 +1963,6 @@ public class CameraActivity extends QuickActivity
Profile profile = mProfiler.create("CameraActivity.resume").start();
CameraPerformanceTracker.onEvent(CameraPerformanceTracker.ACTIVITY_RESUME);
Log.v(TAG, "Build info: " + Build.DISPLAY);
- preloadFilmstripItems();
updateStorageSpaceAndHint(null);
mLastLayoutOrientation = getResources().getConfiguration().orientation;
diff --git a/src/com/android/camera/PermissionsActivity.java b/src/com/android/camera/PermissionsActivity.java
index 9d2708f..a3981ef 100644
--- a/src/com/android/camera/PermissionsActivity.java
+++ b/src/com/android/camera/PermissionsActivity.java
@@ -214,7 +214,8 @@ public class PermissionsActivity extends QuickActivity {
}
private void handlePermissionsSuccess() {
- setResult(RESULT_CODE_OK, null);
+ Intent intent = new Intent(this, CameraActivity.class);
+ startActivity(intent);
finish();
}
@@ -226,7 +227,6 @@ public class PermissionsActivity extends QuickActivity {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
- setResult(RESULT_CODE_FAILED, null);
finish();
}
return true;
@@ -236,7 +236,6 @@ public class PermissionsActivity extends QuickActivity {
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- setResult(RESULT_CODE_FAILED, null);
finish();
}
})