Java Code Examples for android.content.Context#getNoBackupFilesDir()

The following examples show how to use android.content.Context#getNoBackupFilesDir() . 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: YoutubeDL.java    From youtubedl-android with GNU General Public License v3.0 6 votes vote down vote up
synchronized public void init(Context appContext) throws YoutubeDLException {
    if (initialized) return;

    File baseDir = new File(appContext.getNoBackupFilesDir(), baseName);
    if(!baseDir.exists()) baseDir.mkdir();

    File packagesDir = new File(baseDir, packagesRoot);
    binDir = new File(appContext.getApplicationInfo().nativeLibraryDir);
    pythonPath = new File(binDir, pythonBinName);
    File pythonDir = new File(packagesDir, pythonDirName);
    File ffmpegDir = new File(packagesDir, ffmpegDirName);

    File youtubeDLDir = new File(baseDir, youtubeDLDirName);
    youtubeDLPath = new File(youtubeDLDir, youtubeDLBin);

    ENV_LD_LIBRARY_PATH = pythonDir.getAbsolutePath() + "/usr/lib" + ":" + ffmpegDir.getAbsolutePath() + "/usr/lib";
    ENV_SSL_CERT_FILE = pythonDir.getAbsolutePath() + "/usr/etc/tls/cert.pem";
    ENV_PYTHONHOME = pythonDir.getAbsolutePath() + "/usr";

    initPython(appContext, pythonDir);
    initYoutubeDL(appContext, youtubeDLDir);

    initialized = true;
}
 
Example 2
Source File: FFmpeg.java    From youtubedl-android with GNU General Public License v3.0 5 votes vote down vote up
synchronized public void init(Context appContext) throws YoutubeDLException {
    if (initialized) return;

    File baseDir = new File(appContext.getNoBackupFilesDir(), baseName);
    if(!baseDir.exists()) baseDir.mkdir();

    binDir = new File(appContext.getApplicationInfo().nativeLibraryDir);

    File packagesDir = new File(baseDir, packagesRoot);
    File ffmpegDir = new File(packagesDir, ffmegDirName);
    initFFmpeg(appContext, ffmpegDir);

    initialized = true;
}
 
Example 3
Source File: FullBackup.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
BackupScheme(Context context) {
    mFullBackupContent = context.getApplicationInfo().fullBackupContent;
    mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
    mPackageManager = context.getPackageManager();
    mPackageName = context.getPackageName();

    // System apps have control over where their default storage context
    // is pointed, so we're always explicit when building paths.
    final Context ceContext = context.createCredentialProtectedStorageContext();
    FILES_DIR = ceContext.getFilesDir();
    DATABASE_DIR = ceContext.getDatabasePath("foo").getParentFile();
    ROOT_DIR = ceContext.getDataDir();
    SHAREDPREF_DIR = ceContext.getSharedPreferencesPath("foo").getParentFile();
    CACHE_DIR = ceContext.getCacheDir();
    NOBACKUP_DIR = ceContext.getNoBackupFilesDir();

    final Context deContext = context.createDeviceProtectedStorageContext();
    DEVICE_FILES_DIR = deContext.getFilesDir();
    DEVICE_DATABASE_DIR = deContext.getDatabasePath("foo").getParentFile();
    DEVICE_ROOT_DIR = deContext.getDataDir();
    DEVICE_SHAREDPREF_DIR = deContext.getSharedPreferencesPath("foo").getParentFile();
    DEVICE_CACHE_DIR = deContext.getCacheDir();
    DEVICE_NOBACKUP_DIR = deContext.getNoBackupFilesDir();

    if (android.os.Process.myUid() != Process.SYSTEM_UID) {
        EXTERNAL_DIR = context.getExternalFilesDir(null);
    } else {
        EXTERNAL_DIR = null;
    }
}
 
Example 4
Source File: YoutubeDLUpdater.java    From youtubedl-android with GNU General Public License v3.0 4 votes vote down vote up
@NonNull
private static File getYoutubeDLDir(Context appContext) {
    File baseDir = new File(appContext.getNoBackupFilesDir(), YoutubeDL.baseName);
    return new File(baseDir, YoutubeDL.youtubeDLDirName);
}
 
Example 5
Source File: ContextCompatApi21.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static File getNoBackupFilesDir(Context context) {
    return context.getNoBackupFilesDir();
}