From cdf13feab683c09c43aa1279be4cbe4e3943575e Mon Sep 17 00:00:00 2001 From: Michael W Date: Sun, 10 Nov 2019 17:16:53 +0100 Subject: Snap: Handle SDCard-removed case * When the storage path has been set to SDCard but the card has been removed, there is currently no way to alter the setting and to get your cam to work properly again * Check the writeable-state of the sdcard on startup and fall back to using the internal storage in that case * The startup-flag is used to keep the current behaviour with removed SDcards while cam is still active * Fixes: https://gitlab.com/LineageOS/issues/android/issues/1376 Change-Id: Ib408883a6810693c93488f8a02fe061c56932d1d --- src/com/android/camera/CameraActivity.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index e7d66e7f6..f92f7b206 100755 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -280,6 +280,8 @@ public class CameraActivity extends Activity private WakeLock mWakeLock; private static final int REFOCUS_ACTIVITY_CODE = 1; + private boolean mIsStartup = true; + private class MyOrientationEventListener extends OrientationEventListener { public MyOrientationEventListener(Context context) { @@ -2033,6 +2035,12 @@ public class CameraActivity extends Activity } protected void updateStorageSpaceAndHint() { + if (mIsStartup) { + if (!SDCard.instance().isWriteable()) { + Storage.setSaveSDCard(false); + } + mIsStartup = false; + } updateStorageSpace(); updateStorageHint(mStorageSpaceBytes); } -- cgit v1.2.3