am 2c40582a: Merge "Add native C APIs for working with the Asset Manager" into gingerbread

Merge commit '2c40582a6c3a5781b39d0504d5aa8934982989d2' into gingerbread-plus-aosp

* commit '2c40582a6c3a5781b39d0504d5aa8934982989d2':
  Add native C APIs for working with the Asset Manager
This commit is contained in:
Christopher Tate
2010-07-15 15:03:32 -07:00
committed by Android Git Automerger
8 changed files with 398 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.graphics.PixelFormat;
import android.os.Build;
import android.os.Bundle;
@@ -52,7 +53,8 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback2,
private boolean mDestroyed;
private native int loadNativeCode(String path, MessageQueue queue,
String internalDataPath, String externalDataPath, int sdkVersion);
String internalDataPath, String externalDataPath, int sdkVersion,
AssetManager assetMgr);
private native void unloadNativeCode(int handle);
private native void onStartNative(int handle);
@@ -138,7 +140,7 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback2,
mNativeHandle = loadNativeCode(path, Looper.myQueue(),
getFilesDir().toString(),
Environment.getExternalStorageAppFilesDirectory(ai.packageName).toString(),
Build.VERSION.SDK_INT);
Build.VERSION.SDK_INT, getAssets());
if (mNativeHandle == 0) {
throw new IllegalArgumentException("Unable to load native library: " + path);

View File

@@ -70,6 +70,7 @@ public final class AssetManager {
// For communication with native code.
private int mObject;
private int mNObject; // used by the NDK
private StringBlock mStringBlocks[] = null;