Java Code Examples for android.os.FileUtils#S_IRUSR

The following examples show how to use android.os.FileUtils#S_IRUSR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 7 votes vote down vote up
@SuppressWarnings("deprecation")
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 2
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 3
Source File: ContextImpl.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 4
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 5
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 6
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 7
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 8
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 9
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 10
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 11
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 12
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 13
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 14
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 15
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 16
Source File: ContextImpl.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
static void setFilePermissionsFromMode(String name, int mode,
        int extraPermissions) {
    int perms = FileUtils.S_IRUSR|FileUtils.S_IWUSR
        |FileUtils.S_IRGRP|FileUtils.S_IWGRP
        |extraPermissions;
    if ((mode&MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode&MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    if (DEBUG) {
        Log.i(TAG, "File " + name + ": mode=0x" + Integer.toHexString(mode)
              + ", perms=0x" + Integer.toHexString(perms));
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 17
Source File: XposedApp.java    From EdXposedManager with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
@SuppressLint({"WorldReadableFiles", "WorldWriteableFiles"})
public static void setFilePermissionsFromMode(String name, int mode) {
    int perms = FileUtils.S_IRUSR | FileUtils.S_IWUSR
            | FileUtils.S_IRGRP | FileUtils.S_IWGRP;
    if ((mode & Context.MODE_WORLD_READABLE) != 0) {
        perms |= FileUtils.S_IROTH;
    }
    if ((mode & Context.MODE_WORLD_WRITEABLE) != 0) {
        perms |= FileUtils.S_IWOTH;
    }
    FileUtils.setPermissions(name, perms, -1, -1);
}
 
Example 18
Source File: SQLiteOpenHelper.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private static void setFilePermissionsForDb(String dbPath) {
    int perms = FileUtils.S_IRUSR | FileUtils.S_IWUSR | FileUtils.S_IRGRP | FileUtils.S_IWGRP;
    FileUtils.setPermissions(dbPath, perms, -1, -1);
}