Available Methods
- getSystemService ( )
- obtainStyledAttributes ( )
- startActivity ( )
- getSharedPreferences ( )
- getApplicationContext ( )
- getString ( )
- getResources ( )
- getPackageManager ( )
- startService ( )
- getPackageName ( )
- getContentResolver ( )
- sendBroadcast ( )
- getCacheDir ( )
- getFilesDir ( )
- getApplicationInfo ( )
- toString ( )
- registerReceiver ( )
- getAssets ( )
- getExternalFilesDir ( )
- getExternalCacheDir ( )
- getDir ( )
- unregisterReceiver ( )
- bindService ( )
- openFileOutput ( )
- stopService ( )
- checkCallingOrSelfPermission ( )
- getTheme ( )
- unbindService ( )
- startForegroundService ( )
- getMainLooper ( )
- deleteDatabase ( )
- getClassLoader ( )
- getDatabasePath ( )
- openFileInput ( )
- MODE_PRIVATE
- checkSelfPermission ( )
- getDrawable ( )
- checkPermission ( )
- deleteFile ( )
- createConfigurationContext ( )
- getColor ( )
- grantUriPermission ( )
- CONTEXT_DEVICE_PROTECTED_STORAGE
- getExternalFilesDirs ( )
- getFileStreamPath ( )
- CONTEXT_CREDENTIAL_PROTECTED_STORAGE
- sendOrderedBroadcast ( )
- setTheme ( )
- MODE_MULTI_PROCESS
- checkCallingOrSelfUriPermission ( )
- getText ( )
- createPackageContext ( )
- openOrCreateDatabase ( )
- isRestricted ( )
- NOTIFICATION_SERVICE
- BIND_AUTO_CREATE
- startActivities ( )
- getPackageCodePath ( )
- createDeviceProtectedStorageContext ( )
- getExternalCacheDirs ( )
- CONTEXT_IGNORE_SECURITY
- registerComponentCallbacks ( )
- revokeUriPermission ( )
- getColorStateList ( )
- CONTEXT_RESTRICTED
- checkCallingPermission ( )
- BIND_IMPORTANT
- deleteSharedPreferences ( )
- getClass ( )
- getCodeCacheDir ( )
- BIND_DEBUG_UNBIND
- MODE_WORLD_READABLE
- startServiceAsUser ( )
- getSharedPreferencesPath ( )
- enforceCallingOrSelfPermission ( )
- BIND_TREAT_LIKE_ACTIVITY
- getObbDir ( )
- getObbDirs ( )
- LOCATION_SERVICE
- moveSharedPreferencesFrom ( )
- CONTEXT_INCLUDE_CODE
- bindServiceAsUser ( )
- BIND_ABOVE_CLIENT
- removeStickyBroadcast ( )
Related Classes
- java.io.File
- java.io.InputStream
- android.os.Bundle
- android.view.View
- java.util.Date
- android.util.Log
- android.widget.TextView
- android.content.Intent
- android.view.ViewGroup
- android.app.Activity
- java.io.FileOutputStream
- java.util.Locale
- android.view.LayoutInflater
- android.os.Build
- android.widget.Toast
- android.util.AttributeSet
- android.widget.ImageView
- android.graphics.Color
- android.os.Handler
- android.net.Uri
- android.graphics.Bitmap
- android.text.TextUtils
- android.graphics.Paint
- android.graphics.drawable.Drawable
- android.widget.LinearLayout
Java Code Examples for android.content.Context#MODE_WORLD_READABLE
The following examples show how to use
android.content.Context#MODE_WORLD_READABLE .
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: YTutils.java From YTPlayer with GNU General Public License v3.0 | 5 votes |
private Uri getApkUri(String path) { // Before N, a MODE_WORLD_READABLE file could be passed via the ACTION_INSTALL_PACKAGE // Intent. Since N, MODE_WORLD_READABLE files are forbidden, and a FileProvider is // recommended. boolean useFileProvider = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N; // String tempFilename = "tmp.apk"; // byte[] buffer = new byte[16384]; int fileMode = useFileProvider ? Context.MODE_PRIVATE : Context.MODE_WORLD_READABLE; /* try (InputStream is = new FileInputStream(new File(path)); FileOutputStream fout = context.openFileOutput(tempFilename, fileMode)) { int n; while ((n = is.read(buffer)) >= 0) { fout.write(buffer, 0, n); } } catch (IOException e) { Log.i(TAG + ":getApkUri", "Failed to write temporary APK file", e); }*/ if (useFileProvider) { // File toInstall = new File(context.getFilesDir(), tempFilename); File toInstall = new File(path); return FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID+".provider", toInstall); } else { return Uri.fromFile(new File(path)); } }
Example 2
Source File: XposedApp.java From EdXposedManager with GNU General Public License v3.0 | 5 votes |
@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); }