本文整理了Java中android.content.Context.createDeviceProtectedStorageContext()
方法的一些代码示例,展示了Context.createDeviceProtectedStorageContext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.createDeviceProtectedStorageContext()
方法的具体详情如下:
包路径:android.content.Context
类名称:Context
方法名:createDeviceProtectedStorageContext
暂无
代码示例来源:origin: oasisfeng/condom
@RequiresApi(N) @Override public Context createDeviceProtectedStorageContext() {
return mBase.createDeviceProtectedStorageContext();
}
代码示例来源:origin: Trumeet/MiPushFramework
@RequiresApi(N) @Override public Context createDeviceProtectedStorageContext() {
return mBase.createDeviceProtectedStorageContext();
}
代码示例来源:origin: topjohnwu/libsu
@Override
public boolean onInit(Context context, @NonNull Shell shell) {
Context de = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
? context.createDeviceProtectedStorageContext() : context;
File bbPath = new File(de.getFilesDir().getParentFile(), "busybox");
File bb = new File(bbPath, "busybox");
代码示例来源:origin: apsun/RemotePreferences
/**
* Called at application startup to register preference change listeners.
*
* @return Always returns {@code true}.
*/
@Override
public boolean onCreate() {
// We register the shared preference listeners whenever the provider
// is created. This method is called before almost all other code in
// the app, which ensures that we never miss a preference change.
for (RemotePreferenceFile file : mPrefFiles) {
Context context = getContext();
if (file.isDeviceProtected() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
context = context.createDeviceProtectedStorageContext();
}
SharedPreferences prefs = context.getSharedPreferences(file.getFileName(), Context.MODE_PRIVATE);
prefs.registerOnSharedPreferenceChangeListener(this);
mPreferences.put(file.getFileName(), prefs);
}
return true;
}
代码示例来源:origin: apsun/RemotePreferences
/**
* Listener for preference value changes in the local application.
* Re-raises the event through the
* {@link ContentResolver#notifyChange(Uri, ContentObserver)} API
* to any registered {@link ContentObserver} objects. Note that this
* is NOT called for {@link SharedPreferences.Editor#clear()}.
*
* @param prefs The preference file that changed.
* @param prefKey The preference key that changed.
*/
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String prefKey) {
RemotePreferenceFile prefFile = getSharedPreferencesFile(prefs);
Uri uri = getPreferenceUri(prefFile.getFileName(), prefKey);
Context context = getContext();
if (prefFile.isDeviceProtected() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
context = context.createDeviceProtectedStorageContext();
}
ContentResolver resolver = context.getContentResolver();
resolver.notifyChange(uri, null);
}
内容来源于网络,如有侵权,请联系作者删除!