summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/accounts/ChooseAccountTypeActivity.java54
-rw-r--r--core/java/android/accounts/ChooseTypeAndAccountActivity.java47
-rw-r--r--core/java/android/webkit/CallbackProxy.java8
-rw-r--r--core/java/android/webkit/WebView.java6
-rw-r--r--docs/html/guide/practices/design/jni.jd168
-rw-r--r--media/jni/android_media_MediaPlayer.cpp4
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java35
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioEffectTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioEffectTest.java)3
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioManagerTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioManagerTest.java)4
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioTrackTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioTrackTest.java)3
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaBassBoostTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaBassBoostTest.java)4
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaEnvReverbTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaEnvReverbTest.java)4
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaEqualizerTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaEqualizerTest.java)4
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaPresetReverbTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPresetReverbTest.java)4
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaVirtualizerTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaVirtualizerTest.java)4
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaVisualizerTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaVisualizerTest.java)3
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/SimTonesTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/SimTonesTest.java)4
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediaplayback/MediaPlayerApiTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java)12
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java)2
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/MediaItemThumbnailTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaItemThumbnailTest.java)2
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/MediaPropertiesTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPropertiesTest.java)2
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorAPITest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorAPITest.java)2
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorExportTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorExportTest.java)2
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorPreviewTest.java (renamed from media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorPreviewTest.java)2
24 files changed, 204 insertions, 179 deletions
diff --git a/core/java/android/accounts/ChooseAccountTypeActivity.java b/core/java/android/accounts/ChooseAccountTypeActivity.java
index 5239e8c56fb0..448b2c0c49ae 100644
--- a/core/java/android/accounts/ChooseAccountTypeActivity.java
+++ b/core/java/android/accounts/ChooseAccountTypeActivity.java
@@ -33,7 +33,6 @@ import android.widget.ListView;
import android.widget.TextView;
import com.android.internal.R;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -43,7 +42,7 @@ import java.util.Set;
/**
* @hide
*/
-public class ChooseAccountTypeActivity extends Activity implements AccountManagerCallback<Bundle> {
+public class ChooseAccountTypeActivity extends Activity {
private static final String TAG = "AccountManager";
private HashMap<String, AuthInfo> mTypeToAuthenticatorInfo = new HashMap<String, AuthInfo>();
@@ -52,7 +51,6 @@ public class ChooseAccountTypeActivity extends Activity implements AccountManage
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.choose_account_type);
// Read the validAccountTypes, if present, and add them to the setOfAllowableAccountTypes
Set<String> setOfAllowableAccountTypes = null;
@@ -90,10 +88,11 @@ public class ChooseAccountTypeActivity extends Activity implements AccountManage
}
if (mAuthenticatorInfosToDisplay.size() == 1) {
- runAddAccountForAuthenticator(mAuthenticatorInfosToDisplay.get(0));
+ setResultAndFinish(mAuthenticatorInfosToDisplay.get(0).desc.type);
return;
}
+ setContentView(R.layout.choose_account_type);
// Setup the list
ListView list = (ListView) findViewById(android.R.id.list);
// Use an existing ListAdapter that will map an array of strings to TextViews
@@ -103,11 +102,20 @@ public class ChooseAccountTypeActivity extends Activity implements AccountManage
list.setTextFilterEnabled(false);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
- runAddAccountForAuthenticator(mAuthenticatorInfosToDisplay.get(position));
+ setResultAndFinish(mAuthenticatorInfosToDisplay.get(position).desc.type);
}
});
}
+ private void setResultAndFinish(final String type) {
+ Bundle bundle = new Bundle();
+ bundle.putString(AccountManager.KEY_ACCOUNT_TYPE, type);
+ setResult(Activity.RESULT_OK, new Intent().putExtras(bundle));
+ Log.d(TAG, "ChooseAccountTypeActivity.setResultAndFinish: "
+ + "selected account type " + type);
+ finish();
+ }
+
private void buildTypeToAuthDescriptionMap() {
for(AuthenticatorDescription desc : AccountManager.get(this).getAuthenticatorTypes()) {
String name = null;
@@ -136,42 +144,6 @@ public class ChooseAccountTypeActivity extends Activity implements AccountManage
}
}
- protected void runAddAccountForAuthenticator(AuthInfo authInfo) {
- Log.d(TAG, "selected account type " + authInfo.name);
- final Bundle options = getIntent().getBundleExtra(
- ChooseTypeAndAccountActivity.EXTRA_ADD_ACCOUNT_OPTIONS_BUNDLE);
- final String[] requiredFeatures = getIntent().getStringArrayExtra(
- ChooseTypeAndAccountActivity.EXTRA_ADD_ACCOUNT_REQUIRED_FEATURES_STRING_ARRAY);
- final String authTokenType = getIntent().getStringExtra(
- ChooseTypeAndAccountActivity.EXTRA_ADD_ACCOUNT_AUTH_TOKEN_TYPE_STRING);
- AccountManager.get(this).addAccount(authInfo.desc.type, authTokenType, requiredFeatures,
- options, this, this, null /* Handler */);
- }
-
- public void run(final AccountManagerFuture<Bundle> accountManagerFuture) {
- try {
- Bundle accountManagerResult = accountManagerFuture.getResult();
- Bundle bundle = new Bundle();
- bundle.putString(AccountManager.KEY_ACCOUNT_NAME,
- accountManagerResult.getString(AccountManager.KEY_ACCOUNT_NAME));
- bundle.putString(AccountManager.KEY_ACCOUNT_TYPE,
- accountManagerResult.getString(AccountManager.KEY_ACCOUNT_TYPE));
- setResult(Activity.RESULT_OK, new Intent().putExtras(bundle));
- finish();
- return;
- } catch (OperationCanceledException e) {
- setResult(Activity.RESULT_CANCELED);
- finish();
- return;
- } catch (IOException e) {
- } catch (AuthenticatorException e) {
- }
- Bundle bundle = new Bundle();
- bundle.putString(AccountManager.KEY_ERROR_MESSAGE, "error communicating with server");
- setResult(Activity.RESULT_OK, new Intent().putExtras(bundle));
- finish();
- }
-
private static class AuthInfo {
final AuthenticatorDescription desc;
final String name;
diff --git a/core/java/android/accounts/ChooseTypeAndAccountActivity.java b/core/java/android/accounts/ChooseTypeAndAccountActivity.java
index 852c4dddf819..8cc200250ba3 100644
--- a/core/java/android/accounts/ChooseTypeAndAccountActivity.java
+++ b/core/java/android/accounts/ChooseTypeAndAccountActivity.java
@@ -36,6 +36,7 @@ import android.widget.ListView;
import android.widget.TextView;
import com.android.internal.R;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -44,7 +45,8 @@ import java.util.Set;
/**
* @hide
*/
-public class ChooseTypeAndAccountActivity extends Activity {
+public class ChooseTypeAndAccountActivity extends Activity
+ implements AccountManagerCallback<Bundle> {
private static final String TAG = "AccountManager";
/**
@@ -211,10 +213,9 @@ public class ChooseTypeAndAccountActivity extends Activity {
protected void onActivityResult(final int requestCode, final int resultCode,
final Intent data) {
if (resultCode == RESULT_OK && data != null) {
- String accountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
String accountType = data.getStringExtra(AccountManager.KEY_ACCOUNT_TYPE);
- if (accountName != null && accountType != null) {
- setResultAndFinish(accountName, accountType);
+ if (accountType != null) {
+ runAddAccountForAuthenticator(accountType);
return;
}
}
@@ -223,6 +224,43 @@ public class ChooseTypeAndAccountActivity extends Activity {
finish();
}
+ protected void runAddAccountForAuthenticator(String type) {
+ Log.d(TAG, "selected account type " + type);
+ final Bundle options = getIntent().getBundleExtra(
+ ChooseTypeAndAccountActivity.EXTRA_ADD_ACCOUNT_OPTIONS_BUNDLE);
+ final String[] requiredFeatures = getIntent().getStringArrayExtra(
+ ChooseTypeAndAccountActivity.EXTRA_ADD_ACCOUNT_REQUIRED_FEATURES_STRING_ARRAY);
+ final String authTokenType = getIntent().getStringExtra(
+ ChooseTypeAndAccountActivity.EXTRA_ADD_ACCOUNT_AUTH_TOKEN_TYPE_STRING);
+ AccountManager.get(this).addAccount(type, authTokenType, requiredFeatures,
+ options, this, this, null /* Handler */);
+ }
+
+ public void run(final AccountManagerFuture<Bundle> accountManagerFuture) {
+ try {
+ final Bundle accountManagerResult = accountManagerFuture.getResult();
+ final String name = accountManagerResult.getString(AccountManager.KEY_ACCOUNT_NAME);
+ final String type = accountManagerResult.getString(AccountManager.KEY_ACCOUNT_TYPE);
+ if (name != null && type != null) {
+ final Bundle bundle = new Bundle();
+ bundle.putString(AccountManager.KEY_ACCOUNT_NAME, name);
+ bundle.putString(AccountManager.KEY_ACCOUNT_TYPE, type);
+ setResult(Activity.RESULT_OK, new Intent().putExtras(bundle));
+ finish();
+ return;
+ }
+ } catch (OperationCanceledException e) {
+ setResult(Activity.RESULT_CANCELED);
+ finish();
+ return;
+ } catch (IOException e) {
+ } catch (AuthenticatorException e) {
+ }
+ Bundle bundle = new Bundle();
+ bundle.putString(AccountManager.KEY_ERROR_MESSAGE, "error communicating with server");
+ setResult(Activity.RESULT_OK, new Intent().putExtras(bundle));
+ finish();
+ }
private Drawable getDrawableForType(
final HashMap<String, AuthenticatorDescription> typeToAuthDescription,
@@ -266,6 +304,7 @@ public class ChooseTypeAndAccountActivity extends Activity {
private void startChooseAccountTypeActivity() {
final Intent intent = new Intent(this, ChooseAccountTypeActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
intent.putExtra(EXTRA_ALLOWABLE_ACCOUNT_TYPES_STRING_ARRAY,
getIntent().getStringArrayExtra(EXTRA_ALLOWABLE_ACCOUNT_TYPES_STRING_ARRAY));
intent.putExtra(EXTRA_ADD_ACCOUNT_OPTIONS_BUNDLE,
diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java
index c9fcf0c27842..5ee90a4fdab6 100644
--- a/core/java/android/webkit/CallbackProxy.java
+++ b/core/java/android/webkit/CallbackProxy.java
@@ -905,11 +905,9 @@ class CallbackProxy extends Handler {
*/
public void onPageStarted(String url, Bitmap favicon) {
- // Do an unsynchronized quick check to avoid posting if no callback has
- // been set.
- if (mWebViewClient == null) {
- return;
- }
+ // We need to send the message even if no WebViewClient is set, because we need to call
+ // WebView.onPageStarted().
+
// Performance probe
if (PERF_PROBE) {
mWebCoreThreadTime = SystemClock.currentThreadTimeMillis();
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 139f9f37e9ae..530b230b348b 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2392,6 +2392,12 @@ public class WebView extends AbsoluteLayout
return mZoomManager.getScale();
}
+ // Called by JNI. Returns the scale to apply to the text selection handles
+ /* package */ float getTextHandleScale() {
+ float density = mContext.getResources().getDisplayMetrics().density;
+ return density / getScale();
+ }
+
/**
* Return the reading level scale of the WebView
* @return The reading level scale.
diff --git a/docs/html/guide/practices/design/jni.jd b/docs/html/guide/practices/design/jni.jd
index 6e984b00a881..9980efdf0c3f 100644
--- a/docs/html/guide/practices/design/jni.jd
+++ b/docs/html/guide/practices/design/jni.jd
@@ -26,9 +26,9 @@ page.title=JNI Tips
</div>
</div>
-<p>JNI is the Java Native Interface. It defines a way for code written in the
-Java programming language to interact with native
-code: functions written in C/C++. It's VM-neutral, has support for loading code from
+<p>JNI is the Java Native Interface. It defines a way for managed code
+(written in the Java programming language) to interact with native
+code (written in C/C++). It's vendor-neutral, has support for loading code from
dynamic shared libraries, and while cumbersome at times is reasonably efficient.</p>
<p>You really should read through the
@@ -46,13 +46,13 @@ There's a more detailed <a href="http://java.sun.com/docs/books/jni/html/jniTOC.
pointers to pointers to function tables. (In the C++ version, they're classes with a
pointer to a function table and a member function for each JNI function that indirects through
the table.) The JavaVM provides the "invocation interface" functions,
-which allow you to create and destroy the VM. In theory you can have multiple VMs per process,
-but Android's VM only allows one.</p>
+which allow you to create and destroy a JavaVM. In theory you can have multiple JavaVMs per process,
+but Android only allows one.</p>
<p>The JNIEnv provides most of the JNI functions. Your native functions all receive a JNIEnv as
the first argument.</p>
-<p>On some VMs, the JNIEnv is used for thread-local storage. For this reason, <strong>you cannot share a JNIEnv between threads</strong>.
+<p>The JNIEnv is used for thread-local storage. For this reason, <strong>you cannot share a JNIEnv between threads</strong>.
If a piece of code has no other way to get its JNIEnv, you should share
the JavaVM, and use <code>GetEnv</code> to discover the thread's JNIEnv. (Assuming it has one; see <code>AttachCurrentThread</code> below.)</p>
@@ -66,23 +66,22 @@ that header refers to JNIEnv.)</p>
<a name="threads" id="threads"></a>
<h2>Threads</h2>
-<p>All VM threads are Linux threads, scheduled by the kernel. They're usually
-started using Java language features (notably <code>Thread.start</code>),
-but they can also be created elsewhere and then attached to the VM. For
+<p>All threads are Linux threads, scheduled by the kernel. They're usually
+started from managed code (using <code>Thread.start</code>),
+but they can also be created elsewhere and then attached to the JavaVM. For
example, a thread started with <code>pthread_create</code> can be attached
with the JNI <code>AttachCurrentThread</code> or
<code>AttachCurrentThreadAsDaemon</code> functions. Until a thread is
-attached to the VM, it has no JNIEnv, and
-<strong>cannot make JNI calls</strong>.</p>
+attached, it has no JNIEnv, and <strong>cannot make JNI calls</strong>.</p>
-<p>Attaching a natively-created thread causes the VM to allocate and initialize
-a <code>Thread</code> object, add it to the "main" <code>ThreadGroup</code>,
-and add the thread to the set that is visible to the debugger. Calling
-<code>AttachCurrentThread</code> on an already-attached thread is a no-op.</p>
+<p>Attaching a natively-created thread causes a <code>java.lang.Thread</code>
+object to be constructed and added to the "main" <code>ThreadGroup</code>,
+making it visible to the debugger. Calling <code>AttachCurrentThread</code>
+on an already-attached thread is a no-op.</p>
-<p>The Dalvik VM does not suspend threads executing native code. If
+<p>Android does not suspend threads executing native code. If
garbage collection is in progress, or the debugger has issued a suspend
-request, the VM will pause the thread the next time it makes a JNI call.</p>
+request, Android will pause the thread the next time it makes a JNI call.</p>
<p>Threads attached through JNI <strong>must call
<code>DetachCurrentThread</code> before they exit</strong>.
@@ -108,12 +107,12 @@ the argument.)</p>
</ul>
<p>Similarly, to call a method, you'd first get a class object reference and then a method ID. The IDs are often just
-pointers to internal VM data structures. Looking them up may require several string
+pointers to internal runtime data structures. Looking them up may require several string
comparisons, but once you have them the actual call to get the field or invoke the method
is very quick.</p>
<p>If performance is important, it's useful to look the values up once and cache the results
-in your native code. Because there is a limit of one VM per process, it's reasonable
+in your native code. Because there is a limit of one JavaVM per process, it's reasonable
to store this data in a static local structure.</p>
<p>The class references, field IDs, and method IDs are guaranteed valid until the class is unloaded. Classes
@@ -145,13 +144,17 @@ then reloaded, it will be executed again.</p>
<a name="local_and_global_references" id="local_and_global_references"></a>
<h2>Local and Global References</h2>
-<p>Every object that JNI returns is a "local reference". This means that it's valid for the
+<p>Every argument passed to a native method, and almost every object returned
+by a JNI function is a "local reference". This means that it's valid for the
duration of the current native method in the current thread.
-<strong>Even if the object itself continues to live on after the native method returns, the reference is not valid.</strong>
-This applies to all sub-classes of <code>jobject</code>, including
+<strong>Even if the object itself continues to live on after the native method
+returns, the reference is not valid.</strong>
+<p>This applies to all sub-classes of <code>jobject</code>, including
<code>jclass</code>, <code>jstring</code>, and <code>jarray</code>.
-(Dalvik VM will warn you about most reference mis-uses when extended JNI
+(The runtime will warn you about most reference mis-uses when extended JNI
checks are enabled.)</p>
+<p>The only way to get non-local references is via the functions
+<code>NewGlobalRef</code> and <code>NewWeakGlobalRef</code>.
<p>If you want to hold on to a reference for a longer period, you must use
a "global" reference. The <code>NewGlobalRef</code> function takes the
@@ -159,7 +162,7 @@ local reference as an argument and returns a global one.
The global reference is guaranteed to be valid until you call
<code>DeleteGlobalRef</code>.</p>
-<p>This pattern is commonly used when caching copies of class objects obtained
+<p>This pattern is commonly used when caching a jclass returned
from <code>FindClass</code>, e.g.:</p>
<pre>jclass localClass = env-&gt;FindClass("MyClass");
jclass globalClass = reinterpret_cast&lt;jclass&gt;(env-&gt;NewGlobalRef(localClass));</pre>
@@ -181,22 +184,25 @@ not use <code>jobject</code> values as keys.</p>
<p>Programmers are required to "not excessively allocate" local references. In practical terms this means
that if you're creating large numbers of local references, perhaps while running through an array of
-Objects, you should free them manually with
+objects, you should free them manually with
<code>DeleteLocalRef</code> instead of letting JNI do it for you. The
-VM is only required to reserve slots for
+implementation is only required to reserve slots for
16 local references, so if you need more than that you should either delete as you go or use
-<code>EnsureLocalCapacity</code> to reserve more.</p>
+<code>EnsureLocalCapacity</code>/<code>PushLocalFrame</code> to reserve more.</p>
-<p>Note that <code>jfieldID</code>s and <code>jmethodID</code>s are just integers, not object
-references, and should not be passed to <code>NewGlobalRef</code>. The raw data
+<p>Note that <code>jfieldID</code>s and <code>jmethodID</code>s are opaque
+types, not object references, and should not be passed to
+<code>NewGlobalRef</code>. The raw data
pointers returned by functions like <code>GetStringUTFChars</code>
-and <code>GetByteArrayElements</code> are also not objects.</p>
+and <code>GetByteArrayElements</code> are also not objects. (They may be passed
+between threads, and are valid until the matching Release call.)</p>
<p>One unusual case deserves separate mention. If you attach a native
-thread to the VM with <code>AttachCurrentThread</code>, the code you are running will
-never "return" to the VM until the thread detaches from the VM. Any local
-references you create will have to be deleted manually unless you're going
-to detach the thread soon.</p>
+thread with <code>AttachCurrentThread</code>, the code you are running will
+never automatically free local references until the thread detaches. Any local
+references you create will have to be deleted manually. In general, any native
+code that creates local references in a loop probably needs to do some manual
+deletion.</p>
<a name="UTF_8_and_UTF_16_strings" id="UTF_8_and_UTF_16_strings"></a>
<h2>UTF-8 and UTF-16 Strings</h2>
@@ -205,14 +211,15 @@ to detach the thread soon.</p>
modified encoding is useful for C code because it encodes \u0000 as 0xc0 0x80 instead of 0x00.
The nice thing about this is that you can count on having C-style zero-terminated strings,
suitable for use with standard libc string functions. The down side is that you cannot pass
-arbitrary UTF-8 data into the VM and expect it to work correctly.</p>
+arbitrary UTF-8 data to JNI and expect it to work correctly.</p>
-<p>It's usually best to operate with UTF-16 strings. With Android's current VMs, the
-<code>GetStringChars</code> method
-does not require a copy, whereas <code>GetStringUTFChars</code> requires a malloc and a UTF conversion. Note that
+<p>If possible, it's usually faster to operate with UTF-16 strings. Android
+currently does not require a copy in <code>GetStringChars</code>, whereas
+<code>GetStringUTFChars</code> requires an allocation and a conversion to
+UTF-8. Note that
<strong>UTF-16 strings are not zero-terminated</strong>, and \u0000 is allowed,
so you need to hang on to the string length as well as
-the string pointer.</p>
+the jchar pointer.</p>
<p><strong>Don't forget to <code>Release</code> the strings you <code>Get</code></strong>. The
string functions return <code>jchar*</code> or <code>jbyte*</code>, which
@@ -237,9 +244,8 @@ While arrays of objects must be accessed one entry at a time, arrays of
primitives can be read and written directly as if they were declared in C.</p>
<p>To make the interface as efficient as possible without constraining
-the VM implementation,
-the <code>Get&lt;PrimitiveType&gt;ArrayElements</code> family of calls
-allows the VM to either return a pointer to the actual elements, or
+the VM implementation, the <code>Get&lt;PrimitiveType&gt;ArrayElements</code>
+family of calls allows the runtime to either return a pointer to the actual elements, or
allocate some memory and make a copy. Either way, the raw pointer returned
is guaranteed to be valid until the corresponding <code>Release</code> call
is issued (which implies that, if the data wasn't copied, the array object
@@ -253,7 +259,7 @@ non-NULL pointer for the <code>isCopy</code> argument. This is rarely
useful.</p>
<p>The <code>Release</code> call takes a <code>mode</code> argument that can
-have one of three values. The actions performed by the VM depend upon
+have one of three values. The actions performed by the runtime depend upon
whether it returned a pointer to the actual data or a copy of it:</p>
<ul>
@@ -312,8 +318,9 @@ to do is copy data in or out. Consider the following:</p>
}</pre>
<p>This grabs the array, copies the first <code>len</code> byte
-elements out of it, and then releases the array. Depending upon the VM
-policies the <code>Get</code> call will either pin or copy the array contents.
+elements out of it, and then releases the array. Depending upon the
+implementation, the <code>Get</code> call will either pin or copy the array
+contents.
The code copies the data (for perhaps a second time), then calls <code>Release</code>; in this case
<code>JNI_ABORT</code> ensures there's no chance of a third copy.</p>
@@ -335,7 +342,7 @@ to copy data into an array, and <code>GetStringRegion</code> or
<a name="exceptions" id="exceptions"></a>
-<h2>Exception</h2>
+<h2>Exceptions</h2>
<p><strong>You must not call most JNI functions while an exception is pending.</strong>
Your code is expected to notice the exception (via the function's return value,
@@ -369,11 +376,11 @@ you call a method (using a function like <code>CallObjectMethod</code>),
you must always check for an exception, because the return value is not
going to be valid if an exception was thrown.</p>
-<p>Note that exceptions thrown by interpreted code do not "leap over" native code,
-and C++ exceptions thrown by native code are not handled by Dalvik.
+<p>Note that exceptions thrown by interpreted code do not unwind native stack
+frames, and Android does not yet support C++ exceptions.
The JNI <code>Throw</code> and <code>ThrowNew</code> instructions just
-set an exception pointer in the current thread. Upon returning to the VM from
-native code, the exception will be noted and handled appropriately.</p>
+set an exception pointer in the current thread. Upon returning to managed
+from native code, the exception will be noted and handled appropriately.</p>
<p>Native code can "catch" an exception by calling <code>ExceptionCheck</code> or
<code>ExceptionOccurred</code>, and clear it with
@@ -476,23 +483,19 @@ written in C++:</p>
shared library. For Android apps, you may find it useful to get the full
path to the application's private data storage area from the context object.</p>
-<p>This is the recommended approach, but not the only approach. The VM does
-not require explicit registration, nor that you provide a
+<p>This is the recommended approach, but not the only approach. Explicit
+registration is not required, nor is it necessary that you provide a
<code>JNI_OnLoad</code> function.
You can instead use "discovery" of native methods that are named in a
-specific way (see <a href="http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/design.html#wp615">
- the JNI spec</a> for details), though this is less desirable.
-It requires more space in the shared object symbol table,
-loading is slower because it requires string searches through all of the
-loaded shared libraries, and if a method signature is wrong you won't know
+specific way (see <a href="http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/design.html#wp615">the JNI spec</a> for details), though this is less desirable because if a method signature is wrong you won't know
about it until the first time the method is actually used.</p>
<p>One other note about <code>JNI_OnLoad</code>: any <code>FindClass</code>
calls you make from there will happen in the context of the class loader
that was used to load the shared library. Normally <code>FindClass</code>
uses the loader associated with the method at the top of the interpreted
-stack, or if there isn't one (because the thread was just attached to
-the VM) it uses the "system" class loader. This makes
+stack, or if there isn't one (because the thread was just attached) it uses
+the "system" class loader. This makes
<code>JNI_OnLoad</code> a convenient place to look up and cache class
object references.</p>
@@ -515,10 +518,9 @@ that use 64-bit pointers, <strong>you need to stash your native pointers in a
<p>All JNI 1.6 features are supported, with the following exceptions:</p>
<ul>
- <li><code>DefineClass</code> is not implemented. Dalvik does not use
+ <li><code>DefineClass</code> is not implemented. Android does not use
Java bytecodes or class files, so passing in binary class data
- doesn't work. Translation facilities may be added in a future
- version of the VM.</li>
+ doesn't work.</li>
<li>"Weak global" references are implemented, but may only be passed
to <code>NewLocalRef</code>, <code>NewGlobalRef</code>, and
<code>DeleteWeakGlobalRef</code>. (The spec strongly encourages
@@ -536,12 +538,16 @@ that use 64-bit pointers, <strong>you need to stash your native pointers in a
around this requires using explicit registration or moving the
native methods out of inner classes.
<li>Until Android 2.0 (Eclair), it was not possible to use a <code>pthread_key_create</code>
- destructor function to avoid the VM's "thread must be detached before
- exit" check. (The VM also uses a pthread key destructor function,
+ destructor function to avoid the "thread must be detached before
+ exit" check. (The runtime also uses a pthread key destructor function,
so it'd be a race to see which gets called first.)
<li>Until Android 2.2 (Froyo), weak global references were not implemented.
- Older VMs will vigorously reject attempts to use them. You can use
+ Older versions will vigorously reject attempts to use them. You can use
the Android platform version constants to test for support.
+ <li>Until Android 4.0 (Ice Cream Sandwich), JNI local references were
+ actually direct pointers. Ice Cream Sandwich added the indirection
+ necessary to support better garbage collectors, but this means that lots
+ of JNI bugs are undetectable on older releases.
</ul>
@@ -572,8 +578,8 @@ the details of the failure can be found in the exception's detail message.</p>
<p>In logcat, you'll see:</p>
<pre>W/dalvikvm( 880): No implementation found for native LFoo;.myfunc ()V</pre>
-<p>This means that the VM tried to find a matching method but was unsuccessful.
-Some common reasons for this are:</p>
+<p>This means that the runtime tried to find a matching method but was
+unsuccessful. Some common reasons for this are:</p>
<ul>
<li>The library isn't getting loaded. Check the logcat output for
messages about library loading.
@@ -581,10 +587,15 @@ Some common reasons for this are:</p>
is commonly caused by:
<ul>
<li>For lazy method lookup, failing to declare C++ functions
- with <code>extern "C"</code>. You can use <code>arm-eabi-nm</code>
+ with <code>extern "C"</code> and appropriate
+ visibility (<code>JNIEXPORT</code>). Note that prior to Ice Cream
+ Sandwich, the JNIEXPORT macro was incorrect, so using a new GCC with
+ an old <code>jni.h</code> won't work.
+ You can use <code>arm-eabi-nm</code>
to see the symbols as they appear in the library; if they look
mangled (something like <code>_Z15Java_Foo_myfuncP7_JNIEnvP7_jclass</code>
- rather than <code>Java_Foo_myfunc</code>) then you need to
+ rather than <code>Java_Foo_myfunc</code>), or if the symbol type is
+ a lowercase 't' rather than an uppercase 'T', then you need to
adjust the declaration.
<li>For explicit registration, minor errors when entering the
method signature. Make sure that what you're passing to the
@@ -612,7 +623,7 @@ must also wrap the class with 'L' and ';', so a one-dimensional array of
<p>If the class name looks right, you could be running into a class loader
issue. <code>FindClass</code> wants to start the class search in the
-class loader associated with your code. It examines the VM call stack,
+class loader associated with your code. It examines the call stack,
which will look something like:
<pre> Foo.myfunc(Native Method)
Foo.main(Foo.java:10)
@@ -623,14 +634,14 @@ finds the <code>ClassLoader</code> object associated with the <code>Foo</code>
class and uses that.</p>
<p>This usually does what you want. You can get into trouble if you
-create a thread outside the VM (perhaps by calling <code>pthread_create</code>
-and then attaching it to the VM with <code>AttachCurrentThread</code>).
+create a thread yourself (perhaps by calling <code>pthread_create</code>
+and then attaching it with <code>AttachCurrentThread</code>).
Now the stack trace looks like this:</p>
<pre> dalvik.system.NativeStart.run(Native Method)</pre>
<p>The topmost method is <code>NativeStart.run</code>, which isn't part of
your application. If you call <code>FindClass</code> from this thread, the
-VM will start in the "system" class loader instead of the one associated
+JavaVM will start in the "system" class loader instead of the one associated
with your application, so attempts to find app-specific classes will fail.</p>
<p>There are a few ways to work around this:</p>
@@ -656,12 +667,12 @@ with your application, so attempts to find app-specific classes will fail.</p>
<h2>FAQ: How do I share raw data with native code?</h2>
<p>You may find yourself in a situation where you need to access a large
-buffer of raw data from code written in Java and C/C++. Common examples
+buffer of raw data from both managed and native code. Common examples
include manipulation of bitmaps or sound samples. There are two
basic approaches.</p>
<p>You can store the data in a <code>byte[]</code>. This allows very fast
-access from code written in Java. On the native side, however, you're
+access from managed code. On the native side, however, you're
not guaranteed to be able to access the data without having to copy it. In
some implementations, <code>GetByteArrayElements</code> and
<code>GetPrimitiveArrayCritical</code> will return actual pointers to the
@@ -674,8 +685,8 @@ the JNI <code>NewDirectByteBuffer</code> function. Unlike regular
byte buffers, the storage is not allocated on the managed heap, and can
always be accessed directly from native code (get the address
with <code>GetDirectBufferAddress</code>). Depending on how direct
-byte buffer access is implemented in the VM, accessing the data from code
-written in Java can be very slow.</p>
+byte buffer access is implemented, accessing the data from managed code
+can be very slow.</p>
<p>The choice of which to use depends on two factors:</p>
<ol>
@@ -688,5 +699,4 @@ written in Java can be very slow.</p>
</ol>
<p>If there's no clear winner, use a direct byte buffer. Support for them
-is built directly into JNI, and access to them from code written in
-Java can be made faster with VM improvements.</p>
+is built directly into JNI, and performance should improve in future releases.</p>
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index c270f21a7b25..f3174fef2666 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -651,6 +651,10 @@ static void
android_media_MediaPlayer_native_finalize(JNIEnv *env, jobject thiz)
{
LOGV("native_finalize");
+ sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
+ if (mp != NULL) {
+ LOGW("MediaPlayer finalized without being released");
+ }
android_media_MediaPlayer_release(env, thiz);
}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
index f3cf0f71c6bb..3fb2da080954 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
@@ -17,27 +17,26 @@
package com.android.mediaframeworktest;
import com.android.mediaframeworktest.functional.CameraTest;
-import com.android.mediaframeworktest.functional.MediaAudioTrackTest;
import com.android.mediaframeworktest.functional.MediaMetadataTest;
import com.android.mediaframeworktest.functional.MediaMimeTest;
-import com.android.mediaframeworktest.functional.MediaPlayerApiTest;
-import com.android.mediaframeworktest.functional.MediaRecorderTest;
-import com.android.mediaframeworktest.functional.SimTonesTest;
import com.android.mediaframeworktest.functional.MediaPlayerInvokeTest;
-import com.android.mediaframeworktest.functional.MediaAudioManagerTest;
-import com.android.mediaframeworktest.functional.MediaAudioEffectTest;
-import com.android.mediaframeworktest.functional.MediaBassBoostTest;
-import com.android.mediaframeworktest.functional.MediaEnvReverbTest;
-import com.android.mediaframeworktest.functional.MediaEqualizerTest;
-import com.android.mediaframeworktest.functional.MediaPresetReverbTest;
-import com.android.mediaframeworktest.functional.MediaVirtualizerTest;
-import com.android.mediaframeworktest.functional.MediaVisualizerTest;
-/*import for VideoEditor Test cases*/
-import com.android.mediaframeworktest.functional.MediaItemThumbnailTest;
-import com.android.mediaframeworktest.functional.MediaPropertiesTest;
-import com.android.mediaframeworktest.functional.VideoEditorAPITest;
-import com.android.mediaframeworktest.functional.VideoEditorExportTest;
-import com.android.mediaframeworktest.functional.VideoEditorPreviewTest;
+import com.android.mediaframeworktest.functional.mediaplayback.MediaPlayerApiTest;
+import com.android.mediaframeworktest.functional.mediarecorder.MediaRecorderTest;
+import com.android.mediaframeworktest.functional.audio.SimTonesTest;
+import com.android.mediaframeworktest.functional.audio.MediaAudioTrackTest;
+import com.android.mediaframeworktest.functional.audio.MediaAudioManagerTest;
+import com.android.mediaframeworktest.functional.audio.MediaAudioEffectTest;
+import com.android.mediaframeworktest.functional.audio.MediaBassBoostTest;
+import com.android.mediaframeworktest.functional.audio.MediaEnvReverbTest;
+import com.android.mediaframeworktest.functional.audio.MediaEqualizerTest;
+import com.android.mediaframeworktest.functional.audio.MediaPresetReverbTest;
+import com.android.mediaframeworktest.functional.audio.MediaVirtualizerTest;
+import com.android.mediaframeworktest.functional.audio.MediaVisualizerTest;
+import com.android.mediaframeworktest.functional.videoeditor.MediaItemThumbnailTest;
+import com.android.mediaframeworktest.functional.videoeditor.MediaPropertiesTest;
+import com.android.mediaframeworktest.functional.videoeditor.VideoEditorAPITest;
+import com.android.mediaframeworktest.functional.videoeditor.VideoEditorExportTest;
+import com.android.mediaframeworktest.functional.videoeditor.VideoEditorPreviewTest;
import junit.framework.TestSuite;
import android.test.InstrumentationTestRunner;
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioEffectTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioEffectTest.java
index 1511cd795229..ab78714cb56e 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioEffectTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioEffectTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.audio;
import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames;
@@ -1529,4 +1529,3 @@ public class MediaAudioEffectTest extends ActivityInstrumentationTestCase2<Media
}
}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioManagerTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioManagerTest.java
index 644444ae90df..c9087d14665f 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioManagerTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioManagerTest.java
@@ -14,7 +14,7 @@
* the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.audio;
import com.android.mediaframeworktest.MediaFrameworkTest;
import android.content.Context;
@@ -67,4 +67,4 @@ public class MediaAudioManagerTest extends ActivityInstrumentationTestCase2<Medi
assertTrue("SetRingtoneMode : " + ringtoneMode[i], result);
}
}
- } \ No newline at end of file
+ }
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioTrackTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioTrackTest.java
index cea3a5a797a5..e884aba7bcf7 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioTrackTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioTrackTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.audio;
import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames;
@@ -1250,4 +1250,3 @@ public class MediaAudioTrackTest extends ActivityInstrumentationTestCase2<MediaF
}
}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaBassBoostTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaBassBoostTest.java
index edc3e073ed81..e3aa8cf86cf9 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaBassBoostTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaBassBoostTest.java
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.audio;
import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames;
+import com.android.mediaframeworktest.functional.EnergyProbe;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.media.audiofx.AudioEffect;
@@ -291,4 +292,3 @@ public class MediaBassBoostTest extends ActivityInstrumentationTestCase2<MediaFr
}
}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaEnvReverbTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaEnvReverbTest.java
index 79b90d07bfd0..3c8d05a027e7 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaEnvReverbTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaEnvReverbTest.java
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.audio;
import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames;
+import com.android.mediaframeworktest.functional.EnergyProbe;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.media.audiofx.AudioEffect;
@@ -528,4 +529,3 @@ public class MediaEnvReverbTest extends ActivityInstrumentationTestCase2<MediaFr
}
}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaEqualizerTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaEqualizerTest.java
index 459f55111b21..ee91bbb34d76 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaEqualizerTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaEqualizerTest.java
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.audio;
import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames;
+import com.android.mediaframeworktest.functional.EnergyProbe;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.media.audiofx.AudioEffect;
@@ -354,4 +355,3 @@ public class MediaEqualizerTest extends ActivityInstrumentationTestCase2<MediaFr
}
}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPresetReverbTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaPresetReverbTest.java
index 8cc070e8cb55..757bbc5fb394 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPresetReverbTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaPresetReverbTest.java
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.audio;
import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames;
+import com.android.mediaframeworktest.functional.EnergyProbe;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.media.audiofx.AudioEffect;
@@ -369,4 +370,3 @@ public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<Medi
}
}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaVirtualizerTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaVirtualizerTest.java
index 3d3c01122497..b74e52591cb7 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaVirtualizerTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaVirtualizerTest.java
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.audio;
import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames;
+import com.android.mediaframeworktest.functional.EnergyProbe;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.media.audiofx.AudioEffect;
@@ -296,4 +297,3 @@ public class MediaVirtualizerTest extends ActivityInstrumentationTestCase2<Media
}
}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaVisualizerTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaVisualizerTest.java
index 0d5c6b426dae..e0cf51d0a4d7 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaVisualizerTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaVisualizerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.audio;
import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames;
@@ -506,4 +506,3 @@ public class MediaVisualizerTest extends ActivityInstrumentationTestCase2<MediaF
}
}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/SimTonesTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/SimTonesTest.java
index 241f8d6b7327..aaf992cc07a7 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/SimTonesTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/SimTonesTest.java
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.audio;
// import android.content.Resources;
import com.android.mediaframeworktest.MediaFrameworkTest;
+import com.android.mediaframeworktest.functional.TonesAutoTest;
import android.content.Context;
import android.test.ActivityInstrumentationTestCase;
@@ -70,4 +71,3 @@ public class SimTonesTest extends ActivityInstrumentationTestCase<MediaFramework
assertTrue("Stress Tones", result);
}
}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediaplayback/MediaPlayerApiTest.java
index 57d5368eba0a..c501d3f189f2 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediaplayback/MediaPlayerApiTest.java
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.mediaplayback;
import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames;
import com.android.mediaframeworktest.MediaProfileReader;
+import com.android.mediaframeworktest.functional.CodecTest;
import android.content.Context;
import android.test.ActivityInstrumentationTestCase;
@@ -31,16 +32,15 @@ import java.io.File;
/**
* Junit / Instrumentation test case for the media player api
-
- */
-public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFrameworkTest> {
+ */
+public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFrameworkTest> {
private boolean duratoinWithinTolerence = false;
private String TAG = "MediaPlayerApiTest";
private boolean isWMAEnable = false;
private boolean isWMVEnable = false;
-
+
Context mContext;
-
+
public MediaPlayerApiTest() {
super("com.android.mediaframeworktest", MediaFrameworkTest.class);
isWMAEnable = MediaProfileReader.getWMAEnable();
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java
index 796b52cb77f0..b5c8c8c486f0 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.mediarecorder;
import com.android.mediaframeworktest.MediaFrameworkTest;
import com.android.mediaframeworktest.MediaNames;
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaItemThumbnailTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/MediaItemThumbnailTest.java
index d5b67aa6f017..80a3bcd370a1 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaItemThumbnailTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/MediaItemThumbnailTest.java
@@ -15,7 +15,7 @@
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.videoeditor;
import java.io.File;
import java.io.IOException;
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPropertiesTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/MediaPropertiesTest.java
index 0ad6760d1ee8..e2f68637ba42 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPropertiesTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/MediaPropertiesTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.videoeditor;
import java.io.File;
import java.io.IOException;
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorAPITest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorAPITest.java
index 2a02b58f0bfa..b32d865d083a 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorAPITest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorAPITest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.videoeditor;
import java.io.File;
import java.util.List;
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorExportTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorExportTest.java
index e1b337df9c8a..57a1c75e86f4 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorExportTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorExportTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.videoeditor;
import java.io.File;
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorPreviewTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorPreviewTest.java
index 9a7f4f2ee5c2..e848f5f5b105 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorPreviewTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorPreviewTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.mediaframeworktest.functional;
+package com.android.mediaframeworktest.functional.videoeditor;
import java.io.File;
import java.io.IOException;