Java Code Examples for android.content.Context#CONTEXT_DEVICE_PROTECTED_STORAGE
The following examples show how to use
android.content.Context#CONTEXT_DEVICE_PROTECTED_STORAGE .
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 | 5 votes |
@Override public Context createCredentialProtectedStorageContext() { final int flags = (mFlags & ~Context.CONTEXT_DEVICE_PROTECTED_STORAGE) | Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE; return new ContextImpl(this, mMainThread, mPackageInfo, mActivityToken, mUser, flags, mDisplay, null, Display.INVALID_DISPLAY); }
Example 2
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public Context createCredentialProtectedStorageContext() { final int flags = (mFlags & ~Context.CONTEXT_DEVICE_PROTECTED_STORAGE) | Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE; return new ContextImpl(this, mMainThread, mPackageInfo, mActivityToken, mUser, flags, mDisplay, null, Display.INVALID_DISPLAY); }
Example 3
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public Context createDeviceProtectedStorageContext() { final int flags = (mFlags & ~Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE) | Context.CONTEXT_DEVICE_PROTECTED_STORAGE; return new ContextImpl(this, mMainThread, mPackageInfo, mSplitName, mActivityToken, mUser, flags, mClassLoader); }
Example 4
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public Context createCredentialProtectedStorageContext() { final int flags = (mFlags & ~Context.CONTEXT_DEVICE_PROTECTED_STORAGE) | Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE; return new ContextImpl(this, mMainThread, mPackageInfo, mSplitName, mActivityToken, mUser, flags, mClassLoader); }
Example 5
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public Context createCredentialProtectedStorageContext() { final int flags = (mFlags & ~Context.CONTEXT_DEVICE_PROTECTED_STORAGE) | Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE; return new ContextImpl(this, mMainThread, mPackageInfo, mSplitName, mActivityToken, mUser, flags, mClassLoader, null); }
Example 6
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public Context createCredentialProtectedStorageContext() { final int flags = (mFlags & ~Context.CONTEXT_DEVICE_PROTECTED_STORAGE) | Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE; return new ContextImpl(this, mMainThread, mPackageInfo, mSplitName, mActivityToken, mUser, flags, mClassLoader); }
Example 7
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public Context createDeviceProtectedStorageContext() { final int flags = (mFlags & ~Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE) | Context.CONTEXT_DEVICE_PROTECTED_STORAGE; return new ContextImpl(this, mMainThread, mPackageInfo, mSplitName, mActivityToken, mUser, flags, mClassLoader); }
Example 8
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public Context createCredentialProtectedStorageContext() { final int flags = (mFlags & ~Context.CONTEXT_DEVICE_PROTECTED_STORAGE) | Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE; return new ContextImpl(this, mMainThread, mPackageInfo, mSplitName, mActivityToken, mUser, flags, mClassLoader); }
Example 9
Source File: ContextImpl.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
@Override public boolean isDeviceProtectedStorage() { return (mFlags & Context.CONTEXT_DEVICE_PROTECTED_STORAGE) != 0; }
Example 10
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
private ContextImpl(@Nullable ContextImpl container, @NonNull ActivityThread mainThread, @NonNull LoadedApk packageInfo, @Nullable String splitName, @Nullable IBinder activityToken, @Nullable UserHandle user, int flags, @Nullable ClassLoader classLoader) { mOuterContext = this; // If creator didn't specify which storage to use, use the default // location for application. if ((flags & (Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE | Context.CONTEXT_DEVICE_PROTECTED_STORAGE)) == 0) { final File dataDir = packageInfo.getDataDirFile(); if (Objects.equals(dataDir, packageInfo.getCredentialProtectedDataDirFile())) { flags |= Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE; } else if (Objects.equals(dataDir, packageInfo.getDeviceProtectedDataDirFile())) { flags |= Context.CONTEXT_DEVICE_PROTECTED_STORAGE; } } mMainThread = mainThread; mActivityToken = activityToken; mFlags = flags; if (user == null) { user = Process.myUserHandle(); } mUser = user; mPackageInfo = packageInfo; mSplitName = splitName; mClassLoader = classLoader; mResourcesManager = ResourcesManager.getInstance(); if (container != null) { mBasePackageName = container.mBasePackageName; mOpPackageName = container.mOpPackageName; setResources(container.mResources); mDisplay = container.mDisplay; } else { mBasePackageName = packageInfo.mPackageName; ApplicationInfo ainfo = packageInfo.getApplicationInfo(); if (ainfo.uid == Process.SYSTEM_UID && ainfo.uid != Process.myUid()) { // Special case: system components allow themselves to be loaded in to other // processes. For purposes of app ops, we must then consider the context as // belonging to the package of this process, not the system itself, otherwise // the package+uid verifications in app ops will fail. mOpPackageName = ActivityThread.currentPackageName(); } else { mOpPackageName = mBasePackageName; } } mContentResolver = new ApplicationContentResolver(this, mainThread, user); }
Example 11
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public boolean isDeviceProtectedStorage() { return (mFlags & Context.CONTEXT_DEVICE_PROTECTED_STORAGE) != 0; }
Example 12
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
private ContextImpl(@Nullable ContextImpl container, @NonNull ActivityThread mainThread, @NonNull LoadedApk packageInfo, @Nullable String splitName, @Nullable IBinder activityToken, @Nullable UserHandle user, int flags, @Nullable ClassLoader classLoader, @Nullable String overrideOpPackageName) { mOuterContext = this; // If creator didn't specify which storage to use, use the default // location for application. if ((flags & (Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE | Context.CONTEXT_DEVICE_PROTECTED_STORAGE)) == 0) { final File dataDir = packageInfo.getDataDirFile(); if (Objects.equals(dataDir, packageInfo.getCredentialProtectedDataDirFile())) { flags |= Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE; } else if (Objects.equals(dataDir, packageInfo.getDeviceProtectedDataDirFile())) { flags |= Context.CONTEXT_DEVICE_PROTECTED_STORAGE; } } mMainThread = mainThread; mActivityToken = activityToken; mFlags = flags; if (user == null) { user = Process.myUserHandle(); } mUser = user; mPackageInfo = packageInfo; mSplitName = splitName; mClassLoader = classLoader; mResourcesManager = ResourcesManager.getInstance(); String opPackageName; if (container != null) { mBasePackageName = container.mBasePackageName; opPackageName = container.mOpPackageName; setResources(container.mResources); mDisplay = container.mDisplay; } else { mBasePackageName = packageInfo.mPackageName; ApplicationInfo ainfo = packageInfo.getApplicationInfo(); if (ainfo.uid == Process.SYSTEM_UID && ainfo.uid != Process.myUid()) { // Special case: system components allow themselves to be loaded in to other // processes. For purposes of app ops, we must then consider the context as // belonging to the package of this process, not the system itself, otherwise // the package+uid verifications in app ops will fail. opPackageName = ActivityThread.currentPackageName(); } else { opPackageName = mBasePackageName; } } mOpPackageName = overrideOpPackageName != null ? overrideOpPackageName : opPackageName; mContentResolver = new ApplicationContentResolver(this, mainThread); }
Example 13
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
private ContextImpl(@Nullable ContextImpl container, @NonNull ActivityThread mainThread, @NonNull LoadedApk packageInfo, @Nullable String splitName, @Nullable IBinder activityToken, @Nullable UserHandle user, int flags, @Nullable ClassLoader classLoader) { mOuterContext = this; // If creator didn't specify which storage to use, use the default // location for application. if ((flags & (Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE | Context.CONTEXT_DEVICE_PROTECTED_STORAGE)) == 0) { final File dataDir = packageInfo.getDataDirFile(); if (Objects.equals(dataDir, packageInfo.getCredentialProtectedDataDirFile())) { flags |= Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE; } else if (Objects.equals(dataDir, packageInfo.getDeviceProtectedDataDirFile())) { flags |= Context.CONTEXT_DEVICE_PROTECTED_STORAGE; } } mMainThread = mainThread; mActivityToken = activityToken; mFlags = flags; if (user == null) { user = Process.myUserHandle(); } mUser = user; mPackageInfo = packageInfo; mSplitName = splitName; mClassLoader = classLoader; mResourcesManager = ResourcesManager.getInstance(); if (container != null) { mBasePackageName = container.mBasePackageName; mOpPackageName = container.mOpPackageName; setResources(container.mResources); mDisplay = container.mDisplay; } else { mBasePackageName = packageInfo.mPackageName; ApplicationInfo ainfo = packageInfo.getApplicationInfo(); if (ainfo.uid == Process.SYSTEM_UID && ainfo.uid != Process.myUid()) { // Special case: system components allow themselves to be loaded in to other // processes. For purposes of app ops, we must then consider the context as // belonging to the package of this process, not the system itself, otherwise // the package+uid verifications in app ops will fail. mOpPackageName = ActivityThread.currentPackageName(); } else { mOpPackageName = mBasePackageName; } } mContentResolver = new ApplicationContentResolver(this, mainThread, user); }
Example 14
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public boolean isDeviceProtectedStorage() { return (mFlags & Context.CONTEXT_DEVICE_PROTECTED_STORAGE) != 0; }
Example 15
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public boolean isDeviceProtectedStorage() { return (mFlags & Context.CONTEXT_DEVICE_PROTECTED_STORAGE) != 0; }
Example 16
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
private ContextImpl(@Nullable ContextImpl container, @NonNull ActivityThread mainThread, @NonNull LoadedApk packageInfo, @Nullable String splitName, @Nullable IBinder activityToken, @Nullable UserHandle user, int flags, @Nullable ClassLoader classLoader) { mOuterContext = this; // If creator didn't specify which storage to use, use the default // location for application. if ((flags & (Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE | Context.CONTEXT_DEVICE_PROTECTED_STORAGE)) == 0) { final File dataDir = packageInfo.getDataDirFile(); if (Objects.equals(dataDir, packageInfo.getCredentialProtectedDataDirFile())) { flags |= Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE; } else if (Objects.equals(dataDir, packageInfo.getDeviceProtectedDataDirFile())) { flags |= Context.CONTEXT_DEVICE_PROTECTED_STORAGE; } } mMainThread = mainThread; mActivityToken = activityToken; mFlags = flags; if (user == null) { user = Process.myUserHandle(); } mUser = user; mPackageInfo = packageInfo; mSplitName = splitName; mClassLoader = classLoader; mResourcesManager = ResourcesManager.getInstance(); if (container != null) { mBasePackageName = container.mBasePackageName; mOpPackageName = container.mOpPackageName; setResources(container.mResources); mDisplay = container.mDisplay; } else { mBasePackageName = packageInfo.mPackageName; ApplicationInfo ainfo = packageInfo.getApplicationInfo(); if (ainfo.uid == Process.SYSTEM_UID && ainfo.uid != Process.myUid()) { // Special case: system components allow themselves to be loaded in to other // processes. For purposes of app ops, we must then consider the context as // belonging to the package of this process, not the system itself, otherwise // the package+uid verifications in app ops will fail. mOpPackageName = ActivityThread.currentPackageName(); } else { mOpPackageName = mBasePackageName; } } mContentResolver = new ApplicationContentResolver(this, mainThread); }
Example 17
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public boolean isDeviceProtectedStorage() { return (mFlags & Context.CONTEXT_DEVICE_PROTECTED_STORAGE) != 0; }
Example 18
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public boolean isDeviceProtectedStorage() { return (mFlags & Context.CONTEXT_DEVICE_PROTECTED_STORAGE) != 0; }
Example 19
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
private ContextImpl(@Nullable ContextImpl container, @NonNull ActivityThread mainThread, @NonNull LoadedApk packageInfo, @Nullable String splitName, @Nullable IBinder activityToken, @Nullable UserHandle user, int flags, @Nullable ClassLoader classLoader) { mOuterContext = this; // If creator didn't specify which storage to use, use the default // location for application. if ((flags & (Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE | Context.CONTEXT_DEVICE_PROTECTED_STORAGE)) == 0) { final File dataDir = packageInfo.getDataDirFile(); if (Objects.equals(dataDir, packageInfo.getCredentialProtectedDataDirFile())) { flags |= Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE; } else if (Objects.equals(dataDir, packageInfo.getDeviceProtectedDataDirFile())) { flags |= Context.CONTEXT_DEVICE_PROTECTED_STORAGE; } } mMainThread = mainThread; mActivityToken = activityToken; mFlags = flags; if (user == null) { user = Process.myUserHandle(); } mUser = user; mPackageInfo = packageInfo; mSplitName = splitName; mClassLoader = classLoader; mResourcesManager = ResourcesManager.getInstance(); if (container != null) { mBasePackageName = container.mBasePackageName; mOpPackageName = container.mOpPackageName; setResources(container.mResources); mDisplay = container.mDisplay; } else { mBasePackageName = packageInfo.mPackageName; ApplicationInfo ainfo = packageInfo.getApplicationInfo(); if (ainfo.uid == Process.SYSTEM_UID && ainfo.uid != Process.myUid()) { // Special case: system components allow themselves to be loaded in to other // processes. For purposes of app ops, we must then consider the context as // belonging to the package of this process, not the system itself, otherwise // the package+uid verifications in app ops will fail. mOpPackageName = ActivityThread.currentPackageName(); } else { mOpPackageName = mBasePackageName; } } mContentResolver = new ApplicationContentResolver(this, mainThread, user); }
Example 20
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public boolean isDeviceProtectedStorage() { return (mFlags & Context.CONTEXT_DEVICE_PROTECTED_STORAGE) != 0; }