am 805fd7ee: Add API to get path to OBBs.
* commit '805fd7ee0e5dc2939e85c84f78d9890a51982bc0': Add API to get path to OBBs.
This commit is contained in:
@@ -122,6 +122,8 @@ public class ActivityManager {
|
||||
/**
|
||||
* Thumbnail representation of the task's last state. Must
|
||||
* use {@link ActivityManager#TASKS_GET_THUMBNAILS} to have this set.
|
||||
* @hide -- this is not scalable, need to have a separate API to get
|
||||
* the bitmap.
|
||||
*/
|
||||
public Bitmap thumbnail;
|
||||
|
||||
@@ -203,6 +205,7 @@ public class ActivityManager {
|
||||
/**
|
||||
* Flag for use with {@link #getRecentTasks}: also return the thumbnail
|
||||
* bitmap (if available) for each recent task.
|
||||
* @hide
|
||||
*/
|
||||
public static final int TASKS_GET_THUMBNAILS = 0x0001000;
|
||||
|
||||
@@ -214,8 +217,7 @@ public class ActivityManager {
|
||||
* actual number returned may be smaller, depending on how many tasks the
|
||||
* user has started and the maximum number the system can remember.
|
||||
* @param flags Information about what to return. May be any combination
|
||||
* of {@link #RECENT_WITH_EXCLUDED}, {@link #RECENT_IGNORE_UNAVAILABLE},
|
||||
* and {@link #TASKS_GET_THUMBNAILS}.
|
||||
* of {@link #RECENT_WITH_EXCLUDED} and {@link #RECENT_IGNORE_UNAVAILABLE}.
|
||||
*
|
||||
* @return Returns a list of RecentTaskInfo records describing each of
|
||||
* the recent tasks.
|
||||
@@ -261,8 +263,8 @@ public class ActivityManager {
|
||||
public ComponentName topActivity;
|
||||
|
||||
/**
|
||||
* Thumbnail representation of the task's current state. Must
|
||||
* use {@link ActivityManager#TASKS_GET_THUMBNAILS} to have this set.
|
||||
* Thumbnail representation of the task's current state. Currently
|
||||
* always null.
|
||||
*/
|
||||
public Bitmap thumbnail;
|
||||
|
||||
|
||||
@@ -153,6 +153,7 @@ class ContextImpl extends Context {
|
||||
private File mPreferencesDir;
|
||||
private File mFilesDir;
|
||||
private File mCacheDir;
|
||||
private File mObbDir;
|
||||
private File mExternalFilesDir;
|
||||
private File mExternalCacheDir;
|
||||
|
||||
@@ -646,6 +647,17 @@ class ContextImpl extends Context {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getObbDir() {
|
||||
synchronized (mSync) {
|
||||
if (mObbDir == null) {
|
||||
mObbDir = Environment.getExternalStorageAppObbDirectory(
|
||||
getPackageName());
|
||||
}
|
||||
return mObbDir;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getCacheDir() {
|
||||
synchronized (mSync) {
|
||||
|
||||
@@ -84,7 +84,7 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback2,
|
||||
private boolean mDestroyed;
|
||||
|
||||
private native int loadNativeCode(String path, String funcname, MessageQueue queue,
|
||||
String internalDataPath, String externalDataPath, int sdkVersion,
|
||||
String internalDataPath, String obbPath, String externalDataPath, int sdkVersion,
|
||||
AssetManager assetMgr, byte[] savedState);
|
||||
private native void unloadNativeCode(int handle);
|
||||
|
||||
@@ -191,7 +191,7 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback2,
|
||||
? savedInstanceState.getByteArray(KEY_NATIVE_SAVED_STATE) : null;
|
||||
|
||||
mNativeHandle = loadNativeCode(path, funcname, Looper.myQueue(),
|
||||
getFilesDir().toString(),
|
||||
getFilesDir().toString(), getObbDir().toString(),
|
||||
Environment.getExternalStorageAppFilesDirectory(ai.packageName).toString(),
|
||||
Build.VERSION.SDK_INT, getAssets(), nativeSavedState);
|
||||
|
||||
|
||||
@@ -515,6 +515,13 @@ public abstract class Context {
|
||||
*/
|
||||
public abstract File getExternalFilesDir(String type);
|
||||
|
||||
/**
|
||||
* Return the directory where this application's OBB files (if there
|
||||
* are any) can be found. Note if the application does not have any OBB
|
||||
* files, this directory may not exist.
|
||||
*/
|
||||
public abstract File getObbDir();
|
||||
|
||||
/**
|
||||
* Returns the absolute path to the application specific cache directory
|
||||
* on the filesystem. These files will be ones that get deleted first when the
|
||||
|
||||
@@ -190,6 +190,11 @@ public class ContextWrapper extends Context {
|
||||
return mBase.getExternalFilesDir(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getObbDir() {
|
||||
return mBase.getObbDir();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getCacheDir() {
|
||||
return mBase.getCacheDir();
|
||||
|
||||
@@ -107,6 +107,10 @@ public class Environment {
|
||||
= new File (new File(getDirectory("EXTERNAL_STORAGE", "/sdcard"),
|
||||
"Android"), "media");
|
||||
|
||||
private static final File EXTERNAL_STORAGE_ANDROID_OBB_DIRECTORY
|
||||
= new File (new File(getDirectory("EXTERNAL_STORAGE", "/sdcard"),
|
||||
"Android"), "obb");
|
||||
|
||||
private static final File DOWNLOAD_CACHE_DIRECTORY
|
||||
= getDirectory("DOWNLOAD_CACHE", "/cache");
|
||||
|
||||
@@ -303,6 +307,14 @@ public class Environment {
|
||||
return new File(EXTERNAL_STORAGE_ANDROID_MEDIA_DIRECTORY, packageName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the raw path to an application's OBB files
|
||||
* @hide
|
||||
*/
|
||||
public static File getExternalStorageAppObbDirectory(String packageName) {
|
||||
return new File(EXTERNAL_STORAGE_ANDROID_OBB_DIRECTORY, packageName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the path to an application's files.
|
||||
* @hide
|
||||
|
||||
Reference in New Issue
Block a user