Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04abecbd authored by Michael Bestas's avatar Michael Bestas
Browse files

Improve permission string & cleanup code

Change-Id: Id0e4be70019fd03c165d4f95f1b5f6323e2802ea
parent 26fd0d7e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -842,6 +842,7 @@
    <string name="welcome_msg">Welcome to the CyanogenMod file manager.\n\nThis app allows you to explore the file system and do operations that could break your device. To prevent damage, the app will start in a safe, low-privileged mode.\n\nYou can access the advanced, full-privileged mode via Settings. It\'s your responsibility to ensure that an operation doesn\'t break your system.\n\nThe CyanogenMod Team</string>

    <string name="activity_not_found_exception">Couldn\'t find an app to open this file</string>
    <string name="storage_permissions_denied">Storage permissions denied!</string>

    <string name="storage_permissions_denied">The app cannot run without permission to write to external storage.</string>

</resources>
+3 −3
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.content.res.XmlResourceParser;
import android.database.Cursor;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.Manifest;
import android.net.Uri;
import android.nfc.NfcAdapter;
import android.nfc.NfcEvent;
@@ -495,14 +496,13 @@ public class NavigationActivity extends Activity

    private static final int REQUEST_CODE_STORAGE_PERMS = 321;
    private boolean hasPermissions() {
        String permission = "android.permission.WRITE_EXTERNAL_STORAGE";
        int res = checkCallingOrSelfPermission(permission);
        int res = checkCallingOrSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
        return (res == PackageManager.PERMISSION_GRANTED);
    }

    private void requestNecessaryPermissions() {
        String[] permissions = new String[] {
                "android.permission.WRITE_EXTERNAL_STORAGE"
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
        };
        requestPermissions(permissions, REQUEST_CODE_STORAGE_PERMS);
    }