@Deprecated public class RenamingDelegatingContext extends ContextWrapper
Context.BindServiceFlags, Context.CreatePackageOptions, Context.ServiceName
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BACKUP_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_ALLOW_WHITELIST_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_FOREGROUND_SERVICE, BIND_FOREGROUND_SERVICE_WHILE_AWAKE, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_NOT_VISIBLE, BIND_SHOWING_UI, BIND_TREAT_LIKE_ACTIVITY, BIND_VISIBLE, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_CREDENTIAL_PROTECTED_STORAGE, CONTEXT_DEVICE_PROTECTED_STORAGE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_REGISTER_PACKAGE, CONTEXT_RESTRICTED, CONTEXTHUB_SERVICE, COUNTRY_DETECTOR, DEVICE_IDLE_CONTROLLER, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, ETHERNET_SERVICE, FINGERPRINT_SERVICE, GATEKEEPER_SERVICE, HARDWARE_PROPERTIES_SERVICE, HDMI_CONTROL_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_POLICY_SERVICE, NETWORK_SCORE_SERVICE, NETWORK_STATS_SERVICE, NETWORKMANAGEMENT_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, PERSISTENT_DATA_BLOCK_SERVICE, POWER_SERVICE, PRINT_SERVICE, RADIO_SERVICE, RECOVERY_SERVICE, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SERIAL_SERVICE, SHORTCUT_SERVICE, SIP_SERVICE, SOUND_TRIGGER_SERVICE, STATUS_BAR_SERVICE, STORAGE_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TRUST_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, UPDATE_LOCK_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, VOICE_INTERACTION_MANAGER_SERVICE, WALLPAPER_SERVICE, WIFI_NAN_SERVICE, WIFI_P2P_SERVICE, WIFI_RTT_SERVICE, WIFI_SCANNING_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
Constructor and Description |
---|
RenamingDelegatingContext(Context context,
Context fileContext,
String filePrefix)
Deprecated.
|
RenamingDelegatingContext(Context context,
String filePrefix)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
String[] |
databaseList()
Deprecated.
Returns an array of strings naming the private databases associated with
this Context's application package.
|
boolean |
deleteDatabase(String name)
Deprecated.
Delete an existing private SQLiteDatabase associated with this Context's
application package.
|
boolean |
deleteFile(String name)
Deprecated.
Delete the given private file associated with this Context's
application package.
|
String[] |
fileList()
Deprecated.
Returns an array of strings naming the private files associated with
this Context's application package.
|
File |
getCacheDir()
Deprecated.
In order to support calls to getCacheDir(), we create a temp cache dir (inside the real
one) and return it instead.
|
File |
getDatabasePath(String name)
Deprecated.
Returns the absolute path on the filesystem where a database created with
Context.openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory) is stored. |
String |
getDatabasePrefix()
Deprecated.
|
File |
getFileStreamPath(String name)
Deprecated.
Returns the absolute path on the filesystem where a file created with
Context.openFileOutput(java.lang.String, int) is stored. |
void |
makeExistingFilesAndDbsAccessible()
Deprecated.
Makes accessible all files and databases whose names match the filePrefix that was passed to
the constructor.
|
FileInputStream |
openFileInput(String name)
Deprecated.
Open a private file associated with this Context's application package
for reading.
|
FileOutputStream |
openFileOutput(String name,
int mode)
Deprecated.
Open a private file associated with this Context's application package
for writing.
|
SQLiteDatabase |
openOrCreateDatabase(String name,
int mode,
SQLiteDatabase.CursorFactory factory)
Deprecated.
Open a new private SQLiteDatabase associated with this Context's
application package.
|
SQLiteDatabase |
openOrCreateDatabase(String name,
int mode,
SQLiteDatabase.CursorFactory factory,
DatabaseErrorHandler errorHandler)
Deprecated.
Open a new private SQLiteDatabase associated with this Context's
application package.
|
static <T extends ContentProvider> |
providerWithRenamedContext(Class<T> contentProvider,
Context c,
String filePrefix)
Deprecated.
|
static <T extends ContentProvider> |
providerWithRenamedContext(Class<T> contentProvider,
Context c,
String filePrefix,
boolean allowAccessToExistingFilesAndDbs)
Deprecated.
|
attachBaseContext, bindService, bindServiceAsUser, canStartActivityForResult, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, checkUriPermission, clearWallpaper, createApplicationContext, createConfigurationContext, createCredentialProtectedStorageContext, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createPackageContextAsUser, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getBasePackageName, getClassLoader, getCodeCacheDir, getContentResolver, getDataDir, getDir, getDisplay, getDisplayAdjustments, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSharedPreferences, getSharedPreferencesPath, getSystemService, getSystemServiceName, getTheme, getThemeResId, getUserId, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isCredentialProtectedStorage, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, peekWallpaper, registerReceiver, registerReceiver, registerReceiverAsUser, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendBroadcastAsUser, sendBroadcastMultiplePermissions, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendOrderedBroadcastAsUser, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivitiesAsUser, startActivity, startActivity, startActivityAsUser, startActivityAsUser, startActivityForResult, startInstrumentation, startIntentSender, startIntentSender, startService, startServiceAsUser, stopService, stopServiceAsUser, unbindService, unregisterReceiver
bindServiceAsUser, createCredentialEncryptedStorageContext, createDeviceEncryptedStorageContext, getColor, getColorStateList, getDrawable, getSharedPrefsFile, getString, getString, getSystemService, getText, isCredentialEncryptedStorage, isDeviceEncryptedStorage, migrateDatabaseFrom, migrateSharedPreferencesFrom, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks
public RenamingDelegatingContext(Context context, String filePrefix)
context
- : the context that will be delegated.filePrefix
- : a prefix with which database and file names will be
prefixed.public RenamingDelegatingContext(Context context, Context fileContext, String filePrefix)
context
- : the context that will be delegated.fileContext
- : the context that file and db methods will be delegated tofilePrefix
- : a prefix with which database and file names will be
prefixed.public static <T extends ContentProvider> T providerWithRenamedContext(Class<T> contentProvider, Context c, String filePrefix) throws IllegalAccessException, InstantiationException
public static <T extends ContentProvider> T providerWithRenamedContext(Class<T> contentProvider, Context c, String filePrefix, boolean allowAccessToExistingFilesAndDbs) throws IllegalAccessException, InstantiationException
public void makeExistingFilesAndDbsAccessible()
public String getDatabasePrefix()
public SQLiteDatabase openOrCreateDatabase(String name, int mode, SQLiteDatabase.CursorFactory factory)
Context
openOrCreateDatabase
in class ContextWrapper
name
- The name (unique in the application package) of the database.mode
- Operating mode. Use 0 or Context.MODE_PRIVATE
for the
default operation. Use
Context.MODE_ENABLE_WRITE_AHEAD_LOGGING
to enable write-ahead
logging by default. Use Context.MODE_NO_LOCALIZED_COLLATORS
to disable localized collators.factory
- An optional factory class that is called to instantiate a
cursor when query is called.Context.MODE_PRIVATE
,
Context.MODE_ENABLE_WRITE_AHEAD_LOGGING
,
Context.MODE_NO_LOCALIZED_COLLATORS
,
Context.deleteDatabase(java.lang.String)
public SQLiteDatabase openOrCreateDatabase(String name, int mode, SQLiteDatabase.CursorFactory factory, DatabaseErrorHandler errorHandler)
Context
Accepts input param: a concrete instance of DatabaseErrorHandler
to be used to handle corruption when sqlite reports database corruption.
openOrCreateDatabase
in class ContextWrapper
name
- The name (unique in the application package) of the database.mode
- Operating mode. Use 0 or Context.MODE_PRIVATE
for the
default operation. Use
Context.MODE_ENABLE_WRITE_AHEAD_LOGGING
to enable write-ahead
logging by default. Use Context.MODE_NO_LOCALIZED_COLLATORS
to disable localized collators.factory
- An optional factory class that is called to instantiate a
cursor when query is called.errorHandler
- the DatabaseErrorHandler
to be used when
sqlite reports database corruption. if null,
DefaultDatabaseErrorHandler
is
assumed.Context.MODE_PRIVATE
,
Context.MODE_ENABLE_WRITE_AHEAD_LOGGING
,
Context.MODE_NO_LOCALIZED_COLLATORS
,
Context.deleteDatabase(java.lang.String)
public boolean deleteDatabase(String name)
Context
deleteDatabase
in class ContextWrapper
name
- The name (unique in the application package) of the
database.true
if the database was successfully deleted; else false
.Context.openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory)
public File getDatabasePath(String name)
Context
Context.openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory)
is stored.
The returned path may change over time if the calling app is moved to an adopted storage device, so only relative paths should be persisted.
getDatabasePath
in class ContextWrapper
name
- The name of the database for which you would like to get
its path.Context.openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory)
public String[] databaseList()
Context
databaseList
in class ContextWrapper
Context.openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase.CursorFactory)
,
Context.deleteDatabase(java.lang.String)
public FileInputStream openFileInput(String name) throws FileNotFoundException
Context
openFileInput
in class ContextWrapper
name
- The name of the file to open; can not contain path
separators.FileInputStream
.FileNotFoundException
Context.openFileOutput(java.lang.String, int)
,
Context.fileList()
,
Context.deleteFile(java.lang.String)
,
FileInputStream.FileInputStream(String)
public FileOutputStream openFileOutput(String name, int mode) throws FileNotFoundException
Context
No additional permissions are required for the calling app to read or write the returned file.
openFileOutput
in class ContextWrapper
name
- The name of the file to open; can not contain path
separators.mode
- Operating mode. Use 0 or Context.MODE_PRIVATE
for the
default operation. Use Context.MODE_APPEND
to append to an
existing file.FileOutputStream
.FileNotFoundException
Context.MODE_APPEND
,
Context.MODE_PRIVATE
,
Context.openFileInput(java.lang.String)
,
Context.fileList()
,
Context.deleteFile(java.lang.String)
,
FileOutputStream.FileOutputStream(String)
public File getFileStreamPath(String name)
Context
Context.openFileOutput(java.lang.String, int)
is stored.
The returned path may change over time if the calling app is moved to an adopted storage device, so only relative paths should be persisted.
getFileStreamPath
in class ContextWrapper
name
- The name of the file for which you would like to get
its path.Context.openFileOutput(java.lang.String, int)
,
Context.getFilesDir()
,
Context.getDir(java.lang.String, int)
public boolean deleteFile(String name)
Context
deleteFile
in class ContextWrapper
name
- The name of the file to delete; can not contain path
separators.true
if the file was successfully deleted; else
false
.Context.openFileInput(java.lang.String)
,
Context.openFileOutput(java.lang.String, int)
,
Context.fileList()
,
File.delete()
public String[] fileList()
Context
fileList
in class ContextWrapper
Context.openFileInput(java.lang.String)
,
Context.openFileOutput(java.lang.String, int)
,
Context.deleteFile(java.lang.String)
public File getCacheDir()
getCacheDir
in class ContextWrapper
Context.openFileOutput(java.lang.String, int)
,
Context.getFileStreamPath(java.lang.String)
,
Context.getDir(java.lang.String, int)
,
Context.getExternalCacheDir()