Merge "Previous changes put unlinkedJavaLangClass on the heap.  It makes HprofReader unhappy, because it has a NULL class.  So now we won't dump objects with a NULL class. This also suppresses dumping of uninitialized objects." into dalvik-dev
diff --git a/CleanSpec.mk b/CleanSpec.mk
new file mode 100644
index 0000000..b84e1b6
--- /dev/null
+++ b/CleanSpec.mk
@@ -0,0 +1,49 @@
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list.  These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+#     $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+#     $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list.  E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
diff --git a/libcore-disabled/NOTICE b/libcore-disabled/NOTICE
deleted file mode 100644
index a0a06da..0000000
--- a/libcore-disabled/NOTICE
+++ /dev/null
@@ -1,16 +0,0 @@
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the Apache Harmony distribution.                  ==
-   =========================================================================
-
-Apache Harmony
-Copyright 2006 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-Portions of Harmony were originally developed by
-Intel Corporation and are licensed to the Apache Software
-Foundation under the "Software Grant and Corporate Contribution
-License Agreement", informally known as the "Intel Harmony CLA".
diff --git a/libcore-disabled/SoundTest/Android.mk b/libcore-disabled/SoundTest/Android.mk
deleted file mode 100644
index bd628a5..0000000
--- a/libcore-disabled/SoundTest/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_JAVA_LIBRARIES := framework core
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-#define all-core-resource-dirs
-#$(shell cd $(LOCAL_PATH) && find resources)
-#endef
-
-#LOCAL_JAVA_RESOURCE_DIRS := $(call all-core-resource-dirs)
-
-LOCAL_PACKAGE_NAME := SoundTest
-
-include $(BUILD_PACKAGE)
diff --git a/libcore-disabled/SoundTest/AndroidManifest.xml b/libcore-disabled/SoundTest/AndroidManifest.xml
deleted file mode 100644
index 6c8d257..0000000
--- a/libcore-disabled/SoundTest/AndroidManifest.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-  
-          http://www.apache.org/licenses/LICENSE-2.0
-  
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.tests.soundtest">
- -      <application>
-       <!-- icon="@drawable/logo" -->
-        <activity android:name="SoundTest" android:label="SoundTest">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.DEFAULT"/>
-                <category android:name="android.intent.category.LAUNCHER"/>
-            </intent-filter>
-        </activity>
-    </application> 
-</manifest>
diff --git a/libcore-disabled/SoundTest/assets/fx_foghorn.mp3 b/libcore-disabled/SoundTest/assets/fx_foghorn.mp3
deleted file mode 100644
index 71226cf..0000000
--- a/libcore-disabled/SoundTest/assets/fx_foghorn.mp3
+++ /dev/null
Binary files differ
diff --git a/libcore-disabled/SoundTest/res/layout/riproaring_activity.xml b/libcore-disabled/SoundTest/res/layout/riproaring_activity.xml
deleted file mode 100644
index a21599e..0000000
--- a/libcore-disabled/SoundTest/res/layout/riproaring_activity.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-  
-          http://www.apache.org/licenses/LICENSE-2.0
-  
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content">
-	<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" />
-		
-	<TextView android:id="@+id/label" android:textStyle="bold" android:textColor="#00000000" android:textSize="16sp" 
-		android:layout_weight="1"
-		android:text="@string/textview_text" />
-		
-	<EditText android:id="@+id/entry" 
-        android:layout_width="match_parent" 
-        android:layout_height="wrap_content" 
-        android:background="@android:drawable/editbox_background"
-        android:text="@string/edittext_text"
-        android:layout_below="@id/label"/>
-  
-    <Button android:id="@+id/ok" 
-        android:layout_width="wrap_content" 
-        android:layout_height="wrap_content" 
-        android:layout_below="@id/entry"
-        android:layout_alignParentRight="true"
-        android:text="@string/button_text" />
-		
-</LinearLayout>
diff --git a/libcore-disabled/SoundTest/res/values/strings.xml b/libcore-disabled/SoundTest/res/values/strings.xml
deleted file mode 100644
index 6ad4891..0000000
--- a/libcore-disabled/SoundTest/res/values/strings.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-* Copyright (C) 2007 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
--->
-
-<resources>
-
-    <string name="textview_text">I am a TextView</string>
-    <string name="edittext_text">I am an EditText</string>
-    <string name="button_text">I am a Button</string>
-
-</resources>
diff --git a/libcore-disabled/SoundTest/src/com/android/tests/soundtest/SoundTest.java b/libcore-disabled/SoundTest/src/com/android/tests/soundtest/SoundTest.java
deleted file mode 100644
index 3be10a0..0000000
--- a/libcore-disabled/SoundTest/src/com/android/tests/soundtest/SoundTest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.tests.soundtest;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Bundle;
-import android.os.HandlerInterface;
-import android.os.Message;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.Window;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup.LayoutParams;
-import android.widget.Button;
-import android.widget.LinearLayout;
-
-import java.io.InputStream;
-
-import javax.sound.midi.MidiSystem;
-import javax.sound.midi.Sequencer;
-import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.DataLine;
-import javax.sound.sampled.SourceDataLine;
-
-
-public class SoundTest extends Activity implements HandlerInterface {
-
-    public Context mContext;
-    private LinearLayout mLinearLayout;
-    public LayoutParams mParams;
-    Button button, button2;
-
-    public void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-
-        Window wp = getWindow();
-        mContext = wp.getContext();
-        mParams = wp.getAttributes();
-
-        mLinearLayout = new LinearLayout(this);
-        mLinearLayout.setOrientation(LinearLayout.VERTICAL);
-        setContentView(mLinearLayout);
-
-        button = new Button(mContext);
-        button.setMinimumWidth(300);
-        button.setMinimumHeight(70);
-        button.setTextSize(14);
-        button.setText("Play sample");
-        button.setOnClickListener(buttonListener);
-
-        mLinearLayout.addView(button, new LinearLayout.LayoutParams(
-            ViewGroup.LayoutParams.WRAP_CONTENT,
-            ViewGroup.LayoutParams.WRAP_CONTENT));
-        
-        button2 = new Button(mContext);
-        button2.setMinimumWidth(300);
-        button2.setMinimumHeight(70);
-        button2.setTextSize(14);
-        button2.setText("Play MIDI");
-        button2.setOnClickListener(buttonListener2);
-
-        mLinearLayout.addView(button2, new LinearLayout.LayoutParams(
-            ViewGroup.LayoutParams.WRAP_CONTENT,
-            ViewGroup.LayoutParams.WRAP_CONTENT));
-        
-    }
-
-    private OnClickListener buttonListener = new OnClickListener() {
-        public void onClick(View v) {
-            try {
-                button.setText(button.getText() + ".");
-                
-                int RENDER_BUFF_SIZE = 1024*48;
-
-                InputStream is = getAssets().open("fx_foghorn.mp3");
-                
-                AudioInputStream ais = null;
-
-                ais = AudioSystem.getAudioInputStream(is);
-
-                AudioFormat af = ais.getFormat();
-                SourceDataLine sdl = null;
-                DataLine.Info dli = new DataLine.Info(SourceDataLine.class, af);
-                sdl = (SourceDataLine)AudioSystem.getLine(dli);
-
-                sdl.open(af);
-                sdl.start();
-
-                int bytesReaded = 0;
-                byte samplesBuff[] = new byte[RENDER_BUFF_SIZE];
-
-                while (bytesReaded != -1) {
-                    bytesReaded = ais.read(samplesBuff, 0, samplesBuff.length);
-                    if (bytesReaded > 0) {
-                        sdl.write(samplesBuff, 0, bytesReaded);
-                    }
-                }
-
-                sdl.drain();
-                sdl.close();
-            } catch (Exception ee) {
-                ee.printStackTrace();
-            }
-        }
-    };
-
-    private OnClickListener buttonListener2 = new OnClickListener() {
-        public void onClick(View v) {
-            try {
-                button2.setText(button2.getText() + ".");
-                
-                int RENDER_BUFF_SIZE = 1024*48;
-
-                InputStream is = getAssets().open("Dancing_Queen.mid");
-                
-                Sequencer s = MidiSystem.getSequencer(); 
-                s.open();
-                s.setSequence(is);
-                s.setLoopCount(1);
-                s.start();
-                
-            } catch (Exception ee) {
-                ee.printStackTrace();
-            }
-        }
-    };
-    
-    public void handleMessage(Message arg0) {
-    }
-}
diff --git a/libcore-disabled/instrument/MODULE_LICENSE_APACHE2 b/libcore-disabled/instrument/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/libcore-disabled/instrument/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/libcore-disabled/instrument/src/main/java/java/lang/instrument/ClassDefinition.java b/libcore-disabled/instrument/src/main/java/java/lang/instrument/ClassDefinition.java
deleted file mode 100644
index 0780ca0..0000000
--- a/libcore-disabled/instrument/src/main/java/java/lang/instrument/ClassDefinition.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package java.lang.instrument;
-
-import org.apache.harmony.instrument.internal.nls.Messages;
-
-/**
- * Wraps a {@link java.lang.Class} that is to be redefined together with the
- * byte array which constitutes the updated version of the class.
- * 
- */
-public final class ClassDefinition {
-
-    /**
-     * The <code>Class</code> object for the class that will be instrumented.
-     */
-    private Class<?> definitionClass;
-
-    /**
-     * The new version of the class file bytes for the class being instrumented.
-     */
-    private byte[] definitionClassFile;
-
-    /**
-     * Constructs a new instance of <code>ClassDefinition</code> with the
-     * supplied {@link Class} object and byte array representing the new class
-     * file bytes.
-     * 
-     * @param theClass
-     *            the <code>Class</code> object for the class to be redefined
-     * @param theClassFile
-     *            an array of bytes containing the updated version of the class
-     *            to be redefined.
-     * @throws NullPointerException
-     *             if either <code>theClass</code> or
-     *             <code>theClassFile</code> are <code>null</code>.
-     */
-    public ClassDefinition(Class<?> theClass, byte[] theClassFile) {
-        if (theClass == null) {
-            throw new NullPointerException(Messages.getString("instrument.1")); //$NON-NLS-1$
-        }
-        if (theClassFile == null) {
-            throw new NullPointerException(Messages.getString("instrument.2")); //$NON-NLS-1$
-        }
-        this.definitionClass = theClass;
-        this.definitionClassFile = theClassFile;
-    }
-
-    /**
-     * Returns the {@link Class} object for the class to be redefined.
-     * 
-     * @return the <code>Class</code> object
-     */
-    public Class<?> getDefinitionClass() {
-        return this.definitionClass;
-    }
-
-    /**
-     * Returns a reference to the byte array containing the re-engineered
-     * version of the class.
-     * 
-     * @return byte array containing the new version of the class
-     */
-    public byte[] getDefinitionClassFile() {
-        return this.definitionClassFile;
-    }
-}
diff --git a/libcore-disabled/instrument/src/main/java/java/lang/instrument/ClassFileTransformer.java b/libcore-disabled/instrument/src/main/java/java/lang/instrument/ClassFileTransformer.java
deleted file mode 100644
index 429184d..0000000
--- a/libcore-disabled/instrument/src/main/java/java/lang/instrument/ClassFileTransformer.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package java.lang.instrument;
-
-import java.security.ProtectionDomain;
-
-/**
- * This interface must be implemented by types used to instrument classes as
- * they are loaded by a running VM. Implementations are registered by agents in
- * the {@link java.lang.instrument.Instrumentation#addTransformer} operation.
- * Once registered, a <code>ClassFileTransformer</code> has the opportunity to
- * instrument every class that is loaded or redefined by the VM provided that
- * the transformer does not have a dependency on that class.
- * <p>
- * Transformations of classes takes place just prior to them being defined by
- * the VM.
- * </p>
- * 
- */
-public interface ClassFileTransformer {
-
-    /**
-     * Receives a <code>byte</code> array containing the raw contents of a
-     * class for <i>possible</i> transformation into a new <code>byte</code>
-     * array which gets returned to the caller. It is left up to the
-     * implementation to decide what, if any, transformations are carried out
-     * and returned.
-     * <p>
-     * Requests for class transformations can occur in two situations.
-     * <ul>
-     * <li>the attempted defining of a class using
-     * {@link ClassLoader#defineClass(java.lang.String, byte[], int, int)}
-     * <li>the attempted re-defining of a previously defined class using
-     * {@link Instrumentation#redefineClasses(ClassDefinition[])}
-     * </ul>
-     * In both cases this operation will be called before the verification of
-     * the specified bytes in the <code>Class</code> file format. Each
-     * registered <code>ClassFileTransformer</code> instance will have this
-     * operation called on it. The order of the invocations matches the order in
-     * which the transformers were registered using the method
-     * {@link Instrumentation#addTransformer(ClassFileTransformer)}.
-     * </p>
-     * <p>
-     * Provided that the implementation of this method wishes to carry out a
-     * transformation, the return is a newly allocated <code>byte</code> array
-     * which contains <i>a copy of</i> the <code>classfileBuffer</code>
-     * argument plus the transformations to the array specific to the method
-     * implementation. If the transformer is written so as to pass on the
-     * opportunity to modify a given input then the return value should be
-     * <code>null</code>.
-     * </p>
-     * 
-     * @param loader
-     *            the <i>defining</i> <code>ClassLoader</code> for the
-     *            candidate class to be transformed.
-     * @param className
-     *            the fully qualified name of the candidate class to be
-     *            transformed in the <i>fully/qualified/Name</i> format.
-     * @param classBeingRedefined
-     *            if a class redefinition is in process then this argument will
-     *            be the <code>Class</code> object for the class. Otherwise,
-     *            if a class definition is in process, a <code>null</code>.
-     * @param protectionDomain
-     *            the security protection domain for the class being defined or
-     *            redefined.
-     * @param classfileBuffer
-     *            a <code>byte</code> array containing the class to be
-     *            transformed in <code>Class</code> file format.
-     *            <em>This argument
-     *            must not be modified</em>.
-     * @return if transformation occurs, a newly allocated <code>byte</code>
-     *         array containing the modified version of
-     *         <code>classfileBuffer</code>, otherwise <code>null</code>.
-     * @throws IllegalClassFormatException
-     *             if the <code>classfileBuffer</code> does not contain a
-     *             well-formed representation of a class in the
-     *             <code>Class</code> file format. Note that if an invocation
-     *             of this operation ends on an exception throw then (a) the
-     *             remaining transformers in the &quot;chain&quot; will still
-     *             have this method called, and (b) the class definition or
-     *             redefinition that was the catalyst for the transformation
-     *             opportunities will still be attempted.
-     */
-    public byte[] transform(ClassLoader loader, String className,
-            Class<?> classBeingRedefined, ProtectionDomain protectionDomain,
-            byte[] classfileBuffer) throws IllegalClassFormatException;
-}
diff --git a/libcore-disabled/instrument/src/main/java/java/lang/instrument/IllegalClassFormatException.java b/libcore-disabled/instrument/src/main/java/java/lang/instrument/IllegalClassFormatException.java
deleted file mode 100644
index 9696bfe..0000000
--- a/libcore-disabled/instrument/src/main/java/java/lang/instrument/IllegalClassFormatException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package java.lang.instrument;
-
-/**
- * This exception may be thrown from implementations of the method
- * {@link java.lang.instrument.ClassFileTransformer#transform} when the class
- * file bytes supplied to it are found to be corrupted or otherwise in a format
- * which does not adhere to the expected Java class file format.
- * 
- */
-public class IllegalClassFormatException extends Exception {
-
-    private static final long serialVersionUID = -3841736710924794009L;
-
-    /**
-     * Constructs a new instance of <code>IllegalClassFormatException</code>
-     * with no explanatory message.
-     */
-    public IllegalClassFormatException() {
-        super();
-    }
-
-    /**
-     * Constructs a new instance of <code>IllegalClassFormatException</code>
-     * with the supplied message, <code>s</code>, for explanation.
-     * 
-     * @param s
-     *            a string containing information on why the exception is being
-     *            created.
-     */
-    public IllegalClassFormatException(String s) {
-        super(s);
-    }
-}
\ No newline at end of file
diff --git a/libcore-disabled/instrument/src/main/java/java/lang/instrument/Instrumentation.java b/libcore-disabled/instrument/src/main/java/java/lang/instrument/Instrumentation.java
deleted file mode 100644
index 6dd053f..0000000
--- a/libcore-disabled/instrument/src/main/java/java/lang/instrument/Instrumentation.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package java.lang.instrument;
-
-/**
- * Instances of this interface may be used by Java instrumentation agent code
- * for support in carrying out the runtime instrumentation of classes. Using
- * such an approach, classes may be enhanced with services such as profiling,
- * logging or tracing which were not included in the source of the original
- * class.
- * <p>
- * A concrete instance of this interface is made available as an input argument
- * to all Java instrumentation agents'
- * <code>premain(String agentArgs, Instrumentation inst)</code> method.
- * </p>
- * 
- */
-public interface Instrumentation {
-
-    /**
-     * Registers the supplied <code>transformer</code> argument with the VM.
-     * Any classes that are to be defined or re-defined (if supported) in the VM
-     * will then be offered to the transformer for it to carry out any byte code
-     * modifications. The exception to this scheme is if the class to be defined /
-     * re-defined is a dependency of the transformer.
-     * <p>
-     * This operation can be carried out multiple times on a concrete
-     * <code>Instrumentation</code>. The order of registration is important
-     * as it defines the order in which the transformers' transformation
-     * operation gets called.
-     * <p>
-     * <p>
-     * It is possible for any given instance of
-     * <code>ClassFileTransformer</code> to be registered more than once with
-     * this operation.
-     * 
-     * @param transformer
-     *            a class file transformer
-     * @throws NullPointerException
-     *             if <code>transformer</code> is <code>null</code>.
-     */
-    public void addTransformer(ClassFileTransformer transformer);
-
-    /**
-     * Returns an array of all of the classes that have been loaded into the VM.
-     * 
-     * @return an array of <code>Class</code> objects with each element
-     *         identifying a class that has been loaded into the VM.
-     */
-    public Class[] getAllLoadedClasses();
-
-    /**
-     * Returns an array of all of the classes for which <code>loader</code> is
-     * the <i>initiating</i> class loader.
-     * 
-     * @param loader
-     *            a class loader. In order to obtain the array of classes
-     *            initiated by the bootstrap class loader this argument should
-     *            be <code>null</code>.
-     * @return an array of <code>Class</code> objects with each element
-     *         identifying a class that has been initiated by the specified
-     *         class loader.
-     */
-    public Class[] getInitiatedClasses(ClassLoader loader);
-
-    /**
-     * Returns the number of bytes in memory required by this VM for the
-     * supplied object <code>objectToSize</code>. The returned value should
-     * be taken as an estimation only which is susceptible to change between
-     * separate launches of the VM.
-     * 
-     * @param objectToSize
-     *            any object
-     * @return an approximation of the number of bytes in memory taken up by
-     *         <code>objectToSize</code>.
-     * @throws NullPointerException
-     *             if the given object is null.
-     */
-    public long getObjectSize(Object objectToSize);
-
-    /**
-     * Returns a boolean indication of whether or not this VM supports the
-     * on-the-fly redefining of classes that have been already loaded.
-     * 
-     * @return <code>true</code> if class redefining is supported, otherwise
-     *         <code>false</code>.
-     */
-    public boolean isRedefineClassesSupported();
-
-    /**
-     * Receives an array of {@link ClassDefinition} instances and attempts to
-     * carry out on-the-fly redefining on each of the associated classes.
-     * Redefining in this manner may be used to update the following parts of an
-     * already loaded class:
-     * <ul>
-     * <li>attributes
-     * <li>constant pool
-     * <li>method implementations
-     * </ul>
-     * If any invocations of a redefined method are already active in the VM
-     * when this call is made then they will run to completion and be unaffected
-     * by the outcome of this method. Provided the method redefinition is
-     * successful, all subsequent calls on the method will run the new version.
-     * <br>
-     * Redefining a class may <em>not</em> be used to make changes to any
-     * other aspects of a previously loaded class such as its inheritance
-     * hierarchy, the names or signatures of any of its methods, the names of
-     * any fields, the values of any static variables etc.
-     * <p>
-     * If a class associated with a <code>ClassDefinition</code> is
-     * successfully redefined then there will be no resulting re-run of any of
-     * its initialization code. Similarly, any instances of the class that were
-     * created before the redefining will not be changed in any way. That is,
-     * they will remain in the VM as instances of the previous version of the
-     * class.
-     * </p>
-     * <p>
-     * Note that before the requested redefinitions are attempted, each
-     * {@link ClassFileTransformer} registered with the VM will be given the
-     * opportunity to carry out their own custom transformations of the new
-     * version of the class.
-     * </p>
-     * 
-     * @param definitions
-     *            an array of <code>ClassDefinition</code> objects wrapping
-     *            the details of the classes to be redefined. A zero-length
-     *            array value will not cause an error but, instead, will
-     *            silently do nothing.
-     * @throws ClassNotFoundException
-     *             if any of the classes specified in the contents of
-     *             <code>definitions</code> cannot be located.
-     * @throws UnmodifiableClassException
-     *             if any of the classes specified in the contents of
-     *             <code>definitions</code> cannot be modified.
-     * @throws UnsupportedOperationException
-     *             if this method is not supported in by the VM. May be checked
-     *             in advance by calling {@link #isRedefineClassesSupported()}.
-     * @throws ClassFormatError
-     *             if any of the <code>definitions</code> elements has been
-     *             created with a <code>byte</code> array containing a badly
-     *             formed class file.
-     * @throws NoClassDefFoundError
-     *             if there is disagreement between the name of a class to be
-     *             redefined and the name of the class from the corresponding
-     *             class file format byte array.
-     * @throws UnsupportedClassVersionError
-     *             if the version of any of the classes to be redefined is not
-     *             supported by the VM.
-     * @throws ClassCircularityError
-     *             if a circular dependency is detected among the classes to be
-     *             redefined.
-     * @throws LinkageError
-     *             if a linkage error situation is detected such that there is
-     *             an incompatability between dependent classes.
-     * @throws NullPointerException
-     *             if <code>definitions</code> or any of its elements are
-     *             found to be <code>null</code>.
-     * @see #isRedefineClassesSupported()
-     */
-    public void redefineClasses(ClassDefinition[] definitions)
-            throws ClassNotFoundException, UnmodifiableClassException;
-
-    /**
-     * Removes <i>the most recently added instance of</i> the
-     * <code>ClassFileTransformer</code> object from the VM's list of
-     * registered transformers. After this call completes, the specified
-     * <code>ClassFileTransformer</code> object will no longer have its
-     * <code>transform()<code> method automatically invoked when class definitions or
-     * redefinitions are attempted. 
-     * 
-     * @param transformer
-     *            a previously registered <code>ClassFileTransformer</code>.
-     * @return <code>true</code> if <code>transformer</code> was located in
-     *         the list of registered transformers and successfully removed.
-     *         Otherwise, <code>false</code>.
-     * @throws NullPointerException
-     *            if <code>transformer</code> is <code>null</code>.
-     */
-    public boolean removeTransformer(ClassFileTransformer transformer);
-}
diff --git a/libcore-disabled/instrument/src/main/java/java/lang/instrument/UnmodifiableClassException.java b/libcore-disabled/instrument/src/main/java/java/lang/instrument/UnmodifiableClassException.java
deleted file mode 100644
index e8c8d57..0000000
--- a/libcore-disabled/instrument/src/main/java/java/lang/instrument/UnmodifiableClassException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package java.lang.instrument;
-
-/**
- * This exception may be thrown from implementations of the method
- * {@link java.lang.instrument.Instrumentation#redefineClasses} when one of the
- * desired class redefinition operations cannot be carried out. Such a situation
- * may arise if a redefinition attempts to alter the members of a class or its
- * inheritance hierarchy.
- * 
- */
-public class UnmodifiableClassException extends Exception {
-
-    private static final long serialVersionUID = 1716652643585309178L;
-
-    /**
-     * Constructs a new instance of <code>UnmodifiableClassException</code>
-     * with no explanatory message.
-     */
-    public UnmodifiableClassException() {
-        super();
-    }
-
-    /**
-     * Constructs a new instance of <code>UnmodifiableClassException</code>
-     * with the supplied message, <code>s</code>, for explanation.
-     * 
-     * @param s
-     *            a string containing information on why the exception is being
-     *            created.
-     */
-    public UnmodifiableClassException(String s) {
-        super(s);
-    }
-}
diff --git a/libcore-disabled/instrument/src/main/java/java/lang/instrument/package.html b/libcore-disabled/instrument/src/main/java/java/lang/instrument/package.html
deleted file mode 100644
index 50224d7..0000000
--- a/libcore-disabled/instrument/src/main/java/java/lang/instrument/package.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<html>
-  <body>
-    <p>
-      Provides classes and interfaces needed for instrumenting applications.
-    <p>
-  </body>
-</html>
\ No newline at end of file
diff --git a/libcore-disabled/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/Messages.java b/libcore-disabled/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/Messages.java
deleted file mode 100644
index cdde768..0000000
--- a/libcore-disabled/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/Messages.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * THE FILE HAS BEEN AUTOGENERATED BY MSGTOOL TOOL.
- * All changes made to this file manually will be overwritten 
- * if this tool runs again. Better make changes in the template file.
- */
-
-package org.apache.harmony.instrument.internal.nls;
-
-// BEGIN android-added
-import org.apache.harmony.luni.util.MsgHelp;
-// END android-added
-
-/**
- * This class retrieves strings from a resource bundle and returns them,
- * formatting them with MessageFormat when required.
- * <p>
- * It is used by the system classes to provide national language support, by
- * looking up messages in the <code>
- *    org.apache.harmony.instrument.internal.nls.messages
- * </code>
- * resource bundle. Note that if this file is not available, or an invalid key
- * is looked up, or resource bundle support is not available, the key itself
- * will be returned as the associated message. This means that the <em>KEY</em>
- * should a reasonable human-readable (english) string.
- * 
- */
-public class Messages {
-
-    // BEGIN android-changed
-    private static final String sResource =
-        "org.apache.harmony.instrument.internal.nls.messages";
-    // END android-changed
-
-    /**
-     * Retrieves a message which has no arguments.
-     * 
-     * @param msg
-     *            String the key to look up.
-     * @return String the message for that key in the system message bundle.
-     */
-    static public String getString(String msg) {
-        // BEGIN android-changed
-        return MsgHelp.getString(sResource, msg);
-        // END android-changed
-    }
-
-    /**
-     * Retrieves a message which takes 1 argument.
-     * 
-     * @param msg
-     *            String the key to look up.
-     * @param arg
-     *            Object the object to insert in the formatted output.
-     * @return String the message for that key in the system message bundle.
-     */
-    static public String getString(String msg, Object arg) {
-        return getString(msg, new Object[] { arg });
-    }
-
-    /**
-     * Retrieves a message which takes 1 integer argument.
-     * 
-     * @param msg
-     *            String the key to look up.
-     * @param arg
-     *            int the integer to insert in the formatted output.
-     * @return String the message for that key in the system message bundle.
-     */
-    static public String getString(String msg, int arg) {
-        return getString(msg, new Object[] { Integer.toString(arg) });
-    }
-
-    /**
-     * Retrieves a message which takes 1 character argument.
-     * 
-     * @param msg
-     *            String the key to look up.
-     * @param arg
-     *            char the character to insert in the formatted output.
-     * @return String the message for that key in the system message bundle.
-     */
-    static public String getString(String msg, char arg) {
-        return getString(msg, new Object[] { String.valueOf(arg) });
-    }
-
-    /**
-     * Retrieves a message which takes 2 arguments.
-     * 
-     * @param msg
-     *            String the key to look up.
-     * @param arg1
-     *            Object an object to insert in the formatted output.
-     * @param arg2
-     *            Object another object to insert in the formatted output.
-     * @return String the message for that key in the system message bundle.
-     */
-    static public String getString(String msg, Object arg1, Object arg2) {
-        return getString(msg, new Object[] { arg1, arg2 });
-    }
-
-    /**
-     * Retrieves a message which takes several arguments.
-     * 
-     * @param msg
-     *            String the key to look up.
-     * @param args
-     *            Object[] the objects to insert in the formatted output.
-     * @return String the message for that key in the system message bundle.
-     */
-    static public String getString(String msg, Object[] args) {
-        // BEGIN android-changed
-        return MsgHelp.getString(sResource, msg, args);
-        // END android-changed
-    }
-}
diff --git a/libcore-disabled/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/messages.properties b/libcore-disabled/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/messages.properties
deleted file mode 100644
index 6c59186..0000000
--- a/libcore-disabled/instrument/src/main/java/org/apache/harmony/instrument/internal/nls/messages.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#  
-#      http://www.apache.org/licenses/LICENSE-2.0
-#  
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-# 
-
-# messages for EN locale
-instrument.1=Received null class argument.
-instrument.2=Received null class file argument.
-instrument.3=Redefinition operation is not supported!
-instrument.4=Fatal error: failed to execute premain class of java agent.
diff --git a/libcore-disabled/sound/MODULE_LICENSE_APACHE2 b/libcore-disabled/sound/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/libcore-disabled/sound/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/libcore-disabled/sound/src/main/java/com/android/internal/sound/midi/AndroidMidiFileReader.java b/libcore-disabled/sound/src/main/java/com/android/internal/sound/midi/AndroidMidiFileReader.java
deleted file mode 100644
index fb6b0e5..0000000
--- a/libcore-disabled/sound/src/main/java/com/android/internal/sound/midi/AndroidMidiFileReader.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.sound.midi;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.sound.midi.InvalidMidiDataException;
-import javax.sound.midi.MidiFileFormat;
-import javax.sound.midi.Sequence;
-import javax.sound.midi.spi.MidiFileReader;
-
-/**
- * Implements a MidiFileReader for Android. We need to cache data coming from an
- * arbitrary InputStream, since the Android MediaPlayer expects us to pass in a
- * file or a URL.
- */
-public class AndroidMidiFileReader extends MidiFileReader {
-
-    @Override
-    public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public MidiFileFormat getMidiFileFormat(InputStream stream) throws InvalidMidiDataException,
-            IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Sequence getSequence(File file) throws InvalidMidiDataException, IOException {
-        return new AndroidSequence(file.toURL());
-    }
-
-    @Override
-    public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
-        File file = File.createTempFile("javax.sound.midi-", null);
-        file.deleteOnExit();
-
-        BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));
-        byte[] buffer = new byte[1024];
-
-        int count = stream.read(buffer);
-        while (count >= 0) {
-            out.write(buffer, 0, count);
-            count = stream.read(buffer);
-        }
-
-        out.flush();
-        out.close();
-
-        return getSequence(file);
-    }
-
-    @Override
-    public Sequence getSequence(URL url) throws InvalidMidiDataException, IOException {
-        return new AndroidSequence(url);
-    }
-
-}
diff --git a/libcore-disabled/sound/src/main/java/com/android/internal/sound/midi/AndroidSequence.java b/libcore-disabled/sound/src/main/java/com/android/internal/sound/midi/AndroidSequence.java
deleted file mode 100644
index 861f970..0000000
--- a/libcore-disabled/sound/src/main/java/com/android/internal/sound/midi/AndroidSequence.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.sound.midi;
-
-import java.net.URL;
-
-import javax.sound.midi.InvalidMidiDataException;
-import javax.sound.midi.Sequence;
-
-/**
- * Implements a MIDI Sequence for Android. Its set of tracks etc. will always
- * be empty (at least we don't care about the contents). Instead, we store the
- * URL to the original MIDI data in it, so we can feed it into the Android
- * MediaPlayer.
- */
-public class AndroidSequence extends Sequence {
-
-    /**
-     * Holds the URL to the MIDI data.
-     */
-    private URL url;
-    
-    /**
-     * Creates a new AndroidSequence.
-     * 
-     * @param url The URL that points to the MIDI data.
-     *  
-     * @throws InvalidMidiDataException If the MIDI data is invalid (which we
-     *         actually don't check at all).
-     */
-    public AndroidSequence(URL url) throws InvalidMidiDataException {
-        super(0.0f, 1);
-        
-        this.url = url;
-    }
-
-    /**
-     * Returns the URL pointing to the MIDI data.
-     * 
-     * @return The URL.
-     */
-    URL getURL() {
-        return url;
-    }
-
-}
diff --git a/libcore-disabled/sound/src/main/java/com/android/internal/sound/midi/AndroidSequencer.java b/libcore-disabled/sound/src/main/java/com/android/internal/sound/midi/AndroidSequencer.java
deleted file mode 100644
index 6b3ea20..0000000
--- a/libcore-disabled/sound/src/main/java/com/android/internal/sound/midi/AndroidSequencer.java
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.sound.midi;
-
-import android.media.AudioManager;
-import android.media.MediaPlayer;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.sound.midi.ControllerEventListener;
-import javax.sound.midi.InvalidMidiDataException;
-import javax.sound.midi.MetaEventListener;
-import javax.sound.midi.MidiDevice;
-import javax.sound.midi.MidiUnavailableException;
-import javax.sound.midi.Receiver;
-import javax.sound.midi.Sequence;
-import javax.sound.midi.Sequencer;
-import javax.sound.midi.Track;
-import javax.sound.midi.Transmitter;
-
-/**
- * Implements a MIDI Sequencer for Android. Since Android's MediaPlayer is
- * somewhat limited, we only support MIDI playback, but not recording or the
- * querying of MIDI information. Many of the methods hence throw
- * {@link java.lang.UnsupportedOperationException} or return dummy results.
- */
-public class AndroidSequencer implements Sequencer {
-
-    /**
-     * Defines the DeviceInfo for our AndroidSequencer.
-     */
-    private class Info extends MidiDevice.Info {
-        public Info() {
-            super("Android Sequencer", "Android Sequencer", "The Android Project", "1.0");        
-        }
-    }
-    
-    /**
-     * Holds the Android MediaPlayer we use.
-     */
-    private MediaPlayer player;
-    
-    /**
-     * Holds the Android Sequence we want to play.
-     */
-    private AndroidSequence sequence;
-
-    public int[] addControllerEventListener(ControllerEventListener listener, int[] controllers) {
-        throw new UnsupportedOperationException();
-    }
-
-    public boolean addMetaEventListener(MetaEventListener listener) {
-        throw new UnsupportedOperationException();
-    }
-
-    public int getLoopCount() {
-        throw new UnsupportedOperationException();
-    }
-
-    public long getLoopEndPoint() {
-        throw new UnsupportedOperationException();
-    }
-
-    public long getLoopStartPoint() {
-        throw new UnsupportedOperationException();
-    }
-
-    public SyncMode getMasterSyncMode() {
-        throw new UnsupportedOperationException();
-    }
-
-    public SyncMode[] getMasterSyncModes() {
-        throw new UnsupportedOperationException();
-    }
-
-    public long getMicrosecondLength() {
-        throw new UnsupportedOperationException();
-    }
-
-    public long getMicrosecondPosition() {
-        throw new UnsupportedOperationException();
-    }
-
-    public Sequence getSequence() {
-        return sequence;
-    }
-
-    public SyncMode getSlaveSyncMode() {
-        throw new UnsupportedOperationException();
-    }
-
-    public SyncMode[] getSlaveSyncModes() {
-        throw new UnsupportedOperationException();
-    }
-
-    public float getTempoFactor() {
-        throw new UnsupportedOperationException();
-    }
-
-    public float getTempoInBPM() {
-        throw new UnsupportedOperationException();
-    }
-
-    public float getTempoInMPQ() {
-        throw new UnsupportedOperationException();
-    }
-
-    public long getTickLength() {
-        throw new UnsupportedOperationException();
-    }
-
-    public long getTickPosition() {
-        throw new UnsupportedOperationException();
-    }
-
-    public boolean getTrackMute(int track) {
-        throw new UnsupportedOperationException();
-    }
-
-    public boolean getTrackSolo(int track) {
-        throw new UnsupportedOperationException();
-    }
-
-    public boolean isRecording() {
-        return false;
-    }
-
-    public boolean isRunning() {
-        return player != null && player.isPlaying();
-    }
-
-    public void recordDisable(Track track) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void recordEnable(Track track, int channel) {
-        throw new UnsupportedOperationException();
-    }
-
-    public int[] removeControllerEventListener(ControllerEventListener listener, int[] controllers) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void removeMetaEventListener(MetaEventListener listener) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setLoopCount(int count) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setLoopEndPoint(long tick) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setLoopStartPoint(long tick) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setMasterSyncMode(SyncMode sync) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setMicrosecondPosition(long microseconds) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setSequence(InputStream stream) throws IOException, InvalidMidiDataException {
-        setSequence(new AndroidMidiFileReader().getSequence(stream));
-    }
-
-    public void setSequence(Sequence sequence) throws InvalidMidiDataException {
-        if (!(sequence instanceof AndroidSequence)) {
-            throw new InvalidMidiDataException("Sequence must be an AndroidSequence");
-        }
-        
-        if (isRunning()) {
-            stop();
-        }
-        
-        this.sequence = (AndroidSequence)sequence;
-    }
-
-    public void setSlaveSyncMode(SyncMode sync) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setTempoFactor(float factor) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setTempoInBPM(float bpm) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setTempoInMPQ(float mpq) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setTickPosition(long tick) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setTrackMute(int track, boolean mute) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setTrackSolo(int track, boolean solo) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void start() {
-        if (!isOpen()) {
-            throw new IllegalStateException("Sequencer must be open");
-        }
-        
-        if (sequence == null) {
-            throw new IllegalStateException("Need a Sequence to play");
-        }
-
-        if (!isRunning()) {
-            /*
-             * This is ugly, but there is no way around it: The javax.sound API
-             * doesn't expect to throw an exception at this point for illegal
-             * MIDI sequences. Since we don't really construct the MIDI sequence
-             * from the original binary data, but only refer to its URL, the
-             * MediaPlayer can actually bail out at this point. We wrap the
-             * exception into a RuntimeException, to at least keep the API
-             * contract.
-             */
-            try {
-                String s = this.sequence.getURL().toExternalForm();
-                
-                /*
-                 * TODO Workaround for 1107794: MediaPlayer doesn't handle
-                 * "file:" URLs. Get rid of this.
-                 */
-                if (s.startsWith("file:")) {
-                    s = s.substring(5);
-                }
-                
-                player.setDataSource(s);
-                player.setAudioStreamType(AudioManager.STREAM_MUSIC);
-                player.prepare();
-            } catch (IOException ex) {
-                throw new RuntimeException(ex.toString());
-            }
-            
-            player.start();
-        }
-    }
-
-    public void startRecording() {
-        throw new UnsupportedOperationException();
-    }
-
-    public void stop() {
-        if (!isOpen()) {
-            throw new IllegalStateException("Sequencer must be open");
-        }
-        
-        if (isRunning()) {
-            player.stop();
-        }
-    }
-
-    public void stopRecording() {
-        throw new UnsupportedOperationException();
-    }
-
-    public void close() {
-        if (isOpen()) {
-            stop();
-            player = null;
-        }
-    }
-    
-    public Info getDeviceInfo() {
-        return new Info();
-    }
-
-    public int getMaxReceivers() {
-        return 0;
-    }
-
-    public int getMaxTransmitters() {
-        return 0;
-    }
-
-    public Receiver getReceiver() throws MidiUnavailableException {
-        throw new MidiUnavailableException("No receiver available");
-    }
-
-    public List<Receiver> getReceivers() {
-        return new ArrayList<Receiver>();
-    }
-
-    public Transmitter getTransmitter() throws MidiUnavailableException {
-        throw new MidiUnavailableException("No receiver available");
-    }
-
-    public List<Transmitter> getTransmitters() {
-        return new ArrayList<Transmitter>();
-    }
-
-    public boolean isOpen() {
-        return player != null;
-    }
-
-    public void open() throws MidiUnavailableException {
-        try {
-            player = new MediaPlayer();
-        } catch (Exception ex) {
-            throw new MidiUnavailableException(ex.toString());
-        }
-    }
-
-}
diff --git a/libcore-disabled/sound/src/main/java/com/android/internal/sound/sampled/AndroidAudioFileReader.java b/libcore-disabled/sound/src/main/java/com/android/internal/sound/sampled/AndroidAudioFileReader.java
deleted file mode 100644
index f9b1d47..0000000
--- a/libcore-disabled/sound/src/main/java/com/android/internal/sound/sampled/AndroidAudioFileReader.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.sound.sampled;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.sound.sampled.AudioFileFormat;
-import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.UnsupportedAudioFileException;
-import javax.sound.sampled.spi.AudioFileReader;
-
-/**
- * Implements an AudioFileReader for Android. We need to cache data coming from
- * an arbitrary InputStream, since the Android MediaPlayer expects us to pass in
- * a file or URL.
- */
-public class AndroidAudioFileReader extends AudioFileReader {
-
-    @Override
-    public AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException,
-            IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public AudioFileFormat getAudioFileFormat(InputStream stream)
-            throws UnsupportedAudioFileException, IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException,
-            IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException,
-            IOException {
-        return new AndroidAudioInputStream(file.toURL());
-    }
-
-    @Override
-    public AudioInputStream getAudioInputStream(InputStream stream)
-            throws UnsupportedAudioFileException, IOException {
-        File file = File.createTempFile("javax.sound.sampled-", null);
-        file.deleteOnExit();
-
-        BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));
-        byte[] buffer = new byte[1024];
-
-        int count = stream.read(buffer);
-        while (count >= 0) {
-            out.write(buffer, 0, count);
-            count = stream.read(buffer);
-        }
-
-        out.flush();
-        out.close();
-
-        return getAudioInputStream(file);
-    }
-
-    @Override
-    public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException,
-            IOException {
-        return new AndroidAudioInputStream(url);
-    }
-
-}
diff --git a/libcore-disabled/sound/src/main/java/com/android/internal/sound/sampled/AndroidAudioInputStream.java b/libcore-disabled/sound/src/main/java/com/android/internal/sound/sampled/AndroidAudioInputStream.java
deleted file mode 100644
index ba97021..0000000
--- a/libcore-disabled/sound/src/main/java/com/android/internal/sound/sampled/AndroidAudioInputStream.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.sound.sampled;
-
-import java.net.URL;
-
-import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioInputStream;
-
-/**
- * Implements an AudioInputStream for Android. Its internal InputStream is
- * unused (at least we don't care about the contents). Instead, we store the
- * URL to the original audio data in it, so we can feed it into the Android
- * MediaPlayer.
- */
-public class AndroidAudioInputStream extends AudioInputStream {
-
-    /**
-     * Holds the URL to the MIDI data.
-     */
-    private URL url;
-    
-    /**
-     * Creates a new AndroidAudioInputStream.
-     * 
-     * @param url The URL that points to the audio data.
-     */
-    public AndroidAudioInputStream(URL url) {
-        super(null, new AudioFormat(0.0f, 0, 0, false, false), 0);
-        
-        this.url = url;
-    }
-
-    /**
-     * Returns the URL pointing to the audio data.
-     * 
-     * @return The URL.
-     */
-    URL getURL() {
-        return url;
-    }
- 
-}
diff --git a/libcore-disabled/sound/src/main/java/com/android/internal/sound/sampled/AndroidClip.java b/libcore-disabled/sound/src/main/java/com/android/internal/sound/sampled/AndroidClip.java
deleted file mode 100644
index d70eec1..0000000
--- a/libcore-disabled/sound/src/main/java/com/android/internal/sound/sampled/AndroidClip.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.sound.sampled;
-
-import android.media.AudioManager;
-import android.media.MediaPlayer;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.Clip;
-import javax.sound.sampled.Control;
-import javax.sound.sampled.Line;
-import javax.sound.sampled.LineListener;
-import javax.sound.sampled.LineUnavailableException;
-import javax.sound.sampled.Control.Type;
-
-/**
- * Implements an audio Clip for Android. Since Android's MediaPlayer is somewhat
- * limited, we only support sample playback, but not recording or the querying
- * of sample information. Many of the methods hence throw
- * {@link java.lang.UnsupportedOperationException} or return dummy results.
- */
-public class AndroidClip implements Clip {
-
-    /**
-     * Holds the Android MediaPlayer we use.
-     */
-    private MediaPlayer player;
-    
-    /**
-     * Holds the AndroidAudioInputStream we want to play.
-     */
-    private AndroidAudioInputStream stream;
-    
-    public int getFrameLength() {
-        throw new UnsupportedOperationException();
-    }
-
-    public long getMicrosecondLength() {
-        throw new UnsupportedOperationException();
-    }
-
-    public void loop(int count) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void open(AudioFormat format, byte[] data, int offset, int bufferSize)
-            throws LineUnavailableException {
-        InputStream stream = new ByteArrayInputStream(data, offset, bufferSize);
-
-        open();
-        
-        try {
-            this.stream = (AndroidAudioInputStream)(new AndroidAudioFileReader().getAudioInputStream(stream));
-        } catch (Exception ex) {
-            throw new LineUnavailableException(ex.toString());
-        }
-    }
-
-    public void open(AudioInputStream stream) throws LineUnavailableException, IOException {
-        open();
-        
-        if (!(stream instanceof AndroidAudioInputStream)) {
-            try {
-                stream = new AndroidAudioFileReader().getAudioInputStream(stream);
-            } catch (Exception ex) {
-                throw new LineUnavailableException(ex.toString());
-            }
-        }
-        
-        this.stream = (AndroidAudioInputStream)stream;
-    }
-
-    public void setFramePosition(int frames) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setLoopPoints(int start, int end) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void setMicrosecondPosition(long microseconds) {
-        if (!isOpen()) {
-            throw new IllegalStateException("Clip must be open");
-        }
-        
-        player.seekTo((int)(microseconds / 1000));
-    }
-
-    public int available() {
-        throw new UnsupportedOperationException();
-    }
-
-    public void drain() {
-    }
-
-    public void flush() {
-    }
-
-    public int getBufferSize() {
-        throw new UnsupportedOperationException();
-    }
-
-    public AudioFormat getFormat() {
-        throw new UnsupportedOperationException();
-    }
-
-    public int getFramePosition() {
-        throw new UnsupportedOperationException();
-    }
-
-    public float getLevel() {
-        throw new UnsupportedOperationException();
-    }
-
-    public long getLongFramePosition() {
-        throw new UnsupportedOperationException();
-    }
-
-    public long getMicrosecondPosition() {
-        if (isOpen()) {
-            return player.getCurrentPosition() * 1000;
-        } else {
-            return 0;
-        }
-    }
-
-    public boolean isActive() {
-        return false;
-    }
-
-    public boolean isRunning() {
-        return player != null && player.isPlaying();
-    }
-
-    public void start() {
-        if (!isOpen()) {
-            throw new IllegalStateException("Clip must be open");
-        }
-        
-        if (stream == null) {
-            throw new IllegalStateException("Need an AudioInputStream to play");
-        }
-
-        if (!isRunning()) {
-            /*
-             * This is ugly, but there is no way around it: The javax.sound API
-             * doesn't expect to throw an exception at this point for illegal
-             * MIDI sequences. Since we don't really construct the MIDI sequence
-             * from the original binary data, but only refer to its URL, the
-             * MediaPlayer can actually bail out at this point. We wrap the
-             * exception into a RuntimeException, to at least keep the API
-             * contract.
-             */
-            try {
-                String s = this.stream.getURL().toExternalForm();
-                
-                /*
-                 * TODO Workaround for 1107794: MediaPlayer doesn't handle
-                 * "file:" URLs. Get rid of this.
-                 */
-                if (s.startsWith("file:")) {
-                    s = s.substring(5);
-                }
-                
-                player.setDataSource(s);
-                player.setAudioStreamType(AudioManager.STREAM_MUSIC);
-                player.prepare();
-            } catch (IOException ex) {
-                throw new RuntimeException(ex.toString());
-            }
-            
-            player.start();
-        }
-    }
-
-    public void stop() {
-        if (!isOpen()) {
-            throw new IllegalStateException("Clip must be open");
-        }
-        
-        if (isRunning()) {
-            player.stop();
-        }
-    }
-
-    public void addLineListener(LineListener listener) {
-        throw new UnsupportedOperationException();
-    }
-
-    public void close() {
-        if (isOpen()) {
-            stop();
-            player = null;
-        }
-    }
-
-    public Control getControl(Type control) {
-        throw new IllegalArgumentException("No controls available");
-    }
-
-    public Control[] getControls() {
-        return new Control[0];
-    }
-
-    public javax.sound.sampled.Line.Info getLineInfo() {
-        return new Line.Info(this.getClass());
-    }
-
-    public boolean isControlSupported(Type control) {
-        return false;
-    }
-
-    public boolean isOpen() {
-        return player != null;
-    }
-
-    public void open() throws LineUnavailableException {
-        try {
-            player = new MediaPlayer();
-        } catch (Exception ex) {
-            throw new LineUnavailableException(ex.toString());
-        }
-    }
-
-    public void removeLineListener(LineListener listener) {
-        throw new UnsupportedOperationException();
-    }
-
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/ControllerEventListener.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/ControllerEventListener.java
deleted file mode 100644
index 318139d..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/ControllerEventListener.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-import java.util.EventListener;
-
-public interface ControllerEventListener extends EventListener {
-    void controlChange(ShortMessage event);
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/Instrument.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/Instrument.java
deleted file mode 100644
index 397e53e..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/Instrument.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-public abstract class Instrument extends SoundbankResource {
-    private Patch patch;
-
-    protected Instrument(Soundbank soundbank, Patch patch, String name, Class<?> dataClass) {
-        super(soundbank, name, dataClass);
-        this.patch = patch;
-    }
-
-    public Patch getPatch() {
-        return patch;
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/InvalidMidiDataException.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/InvalidMidiDataException.java
deleted file mode 100644
index bc1cb83..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/InvalidMidiDataException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-public class InvalidMidiDataException extends Exception {
-    private static final long serialVersionUID = 2780771756789932067L;
-
-    public InvalidMidiDataException() {
-        super();
-    }
-
-    public InvalidMidiDataException(String message) {
-        super(message);
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/MetaEventListener.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/MetaEventListener.java
deleted file mode 100644
index 0cf0d38..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/MetaEventListener.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-import java.util.EventListener;
-
-public interface MetaEventListener extends EventListener {
-    void meta(MetaMessage meta);
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/MetaMessage.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/MetaMessage.java
deleted file mode 100644
index fe5d9cf..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/MetaMessage.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-import org.apache.harmony.sound.internal.nls.Messages;
-
-public class MetaMessage extends MidiMessage {
-    public static final int META = 255;
-    
-    private int dsp; //displacement from begin of array that 
-                     //return by method getData() from begin
-                     //of array that contain data
-    
-    public MetaMessage() {
-        super(new byte[] {-1, 0});
-    }
-
-    protected MetaMessage(byte[] data) {
-        super(data);
-        if (data == null) {
-            throw new NullPointerException();
-        }
-        if (super.length > 3) {
-            int n = 3;
-            while ((n <= super.length) && (super.data[n - 1] < 0)) {
-                n++;
-            }
-            dsp = n;
-        }
-    }
-
-    @Override
-    public Object clone() {
-        return new MetaMessage(this.getMessage());
-    }
-
-    public byte[] getData() {
-        if ((super.data != null) && (super.length > 3)) {
-            byte[] bt = new byte[super.length - dsp];
-            for (int i = dsp; i < super.length; i++) {
-                bt[i - dsp] = super.data[i];
-            }
-            return bt;
-        }
-        return new byte[0];
-    }
-
-    public int getType() {
-        if ((super.data != null) && (super.length >= 2)) {
-            return super.data[1] & 0xFF;
-        }
-        return 0;
-    }
-
-    public void setMessage(int type, byte[] data, int length) throws InvalidMidiDataException {
-        if (type < 0 || type >= 128) {
-            // sound.0A=Invalid meta event with type {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.0A", type)); //$NON-NLS-1$
-        }
-        if (length < 0 || (data != null && length > data.length)) {
-            // sound.03=length out of bounds: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.03", length)); //$NON-NLS-1$
-        }
-        try {
-            if (data == null) {
-                if (length != 0) {
-                    throw new NullPointerException();
-                }
-                super.setMessage(new byte[] { -1, (byte) type, 0 }, 3);
-            } else {
-                int div = 128;
-                int n = 1;
-                int ost;
-                int sm = 0;
-                while (length / div != 0) {
-                    n++;
-                    div *= 128;
-                }
-                int ln = n;
-                byte[] tdata = new byte[length + ln + 2];
-                div = 1;
-                ost = (length / div) % 128;
-                while (n != 0) {
-                    tdata[n - 1 + 2] = (byte) (ost + sm);
-                    n--;
-                    div *= 128;
-                    ost = (length / div) % 128;
-                    sm = 128;
-                }
-                tdata[0] = -1;
-                tdata[1] = (byte) type;
-                if (length > 0) {
-                    for (int i = 0; i < length; i++) {
-                        tdata[2 + ln + i] = data[i];
-                    }
-                }
-                super.setMessage(tdata, length + 2 + ln);
-                dsp = ln + 2;
-            }
-        } catch (InvalidMidiDataException e) {
-            throw e;
-        }
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiChannel.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiChannel.java
deleted file mode 100644
index e970641..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiChannel.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-public interface MidiChannel {
-    void allNotesOff();
-
-    void allSoundOff();
-
-    void controlChange(int controller, int value);
-
-    int getChannelPressure();
-
-    int getController(int controller);
-
-    boolean getMono();
-
-    boolean getMute();
-
-    boolean getOmni();
-
-    int getPitchBend();
-
-    int getPolyPressure(int noteNumber);
-
-    int getProgram();
-
-    boolean getSolo();
-
-    boolean localControl(boolean on);
-
-    void noteOff(int noteNumber);
-
-    void noteOff(int noteNumber, int velocity);
-
-    void noteOn(int noteNumber, int velocity);
-
-    void programChange(int program);
-
-    void programChange(int bank, int program);
-
-    void resetAllControllers();
-
-    void setChannelPressure(int pressure);
-
-    void setMono(boolean on);
-
-    void setMute(boolean mute);
-
-    void setOmni(boolean on);
-
-    void setPitchBend(int bend);
-
-    void setPolyPressure(int noteNumber, int pressure);
-
-    void setSolo(boolean soloState);
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiDevice.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiDevice.java
deleted file mode 100644
index 9eb5169..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiDevice.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-import java.util.List;
-
-public interface MidiDevice {
-    class Info {
-        private String name;
-
-        private String vendor;
-
-        private String description;
-
-        private String version;
-
-        protected Info(String name, String vendor, String description, String version) {
-            this.name = name;
-            this.vendor = vendor;
-            this.description = description;
-            this.version = version;
-        }
-
-        /*
-         * returns true when objects are the same
-         * 
-         * @see java.lang.Object#equals(java.lang.Object)
-         */
-        @Override
-        public final boolean equals(Object obj) {
-            return this == obj;
-        }
-
-        public final String getDescription() {
-            return description;
-        }
-
-        public final String getName() {
-            return name;
-        }
-
-        public final String getVendor() {
-            return vendor;
-        }
-
-        public final String getVersion() {
-            return version;
-        }
-
-        @Override
-        public final int hashCode() {
-            final int PRIME = 31;
-            int result = super.hashCode();
-            result = PRIME * result + ((description == null) ? 0 : description.hashCode());
-            result = PRIME * result + ((name == null) ? 0 : name.hashCode());
-            result = PRIME * result + ((vendor == null) ? 0 : vendor.hashCode());
-            result = PRIME * result + ((version == null) ? 0 : version.hashCode());
-            return result;
-        }
-
-        @Override
-        public final String toString() {
-            return name;
-        }
-    }
-
-    void close();
-
-    MidiDevice.Info getDeviceInfo();
-
-    int getMaxReceivers();
-
-    int getMaxTransmitters();
-
-    long getMicrosecondPosition();
-
-    Receiver getReceiver() throws MidiUnavailableException;
-
-    List<Receiver> getReceivers();
-
-    Transmitter getTransmitter() throws MidiUnavailableException;
-
-    List<Transmitter> getTransmitters();
-
-    boolean isOpen();
-
-    void open() throws MidiUnavailableException;
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiEvent.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiEvent.java
deleted file mode 100644
index 145529b..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiEvent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-public class MidiEvent {
-    private MidiMessage message;
-    
-    private long tick;
-    
-    public MidiEvent(MidiMessage message, long tick) {
-        this.message = message;
-        this.tick = tick;
-    }
-
-    public MidiMessage getMessage() {
-        return message;
-    }
-
-    public long getTick() {
-        return tick;
-    }
-
-    public void setTick(long tick) {
-        this.tick = tick;
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiFileFormat.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiFileFormat.java
deleted file mode 100644
index e4e9498..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiFileFormat.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-public class MidiFileFormat {
-    public static final int UNKNOWN_LENGTH = -1;
-
-    protected int byteLength;
-
-    protected float divisionType;
-
-    protected long microsecondLength;
-
-    protected int resolution;
-
-    protected int type;
-    
-    private HashMap<String, Object> properties;
-
-    public MidiFileFormat(int type, float divisionType, int resolution, int bytes,
-            long microseconds) {
-        this.type = type;
-        this.divisionType = divisionType;
-        this.resolution = resolution;
-        this.byteLength = bytes;
-        this.microsecondLength = microseconds;
-        this.properties = new HashMap<String, Object>();
-    }
-
-    public MidiFileFormat(int type, float divisionType, int resolution, int bytes,
-            long microseconds, Map<String, Object> properties) {
-        this.type = type;
-        this.divisionType = divisionType;
-        this.resolution = resolution;
-        this.byteLength = bytes;
-        this.microsecondLength = microseconds;
-        
-        this.properties = new HashMap<String, Object>();
-        this.properties.putAll(properties);
-    }
-
-    public int getByteLength() {
-        return byteLength;
-    }
-
-    public float getDivisionType() {
-        return divisionType;
-    }
-
-    public long getMicrosecondLength() {
-        return microsecondLength;
-    }
-
-    public Object getProperty(String key) {
-        return properties.get(key);
-    }
-
-    public int getResolution() {
-        return resolution;
-    }
-
-    public int getType() {
-        return type;
-    }
-
-    public Map<String, Object> properties() {
-        return Collections.unmodifiableMap(properties);
-        
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiMessage.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiMessage.java
deleted file mode 100644
index 1629ee1..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiMessage.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-import org.apache.harmony.sound.internal.nls.Messages;
-
-public abstract class MidiMessage implements Cloneable {
-
-    protected byte[] data;
-
-    protected int length;
-
-    protected MidiMessage(byte[] data) {
-        if (data == null) {
-            length = 0;
-        } else {
-            length = data.length;
-            this.data = data;
-        }
-    }
-
-    @Override
-    public abstract Object clone();
-
-    public int getLength() {
-        return length;
-    }
-
-    public byte[] getMessage() {
-        if (data == null) {
-            throw new NullPointerException();
-        }
-        return data.clone();
-    }
-
-    public int getStatus() {
-        if ((data == null) || (length == 0)) {
-            return 0;
-        }
-        return data[0] & 0xFF;
-    }
-
-    protected void setMessage(byte[] data, int length) throws InvalidMidiDataException {
-        if ((length < 0) || (length > data.length)) {
-            // sound.03=length out of bounds: {0}
-            throw new IndexOutOfBoundsException(Messages.getString("sound.03", length)); //$NON-NLS-1$
-        }
-
-        this.data = new byte[length];
-        if (length != 0) {
-            for (int i = 0; i < length; i++) {
-                this.data[i] = data[i];
-            }
-        }
-        this.length = length;
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiSystem.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiSystem.java
deleted file mode 100644
index eede0a9..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiSystem.java
+++ /dev/null
@@ -1,837 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-
-import javax.sound.midi.MidiDevice.Info;
-import javax.sound.midi.spi.MidiDeviceProvider;
-import javax.sound.midi.spi.MidiFileReader;
-import javax.sound.midi.spi.MidiFileWriter;
-import javax.sound.midi.spi.SoundbankReader;
-
-import org.apache.harmony.sound.utils.ProviderService;
-
-public class MidiSystem {
-    //path to javax.sound.midi.spi.MidiDeviceProvider file in the jar-file
-    private final static String midiDeviceProviderPath = 
-        "META-INF/services/javax.sound.midi.spi.MidiDeviceProvider";
-    
-    //path to javax.sound.midi.spi.MidiFileReader file in the jar-file
-    private final static String midiFileReaderPath =
-        "META-INF/services/javax.sound.midi.spi.MidiFileReader";
-    
-    //path to javax.sound.midi.spi.MidiFileWriter file in the jar-file
-    private final static String midiFileWriterPath =
-        "META-INF/services/javax.sound.midi.spi.MidiFileWriter";
-    
-    //path to javax.sound.midi.spi.SoundbankReader file in the jar-file
-    private final static String soundbankReaderPath =
-        "META-INF/services/javax.sound.midi.spi.SoundbankReader";
-    
-    //key to find default receiver in the sound.properties file
-    private final static String receiverName = "javax.sound.midi.Receiver";
-    
-    //key to find default sequencer in the sound.properties file
-    private final static String sequencerName = "javax.sound.midi.Sequencer";
-    
-    //key to find default synthesizer in the sound.properties file
-    private final static String synthesizerName = "javax.sound.midi.Synthesizer";
-    
-    //key to find default transmitter in the sound.properties file
-    private final static String transmitterName = "javax.sound.midi.Transmitter";
-    
-    public static MidiDevice getMidiDevice(MidiDevice.Info info)
-            throws MidiUnavailableException {
-        //FIXME
-        /*
-         * this method must to throw out MidiUnavailableException if requested device
-         * is not available
-         */
-        
-        /* 
-         * obtain the list of MidiDeviceProviders
-         */
-        List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
-        /*
-         * find device that describes by parameter info and return it
-         */
-        for (int i = 0; i < deviceProviders.size(); i++) {
-            MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
-            for (Info element : deviceInfo) {
-                if (element.equals(info)) {
-                    return ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(info);
-                }
-            }
-        }
-        /*
-         * if we can't find device with requested info, we throw out IllegalArgumentException
-         */
-        throw new IllegalArgumentException("Requested device not installed: " + info.getName());
-    }
-
-    public static MidiDevice.Info[] getMidiDeviceInfo() {
-        /*
-         * obtain the list of MidiDeviceProviders
-         */
-        List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
-        //variable to save MidiDevice.Info
-        List<MidiDevice.Info> infos = new ArrayList<MidiDevice.Info>();
-        /*
-         * look through list of providers and save info of devices
-         */
-        for (int i = 0; i < deviceProviders.size(); i++) {
-            MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
-            for (Info element : deviceInfo) {
-                infos.add(element);
-            }
-        }
-        
-        MidiDevice.Info[] temp = new MidiDevice.Info[infos.size()];
-        return infos.toArray(temp);
-    }
-
-    public static MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException,
-            IOException {
-        /*
-         * obtain the list of MidiFileReaderProviders
-         */
-        List<?> fileReaderProviders = ProviderService.getProviders(midiFileReaderPath);
-        if (fileReaderProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no MidiFileReaderProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((MidiFileReader) fileReaderProviders.get(0)).getMidiFileFormat(file);
-    }
-
-    public static MidiFileFormat getMidiFileFormat(InputStream stream) throws InvalidMidiDataException, 
-            IOException {
-        /*
-         * obtain the list of MidiFileReaderProviders
-         */
-        List<?> fileReaderProviders = ProviderService.getProviders(midiFileReaderPath);
-        if (fileReaderProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no MidiFileReaderProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((MidiFileReader) fileReaderProviders.get(0)).getMidiFileFormat(stream);
-    }
-
-    public static MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException,
-            IOException {
-        /*
-         * obtain the list of MidiFileReaderProviders
-         */
-        List<?> fileReaderProviders = ProviderService.getProviders(midiFileReaderPath);
-        if (fileReaderProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no MidiFileReaderProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((MidiFileReader) fileReaderProviders.get(0)).getMidiFileFormat(url);
-    }
-
-    public static int[] getMidiFileTypes() {
-        /*
-         * obtain the list of MidiFileWriterProviders
-         */
-        List<?> fileWriterProviders = ProviderService.getProviders(midiFileWriterPath);
-        if (fileWriterProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no MidiFileWriterProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((MidiFileWriter) fileWriterProviders.get(0)).getMidiFileTypes();
-    }
-
-    public static int[] getMidiFileTypes(Sequence sequence) {
-        /*
-         * obtain the list of MidiFileWriterProviders
-         */
-        List<?> fileWriterProviders = ProviderService.getProviders(midiFileWriterPath);
-        if (fileWriterProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no MidiFileWriterProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((MidiFileWriter) fileWriterProviders.get(0)).getMidiFileTypes(sequence);
-    }
-
-    public static Receiver getReceiver() throws MidiUnavailableException {
-        /*
-         * description of the default device for javax.sound.midi.Receiver
-         */
-        List<String> defaultDevice = ProviderService.getDefaultDeviceDescription(receiverName);
-        /*
-         * obtain the list of MidiDeviceProviders
-         */
-        List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
-        String provName;
-        int deviceNum = -1;
-        /*
-         * defaultDevice.get(0) --> provider
-         * defaultDevice.get(1) --> name
-         */      
-        if (defaultDevice.size() != 0) {
-            /*
-             * obtain the provider number in the list of deviceProviders that is provider for default device
-             */
-            for (int i = 0; i < deviceProviders.size(); i++) {
-                provName = deviceProviders.get(i).toString();
-                if (provName.substring(0, provName.indexOf("@")).equals(defaultDevice.get(0))) {
-                    deviceNum = i;
-                    break;
-                }
-            }
-            /*
-             * the first case: find the same provider and name that describes by default device
-             */
-            if (deviceNum != -1) {
-                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDeviceInfo();
-                for (Info element : deviceInfo) {
-                    if (element.getName().equals(defaultDevice.get(1))) {
-                        try {
-                            return ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element).getReceiver();
-                        } catch (MidiUnavailableException e) {}
-                    }
-                }
-            for (Info element : deviceInfo) {
-                    try {
-                        return ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element).getReceiver();
-                    } catch (MidiUnavailableException e) {}
-                }
-            }
-            /*
-             * if we don't find again, find any receivers describe by name
-             */
-            for (int i = 0; i < deviceProviders.size(); i++) {
-                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
-                for (Info element : deviceInfo) {
-                    if (element.getName().equals(defaultDevice.get(1))) {
-                        try {
-                            return ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element).getReceiver();
-                        } catch (MidiUnavailableException e) {}
-                    }
-                }
-            }
-        }
-        /*
-         * in the last case we look throw all providers and find any receiver
-         */
-        for (int i = 0; i < deviceProviders.size(); i++) {
-            MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
-            for (Info element : deviceInfo) {
-                try {
-                    return ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element).getReceiver();
-                } catch (MidiUnavailableException e) {}
-            }
-        }
-        /*
-         * if we don't find anyway, we throw out MidiUnavailableException
-         */
-        throw new MidiUnavailableException("There are no Recivers installed on your system!");
-    }
-
-    public static Sequence getSequence(File file) throws InvalidMidiDataException, IOException {
-        /*
-         * obtain the list of MidiFileReaderProviders
-         */
-        List<?> fileReaderProviders = ProviderService.getProviders(midiFileReaderPath);
-        // BEGIN android-added
-        try {
-            ((List)fileReaderProviders).add((Object)Class.forName("com.android.internal.sound.midi.AndroidMidiFileReader").newInstance());
-        } catch (Exception ex) {
-            // Ignore
-        }
-        // END android-added
-        if (fileReaderProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no MidiFileReaderProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((MidiFileReader) fileReaderProviders.get(0)).getSequence(file);
-    }
-
-    public static Sequence getSequence(InputStream stream) throws InvalidMidiDataException,
-            IOException {
-        /*
-         * obtain the list of MidiFileReaderProviders
-         */
-        List<?> fileReaderProviders = ProviderService.getProviders(midiFileReaderPath);
-        // BEGIN android-added
-        try {
-            ((List)fileReaderProviders).add(Class.forName("com.android.internal.sound.midi.AndroidMidiFileReader").newInstance());
-        } catch (Exception ex) {
-            // Ignore
-        }
-        // END android-added
-        if (fileReaderProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no MidiFileReaderProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((MidiFileReader) fileReaderProviders.get(0)).getSequence(stream);
-    }
-
-    public static Sequence getSequence(URL url) throws InvalidMidiDataException, IOException {
-        /*
-         * obtain the list of MidiFileReaderProviders
-         */
-        List<?> fileReaderProviders = ProviderService.getProviders(midiFileReaderPath);
-        // BEGIN android-added
-        try {
-            ((List)fileReaderProviders).add(Class.forName("com.android.internal.sound.midi.AndroidMidiFileReader").newInstance());
-        } catch (Exception ex) {
-            // Ignore
-        }
-        // END android-added
-        if (fileReaderProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no MidiFileReaderProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((MidiFileReader) fileReaderProviders.get(0)).getSequence(url);
-    }
-
-    public static Sequencer getSequencer() throws MidiUnavailableException {
-        /*
-         * this method is equals to method MidiSystem.getSequencer(true)
-         */
-        return getSequencer(true);
-    }
-
-    public static Sequencer getSequencer(boolean connected) throws MidiUnavailableException {
-        /*
-         * description of the default device for javax.sound.midi.Sequencer
-         */
-        List<String> defaultDevice = ProviderService.getDefaultDeviceDescription(sequencerName);
-        /*
-         * obtain the list of MidiDeviceProviders
-         */
-        List<?>  deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
-        
-        Sequencer sequencer;
-        Transmitter seqTrans;
-        Synthesizer synth;
-        Receiver recv;
-        String provName;
-        int deviceNum = -1;
-        /*
-         * defaultDevice.get(0) --> provider
-         * defaultDevice.get(1) --> name
-         */      
-        if (defaultDevice.size() != 0) {
-            /*
-             * obtain the provider number in the list of deviceProviders that is provider for default device
-             */
-            for (int i = 0; i < deviceProviders.size(); i++) {
-                provName = deviceProviders.get(i).toString();
-                if (provName.substring(0, provName.indexOf("@")).equals(defaultDevice.get(0))) {
-                    deviceNum = i;
-                    break;
-                }
-            }
-            /*
-             * the first case: find the same provider and name that describes by default device
-             */
-            if (deviceNum != -1) {
-                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDeviceInfo();
-                for (Info element : deviceInfo) {
-                    if (element.getName().equals(defaultDevice.get(1))) {
-                        if (((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element) instanceof Sequencer) {
-                            if (connected) {
-                                sequencer = (Sequencer) ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element);
-                                seqTrans = sequencer.getTransmitter();
-                                try {
-                                    synth = MidiSystem.getSynthesizer();
-                                    recv = synth.getReceiver();                                    
-                                } catch (MidiUnavailableException e) {
-                                    /*
-                                     * if we haven't Synthesizer in the system, we use default receiver
-                                     */
-                                    recv = MidiSystem.getReceiver();
-                                }
-                                seqTrans.setReceiver(recv);
-                                return sequencer;
-                            }
-                            return (Sequencer) ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element);
-                        }
-                    }
-                }
-                for (Info element : deviceInfo) {
-                    if (((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element) instanceof Sequencer) {
-                        if (connected) {
-                            sequencer = (Sequencer) ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element);
-                            seqTrans = sequencer.getTransmitter();
-                            try {
-                                synth = MidiSystem.getSynthesizer();
-                                recv = synth.getReceiver();                                    
-                            } catch (MidiUnavailableException e) {
-                                /*
-                                 * if we haven't Synthesizer in the system, we use default receiver
-                                 */
-                                recv = MidiSystem.getReceiver();
-                            }
-                            seqTrans.setReceiver(recv);
-                            return sequencer;
-                        }
-                        return (Sequencer) ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element);
-                    }
-                }
-            }
-            /*
-             * if we don't find again, find any receivers describe by name
-             */
-            for (int i = 0; i < deviceProviders.size(); i++) {
-                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
-                for (Info element : deviceInfo) {
-                    if (element.getName().equals(defaultDevice.get(1))) {
-                        if (((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element) instanceof Sequencer) {
-                            if (connected) {
-                                sequencer = (Sequencer) ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element);
-                                seqTrans = sequencer.getTransmitter();
-                                try {
-                                    synth = MidiSystem.getSynthesizer();
-                                    recv = synth.getReceiver();                                    
-                                } catch (MidiUnavailableException e) {
-                                    /*
-                                     * if we haven't Synthesizer in the system, we use default receiver
-                                     */
-                                    recv = MidiSystem.getReceiver();
-                                }
-                                seqTrans.setReceiver(recv);
-                                return sequencer;
-                            }
-                            return (Sequencer) ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element);
-                        }
-                    }
-                }
-            }
-        }
-        /*
-         * in the last case we look throw all providers and find any receiver
-         */
-        for (int i = 0; i < deviceProviders.size(); i++) {
-            MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
-            for (Info element : deviceInfo) {
-                if (((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element) instanceof Sequencer) {
-                    if (connected) {
-                        sequencer = (Sequencer) ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element);
-                        seqTrans = sequencer.getTransmitter();
-                        try {
-                            synth = MidiSystem.getSynthesizer();
-                            recv = synth.getReceiver();                                    
-                        } catch (MidiUnavailableException e) {
-                            /*
-                             * if we haven't Synthesizer in the system, we use default receiver
-                             */
-                            recv = MidiSystem.getReceiver();
-                        }
-                        seqTrans.setReceiver(recv);
-                        return sequencer;
-                    }
-                    return (Sequencer) ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element);
-                }
-            }
-        }
-        // BEGIN android-added
-        try {
-            return (Sequencer)(Class.forName("com.android.internal.sound.midi.AndroidSequencer").newInstance());
-        } catch (Exception ex) {
-            // Ignore
-        }
-        // END android-added
-        /*
-         * if we don't find anyway, we throw out MidiUnavailableException
-         */
-        throw new MidiUnavailableException("There are no Synthesizers installed on your system!");
-    }
-
-    public static Soundbank getSoundbank(File file) throws InvalidMidiDataException,
-            IOException {
-        /*
-         * obtain the list of SoundbankReaderProviders
-         */
-        List<?> soundbankReaderProviders = ProviderService.getProviders(soundbankReaderPath);
-        if (soundbankReaderProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no SoundbankReaderProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((SoundbankReader) soundbankReaderProviders.get(0)).getSoundbank(file);
-    }
-
-    public static Soundbank getSoundbank(InputStream stream) throws InvalidMidiDataException, IOException {
-        /*
-         * obtain the list of SoundbankReaderProviders
-         */
-        List<?> soundbankReaderProviders = ProviderService.getProviders(soundbankReaderPath);
-        if (soundbankReaderProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no SoundbankReaderProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((SoundbankReader) soundbankReaderProviders.get(0)).getSoundbank(stream);
-    }
-
-    public static Soundbank getSoundbank(URL url) throws InvalidMidiDataException, IOException {
-        /*
-         * obtain the list of SoundbankReaderProviders
-         */
-        List<?> soundbankReaderProviders = ProviderService.getProviders(soundbankReaderPath);
-        if (soundbankReaderProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no SoundbankReaderProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((SoundbankReader) soundbankReaderProviders.get(0)).getSoundbank(url);
-    }
-
-    public static Synthesizer getSynthesizer() throws MidiUnavailableException {
-        /*
-         * description of the default device for javax.sound.midi.Synthesizer
-         */
-        List<String> defaultDevice = ProviderService.getDefaultDeviceDescription(synthesizerName);
-        /*
-         * obtain the list of MidiDeviceProviders
-         */
-        List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
-        String provName;
-        int deviceNum = -1;
-        
-        /*
-         * defaultDevice.get(0) --> provider
-         * defaultDevice.get(1) --> name
-         */      
-        if (defaultDevice.size() != 0) {
-            /*
-             * obtain the provider number in the list of deviceProviders that is provider for default device
-             */
-            for (int i = 0; i < deviceProviders.size(); i++) {
-                provName = deviceProviders.get(i).toString();
-                if (provName.substring(0, provName.indexOf("@")).equals(defaultDevice.get(0))) {
-                    deviceNum = i;
-                    break;
-                }
-            }
-            /*
-             * the first case: find the same provider and name that describes by default device
-             */
-            if (deviceNum != -1) {
-                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDeviceInfo();
-                for (Info element : deviceInfo) {
-                    if (element.getName().equals(defaultDevice.get(1))) {
-                        if (((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element) instanceof Synthesizer) {
-                            return (Synthesizer) ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element);
-                        }
-                    }
-                }
-                for (Info element : deviceInfo) {
-                    if (((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element) instanceof Synthesizer) {
-                        return (Synthesizer) ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element);
-                    }
-                }
-            }
-            /*
-             * if we don't find again, find any receivers describe by name
-             */
-            for (int i = 0; i < deviceProviders.size(); i++) {
-                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
-                for (Info element : deviceInfo) {
-                    if (element.getName().equals(defaultDevice.get(1))) {
-                        if (((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element) instanceof Synthesizer) {
-                            return (Synthesizer) ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element);
-                        }
-                    }
-                }
-            }
-        }
-        /*
-         * in the last case we look throw all providers and find any receiver
-         */
-        for (int i = 0; i < deviceProviders.size(); i++) {
-            MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
-            for (Info element : deviceInfo) {
-                if (((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element) instanceof Synthesizer) {
-                    return (Synthesizer) ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element);
-                }
-            }
-        }
-        /*
-         * if we don't find anyway, we throw out MidiUnavailableException
-         */
-        throw new MidiUnavailableException("There are no Synthesizers installed on your system!");
-    }
-
-    public static Transmitter getTransmitter() throws MidiUnavailableException {
-        /*
-         * description of the default device for javax.sound.midi.Transmitter
-         */
-        List<String> defaultDevice = ProviderService.getDefaultDeviceDescription(transmitterName);
-        /*
-         * obtain the list of MidiDeviceProviders
-         */
-        List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
-        String provName;
-        int deviceNum = -1;
-        /*
-         * defaultDevice.get(0) --> provider
-         * defaultDevice.get(1) --> name
-         */      
-        if (defaultDevice.size() != 0) {
-            /*
-             * obtain the provider number in the list of deviceProviders that is provider for default device
-             */
-            for (int i = 0; i < deviceProviders.size(); i++) {
-                provName = deviceProviders.get(i).toString();
-                if (provName.substring(0, provName.indexOf("@")).equals(defaultDevice.get(0))) {
-                    deviceNum = i;
-                    break;
-                }
-            }
-            /*
-             * the first case: find the same provider and name that describes by default device
-             */
-            if (deviceNum != -1) {
-                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDeviceInfo();
-                for (Info element : deviceInfo) {
-                    if (element.getName().equals(defaultDevice.get(1))) {
-                        try {
-                            return ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element).getTransmitter();
-                        } catch (MidiUnavailableException e) {}
-                    }
-                }
-                for (Info element : deviceInfo) {
-                    try {
-                        return ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element).getTransmitter();
-                    } catch (MidiUnavailableException e) {}
-                }
-            }
-            /*
-             * if we don't find again, find any receivers describe by name
-             */
-            for (int i = 0; i < deviceProviders.size(); i++) {
-                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
-                for (Info element : deviceInfo) {
-                    if (element.getName().equals(defaultDevice.get(1))) {
-                        try {
-                            return ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element).getTransmitter();
-                        } catch (MidiUnavailableException e) {}
-                    }
-                }
-            }
-        }
-        /*
-         * in the last case we look throw all providers and find any receiver
-         */
-        for (int i = 0; i < deviceProviders.size(); i++) {
-            MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
-            for (Info element : deviceInfo) {
-                try {
-                    return ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element).getTransmitter();
-                } catch (MidiUnavailableException e) {}
-            }
-        }
-        /*
-         * if we don't find anyway, we throw out MidiUnavailableException
-         */
-        throw new MidiUnavailableException("There are no Transmitters installed on your system!");
-    }
-
-    public static boolean isFileTypeSupported(int fileType) {
-        /*
-         * obtain the list of MidiFileWriterProviders;
-         * if we already obtain the list of providers, we don't obtain it again
-         */
-        List<?> fileWriterProviders = ProviderService.getProviders(midiFileWriterPath);
-        if (fileWriterProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no MidiFileWriterProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((MidiFileWriter) fileWriterProviders.get(0)).isFileTypeSupported(fileType);
-    }
-
-    public static boolean isFileTypeSupported(int fileType, Sequence sequence) {
-        /*
-         * obtain the list of MidiFileWriterProviders
-         */
-        List<?> fileWriterProviders = ProviderService.getProviders(midiFileWriterPath);
-        if (fileWriterProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no MidiFileWriterProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((MidiFileWriter) fileWriterProviders.get(0)).isFileTypeSupported(fileType, sequence);
-    }
-
-    public static int write(Sequence in, int type, File out) throws IOException {
-        /*
-         * obtain the list of MidiFileWriterProviders
-         */
-        List<?>  fileWriterProviders = ProviderService.getProviders(midiFileWriterPath);
-        if (fileWriterProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no MidiFileWriterProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((MidiFileWriter) fileWriterProviders.get(0)).write(in, type, out);
-    }
-
-    public static int write(Sequence in, int fileType, OutputStream out) throws IOException {
-        /*
-         * obtain the list of MidiFileWriterProviders
-         */
-        List<?>  fileWriterProviders = ProviderService.getProviders(midiFileWriterPath);
-        if (fileWriterProviders.size() == 0) {
-            //FIXME
-            /*
-             * I don't understand what type of exception we should throw out if we haven't
-             * appropriate providers...
-             * Maybe here is should be MidiUnavailableException
-             */
-            throw new Error("There is no MidiFileWriterProviders on your system!!!");
-        }
-        /*
-         * It's not determine what provider for this service I should to use, and so
-         * I use the first one
-         */
-        return ((MidiFileWriter) fileWriterProviders.get(0)).write(in, fileType, out);
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiUnavailableException.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiUnavailableException.java
deleted file mode 100644
index bd50af5..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/MidiUnavailableException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-public class MidiUnavailableException extends Exception {
-    private static final long serialVersionUID = 6093809578628944323L;
-
-    public MidiUnavailableException() {
-        super();
-    }
-
-    public MidiUnavailableException(String message) {
-        super(message);
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/Patch.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/Patch.java
deleted file mode 100644
index fc1d280..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/Patch.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-public class Patch {
-    private int bank;
-
-    private int program;
-
-    public Patch(int bank, int program) {
-        this.bank = bank;
-        this.program = program;
-    }
-
-    public int getBank() {
-        return bank;
-    }
-
-    public int getProgram() {
-        return program;
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/Receiver.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/Receiver.java
deleted file mode 100644
index 014c05f..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/Receiver.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-public interface Receiver {
-    void close();
-
-    void send(MidiMessage message, long timeStamp);
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/Sequence.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/Sequence.java
deleted file mode 100644
index 0a12834..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/Sequence.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-import java.util.Vector;
-
-import org.apache.harmony.sound.internal.nls.Messages;
-
-public class Sequence {
-    public static final float PPQ = 0.0f;
-
-    public static final float SMPTE_24 = 24.0f;
-
-    public static final float SMPTE_25 = 25.0f;
-
-    public static final float SMPTE_30 = 30.0f;
-
-    public static final float SMPTE_30DROP = 29.969999313354492f;
-    
-    protected float divisionType;
-
-    protected int resolution;
-
-    protected Vector<Track> tracks;
-    
-    private Vector<Patch> patches;
-
-    public Sequence(float divisionType, int resolution) throws InvalidMidiDataException {
-        if (divisionType != Sequence.PPQ &&
-                divisionType != Sequence.SMPTE_24 &&
-                divisionType != Sequence.SMPTE_25 &&
-                divisionType != Sequence.SMPTE_30 &&
-                divisionType != Sequence.SMPTE_30DROP ) {
-            // sound.0B=Unsupported division type: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.0B", divisionType));       //$NON-NLS-1$
-        }
-        this.divisionType = divisionType;
-        this.resolution = resolution;
-        this.tracks = new Vector<Track>();
-        this.patches = new Vector<Patch>();
-        
-    }
-
-    public Sequence(float divisionType, int resolution, int numTracks)
-            throws InvalidMidiDataException {
-        if (divisionType != Sequence.PPQ &&
-                divisionType != Sequence.SMPTE_24 &&
-                divisionType != Sequence.SMPTE_25 &&
-                divisionType != Sequence.SMPTE_30 &&
-                divisionType != Sequence.SMPTE_30DROP ) {
-            // sound.0B=Unsupported division type: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.0B", divisionType));       //$NON-NLS-1$
-        }
-        this.divisionType = divisionType;
-        this.resolution = resolution;
-        this.patches = new Vector<Patch>();
-        this.tracks = new Vector<Track>();
-        if (numTracks > 0) {
-            for (int i = 0; i < numTracks; i++) {
-                tracks.add(new Track());
-            }
-        }
-    }
-
-    public Track createTrack() {
-        /*
-         * new Tracks accrue to the end of vector
-         */
-        Track tr = new Track();
-        tracks.add(tr);
-        return tr;
-    }
-
-    public boolean deleteTrack(Track track) {
-        return tracks.remove(track);
-    }
-
-    public float getDivisionType() {
-        return divisionType;
-    }
-
-    public long getMicrosecondLength() {
-        float divisionType;
-        if (this.divisionType == 0.0f) {
-            divisionType = 2;
-        } else {
-            divisionType = this.divisionType;
-        }
-        return (long) (1000000.0 * getTickLength() / 
-                (divisionType * this.resolution * 1.0f));
-    }
-
-    public Patch[] getPatchList() {
-        //FIXME
-        /*
-         * I don't understand how to works this method, and so
-         * I simply return an empty array. 'patches' initializes
-         * in the constructor as empty vector 
-         */
-        Patch[] patch = new Patch[patches.size()];
-        patches.toArray(patch);
-        return patch;
-    }
-
-    public int getResolution() {
-        return resolution;
-    }
-
-    public long getTickLength() {
-        /*
-         * this method return the biggest value of tick of 
-         * all tracks contain in the Sequence
-         */
-        long maxTick = 0;
-        for (int i = 0; i < tracks.size(); i++) {
-            if (maxTick < tracks.get(i).ticks()) {
-                maxTick = tracks.get(i).ticks();
-            }
-        }
-        return maxTick;
-    }
-
-    public Track[] getTracks() {
-        Track[] track = new Track[tracks.size()];
-        tracks.toArray(track);
-        return track;
-    }
-
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/Sequencer.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/Sequencer.java
deleted file mode 100644
index 4f0d8f8..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/Sequencer.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public interface Sequencer extends MidiDevice {
-    int LOOP_CONTINUOUSLY = -1;
-
-    class SyncMode {
-        public static final SyncMode INTERNAL_CLOCK = new SyncMode("INTERNAL_CLOCK"); //$NON-NLS-1$
-
-        public static final SyncMode MIDI_SYNC = new SyncMode("MIDI_SYNC"); //$NON-NLS-1$
-
-        public static final SyncMode MIDI_TIME_CODE = new SyncMode("MIDI_TIME_CODE"); //$NON-NLS-1$
-
-        public static final SyncMode NO_SYNC = new SyncMode("NO_SYNC"); //$NON-NLS-1$
-
-        private String name;
-
-        protected SyncMode(String name) {
-            this.name = name;
-        }
-
-        @Override
-        public final boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (!super.equals(obj)) {
-                return false;
-            }
-            if (getClass() != obj.getClass()) {
-                return false;
-            }
-            final SyncMode other = (SyncMode) obj;
-            if (name == null) {
-                if (other.name != null) {
-                    return false;
-                }
-            } else if (!name.equals(other.name)) {
-                return false;
-            }
-            return true;
-        }
-
-        @Override
-        public final int hashCode() {
-            final int PRIME = 31;
-            int result = super.hashCode();
-            result = PRIME * result + ((name == null) ? 0 : name.hashCode());
-            return result;
-        }
-
-        @Override
-        public final String toString() {
-            return name;
-        }
-    }
-
-    int[] addControllerEventListener(ControllerEventListener listener, int[] controllers);
-
-    boolean addMetaEventListener(MetaEventListener listener);
-
-    int getLoopCount();
-
-    long getLoopEndPoint();
-
-    long getLoopStartPoint();
-
-    Sequencer.SyncMode getMasterSyncMode();
-
-    Sequencer.SyncMode[] getMasterSyncModes();
-
-    long getMicrosecondLength();
-
-    long getMicrosecondPosition();
-
-    Sequence getSequence();
-
-    Sequencer.SyncMode getSlaveSyncMode();
-
-    Sequencer.SyncMode[] getSlaveSyncModes();
-
-    float getTempoFactor();
-
-    float getTempoInBPM();
-
-    float getTempoInMPQ();
-
-    long getTickLength();
-
-    long getTickPosition();
-
-    boolean getTrackMute(int track);
-
-    boolean getTrackSolo(int track);
-
-    boolean isRecording();
-
-    boolean isRunning();
-
-    void recordDisable(Track track);
-
-    void recordEnable(Track track, int channel);
-
-    int[] removeControllerEventListener(ControllerEventListener listener, int[] controllers);
-
-    void removeMetaEventListener(MetaEventListener listener);
-
-    void setLoopCount(int count);
-
-    void setLoopEndPoint(long tick);
-
-    void setLoopStartPoint(long tick);
-
-    void setMasterSyncMode(Sequencer.SyncMode sync);
-
-    void setMicrosecondPosition(long microseconds);
-
-    void setSequence(InputStream stream) throws IOException, InvalidMidiDataException;
-
-    void setSequence(Sequence sequence) throws InvalidMidiDataException;
-
-    void setSlaveSyncMode(Sequencer.SyncMode sync);
-
-    void setTempoFactor(float factor);
-
-    void setTempoInBPM(float bpm);
-
-    void setTempoInMPQ(float mpq);
-
-    void setTickPosition(long tick);
-
-    void setTrackMute(int track, boolean mute);
-
-    void setTrackSolo(int track, boolean solo);
-
-    void start();
-
-    void startRecording();
-
-    void stop();
-
-    void stopRecording();
-
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/ShortMessage.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/ShortMessage.java
deleted file mode 100644
index e75b784..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/ShortMessage.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-import org.apache.harmony.sound.internal.nls.Messages;
-
-public class ShortMessage extends MidiMessage {
-
-    public static final int ACTIVE_SENSING = 254;
-
-    public static final int CHANNEL_PRESSURE = 208;
-
-    public static final int CONTINUE = 251;
-
-    public static final int CONTROL_CHANGE = 176;
-
-    public static final int END_OF_EXCLUSIVE = 247;
-
-    public static final int MIDI_TIME_CODE = 241;
-
-    public static final int NOTE_OFF = 128;
-
-    public static final int NOTE_ON = 144;
-
-    public static final int PITCH_BEND = 224;
-
-    public static final int POLY_PRESSURE = 160;
-
-    public static final int PROGRAM_CHANGE = 192;
-
-    public static final int SONG_POSITION_POINTER = 242;
-
-    public static final int SONG_SELECT = 243;
-
-    public static final int START = 250;
-
-    public static final int STOP = 252;
-
-    public static final int SYSTEM_RESET = 255;
-
-    public static final int TIMING_CLOCK = 248;
-
-    public static final int TUNE_REQUEST = 246;
-
-    public ShortMessage() {
-        super(new byte[] {-112, 64, 127});
-    }
-
-    protected ShortMessage(byte[] data) {
-        super(data);
-    }
-
-    @Override
-    public Object clone() {
-        return new ShortMessage(this.getMessage());
-    }
-
-    public int getChannel() {
-        /*
-         * channel change from 0 up to 15
-         */
-        if ((data == null) || (data.length == 0)) {
-            return 0;
-        }
-        return data[0] & 0x0F;
-    }
-
-    public int getCommand() {
-       /*
-        * command should be divisible by 16 without rest 
-        */
-        if ((data == null) || (data.length == 0)) {
-            return 0;
-        }
-        return (data[0] & 0xFF) - getChannel();
-    }
-
-    public int getData1() {
-        if ((data == null) || (data.length == 0)) {
-            return 0;
-        } else if (data.length < 2) {
-            return 0;
-        } else {
-            return data[1] & 0xFF;
-        }
-    }
-
-    public int getData2() {
-        if ((data == null) || (data.length == 0)) {
-            return 0;
-        } else if (data.length < 3) {
-            return 0;
-        } else {
-            return data[2] & 0xFF;
-        }
-    }
-
-    protected final int getDataLength(int status)
-            throws InvalidMidiDataException {
-        // FIXME
-        /*
-         * I have some question about this method. I didn't understand how
-         * should to work this method, but some results I get by experimental
-         * method. From 0 up to 127, from 256 up to 383 and so on this method
-         * throw out exception, i.e. after 256 begin cycle with some small
-         * differences in the first lap, from 0 up to 255. From the second lap
-         * and so on this method, getDataLenght(int), throw out exception with
-         * value of status from 496 up to 511, from 752 up to 767 and so on,
-         * i.e. on the last 16 number of 256-lap. And now differences in the
-         * first lap. This method don't throw out exception with value of status
-         * from 240 up to 255. It has next behavior: 
-         * - value of status equals 240 -- throw out exception; 
-         * - 241 -- return 1; 
-         * - 242 -- return 2; 
-         * - 243 -- return 1; 
-         * - from 244 up to 245 -- throw out exception; 
-         * - from 246 up to 255 -- return 0;
-         */
-        if (status < 0) {
-            // sound.04=Invalid status byte: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.04", status)); //$NON-NLS-1$
-        }
-        if (((status % 256) >= 0) && ((status % 256) <= 127)) {
-            // sound.04=Invalid status byte: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.04", status)); //$NON-NLS-1$
-        }
-        if (((status / 256) == 0)
-                && ((status == 240) || (status == 244) || (status == 245))) {
-            // sound.04=Invalid status byte: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.04", status)); //$NON-NLS-1$
-        }
-        if (((status / 256) != 0) && ((status % 256) >= 244)
-                && ((status % 256) <= 255)) {
-            // sound.04=Invalid status byte: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.04", status)); //$NON-NLS-1$
-        }
-
-        if ((status / 256) == 0) {
-            if ((status == 241) || (status == 243)) {
-                return 1;
-            } else if (status == 242) {
-                return 2;
-            } else if ((status >= 246) && (status <= 255)) {
-                return 0;
-            }
-        }
-        if (((status % 256) >= 128) && ((status % 256) <= 191)) {
-            return 2;
-        } else if (((status % 256) >= 192) && ((status % 256) <= 223)) {
-            return 1;
-        } else {
-            return 2;
-        }
-    }
-
-    public void setMessage(int status) throws InvalidMidiDataException {
-        /*
-         * value of variable status is more or equals 246 and less or equals 255
-         */
-        if ((status < 246) || (status > 255)) {
-            // sound.04=Invalid status byte: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.04", status)); //$NON-NLS-1$
-        }
-        super.setMessage(new byte[] {(byte) status}, 1);
-    }
-
-    public void setMessage(int status, int data1, int data2)
-            throws InvalidMidiDataException {
-        // FIXME
-        /*
-         * In the Sun's implementation variables data1 and data2 don't use; I
-         * don't find situation when this variables influence on result of
-         * functions getData1() and getData2(). But function getDataLength(int)
-         * return 0 when I modify status byte from 246 up to 255, and so I think
-         * it's true.
-         */
-        if ((status < 246) || (status > 255)) {
-            // sound.04=Invalid status byte: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.04", status)); //$NON-NLS-1$
-        }
-        super.setMessage(new byte[] {(byte) status}, 1);
-    }
-
-    public void setMessage(int command, int channel, int data1, int data2)
-            throws InvalidMidiDataException {
-        // FIXME
-        /*
-         * value of variable command is more or equals 128 and less or equals
-         * 239
-         */
-        if ((command < 128) || (command > 239)) {
-            /*
-             * when this exception throw out, the value of variable command
-             * should be the hexadecimal number
-             */
-            // sound.05=command out of range: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.05", command)); //$NON-NLS-1$
-        }
-        /*
-         * value of variable channel is more or equals 0 and less or equals 15
-         */
-        if ((channel < 0) || (channel > 15)) {
-            // sound.06=channel out of range: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.06", channel)); //$NON-NLS-1$
-        }
-        /*
-         * value of data1 and data2 is more or equals 0 and less or equals 127,
-         * but when command more or equals 192 and less or equals 223 the second
-         * data, data2, is unused, because getDataLength(int) return 1 in this
-         * case, and in other cases it return 2
-         */
-        if ((getDataLength(command) >= 1) && ((data1 < 0) || (data1 > 127))) {
-            // sound.07=data1 out of range: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.07", data1)); //$NON-NLS-1$
-        }
-        if ((getDataLength(command) == 2) && ((data2 < 0) || (data2 > 127))) {
-            // sound.08=data2 out of range: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.08", data2)); //$NON-NLS-1$
-        }
-
-        int tcom = command - (command % 16);
-        if (getDataLength(command) == 1) {
-            super.setMessage(new byte[] {(byte) (tcom + channel), (byte) data1}, 2);
-        } else {
-            super.setMessage(new byte[] {(byte) (tcom + channel), (byte) data1, 
-                    (byte) data2}, 3);
-        }
-    }
-
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/Soundbank.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/Soundbank.java
deleted file mode 100644
index c2a7a85..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/Soundbank.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-public interface Soundbank {
-    String getDescription();
-
-    Instrument getInstrument(Patch patch);
-
-    Instrument[] getInstruments();
-
-    String getName();
-
-    SoundbankResource[] getResources();
-
-    String getVendor();
-
-    String getVersion();
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/SoundbankResource.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/SoundbankResource.java
deleted file mode 100644
index d824d53..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/SoundbankResource.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-public abstract class SoundbankResource {
-    private Soundbank soundbank;
-    private String name;
-    private Class<?> dataClass;
-    
-    protected SoundbankResource(Soundbank soundbank, String name, Class<?> dataClass) {
-        super();
-        this.soundbank = soundbank;
-        this.name = name;
-        this.dataClass = dataClass;
-    }
-
-    public abstract Object getData();
-
-    public Class<?> getDataClass() {
-        return dataClass;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public Soundbank getSoundbank() {
-        return soundbank;
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/Synthesizer.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/Synthesizer.java
deleted file mode 100644
index b203a85..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/Synthesizer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-public interface Synthesizer extends MidiDevice {
-    Instrument[] getAvailableInstruments();
-
-    MidiChannel[] getChannels();
-
-    Soundbank getDefaultSoundbank();
-
-    long getLatency();
-
-    Instrument[] getLoadedInstruments();
-
-    int getMaxPolyphony();
-
-    VoiceStatus[] getVoiceStatus();
-
-    boolean isSoundbankSupported(Soundbank soundbank);
-
-    boolean loadAllInstruments(Soundbank soundbank);
-
-    boolean loadInstrument(Instrument instrument);
-
-    boolean loadInstruments(Soundbank soundbank, Patch[] patchList);
-
-    boolean remapInstrument(Instrument from, Instrument to);
-
-    void unloadAllInstruments(Soundbank soundbank);
-
-    void unloadInstrument(Instrument instrument);
-
-    void unloadInstruments(Soundbank soundbank, Patch[] patchList);
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/SysexMessage.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/SysexMessage.java
deleted file mode 100644
index 8ba7b86..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/SysexMessage.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-import org.apache.harmony.sound.internal.nls.Messages;
-
-public class SysexMessage extends MidiMessage {
-    public static final int SPECIAL_SYSTEM_EXCLUSIVE = 247;
-
-    public static final int SYSTEM_EXCLUSIVE = 240;
-
-    public SysexMessage() {
-        super(new byte[] {-16, -9});
-    }
-
-    protected SysexMessage(byte[] data) {
-        super(data);
-    }
-
-    @Override
-    public Object clone() {
-        return new SysexMessage(this.getMessage());
-    }
-
-    public byte[] getData() {
-        byte[] bt = new byte[super.length - 1];
-        for(int i = 1; i < super.length; i++) {
-            bt[i-1] = super.data[i];
-        }
-        return bt;
-    }
-
-    @Override
-    public void setMessage(byte[] data, int length) throws InvalidMidiDataException {
-        //FIXME
-        /*
-         * if this exception throw out, the value of wrong status byte
-         * should be the hexadecimal value
-         */
-        if(((data[0] & 0xFF) != SysexMessage.SPECIAL_SYSTEM_EXCLUSIVE) &&
-                ((data[0] & 0xFF) != SysexMessage.SYSTEM_EXCLUSIVE)) {
-            // sound.09=Invalid status byte for sysex message: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.09",  //$NON-NLS-1$
-                    data[0] & 0xFF));
-        }
-        super.setMessage(data, length);
-    }
-
-    public void setMessage(int status, byte[] data, int length) throws InvalidMidiDataException {
-        //FIXME
-        /*
-         * if this exception throw out, the value of wrong status byte
-         * should be the hexadecimal value
-         */
-        if((status != SysexMessage.SPECIAL_SYSTEM_EXCLUSIVE) &&
-                (status != SysexMessage.SYSTEM_EXCLUSIVE)) {
-            // sound.09=Invalid status byte for sysex message: {0}
-            throw new InvalidMidiDataException(Messages.getString("sound.09",  //$NON-NLS-1$
-                    status));
-        }
-        if((length < 0) || (length > data.length)) {
-            // sound.03=length out of bounds: {0}
-            throw new IndexOutOfBoundsException(Messages.getString("sound.03", length)); //$NON-NLS-1$
-        }
-        byte[] bt = new byte[length + 1];
-        bt[0] = (byte) status;
-        for(int i = 0; i < length; i++) {
-            bt[i+1] = data[i];
-        }
-        super.setMessage(bt, length + 1);
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/Track.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/Track.java
deleted file mode 100644
index 27dab92..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/Track.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-import java.util.ArrayList;
-
-import org.apache.harmony.sound.internal.nls.Messages;
-
-public class Track {
-    private ArrayList<MidiEvent> events; //vector of events contain in the Track
-    
-    private MidiEvent badEvent; //variable to save event which I try to add
-                                //to empty Track; see description below
-    
-    private long tick; 
-    
-    Track() {
-        /*
-         * create an empty Track; new Track must contain only meta-event End of Track.
-         * MetaMessage with MetaMessage.data contains -1, 47 and 0 is meta-event
-         */
-        events = new ArrayList<MidiEvent>();
-        events.add(new MidiEvent(new MetaMessage(new byte[] {-1, 47, 0}), 0));
-    }
-    public boolean add(MidiEvent event) {
-        //FIXME
-        /*
-         * Some words about badEvent.
-         * When I write tests, I find following situation in the RI:
-         * if I want to add to empty Track new event that is not meta-event End of Track,
-         * I catch exception ArrayIndexOutOfBoundsException with meaning -1, and my
-         * event doesn't add to Track, but meta-event adds. If I try to add the same 
-         * event after it, method Track.add(MidiEvent) return 'false', and my event
-         * doesn't add again. So, I want to delete this event and use method 
-         * Track.remove(MidiEvent) for it, but it return 'false' too! And only after
-         * this "shamanism" I can add this event to Track normally. 
-         * And only for this situation I use variable badEvent. 
-         * 
-         * See test org.apache.harmony.sound.tests.javax.sound.midi.TrackTest 
-         * for more details
-         */
-        
-        /*
-         * if event equals null or badEvent, this method return 'false'
-         */
-        if (event == null || event == badEvent) {
-            return false;
-        }
-        /*
-         * If event equals meta-event End of Track and Track in this moment
-         * doesn't contain some events, i.e. Track.size() return 0, this 
-         * event accrue to Track; 
-         * if Track is not empty, but it doesn't contain meta-event, 
-         * this event accrue to the end of Track;
-         * in any case addition of this meta-event is successful, this method 
-         * return 'true' even if meta-event End of Track already contains in the Track
-         */
-        if (event.getMessage().getMessage()[0] == -1 &&
-                event.getMessage().getMessage()[1] == 47 &&
-                event.getMessage().getMessage()[2] == 0 ) {
-            if (events.size() == 0) {
-                return events.add(event);
-            }
-            byte[] bt = events.get(events.size() - 1).getMessage().getMessage();
-            if ((bt[0] != -1) && (bt[1] != 47) && (bt[2] != 0)) {
-                return events.add(event);
-            }         
-            return true;
-        }
-        /*
-         * after use method Track.add(MidiEvent) Track must contain meta-event
-         * End of Track; so, at first I add this event to Track if it doesn't 
-         * contain meta-event and parameter 'event' is not meta-event
-         */
-        if (events.size() == 0) {
-            events.add(new MidiEvent(new MetaMessage(new byte[] {-1, 47, 0}), 0));
-            badEvent = event;
-            // sounds.01=-1
-            throw new ArrayIndexOutOfBoundsException(Messages.getString("sound.01")); //$NON-NLS-1$
-        }
-        byte[] bt = events.get(events.size() - 1).getMessage().getMessage();
-        if ((bt[0] != -1) && (bt[1] != 47) && (bt[2] != 0)) {
-            events.add(new MidiEvent(new MetaMessage(new byte[] {-1, 47, 0}), 0));
-        }
-        
-        if (events.contains(event)) {
-            return false;
-        } 
-        
-        /*
-         * events in the Track must take up position in ascending ticks
-         */
-        if (events.size() == 1) {
-            events.add(0, event);
-        }
-        for (int i = 0; i < events.size() - 1; i++ ) {
-            if (events.get(i).getTick() <= event.getTick()) {
-                continue;
-            }
-            events.add(i, event);
-            break;
-        }
-        /*
-         * method Track.ticks() return the biggest value of tick of all events
-         * and save it even I remove event with the biggest values of tick
-         */
-        if (tick < event.getTick()) {
-            tick = event.getTick();
-        }
-        return true;           
-    }
-
-    public MidiEvent get(int index) throws ArrayIndexOutOfBoundsException {
-        if (index < 0 || index >= events.size()) {
-            // sound.02=Index: {0}, Size: {1}
-            throw new ArrayIndexOutOfBoundsException(Messages.getString("sound.02", index, events.size()));  //$NON-NLS-1$
-        }
-        return events.get(index);
-    }
-
-    public boolean remove(MidiEvent event) {
-        /*
-         * if I remove event that equals badEvent, I "delete" badEvent
-         */
-        if (event == badEvent) {
-            badEvent = null;
-            return false;
-        }
-        /*
-         * method Track.ticks() always return the biggest value that ever has been
-         * in the Track; so only when Track is empty Track.ticks() return 0 
-         */
-        if (events.remove(event)) {
-            if (events.size() == 0) {
-                tick = 0;
-            }
-            return true;
-        }
-        return false;
-    }
-
-    public int size() {
-        return events.size();
-    }
-
-    public long ticks() {
-        return tick;
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/Transmitter.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/Transmitter.java
deleted file mode 100644
index 1e89197..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/Transmitter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-public interface Transmitter {
-    void close();
-
-    Receiver getReceiver();
-
-    void setReceiver(Receiver receiver);
-
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/VoiceStatus.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/VoiceStatus.java
deleted file mode 100644
index 370f48e..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/VoiceStatus.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi;
-
-public class VoiceStatus {
-    public boolean active;
-
-    public int bank;
-
-    public int channel;
-
-    public int note;
-
-    public int program;
-
-    public int volume;
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/spi/MidiDeviceProvider.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/spi/MidiDeviceProvider.java
deleted file mode 100644
index 6112ec7..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/spi/MidiDeviceProvider.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi.spi;
-
-import javax.sound.midi.MidiDevice;
-import javax.sound.midi.MidiDevice.Info;
-
-public abstract class MidiDeviceProvider {
-
-    public abstract MidiDevice getDevice(MidiDevice.Info info);
-
-    public abstract MidiDevice.Info[] getDeviceInfo();
-
-    public boolean isDeviceSupported(MidiDevice.Info info) {
-        MidiDevice.Info[] devices = getDeviceInfo();
-        for (Info element : devices) {
-            if (info.equals(element)) {
-                return true;
-            }
-        }
-        return false;
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/spi/MidiFileReader.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/spi/MidiFileReader.java
deleted file mode 100644
index 0d61181..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/spi/MidiFileReader.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi.spi;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.sound.midi.InvalidMidiDataException;
-import javax.sound.midi.MidiFileFormat;
-import javax.sound.midi.Sequence;
-
-public abstract class MidiFileReader {
-
-    public abstract MidiFileFormat getMidiFileFormat(File file)
-            throws InvalidMidiDataException, IOException;
-
-    public abstract MidiFileFormat getMidiFileFormat(InputStream stream)
-            throws InvalidMidiDataException, IOException;
-
-    public abstract MidiFileFormat getMidiFileFormat(URL url)
-            throws InvalidMidiDataException, IOException;
-
-    public abstract Sequence getSequence(File file)
-            throws InvalidMidiDataException, IOException;
-
-    public abstract Sequence getSequence(InputStream stream)
-            throws InvalidMidiDataException, IOException;
-
-    public abstract Sequence getSequence(URL url)
-            throws InvalidMidiDataException, IOException;
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/spi/MidiFileWriter.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/spi/MidiFileWriter.java
deleted file mode 100644
index e47d17c..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/spi/MidiFileWriter.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi.spi;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.sound.midi.Sequence;
-
-public abstract class MidiFileWriter {
-
-    public abstract int[] getMidiFileTypes();
-
-    public abstract int[] getMidiFileTypes(Sequence sequence);
-
-    public boolean isFileTypeSupported(int fileType) {
-        int[] supported = getMidiFileTypes();
-        for (int element : supported) {
-            if (fileType == element) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public boolean isFileTypeSupported(int fileType, Sequence sequence) {
-        int[] supported = getMidiFileTypes(sequence);
-        for (int element : supported) {
-            if (fileType == element) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public abstract int write(Sequence in, int fileType, File out)
-            throws IOException;
-
-    public abstract int write(Sequence in, int fileType, OutputStream out)
-            throws IOException;
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/midi/spi/SoundbankReader.java b/libcore-disabled/sound/src/main/java/javax/sound/midi/spi/SoundbankReader.java
deleted file mode 100644
index 4fd195a..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/midi/spi/SoundbankReader.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.midi.spi;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.sound.midi.InvalidMidiDataException;
-import javax.sound.midi.Soundbank;
-
-public abstract class SoundbankReader {
-
-    public abstract Soundbank getSoundbank(File file)
-            throws InvalidMidiDataException, IOException;
-
-    public abstract Soundbank getSoundbank(InputStream stream)
-            throws InvalidMidiDataException, IOException;
-
-    public abstract Soundbank getSoundbank(URL url)
-            throws InvalidMidiDataException, IOException;
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioFileFormat.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioFileFormat.java
deleted file mode 100644
index ce476f1..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioFileFormat.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-public class AudioFileFormat {
-
-    private AudioFileFormat.Type type;
-    private int byteLength = AudioSystem.NOT_SPECIFIED;
-    private AudioFormat format;
-    private int frameLength;
-    private HashMap<String, Object> prop;
-
-    protected AudioFileFormat(AudioFileFormat.Type type,
-            int byteLength,
-            AudioFormat format,
-            int frameLength) {
-        this.type = type;
-        this.byteLength = byteLength;
-        this.format = format;
-        this.frameLength = frameLength;
-    }
-    
-    public AudioFileFormat(AudioFileFormat.Type type,
-            AudioFormat format,
-            int frameLength) {
-        this.type = type;
-        this.format = format;
-        this.frameLength = frameLength;
-    }
-
-    public AudioFileFormat(AudioFileFormat.Type type,
-            AudioFormat format,
-            int frameLength,
-            Map<String,Object> properties) {
-        this.type = type;
-        this.format = format;
-        this.frameLength = frameLength;
-        prop = new HashMap<String, Object>();
-        prop.putAll(properties);
-    }
-    
-    public AudioFileFormat.Type getType() {
-        return type;
-    }
-    
-    public int getByteLength() {
-        return byteLength;
-    }
-
-    public AudioFormat getFormat() {
-        return format;
-    }
-    
-    public int getFrameLength() {
-        return frameLength;
-    }
-    
-    public Map<String,Object> properties() {
-        if (prop == null) {
-            return null;
-        }
-        return Collections.unmodifiableMap(prop);
-    }
-    
-    public Object getProperty(String key) {
-        if (prop == null) {
-            return null;
-        }
-        return prop.get(key);
-    }
-    
-    public String toString() {
-        return type + " (." + type.getExtension() + ") file, data format: " + format + //$NON-NLS-1$ //$NON-NLS-2$
-            " frame length: " + frameLength; //$NON-NLS-1$
-    }
-    
-    public static class Type {
-
-        private String name;
-
-        private String extension;
-
-        public static final Type AIFC = new Type("AIFF-C", "aifc"); //$NON-NLS-1$ //$NON-NLS-2$
-
-        public static final Type AIFF = new Type("AIFF", "aif"); //$NON-NLS-1$ //$NON-NLS-2$
-
-        public static final Type AU = new Type("AU", "au"); //$NON-NLS-1$ //$NON-NLS-2$
-
-        public static final Type SND = new Type("SND", "snd"); //$NON-NLS-1$ //$NON-NLS-2$
-
-        public static final Type WAVE = new Type("WAVE", "wav"); //$NON-NLS-1$ //$NON-NLS-2$
-
-        public Type(String name, String extension) {
-            this.name = name;
-            this.extension = extension;
-        }
-
-        /*
-         * according to the spec it should return true when objects are same but
-         * RI seem to compare internals
-         * 
-         * @see java.lang.Object#equals(java.lang.Object)
-         */
-        @Override
-        public final boolean equals(Object another) {
-            if (this == another) {
-                return true;
-            }
-
-            if (another == null || !(another instanceof Type)) {
-                return false;
-            }
-
-            Type obj = (Type) another;
-            return (name == null ? obj.name == null : name.equals(obj.name))
-                    && (extension == null ? obj.extension == null : extension
-                            .equals(obj.extension));
-        }
-
-        public String getExtension() {
-            return extension;
-        }
-
-        @Override
-        public final int hashCode() {
-            return (name == null ? 0 : name.hashCode()) + 
-                    (extension == null ? 0 : extension.hashCode());
-        }
-
-        @Override
-        public final String toString() {
-            return name;
-        }
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioFormat.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioFormat.java
deleted file mode 100644
index 721ed6a..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioFormat.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-public class AudioFormat {
-    public static class Encoding {
-
-        public static final Encoding ALAW = new Encoding("ALAW"); //$NON-NLS-1$
-
-        public static final Encoding PCM_SIGNED = new Encoding("PCM_SIGNED"); //$NON-NLS-1$
-
-        public static final Encoding PCM_UNSIGNED = new Encoding("PCM_UNSIGNED"); //$NON-NLS-1$
-
-        public static final Encoding ULAW = new Encoding("ULAW"); //$NON-NLS-1$
-
-        private String name;
-
-        public Encoding(String name) {
-            this.name = name;
-        }
-
-        @Override
-        public boolean equals(Object another) {
-            if (this == another) {
-                return true;
-            }
-
-            if (another == null || !(another instanceof Encoding)) {
-                return false;
-            }
-
-            Encoding obj = (Encoding) another;
-            return name == null ? obj.name == null : name.equals(obj.name);
-        }
-
-        @Override
-        public final int hashCode() {
-            return name == null ? 0 : name.hashCode();
-        }
-
-        @Override
-        public final String toString() {
-            return name;
-        }
-    }
-
-    protected boolean bigEndian;
-
-    protected int channels;
-
-    protected Encoding encoding;
-
-    protected float frameRate;
-
-    protected int frameSize;
-
-    protected float sampleRate;
-
-    protected int sampleSizeInBits;
-
-    private HashMap<String, Object> prop;
-
-    public AudioFormat(AudioFormat.Encoding encoding,
-            float sampleRate,
-            int sampleSizeInBits,
-            int channels,
-            int frameSize,
-            float frameRate,
-            boolean bigEndian) {
-
-        this.encoding = encoding;
-        this.sampleRate = sampleRate;
-        this.sampleSizeInBits = sampleSizeInBits;
-        this.channels = channels;
-        this.frameSize = frameSize;
-        this.frameRate = frameRate;
-        this.bigEndian = bigEndian;
-
-    }
-
-    public AudioFormat(AudioFormat.Encoding encoding,
-            float sampleRate,
-            int sampleSizeInBits,
-            int channels,
-            int frameSize,
-            float frameRate,
-            boolean bigEndian,
-            Map<String,Object> properties) {
-
-        this.encoding = encoding;
-        this.sampleRate = sampleRate;
-        this.sampleSizeInBits = sampleSizeInBits;
-        this.channels = channels;
-        this.frameSize = frameSize;
-        this.frameRate = frameRate;
-        this.bigEndian = bigEndian;
-        prop = new HashMap<String, Object>();
-        prop.putAll(properties);
-
-    }
-
-    public AudioFormat(float sampleRate,
-            int sampleSizeInBits,
-            int channels,
-            boolean signed,
-            boolean bigEndian) {
-
-        this.encoding = (signed?  Encoding.PCM_SIGNED : Encoding.PCM_UNSIGNED);
-        this.sampleRate = sampleRate;
-        this.sampleSizeInBits = sampleSizeInBits;
-        this.channels = channels;
-        this.frameSize = sampleSizeInBits >> 3;
-        if ((sampleSizeInBits & 0x7) != 0) {
-            this.frameSize++;
-        }
-        this.frameSize *= channels;
-        this.frameRate = sampleRate;
-        this.bigEndian = bigEndian;
-
-    }
-
-    public Encoding getEncoding() {
-        return encoding;
-    }
-
-    public float getSampleRate() {
-        return sampleRate;
-    }
-    
-    public int getSampleSizeInBits() {
-        return sampleSizeInBits;
-    }
-
-    public int getChannels() {
-        return channels;
-    }
-
-    public int getFrameSize() {
-        return frameSize;
-    }
-
-    public float getFrameRate() {
-        return frameRate;
-    }
-
-    public boolean isBigEndian() {
-        return bigEndian;
-    }
-
-    public Map<String,Object> properties() {
-        if (prop != null) {
-            return Collections.unmodifiableMap(prop);
-        } else {
-            return Collections.emptyMap();
-        }
-    }
-
-    public Object getProperty(String key) {
-        if (prop == null) {
-            return null;
-        }
-        return prop.get(key);
-    }
-
-    public boolean matches(AudioFormat format) {
-        if (!encoding.equals(format.getEncoding()) ||
-                channels != format.getChannels() ||
-                sampleSizeInBits != format.getSampleSizeInBits() ||
-                frameSize != format.getFrameSize()) {
-            return false;
-        }
-        if (format.getSampleRate() != AudioSystem.NOT_SPECIFIED &&
-                sampleRate != format.getSampleRate()) {
-            return false;
-        }
-        
-        if (format.getFrameRate() != AudioSystem.NOT_SPECIFIED &&
-                frameRate != format.getFrameRate()) {
-            return false;
-        }
-        
-        if ((sampleSizeInBits > 8) 
-                && (bigEndian != format.isBigEndian())) {
-            return false;
-        }
-        return true;
-        
-    }
-
-    public String toString() {
-
-        String ch;
-        switch (channels) {
-        case 1:
-            ch = "mono,"; //$NON-NLS-1$
-            break;
-        case 2:
-            ch = "stereo,"; //$NON-NLS-1$
-        default:
-            ch = channels + " channels, "; //$NON-NLS-1$
-        }       
-
-        return encoding + " " + sampleRate + " Hz, " + sampleSizeInBits + " bit, " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-            + ch + frameSize + " bytes/frame, " + frameRate + " frames/second"; //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioInputStream.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioInputStream.java
deleted file mode 100644
index 3105f94..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioInputStream.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.harmony.sound.internal.nls.Messages;
-
-public class AudioInputStream extends InputStream {
-
-    protected AudioFormat format;
-
-    protected long frameLength;
-
-    protected long framePos;
-
-    protected int frameSize;
-
-    private InputStream stream;
-
-    private TargetDataLine line;
-
-    private byte[] oneByte = new byte[1];
-
-    private long marketFramePos;
-
-    public AudioInputStream(InputStream stream, AudioFormat format, long length) {
-        this.stream = stream;
-        this.format = format;
-        this.frameLength = length;
-        this.frameSize = format.getFrameSize();
-    }
-
-    public AudioInputStream(TargetDataLine line) {
-        this.line = line;
-        this.format = line.getFormat();
-        this.frameLength = AudioSystem.NOT_SPECIFIED; //TODO
-        this.frameSize = this.format.getFrameSize();
-    }
-
-    public AudioFormat getFormat() {
-        return format;
-    }
-
-    public long getFrameLength() {
-        return frameLength;
-    }
-
-    public int read() throws IOException {
-        if (frameSize != 1) {
-            // sound.0C=Frame size must be one byte
-            throw new IOException(Messages.getString("sound.0C")); //$NON-NLS-1$
-        }
-        int res;
-        if (stream != null) { // InputStream
-            if (framePos == frameLength) {
-                return 0;
-            }
-            res = stream.read();
-            if (res == -1) {
-                return -1;
-            }
-            framePos += 1;
-            return res;
-        } else { // TargetDataLine
-            if (line.read(oneByte, 0, 1) == 0) {
-                return -1;
-            }
-            framePos = line.getLongFramePosition();
-            return oneByte[0];
-        }
-    }
-
-    public int read(byte[] b) throws IOException {
-        return read(b, 0, b.length);
-    }
-
-    public int read(byte[] b, int off, int len) throws IOException {
-        int l = Math.min(len, (int) ((frameLength - framePos) * frameSize));
-        l = l - (l % frameSize);
-        if (l == 0) {
-            return 0;
-        }
-        int res;
-        if (stream != null) { // InputStream
-            res = stream.read(b, off, l);
-            if (res == -1) {
-                return -1;
-            }
-            framePos = framePos + res / frameSize;
-            return res;
-        } else { // TargetDataLine
-            res = line.read(b, off, l);
-            if (res == 0) {
-                return -1;
-            }
-            framePos = line.getLongFramePosition();
-            return res;
-        }
-
-    }
-
-    public long skip(long n) throws IOException {
-
-        if (n < frameSize) {
-            return 0;
-        }
-        byte[] skipBuf = new byte[frameSize];
-        long skipped = 0;
-        while (skipped < n) {
-            int read = read(skipBuf, 0, frameSize);
-            if (read == -1) {
-                return skipped;
-            }
-            skipped += read;
-            if (n - skipped < frameSize) {
-                return skipped;
-            }
-        }
-        return skipped;
-
-    }
-
-    public int available() throws IOException {
-        if (stream != null) { // InputStream
-            return Math.min(stream.available(),
-                    (int)((frameLength - framePos) * frameSize));
-        } else { // TargetDataLine
-            return line.available();
-        }
-    }
-
-    public void close() throws IOException {
-        if (stream != null) { // InputStream
-            stream.close();
-        } else { // TargetDataLine
-            line.close();
-        }
-    }
-
-    public void mark(int readlimit) {
-        if (stream != null) { //InputStream
-            stream.mark(readlimit);
-            marketFramePos = framePos;
-        } else { // TargetDataLine
-            // do nothing
-        }
-    }
-
-    public void reset() throws IOException {
-        if (stream != null) { //InputStream
-            stream.reset();
-            framePos = marketFramePos;
-        } else { // TargetDataLine
-            // do nothing
-        }
-    }
-
-    public boolean markSupported() {
-        if (stream != null) { //InputStream
-            return stream.markSupported();
-        } else { // TargetDataLine
-            return false;
-        }
-    }
-
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioPermission.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioPermission.java
deleted file mode 100644
index 04ddd94..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioPermission.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-import java.security.BasicPermission;
-
-public class AudioPermission extends BasicPermission {
-
-    private static final long serialVersionUID = -5518053473477801126L;
-
-    public AudioPermission(String name) {
-        super(name);
-    }
-
-    public AudioPermission(String name, String actions) {
-        super(name, actions);
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioSystem.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioSystem.java
deleted file mode 100644
index c279c17..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/AudioSystem.java
+++ /dev/null
@@ -1,638 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Iterator;
-import java.util.Properties;
-
-import javax.sound.sampled.spi.AudioFileReader;
-import javax.sound.sampled.spi.AudioFileWriter;
-import javax.sound.sampled.spi.FormatConversionProvider;
-import javax.sound.sampled.spi.MixerProvider;
-
-import org.apache.harmony.sound.utils.ProviderService;
-
-import org.apache.harmony.sound.internal.nls.Messages;
-
-public class AudioSystem {
-
-    public static final int NOT_SPECIFIED = -1;
-
-    private final static String audioFileReaderPath = "META-INF/services/javax.sound.sampled.spi.AudioFileReader"; //$NON-NLS-1$
-
-    private final static String audioFileWriterPath = "META-INF/services/javax.sound.sampled.spi.AudioFileWriter"; //$NON-NLS-1$
-
-    private final static String formatConversionProviderPath = "META-INF/services/javax.sound.sampled.spi.FormatConversionProvider"; //$NON-NLS-1$
-
-    private final static String mixerProviderPath = "META-INF/services/javax.sound.sampled.spi.MixerProvider"; //$NON-NLS-1$
-
-    private final static String CLIP = "javax.sound.sampled.Clip"; //$NON-NLS-1$
-
-    private final static String PORT = "javax.sound.sampled.Port"; //$NON-NLS-1$
-
-    private final static String SOURCEDATALINE = "javax.sound.sampled.SourceDataLine"; //$NON-NLS-1$
-
-    private final static String TARGETDATALINE = "javax.sound.sampled.TargetDataLine"; //$NON-NLS-1$
-
-    public static Mixer.Info[] getMixerInfo() {
-        List<Mixer.Info> result = new ArrayList<Mixer.Info>();
-        for (Iterator providers = ProviderService.getProviders(
-                mixerProviderPath).iterator(); providers.hasNext();) {
-            try {
-                Mixer.Info[] infos = ((MixerProvider) (providers.next()))
-                        .getMixerInfo();
-                for (Mixer.Info info : infos) {
-                    result.add(info);
-                }
-            } catch (ClassCastException e) {}
-        }
-        Mixer.Info[] temp = new Mixer.Info[result.size()];
-        return result.toArray(temp);
-    }
-
-    public static Mixer getMixer(Mixer.Info info) {
-        Mixer.Info[] infos;
-        Mixer.Info inf;
-        if (info == null) {
-            infos = getMixerInfo();
-            if (infos == null) {
-                throw new IllegalArgumentException(
-                        "No system default mixer installed"); //$NON-NLS-1$
-            }
-            inf = infos[0];
-        } else {
-            inf = info;
-        }
-
-        for (Iterator providers = ProviderService.getProviders(
-                mixerProviderPath).iterator(); providers.hasNext();) {
-            try {
-                return ((MixerProvider) (providers.next())).getMixer(inf);
-            } catch (ClassCastException e) {} catch (IllegalArgumentException e) {}
-        }
-        throw new IllegalArgumentException("Mixer not supported: " + inf); //$NON-NLS-1$
-    }
-
-    public static Line.Info[] getSourceLineInfo(Line.Info info) {
-        List<Line.Info> result = new ArrayList<Line.Info>();
-        for (Iterator providers = ProviderService.getProviders(
-                mixerProviderPath).iterator(); providers.hasNext();) {
-            try {
-                MixerProvider pr = (MixerProvider) providers.next();
-                Mixer.Info[] mixinfos = pr.getMixerInfo();
-                for (Mixer.Info mixinfo : mixinfos) {
-                    Mixer mix = pr.getMixer(mixinfo);
-                    Line.Info[] linfos = mix.getSourceLineInfo(info);
-                    for (Line.Info linfo : linfos) {
-                        result.add(linfo);
-                    }
-                }
-            } catch (ClassCastException e) {}
-        }
-        Line.Info[] temp = new Line.Info[result.size()];
-        return result.toArray(temp);
-    }
-
-    public static Line.Info[] getTargetLineInfo(Line.Info info) {
-        List<Line.Info> result = new ArrayList<Line.Info>();
-        for (Iterator providers = ProviderService.getProviders(
-                mixerProviderPath).iterator(); providers.hasNext();) {
-            try {
-                MixerProvider pr = (MixerProvider) providers.next();
-                Mixer.Info[] mixinfos = pr.getMixerInfo();
-                for (Mixer.Info mixinfo : mixinfos) {
-                    Mixer mix = pr.getMixer(mixinfo);
-                    Line.Info[] linfos = mix.getTargetLineInfo(info);
-                    for (Line.Info linfo : linfos) {
-                        result.add(linfo);
-                    }
-                }
-            } catch (ClassCastException e) {}
-        }
-        Line.Info[] temp = new Line.Info[result.size()];
-        return result.toArray(temp);
-    }
-
-    public static boolean isLineSupported(Line.Info info) {
-
-        for (Iterator providers = ProviderService.getProviders(
-                mixerProviderPath).iterator(); providers.hasNext();) {
-            try {
-                MixerProvider pr = (MixerProvider) providers.next();
-                Mixer.Info[] mixinfos = pr.getMixerInfo();
-                for (Mixer.Info mixinfo : mixinfos) {
-                    Mixer mix = pr.getMixer(mixinfo);
-                    if (mix.isLineSupported(info)) {
-                        return true;
-                    }
-                }
-            } catch (ClassCastException e) {}
-        }
-        return false;
-    }
-
-    private static Mixer getMixer(String propVal, Line.Info info,
-            List<?> mixerProviders) {
-
-        int index = propVal.indexOf("#"); //$NON-NLS-1$
-        String className;
-        String mixName;
-        if (index == -1) {
-            className = propVal.trim();
-            mixName = ""; //$NON-NLS-1$
-        } else {
-            className = propVal.substring(0, index).trim();
-            if (index == propVal.length()) {
-                mixName = ""; //$NON-NLS-1$
-            } else {
-                mixName = propVal.substring(index + 1).trim();
-            }
-        }
-        Mixer.Info[] minfos = null;
-        if (!className.equals("")) { //$NON-NLS-1$
-            for (Iterator providers = mixerProviders.iterator(); providers
-                    .hasNext();) {
-                try {
-                    MixerProvider pr = (MixerProvider) (providers.next());
-                    if (className.equals(pr.getClass().getName())) {
-                        minfos = pr.getMixerInfo();
-                        break;
-                    }
-                } catch (ClassCastException e) {}
-            }
-        }
-        if (minfos == null) {
-            minfos = getMixerInfo();
-        }
-
-        if (!mixName.equals("")) { //$NON-NLS-1$
-            for (Mixer.Info minfo : minfos) {
-                if (mixName.equals(minfo.getName())) {
-                    return getMixer(minfo);
-                }
-            }
-        }
-        if (minfos.length > 0) {
-            return getMixer(minfos[0]);
-        }
-        return null;
-    }
-
-    public static Line getLine(Line.Info info) throws LineUnavailableException {
-        String propName = null;
-        Class lineClass = info.getLineClass();
-
-        if (Clip.class.isAssignableFrom(lineClass)) {
-            propName = CLIP;
-        } else if (Port.class.isAssignableFrom(lineClass)) {
-            propName = PORT;
-        } else if (SourceDataLine.class.isAssignableFrom(lineClass)) {
-            propName = SOURCEDATALINE;
-        } else if (TargetDataLine.class.isAssignableFrom(lineClass)) {
-            propName = TARGETDATALINE;
-        }
-        return getLine(propName, info);
-    }
-
-    private static Line getLine(String propName, Line.Info info)
-            throws LineUnavailableException {
-
-        List<?> mixerProviders = ProviderService
-                .getProviders(mixerProviderPath);
-
-        if (propName != null) {
-            String propVal = System.getProperty(propName);
-            if (propVal != null) {
-                Mixer m = getMixer(propVal, info, mixerProviders);
-                if (m != null) {
-                    Line l = m.getLine(info);
-                    if (l != null) {
-                        return l;
-                    }
-                }
-            }
-
-            Properties soundProperties = ProviderService.getSoundProperties();
-            propVal = soundProperties.getProperty(propName);
-            if (propVal != null) {
-                Mixer m = getMixer(propVal, info, mixerProviders);
-                if (m != null) {
-                    Line l = m.getLine(info);
-                    if (l != null) {
-                        return l;
-                    }
-                }
-            }
-        }
-
-        for (Iterator providers = ProviderService.getProviders(
-                mixerProviderPath).iterator(); providers.hasNext();) {
-            try {
-                MixerProvider pr = (MixerProvider) (providers.next());
-                Mixer.Info[] mixinfos = pr.getMixerInfo();
-                for (Mixer.Info mixinfo : mixinfos) {
-                    try {
-                        Mixer mix = pr.getMixer(mixinfo);
-                        return mix.getLine(info);
-                    } catch (IllegalArgumentException e) {
-                        // continue
-                    }
-                }
-            } catch (ClassCastException e) {}
-        }
-        
-        // BEGIN android-added
-        if (CLIP.equals(propName)) {
-            try {
-                return (Clip)(Class.forName("com.android.internal.sound.sampled.AndroidClip").newInstance());
-            } catch (Exception ex) {
-                // Ignore
-            }
-        }
-        // END android-added
-        
-        // sound.11=Could not get line
-        throw new IllegalArgumentException(Messages.getString("sound.11")); //$NON-NLS-1$
-    }
-
-    public static Clip getClip() throws LineUnavailableException {
-        return (Clip) getLine(new Line.Info(Clip.class));
-    }
-
-    public static Clip getClip(Mixer.Info mixerInfo)
-            throws LineUnavailableException {
-        return (Clip) (getMixer(mixerInfo).getLine(new Line.Info(Clip.class)));
-    }
-
-    public static SourceDataLine getSourceDataLine(AudioFormat format)
-            throws LineUnavailableException {
-        SourceDataLine line = (SourceDataLine) getLine(new Line.Info(
-                SourceDataLine.class));
-        line.open(format);
-        return line;
-    }
-
-    public static SourceDataLine getSourceDataLine(AudioFormat format,
-            Mixer.Info mixerinfo) throws LineUnavailableException {
-
-        SourceDataLine line = (SourceDataLine) getMixer(mixerinfo).getLine(
-                new Line.Info(SourceDataLine.class));
-        line.open(format);
-        return line;
-    }
-
-    public static TargetDataLine getTargetDataLine(AudioFormat format)
-            throws LineUnavailableException {
-        TargetDataLine line = (TargetDataLine) getLine(new Line.Info(
-                TargetDataLine.class));
-        line.open(format);
-        return line;
-    }
-
-    public static TargetDataLine getTargetDataLine(AudioFormat format,
-            Mixer.Info mixerinfo) throws LineUnavailableException {
-
-        TargetDataLine line = (TargetDataLine) getMixer(mixerinfo).getLine(
-                new Line.Info(TargetDataLine.class));
-        line.open(format);
-        return line;
-    }
-
-    public static AudioFormat.Encoding[] getTargetEncodings(
-            AudioFormat.Encoding sourceEncoding) {
-
-        List<AudioFormat.Encoding> result = new ArrayList<AudioFormat.Encoding>();
-        for (Iterator providers = ProviderService.getProviders(
-                formatConversionProviderPath).iterator(); providers.hasNext();) {
-            try {
-                FormatConversionProvider pr = (FormatConversionProvider) providers
-                        .next();
-                if (!pr.isSourceEncodingSupported(sourceEncoding)) {
-                    continue;
-                }
-                AudioFormat.Encoding[] encodings = pr.getTargetEncodings();
-                for (AudioFormat.Encoding encoding : encodings) {
-                    result.add(encoding);
-                }
-            } catch (ClassCastException e) {}
-        }
-        AudioFormat.Encoding[] temp = new AudioFormat.Encoding[result.size()];
-        return result.toArray(temp);
-    }
-
-    public static AudioFormat.Encoding[] getTargetEncodings(
-            AudioFormat sourceFormat) {
-
-        List<AudioFormat.Encoding> result = new ArrayList<AudioFormat.Encoding>();
-        for (Iterator providers = ProviderService.getProviders(
-                formatConversionProviderPath).iterator(); providers.hasNext();) {
-            try {
-                AudioFormat.Encoding[] encodings = ((FormatConversionProvider) (providers
-                        .next())).getTargetEncodings(sourceFormat);
-                for (AudioFormat.Encoding encoding : encodings) {
-                    result.add(encoding);
-                }
-            } catch (ClassCastException e) {}
-        }
-        AudioFormat.Encoding[] temp = new AudioFormat.Encoding[result.size()];
-        return result.toArray(temp);
-    }
-
-    public static boolean isConversionSupported(
-            AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
-
-        for (Iterator providers = ProviderService.getProviders(
-                formatConversionProviderPath).iterator(); providers.hasNext();) {
-            if (((FormatConversionProvider) (providers.next()))
-                    .isConversionSupported(targetEncoding, sourceFormat)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public static AudioInputStream getAudioInputStream(
-            AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) {
-
-        if (sourceStream.getFormat().getEncoding().equals(targetEncoding)) {
-            return sourceStream;
-        }
-        for (Iterator providers = ProviderService.getProviders(
-                formatConversionProviderPath).iterator(); providers.hasNext();) {
-            try {
-                return ((FormatConversionProvider) (providers.next()))
-                        .getAudioInputStream(targetEncoding, sourceStream);
-            } catch (ClassCastException e) {} catch (IllegalArgumentException e) {}
-        }
-        // sound.12=Could not get audio input stream from source stream
-        throw new IllegalArgumentException(Messages.getString("sound.12")); //$NON-NLS-1$
-    }
-
-    public static AudioFormat[] getTargetFormats(
-            AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
-
-        List<AudioFormat> result = new ArrayList<AudioFormat>();
-        for (Iterator providers = ProviderService.getProviders(
-                formatConversionProviderPath).iterator(); providers.hasNext();) {
-            try {
-                AudioFormat[] formats = ((FormatConversionProvider) (providers
-                        .next()))
-                        .getTargetFormats(targetEncoding, sourceFormat);
-                for (AudioFormat format : formats) {
-                    result.add(format);
-                }
-            } catch (ClassCastException e) {}
-        }
-        AudioFormat[] temp = new AudioFormat[result.size()];
-        return result.toArray(temp);
-    }
-
-    public static boolean isConversionSupported(AudioFormat targetFormat,
-            AudioFormat sourceFormat) {
-
-        for (Iterator providers = ProviderService.getProviders(
-                formatConversionProviderPath).iterator(); providers.hasNext();) {
-            if (((FormatConversionProvider) (providers.next()))
-                    .isConversionSupported(targetFormat, sourceFormat)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public static AudioInputStream getAudioInputStream(
-            AudioFormat targetFormat, AudioInputStream sourceStream) {
-
-        if (sourceStream.getFormat().matches(targetFormat)) {
-            return sourceStream;
-        }
-        for (Iterator providers = ProviderService.getProviders(
-                formatConversionProviderPath).iterator(); providers.hasNext();) {
-            try {
-                return ((FormatConversionProvider) (providers.next()))
-                        .getAudioInputStream(targetFormat, sourceStream);
-            } catch (ClassCastException e) {} catch (IllegalArgumentException e) {}
-        }
-        // sound.13=Could not get audio input stream from source stream
-        throw new IllegalArgumentException(Messages.getString("sound.13")); //$NON-NLS-1$
-    }
-
-    public static AudioFileFormat getAudioFileFormat(InputStream stream)
-            throws UnsupportedAudioFileException, IOException {
-
-        for (Iterator providers = ProviderService.getProviders(
-                audioFileReaderPath).iterator(); providers.hasNext();) {
-            try {
-                return ((AudioFileReader) (providers.next()))
-                        .getAudioFileFormat(stream);
-            } catch (ClassCastException e) {} catch (UnsupportedAudioFileException e) {}
-        }
-        // sound.14=File is not a supported file type
-        throw new UnsupportedAudioFileException(Messages.getString("sound.14")); //$NON-NLS-1$
-    }
-
-    public static AudioFileFormat getAudioFileFormat(URL url)
-            throws UnsupportedAudioFileException, IOException {
-
-        for (Iterator providers = ProviderService.getProviders(
-                audioFileReaderPath).iterator(); providers.hasNext();) {
-            try {
-                return ((AudioFileReader) (providers.next()))
-                        .getAudioFileFormat(url);
-            } catch (ClassCastException e) {} catch (UnsupportedAudioFileException e) {}
-        }
-        // sound.14=File is not a supported file type
-        throw new UnsupportedAudioFileException(Messages.getString("sound.14")); //$NON-NLS-1$
-    }
-
-    public static AudioFileFormat getAudioFileFormat(File file)
-            throws UnsupportedAudioFileException, IOException {
-
-        for (Iterator providers = ProviderService.getProviders(
-                audioFileReaderPath).iterator(); providers.hasNext();) {
-            try {
-                return ((AudioFileReader) (providers.next()))
-                        .getAudioFileFormat(file);
-            } catch (ClassCastException e) {} catch (UnsupportedAudioFileException e) {}
-        }
-        // sound.14=File is not a supported file type
-        throw new UnsupportedAudioFileException(Messages.getString("sound.14")); //$NON-NLS-1$
-    }
-
-    public static AudioInputStream getAudioInputStream(InputStream stream)
-            throws UnsupportedAudioFileException, IOException {
-
-        if (stream instanceof AudioInputStream) {
-            return (AudioInputStream) stream;
-        }
-        for (Iterator providers = ProviderService.getProviders(
-                audioFileReaderPath).iterator(); providers.hasNext();) {
-            try {
-                return ((AudioFileReader) (providers.next()))
-                        .getAudioInputStream(stream);
-            } catch (ClassCastException e) {} catch (UnsupportedAudioFileException e) {}
-        }
-        // BEGIN android-added
-        try {
-            AudioFileReader reader = (AudioFileReader)(Class.forName("com.android.internal.sound.sampled.AndroidAudioFileReader").newInstance());
-            return reader.getAudioInputStream(stream);
-        } catch (Exception ex) {
-            // Ignore
-        }
-        // END android-added
-        // sound.15=Could not get audio input stream from input stream
-        throw new UnsupportedAudioFileException(Messages.getString("sound.15")); //$NON-NLS-1$
-    }
-
-    public static AudioInputStream getAudioInputStream(URL url)
-            throws UnsupportedAudioFileException, IOException {
-
-        for (Iterator providers = ProviderService.getProviders(
-                audioFileReaderPath).iterator(); providers.hasNext();) {
-            try {
-                return ((AudioFileReader) (providers.next()))
-                        .getAudioInputStream(url);
-            } catch (ClassCastException e) {} catch (UnsupportedAudioFileException e) {}
-        }
-        // BEGIN android-added
-        try {
-            AudioFileReader reader = (AudioFileReader)(Class.forName("com.android.internal.sound.sampled.AndroidAudioFileReader").newInstance());
-            return reader.getAudioInputStream(url);
-        } catch (Exception ex) {
-            // Ignore
-        }
-        // END android-added
-        // sound.16=Could not get audio input stream from input URL
-        throw new UnsupportedAudioFileException(Messages.getString("sound.16")); //$NON-NLS-1$
-    }
-
-    public static AudioInputStream getAudioInputStream(File file)
-            throws UnsupportedAudioFileException, IOException {
-
-        for (Iterator providers = ProviderService.getProviders(
-                audioFileReaderPath).iterator(); providers.hasNext();) {
-            try {
-                return ((AudioFileReader) (providers.next()))
-                        .getAudioInputStream(file);
-            } catch (ClassCastException e) {} catch (UnsupportedAudioFileException e) {}
-        }
-        // BEGIN android-added
-        try {
-            AudioFileReader reader = (AudioFileReader)(Class.forName("com.android.internal.sound.sampled.AndroidAudioFileReader").newInstance());
-            return reader.getAudioInputStream(file);
-        } catch (Exception ex) {
-            // Ignore
-        }
-        // END android-added
-        // sound.17=Could not get audio input stream from input file
-        throw new UnsupportedAudioFileException(Messages.getString("sound.17")); //$NON-NLS-1$
-    }
-
-    public static AudioFileFormat.Type[] getAudioFileTypes() {
-        List<AudioFileFormat.Type> result = new ArrayList<AudioFileFormat.Type>();
-        for (Iterator providers = ProviderService.getProviders(
-                audioFileWriterPath).iterator(); providers.hasNext();) {
-            try {
-                AudioFileFormat.Type[] types = ((AudioFileWriter) (providers
-                        .next())).getAudioFileTypes();
-                for (AudioFileFormat.Type type : types) {
-                    result.add(type);
-                }
-            } catch (ClassCastException e) {}
-        }
-        AudioFileFormat.Type[] temp = new AudioFileFormat.Type[result.size()];
-        return result.toArray(temp);
-    }
-
-    public static boolean isFileTypeSupported(AudioFileFormat.Type fileType) {
-
-        for (Iterator providers = ProviderService.getProviders(
-                audioFileWriterPath).iterator(); providers.hasNext();) {
-            if (((AudioFileWriter) (providers.next()))
-                    .isFileTypeSupported(fileType)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public static AudioFileFormat.Type[] getAudioFileTypes(
-            AudioInputStream stream) {
-        List<AudioFileFormat.Type> result = new ArrayList<AudioFileFormat.Type>();
-        for (Iterator providers = ProviderService.getProviders(
-                audioFileWriterPath).iterator(); providers.hasNext();) {
-            try {
-                AudioFileFormat.Type[] types = ((AudioFileWriter) (providers
-                        .next())).getAudioFileTypes(stream);
-                for (AudioFileFormat.Type type : types) {
-                    result.add(type);
-                }
-            } catch (ClassCastException e) {}
-        }
-        AudioFileFormat.Type[] temp = new AudioFileFormat.Type[result.size()];
-        return result.toArray(temp);
-    }
-
-    public static boolean isFileTypeSupported(AudioFileFormat.Type fileType,
-            AudioInputStream stream) {
-
-        for (Iterator providers = ProviderService.getProviders(
-                audioFileWriterPath).iterator(); providers.hasNext();) {
-            if (((AudioFileWriter) (providers.next())).isFileTypeSupported(
-                    fileType, stream)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public static int write(AudioInputStream stream,
-            AudioFileFormat.Type fileType, OutputStream out) throws IOException {
-        AudioFileWriter writer;
-        for (Iterator providers = ProviderService.getProviders(
-                audioFileWriterPath).iterator(); providers.hasNext();) {
-            writer = (AudioFileWriter) (providers.next());
-            if (writer.isFileTypeSupported(fileType, stream)) {
-                return writer.write(stream, fileType, out);
-            }
-        }
-        // sound.18=Type is not supported
-        throw new IllegalArgumentException(Messages.getString("sound.18")); //$NON-NLS-1$
-    }
-
-    public static int write(AudioInputStream stream,
-            AudioFileFormat.Type fileType, File out) throws IOException {
-        AudioFileWriter writer;
-        for (Iterator providers = ProviderService.getProviders(
-                audioFileWriterPath).iterator(); providers.hasNext();) {
-            writer = (AudioFileWriter) (providers.next());
-            if (writer.isFileTypeSupported(fileType, stream)) {
-                return writer.write(stream, fileType, out);
-            }
-        }
-        // sound.18=Type is not supported
-        throw new IllegalArgumentException(Messages.getString("sound.18")); //$NON-NLS-1$
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/BooleanControl.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/BooleanControl.java
deleted file mode 100644
index 5ab87fb..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/BooleanControl.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-public abstract class BooleanControl extends Control {
-
-    public static class Type extends Control.Type {
-        public static final Type APPLY_REVERB = new Type("Apply Reverb"); //$NON-NLS-1$
-
-        public static final Type MUTE = new Type("Mute"); //$NON-NLS-1$
-
-        protected Type(String name) {
-            super(name);
-        }
-    }
-
-    private boolean value;
-
-    private String trueStateLabel;
-
-    private String falseStateLabel;
-
-    protected BooleanControl(BooleanControl.Type type, boolean initialValue,
-            String trueStateLabel, String falseStateLabel) {
-        super(type);
-        this.value = initialValue;
-        this.trueStateLabel = trueStateLabel;
-        this.falseStateLabel = falseStateLabel;
-    }
-
-    protected BooleanControl(BooleanControl.Type type, boolean initialValue) {
-        this(type, initialValue, "true", "false"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void setValue(boolean value) {
-        this.value = value;
-    }
-
-    public boolean getValue() {
-        return this.value;
-    }
-
-    public String getStateLabel(boolean state) {
-        if (state) {
-            return this.trueStateLabel;
-        } else {
-            return this.falseStateLabel;
-        }
-    }
-
-    public String toString() {
-        return getType() + " Control with current value: " + getStateLabel(value); //$NON-NLS-1$
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/Clip.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/Clip.java
deleted file mode 100644
index 0e65b59..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/Clip.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-import java.io.IOException;
-
-public interface Clip extends DataLine {
-    static final int LOOP_CONTINUOUSLY = -1;
-
-    int getFrameLength();
-
-    long getMicrosecondLength();
-
-    void loop(int count);
-
-    void open(AudioFormat format, byte[] data, int offset, int bufferSize)
-            throws LineUnavailableException;
-
-    void open(AudioInputStream stream) throws LineUnavailableException,
-            IOException;
-
-    void setFramePosition(int frames);
-
-    void setLoopPoints(int start, int end);
-
-    void setMicrosecondPosition(long microseconds);
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/CompoundControl.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/CompoundControl.java
deleted file mode 100644
index 5862761..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/CompoundControl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-public abstract class CompoundControl extends Control {
-    public static class Type extends Control.Type {
-        protected Type(String name) {
-            super(name);
-        }
-    }
-
-    private Control[] memberControls;
-
-    protected CompoundControl(CompoundControl.Type type,
-            Control[] memberControls) {
-        super(type);
-        this.memberControls = memberControls;
-    }
-
-    public Control[] getMemberControls() {
-        return this.memberControls;
-    }
-
-    public String toString() {
-        return getType() + "CompoundControl containing "  //$NON-NLS-1$
-            + String.valueOf(memberControls) + " Controls."; //$NON-NLS-1$
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/Control.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/Control.java
deleted file mode 100644
index b6128e8..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/Control.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-public abstract class Control {
-
-    public static class Type {
-
-        private String name;
-
-        public Type(String name) {
-            this.name = name;
-        }
-
-        @Override
-        public boolean equals(Object another) {
-            if (this == another) {
-                return true;
-            }
-
-            if (another == null || !(another instanceof Type)) {
-                return false;
-            }
-
-            Type obj = (Type) another;
-            return name == null ? obj.name == null : name.equals(obj.name);
-        }
-
-        @Override
-        public final int hashCode() {
-            return name == null ? 0 : name.hashCode();
-        }
-
-        @Override
-        public final String toString() {
-            return name;
-        }
-    }
-
-    private Type type;
-
-    protected Control(Type type) {
-        this.type = type;
-    }
-
-    public Type getType() {
-        return type;
-    }
-
-    public String toString() {
-        return type + " Control"; //$NON-NLS-1$
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/DataLine.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/DataLine.java
deleted file mode 100644
index e37ea3f..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/DataLine.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-public interface DataLine extends Line {
-
-    class Info extends Line.Info {
-        private AudioFormat[] formats;
-        private int minBufferSize;
-        private int maxBufferSize;
-        
-        public Info(Class <?> lineClass, AudioFormat format) {
-            super(lineClass);
-
-            this.formats = new AudioFormat[] { format };
-            this.minBufferSize = AudioSystem.NOT_SPECIFIED;
-            this.maxBufferSize = AudioSystem.NOT_SPECIFIED;
-        }
-
-        public Info(Class <?> lineClass, AudioFormat[] formats, int minBufferSize, int maxBufferSize) {
-            super(lineClass);
-
-            this.formats = formats;
-            this.minBufferSize = minBufferSize;
-            this.maxBufferSize = maxBufferSize;
-        }
-
-        public Info(Class <?> lineClass, AudioFormat format, int bufferSize) {
-            super(lineClass);
-
-            this.formats = new AudioFormat[] { format };
-            this.minBufferSize = bufferSize;
-            this.maxBufferSize = bufferSize;
-        }
-
-        public AudioFormat[] getFormats(){
-            return formats;
-        }
-        
-        public boolean isFormatSupported(AudioFormat format) {
-            if (formats == null) {
-                return false;
-            }
-            for (AudioFormat supported : formats) {
-                if (format.matches(supported)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        public int getMinBufferSize() {
-            return minBufferSize;
-        }
-
-        public int getMaxBufferSize() {
-            return maxBufferSize;
-        }
-
-        @Override
-        public boolean matches(Line.Info info) {
-            
-            if (!super.matches(info)) {
-                return false;
-            }
-            
-            DataLine.Info inf = (DataLine.Info)info;
-            if ((minBufferSize != AudioSystem.NOT_SPECIFIED
-                    && inf.getMinBufferSize() != AudioSystem.NOT_SPECIFIED 
-                    && minBufferSize < inf.getMinBufferSize())
-                    || (maxBufferSize != AudioSystem.NOT_SPECIFIED
-                            && inf.getMaxBufferSize() != AudioSystem.NOT_SPECIFIED
-                            && maxBufferSize > inf.getMaxBufferSize())) {
-                return false;
-            }
-            
-            for (AudioFormat supported : formats) {
-                if (!inf.isFormatSupported(supported)) {
-                    return false;
-                }
-            }
-
-            return true;
-        }
-        
-        @Override
-        public String toString() {
-            String formatStr = (formats.length == 1? "format " + formats[0].toString() //$NON-NLS-1$
-                    : formats.length + " audio formats"); //$NON-NLS-1$
-            String bufStr = ""; //$NON-NLS-1$
-            if (minBufferSize != AudioSystem.NOT_SPECIFIED) {
-                bufStr = "and buffers of " + minBufferSize + //$NON-NLS-1$
-                    " to " + maxBufferSize + " bytes"; //$NON-NLS-1$ //$NON-NLS-2$
-            }
-            return getLineClass() + " supporting " + formatStr + ", " + bufStr; //$NON-NLS-1$
-        }
-    }
-
-    int available();
-
-    void drain();
-
-    void flush();
-    
-    int getBufferSize();
-    
-    AudioFormat getFormat();
-    
-    int getFramePosition();
-    
-    float getLevel();
-    
-    long getLongFramePosition();
-    
-    long getMicrosecondPosition();
-    
-    boolean isActive();
-    
-    boolean isRunning();
-    
-    void start();
-    
-    void stop();
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/EnumControl.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/EnumControl.java
deleted file mode 100644
index a21a4cc..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/EnumControl.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-import org.apache.harmony.sound.internal.nls.Messages;
-
-public abstract class EnumControl extends Control {
-    public static class Type extends Control.Type {
-        public static final Type REVERB = new Type("Reverb"); //$NON-NLS-1$
-
-        protected Type(String name) {
-            super(name);
-        }
-    }
-
-    private Object[] values;
-
-    private Object value;
-
-    protected EnumControl(EnumControl.Type type, Object[] values, Object value) {
-        super(type);
-        this.value = value;
-        this.values = values;
-    }
-
-    public void setValue(Object value) {
-        for (Object val : values) {
-            if (val.equals(value)) {
-                this.value = value;
-                return;
-            }
-        }
-        // sound.0D=The value is not supported
-        throw new IllegalArgumentException(Messages.getString("sound.0D")); //$NON-NLS-1$
-    }
-
-    public Object getValue() {
-        return value;
-    }
-
-    public Object[] getValues() {
-        return values;
-    }
-
-    public String toString() {
-        return getType() + " with current value: " + value; //$NON-NLS-1$
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/FloatControl.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/FloatControl.java
deleted file mode 100644
index 6bf92be..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/FloatControl.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-import org.apache.harmony.sound.internal.nls.Messages;
-
-public abstract class FloatControl extends Control {
-
-    public static class Type extends Control.Type {
-        public static final Type MASTER_GAIN = new Type("Master Gain"); //$NON-NLS-1$
-
-        public static final Type AUX_SEND = new Type("AUX Send"); //$NON-NLS-1$
-
-        public static final Type AUX_RETURN = new Type("AUX Return"); //$NON-NLS-1$
-
-        public static final Type REVERB_SEND = new Type("Reverb Send"); //$NON-NLS-1$
-
-        public static final Type REVERB_RETURN = new Type("Reverb Return"); //$NON-NLS-1$
-
-        public static final Type VOLUME = new Type("Volume"); //$NON-NLS-1$
-
-        public static final Type PAN = new Type("Pan"); //$NON-NLS-1$
-
-        public static final Type BALANCE = new Type("Balance"); //$NON-NLS-1$
-
-        public static final Type SAMPLE_RATE = new Type("Sample Rate"); //$NON-NLS-1$
-
-        protected Type(String name) {
-            super(name);
-        }
-    }
-
-    private float value;
-
-    private float maximum;
-
-    private float minimum;
-
-    private String units;
-
-    private String minLabel;
-
-    private String midLabel;
-
-    private String maxLabel;
-
-    private float precision;
-
-    private int updatePeriod;
-
-    protected FloatControl(FloatControl.Type type, float minimum,
-            float maximum, float precision, int updatePeriod,
-            float initialValue, String units, String minLabel, String midLabel,
-            String maxLabel) {
-        super(type);
-        this.maximum = maximum;
-        this.maxLabel = maxLabel;
-        this.midLabel = midLabel;
-        this.minLabel = minLabel;
-        this.minimum = minimum;
-        this.precision = precision;
-        this.units = units;
-        this.updatePeriod = updatePeriod;
-        this.value = initialValue;
-    }
-
-    protected FloatControl(FloatControl.Type type, float minimum,
-            float maximum, float precision, int updatePeriod,
-            float initialValue, String units) {
-        this(type, minimum, maximum, precision, updatePeriod, initialValue,
-                units, "", "", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void setValue(float newValue) {
-        if (newValue > maximum || newValue < minimum) {
-            // sound.0F=value does not fall within the allowable range
-            throw new IllegalArgumentException(Messages.getString("sound.0F")); //$NON-NLS-1$
-        }
-        this.value = newValue;
-    }
-
-    public float getValue() {
-        return this.value;
-    }
-
-    public float getMaximum() {
-        return this.maximum;
-    }
-
-    public float getMinimum() {
-        return this.minimum;
-    }
-
-    public String getUnits() {
-        return this.units;
-    }
-
-    public String getMinLabel() {
-        return this.minLabel;
-    }
-
-    public String getMidLabel() {
-        return this.midLabel;
-    }
-
-    public String getMaxLabel() {
-        return this.maxLabel;
-    }
-
-    public float getPrecision() {
-        return this.precision;
-    }
-
-    public int getUpdatePeriod() {
-        return this.updatePeriod;
-    }
-
-    public void shift(float from, float to, int microseconds) {
-        setValue(to);
-    }
-
-    public String toString() {
-        return getType() + " with current value: "+ value + " " + units  //$NON-NLS-1$ //$NON-NLS-2$
-            + " (range: " + minimum + " - " + maximum + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/Line.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/Line.java
deleted file mode 100644
index decc68d..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/Line.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-public interface Line {
-
-    class Info {
-        private Class <?> lineClass;
-        
-        public Info(Class <?> lineClass) {
-            this.lineClass = lineClass;
-        }
-
-        public Class <?> getLineClass( ){
-            return lineClass;
-        }
-
-        public boolean matches(Line.Info info) {
-            return lineClass.isAssignableFrom(info.getLineClass());
-        }
-        
-        @Override
-        public String toString() {
-            return lineClass.toString();
-        }
-    }
-
-    void addLineListener(LineListener listener);
-
-    void close();
-
-    Control getControl(Control.Type control);
-
-    Control[] getControls();
-
-    Line.Info getLineInfo();
-
-    boolean isControlSupported(Control.Type control);
-
-    boolean isOpen();
-
-    void open() throws LineUnavailableException;
-
-    void removeLineListener(LineListener listener);
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/LineEvent.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/LineEvent.java
deleted file mode 100644
index 95a480a..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/LineEvent.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-import java.util.EventObject;
-
-public class LineEvent extends EventObject {
-
-    /**
-     * 
-     */
-    private static final long serialVersionUID = -1274246333383880410L;
-    
-    private LineEvent.Type type;
-    private long position;
-
-    public static class Type {
-
-        public static final Type CLOSE = new Type("Close"); //$NON-NLS-1$
-
-        public static final Type OPEN = new Type("Open"); //$NON-NLS-1$
-
-        public static final Type START = new Type("Start"); //$NON-NLS-1$
-
-        public static final Type STOP = new Type("Stop"); //$NON-NLS-1$
-
-        private String name;
-
-        public Type(String name) {
-            this.name = name;
-        }
-
-        @Override
-        public boolean equals(Object another) {
-            if (this == another) {
-                return true;
-            }
-
-            if (another == null || !(another instanceof Type)) {
-                return false;
-            }
-
-            Type obj = (Type) another;
-            return name == null ? obj.name == null : name.equals(obj.name);
-        }
-
-        @Override
-        public final int hashCode() {
-            return name == null ? 0 : name.hashCode();
-        }
-
-        @Override
-        public String toString() {
-            return name;
-        }
-    }
-
-    public LineEvent(Line line, LineEvent.Type type, long position) {
-        super(line);
-        this.type = type;
-        this.position = position;
-    }
-    
-    public final Line getLine() {
-        return (Line)getSource();
-    }
-    
-    public final LineEvent.Type getType() {
-        return type;
-    }
-    
-    public final long getFramePosition() {
-        return position;
-    }
-    
-    public String toString() {
-        return type + " event from line " + getLine(); //$NON-NLS-1$
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/LineListener.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/LineListener.java
deleted file mode 100644
index a3a828f..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/LineListener.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-import java.util.EventListener;
-
-public interface LineListener extends EventListener {
-    void update(LineEvent event);
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/LineUnavailableException.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/LineUnavailableException.java
deleted file mode 100644
index 5a687ed..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/LineUnavailableException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-public class LineUnavailableException extends Exception {
-    private static final long serialVersionUID = -2046718279487432130L;
-
-    public LineUnavailableException() {
-        super();
-    }
-
-    public LineUnavailableException(String message) {
-        super(message);
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/Mixer.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/Mixer.java
deleted file mode 100644
index f9fefda..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/Mixer.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-public interface Mixer extends Line {
-
-    public static class Info {
-        private String name;
-        private String vendor;
-        private String description;
-        private String version;        
-        
-        protected Info(String name, String vendor, String description, String version) {
-            this.name = name;
-            this.vendor = vendor;
-            this.description = description;
-            this.version = version;
-        }
-        
-        @Override
-        public final boolean equals(Object another) {
-            return this == another;
-        }
-        
-        public final String getDescription() {
-            return description;
-        }
-        
-        public final String getName() {
-            return name;
-        }
-        
-        public final String getVendor() {
-            return vendor;
-        }
-        
-        public final String getVersion() {
-            return version;
-        }
-        
-        @Override
-        public final int hashCode() {
-            return name.hashCode() + vendor.hashCode() + description.hashCode() + version.hashCode();
-        }
-        
-        @Override
-        public final String toString() {
-            return name + ", version " + version; //$NON-NLS-1$
-        }
-    }
-
-    Line getLine(Line.Info info) throws LineUnavailableException;
-    
-    int getMaxLines(Line.Info info);
-    
-    Mixer.Info getMixerInfo();
-    
-    Line.Info[] getSourceLineInfo();
-    
-    Line.Info[] getSourceLineInfo(Line.Info info);
-    
-    Line[] getSourceLines();
-    
-    Line.Info[] getTargetLineInfo();
-    
-    Line.Info[] getTargetLineInfo(Line.Info info);
-    
-    Line[] getTargetLines();
-    
-    boolean isLineSupported(Line.Info info);
-    
-    boolean isSynchronizationSupported(Line[] lines, boolean maintainSync);
-    
-    void synchronize(Line[] lines, boolean maintainSync);
-
-    void unsynchronize(Line[] lines);
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/Port.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/Port.java
deleted file mode 100644
index 68d0638..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/Port.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-public interface Port extends Line {
-
-    public static class Info extends Line.Info {
-
-        private String name;
-
-        private boolean isSource;
-
-        public static final Info MICROPHONE = new Info(Port.class,
-                "MICROPHONE", true); //$NON-NLS-1$
-
-        public static final Info LINE_IN = new Info(Port.class, "LINE_IN", true); //$NON-NLS-1$
-
-        public static final Info COMPACT_DISC = new Info(Port.class,
-                "COMPACT_DISC", true); //$NON-NLS-1$
-
-        public static final Info SPEAKER = new Info(Port.class, "SPEAKER", //$NON-NLS-1$
-                false);
-
-        public static final Info HEADPHONE = new Info(Port.class, "HEADPHONES", //$NON-NLS-1$
-                false);
-
-        public static final Info LINE_OUT = new Info(Port.class, "LINE_OUT", //$NON-NLS-1$
-                false);
-
-        public Info(Class<?> lineClass, String name, boolean isSource) {
-            super(lineClass);
-            this.name = name;
-            this.isSource = isSource;
-        }
-
-        public String getName() {
-            return this.name;
-        }
-
-        public boolean isSource() {
-            return this.isSource;
-        }
-
-        public boolean matches(Line.Info info) {
-            if (super.matches(info) && Port.Info.class.equals(info.getClass())
-                    && name.equals(((Port.Info) info).getName())
-                    && isSource == ((Port.Info) info).isSource()) {
-                return true;
-            }
-            return false;
-        }
-
-        public final boolean equals(Object obj) {
-            return this == obj;
-        }
-
-        public final int hashCode() {
-            return name.hashCode() ^ getLineClass().hashCode();
-        }
-
-        public final String toString() {
-            return name + (isSource ? " source port" : " target port"); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/ReverbType.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/ReverbType.java
deleted file mode 100644
index 9645ba6..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/ReverbType.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-public class ReverbType {
-
-    protected ReverbType(String name, int earlyReflectionDelay,
-            float earlyReflectionIntensity, int lateReflectionDelay,
-            float lateReflectionIntensity, int decayTime) {
-        this.name = name;
-        this.earlyReflectionDelay = earlyReflectionDelay;
-        this.earlyReflectionIntensity = earlyReflectionIntensity;
-        this.lateReflectionDelay = lateReflectionDelay;
-        this.lateReflectionIntensity = lateReflectionIntensity;
-        this.decayTime = decayTime;
-    }
-
-    private String name;
-
-    private int earlyReflectionDelay;
-
-    private float earlyReflectionIntensity;
-
-    private int lateReflectionDelay;
-
-    private float lateReflectionIntensity;
-
-    private int decayTime;
-
-    public String getName() {
-        return this.name;
-    }
-
-    public final int getEarlyReflectionDelay() {
-        return this.earlyReflectionDelay;
-    }
-
-    public final float getEarlyReflectionIntensity() {
-        return this.earlyReflectionIntensity;
-    }
-
-    public final int getLateReflectionDelay() {
-        return this.lateReflectionDelay;
-    }
-
-    public final float getLateReflectionIntensity() {
-        return this.lateReflectionIntensity;
-    }
-
-    public final int getDecayTime() {
-        return this.decayTime;
-    }
-
-    public final boolean equals(Object obj) {
-        return this == obj;
-    }
-
-    public final int hashCode() {
-        return toString().hashCode();
-    }
-
-    public final String toString() {
-        return name + ", early reflection delay " + earlyReflectionDelay //$NON-NLS-1$
-                + " ns, early reflection intensity " + earlyReflectionIntensity //$NON-NLS-1$
-                + " dB, late deflection delay " + lateReflectionDelay //$NON-NLS-1$
-                + " ns, late reflection intensity " + lateReflectionIntensity //$NON-NLS-1$
-                + " dB, decay time " + decayTime; //$NON-NLS-1$
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/SourceDataLine.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/SourceDataLine.java
deleted file mode 100644
index 4d68221..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/SourceDataLine.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-public interface SourceDataLine extends DataLine {
-    
-    void open(AudioFormat format) throws LineUnavailableException;
-
-    void open(AudioFormat format, int bufferSize)
-            throws LineUnavailableException;
-
-    int write(byte[] b, int off, int len);
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/TargetDataLine.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/TargetDataLine.java
deleted file mode 100644
index f4c37c8..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/TargetDataLine.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-public interface TargetDataLine extends DataLine {
-
-    void open(AudioFormat format) throws LineUnavailableException;
-
-    void open(AudioFormat format, int bufferSize)
-            throws LineUnavailableException;
-
-    int read(byte[] b, int off, int len);
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/UnsupportedAudioFileException.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/UnsupportedAudioFileException.java
deleted file mode 100644
index 590266f..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/UnsupportedAudioFileException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled;
-
-public class UnsupportedAudioFileException extends Exception {
-    private static final long serialVersionUID = -139127412623160368L;
-
-    public UnsupportedAudioFileException() {
-        super();
-    }
-
-    public UnsupportedAudioFileException(String message) {
-        super(message);
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/spi/AudioFileReader.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/spi/AudioFileReader.java
deleted file mode 100644
index 5c01df5..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/spi/AudioFileReader.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled.spi;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.sound.sampled.AudioFileFormat;
-import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.UnsupportedAudioFileException;
-
-public abstract class AudioFileReader {
-
-    public abstract AudioFileFormat getAudioFileFormat(File file)
-            throws UnsupportedAudioFileException, IOException;
-
-    public abstract AudioFileFormat getAudioFileFormat(InputStream stream)
-            throws UnsupportedAudioFileException, IOException;
-
-    public abstract AudioFileFormat getAudioFileFormat(URL url)
-            throws UnsupportedAudioFileException, IOException;
-
-    public abstract AudioInputStream getAudioInputStream(File file)
-            throws UnsupportedAudioFileException, IOException;
-
-    public abstract AudioInputStream getAudioInputStream(InputStream stream)
-            throws UnsupportedAudioFileException, IOException;
-
-    public abstract AudioInputStream getAudioInputStream(URL url)
-            throws UnsupportedAudioFileException, IOException;
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/spi/AudioFileWriter.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/spi/AudioFileWriter.java
deleted file mode 100644
index 0bae3f3..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/spi/AudioFileWriter.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled.spi;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.AudioFileFormat;
-import javax.sound.sampled.AudioFileFormat.Type;
-
-public abstract class AudioFileWriter {
-
-    public abstract AudioFileFormat.Type[] getAudioFileTypes();
-
-    public abstract AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream);
-
-    public boolean isFileTypeSupported(AudioFileFormat.Type fileType) {
-        AudioFileFormat.Type[] supported = getAudioFileTypes();
-        for (Type element : supported) {
-            if (fileType.equals(element)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public boolean isFileTypeSupported(AudioFileFormat.Type fileType, AudioInputStream stream) {
-        AudioFileFormat.Type[] supported = getAudioFileTypes(stream);
-        for (Type element : supported) {
-            if (fileType.equals(element)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public abstract int write(AudioInputStream stream,
-            AudioFileFormat.Type fileType, File out) throws IOException;
-
-    public abstract int write(AudioInputStream stream,
-            AudioFileFormat.Type fileType, OutputStream out) throws IOException;
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/spi/FormatConversionProvider.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/spi/FormatConversionProvider.java
deleted file mode 100644
index ed0d69f..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/spi/FormatConversionProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled.spi;
-
-import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.AudioFormat.Encoding;
-
-public abstract class FormatConversionProvider {
-
-    public abstract AudioInputStream getAudioInputStream(
-            AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream);
-
-    public abstract AudioInputStream getAudioInputStream(
-            AudioFormat targetFormat, AudioInputStream sourceStream);
-
-    public abstract AudioFormat.Encoding[] getTargetEncodings(
-            AudioFormat sourceFormat);
-
-    public boolean isConversionSupported(AudioFormat.Encoding targetEncoding,
-            AudioFormat sourceFormat) {
-        AudioFormat.Encoding[] encodings = getTargetEncodings(sourceFormat);
-        for (Encoding element : encodings) {
-            if (targetEncoding.equals(element)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public abstract AudioFormat[] getTargetFormats(
-            AudioFormat.Encoding targetFormat, AudioFormat sourceFormat);
-
-    public boolean isConversionSupported(AudioFormat targetFormat,
-            AudioFormat sourceFormat) {
-        AudioFormat[] formats = getTargetFormats(targetFormat.getEncoding(),
-                sourceFormat);
-        for (AudioFormat element : formats) {
-            if (targetFormat.equals(element)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public abstract AudioFormat.Encoding[] getSourceEncodings();
-
-    public boolean isSourceEncodingSupported(AudioFormat.Encoding sourceEncoding) {
-        AudioFormat.Encoding[] encodings = getSourceEncodings();
-        for (Encoding element : encodings) {
-            if (sourceEncoding.equals(element)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public abstract AudioFormat.Encoding[] getTargetEncodings();
-
-    public boolean isTargetEncodingSupported(AudioFormat.Encoding targetEncoding) {
-        AudioFormat.Encoding[] encodings = getTargetEncodings();
-        for (Encoding element : encodings) {
-            if (targetEncoding.equals(element)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-}
diff --git a/libcore-disabled/sound/src/main/java/javax/sound/sampled/spi/MixerProvider.java b/libcore-disabled/sound/src/main/java/javax/sound/sampled/spi/MixerProvider.java
deleted file mode 100644
index 86fdbb7..0000000
--- a/libcore-disabled/sound/src/main/java/javax/sound/sampled/spi/MixerProvider.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package javax.sound.sampled.spi;
-
-import javax.sound.sampled.Mixer;
-import javax.sound.sampled.Mixer.Info;
-
-public abstract class MixerProvider {
-
-    public abstract Mixer getMixer(Mixer.Info info);
-
-    public abstract Mixer.Info[] getMixerInfo();
-
-    public boolean isMixerSupported(Mixer.Info info) {
-        Mixer.Info[] devices = getMixerInfo();
-        for (Info element : devices) {
-            if (info.equals(element)) {
-                return true;
-            }
-        }
-        return false;
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/org/apache/harmony/sound/internal/nls/Messages.java b/libcore-disabled/sound/src/main/java/org/apache/harmony/sound/internal/nls/Messages.java
deleted file mode 100644
index 65ecb83..0000000
--- a/libcore-disabled/sound/src/main/java/org/apache/harmony/sound/internal/nls/Messages.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * THE FILE HAS BEEN AUTOGENERATED BY MSGTOOL TOOL.
- * All changes made to this file manually will be overwritten 
- * if this tool runs again. Better make changes in the template file.
- */
-
-package org.apache.harmony.sound.internal.nls;
-
-import org.apache.harmony.luni.util.MsgHelp;
-
-/**
- * This class retrieves strings from a resource bundle and returns them,
- * formatting them with MessageFormat when required.
- * <p>
- * It is used by the system classes to provide national language support, by
- * looking up messages in the <code>
- *    org.apache.harmony.sound.internal.nls.messages
- * </code>
- * resource bundle. Note that if this file is not available, or an invalid key
- * is looked up, or resource bundle support is not available, the key itself
- * will be returned as the associated message. This means that the <em>KEY</em>
- * should a reasonable human-readable (english) string.
- * 
- */
-public class Messages {
-
-    private static final String sResource =
-        "org.apache.harmony.sound.internal.nls.messages"; //$NON-NLS-1$
-
-    /**
-     * Retrieves a message which has no arguments.
-     * 
-     * @param msg
-     *            String the key to look up.
-     * @return String the message for that key in the system message bundle.
-     */
-    static public String getString(String msg) {
-        return MsgHelp.getString(sResource, msg);
-    }
-
-    /**
-     * Retrieves a message which takes 1 argument.
-     * 
-     * @param msg
-     *            String the key to look up.
-     * @param arg
-     *            Object the object to insert in the formatted output.
-     * @return String the message for that key in the system message bundle.
-     */
-    static public String getString(String msg, Object arg) {
-        return getString(msg, new Object[] { arg });
-    }
-
-    /**
-     * Retrieves a message which takes 1 integer argument.
-     * 
-     * @param msg
-     *            String the key to look up.
-     * @param arg
-     *            int the integer to insert in the formatted output.
-     * @return String the message for that key in the system message bundle.
-     */
-    static public String getString(String msg, int arg) {
-        return getString(msg, new Object[] { Integer.toString(arg) });
-    }
-
-    /**
-     * Retrieves a message which takes 1 character argument.
-     * 
-     * @param msg
-     *            String the key to look up.
-     * @param arg
-     *            char the character to insert in the formatted output.
-     * @return String the message for that key in the system message bundle.
-     */
-    static public String getString(String msg, char arg) {
-        return getString(msg, new Object[] { String.valueOf(arg) });
-    }
-
-    /**
-     * Retrieves a message which takes 2 arguments.
-     * 
-     * @param msg
-     *            String the key to look up.
-     * @param arg1
-     *            Object an object to insert in the formatted output.
-     * @param arg2
-     *            Object another object to insert in the formatted output.
-     * @return String the message for that key in the system message bundle.
-     */
-    static public String getString(String msg, Object arg1, Object arg2) {
-        return getString(msg, new Object[] { arg1, arg2 });
-    }
-
-    /**
-     * Retrieves a message which takes several arguments.
-     * 
-     * @param msg
-     *            String the key to look up.
-     * @param args
-     *            Object[] the objects to insert in the formatted output.
-     * @return String the message for that key in the system message bundle.
-     */
-    static public String getString(String msg, Object[] args) {
-        return MsgHelp.getString(sResource, msg, args);
-    }
-}
diff --git a/libcore-disabled/sound/src/main/java/org/apache/harmony/sound/internal/nls/messages.properties b/libcore-disabled/sound/src/main/java/org/apache/harmony/sound/internal/nls/messages.properties
deleted file mode 100644
index efcf80b..0000000
--- a/libcore-disabled/sound/src/main/java/org/apache/harmony/sound/internal/nls/messages.properties
+++ /dev/null
@@ -1,39 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#  
-#      http://www.apache.org/licenses/LICENSE-2.0
-#  
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-# 
-
-# messages for EN locale
-sound.01=-1
-sound.02=Index: {0}, Size: {1}
-sound.03=length out of bounds: {0}
-sound.04=Invalid status byte: {0}
-sound.05=command out of range: {0}
-sound.06=channel out of range: {0}
-sound.07=data1 out of range: {0}
-sound.08=data2 out of range: {0}
-sound.09=Invalid status byte for sysex message: {0}
-sound.0A=Invalid meta event with type {0}
-sound.0B=Unsupported division type: {0}
-sound.0C=Frame size must be one byte
-sound.0D=The value is not supported
-sound.0F=value does not fall within the allowable range
-sound.11=Could not get line
-sound.12=Could not get audio input stream from source stream
-sound.13=Could not get audio input stream from source stream
-sound.14=File is not a supported file type
-sound.15=Could not get audio input stream from input stream
-sound.16=Could not get audio input stream from input URL
-sound.17=Could not get audio input stream from input file
-sound.18=Type is not supported
diff --git a/libcore-disabled/sound/src/main/java/org/apache/harmony/sound/utils/ProviderService.java b/libcore-disabled/sound/src/main/java/org/apache/harmony/sound/utils/ProviderService.java
deleted file mode 100644
index b1bbe2e..0000000
--- a/libcore-disabled/sound/src/main/java/org/apache/harmony/sound/utils/ProviderService.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.harmony.sound.utils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Properties;
-
-public class ProviderService {
-
-    // Properties from sound.propertie file
-    private static Properties devices;
-
-    static {
-        devices = new Properties();
-
-        FileInputStream fstream = AccessController
-                .doPrivileged(new PrivilegedAction<FileInputStream>() {
-
-                    public FileInputStream run() {
-                        // obtain the path to the file sound.properties
-                        String soundPropertiesPath = System
-                                .getProperty("java.home") //$NON-NLS-1$
-                                + File.separator + "lib" + File.separator //$NON-NLS-1$
-                                + "sound.properties"; //$NON-NLS-1$
-                        try {
-                            return new FileInputStream(soundPropertiesPath);
-                        } catch (FileNotFoundException e) {
-                            return null;
-                        }
-                    }
-                });
-
-        if (fstream != null) {
-            // reading file sound.properties
-            try {
-                devices.load(fstream);
-            } catch (IOException e) {}
-        }
-    }
-
-    /**
-     * this method return information about default device
-     * 
-     * @param deviceName
-     * @return
-     */
-    public static List<String> getDefaultDeviceDescription(String deviceName) {
-
-        // variable that contain information about default device
-        List<String> defaultDevice = new ArrayList<String>();
-        String str;
-        int index;
-
-        /*
-         * obtain the default device that describes by deviceName
-         */
-        str = devices.getProperty(deviceName);
-        /*
-         * if default device doesn't define, than return empty defaultDevice
-         */
-        if (str == null) {
-            return defaultDevice;
-        }
-        /*
-         * the separator between provider and name is '#'; find separator of
-         * provider and name of device in the notation of default device
-         */
-        index = str.indexOf("#"); //$NON-NLS-1$
-        /*
-         * if separator doesn't find, so in the definition of default device
-         * contain only name of provider, and so we add it
-         */
-        if (index == -1) {
-            defaultDevice.add(str);
-            defaultDevice.add(null);
-            /*
-             * if separator is the first symbol, so definition contain only name
-             * of device
-             */
-        } else if (index == 0) {
-            defaultDevice.add(null);
-            defaultDevice.add(str.substring(index + 1));
-            /*
-             * if separator is not the first, so we find provider and name of
-             * device
-             */
-        } else {
-            defaultDevice.add(str.substring(0, index));
-            defaultDevice.add(str.substring(index + 1));
-        }
-        return defaultDevice;
-    }
-
-    /**
-     * this method return the list of providers
-     * 
-     * @param providerName
-     * @return
-     */
-    public static List<?> getProviders(String providerName) {
-        final String name = providerName;
-
-        return AccessController
-                .doPrivileged(new PrivilegedAction<List<Object>>() {
-
-                    public List<Object> run() {
-                        List<Object> providers = new ArrayList<Object>();
-                        String className = null;
-                        byte[] bytes;
-
-                        ClassLoader cl = ClassLoader.getSystemClassLoader();
-                        Enumeration<URL> urls = null;
-                        try {
-                            urls = cl.getResources(name);
-                        } catch (IOException e) {
-                            return providers;
-                        }
-                        for (; urls.hasMoreElements();) {
-                            try {
-                                InputStream in = urls.nextElement()
-                                        .openStream();
-                                bytes = new byte[in.available()];
-                                in.read(bytes);
-                                in.close();
-                            } catch (IOException e) {
-                                continue;
-                            }
-                            String[] astr = new String(bytes).split("\r\n"); //$NON-NLS-1$
-                            for (String str : astr) {
-                                className = str.trim();
-                                if (!className.startsWith("#")) { // skip
-                                                                    // comments
-                                                                    // //$NON-NLS-1$
-                                    try {
-                                        providers.add(Class.forName(
-                                                className.trim(), true, cl)
-                                                .newInstance());
-                                    } catch (IllegalAccessException e) {} catch (InstantiationException e) {} catch (ClassNotFoundException e) {}
-                                }
-                            }
-                        }
-                        return providers;
-                    }
-                });
-
-    }
-
-    public static Properties getSoundProperties() {
-        return devices;
-    }
-
-}
diff --git a/libcore-disabled/sound/src/test/java/android/core/SoundTest.java b/libcore-disabled/sound/src/test/java/android/core/SoundTest.java
deleted file mode 100644
index 22a9261..0000000
--- a/libcore-disabled/sound/src/test/java/android/core/SoundTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import android.media.MediaPlayer;
-
-import com.android.internal.sound.midi.AndroidSequencer;
-import com.android.internal.sound.sampled.AndroidClip;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import java.io.File;
-
-import javax.sound.midi.MidiDevice;
-import javax.sound.midi.MidiSystem;
-import javax.sound.midi.Sequence;
-import javax.sound.midi.Sequencer;
-import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.Clip;
-import javax.sound.sampled.Line;
-
-public class SoundTest extends TestCase {
-
-  public static String TAG = "SoundTest";
-
-    // Regression test for #000000: Completion of MIDI file doesn't fire
-    // corresponding event.
-//    private boolean eventReceived = false;
-//  
-//    public void testMidiFileCompletion() {
-//        try {
-//            MediaPlayer player = new MediaPlayer();
-//            
-//            player.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
-//                public void onCompletion(MediaPlayer player) {
-//                    eventReceived = true;
-//                }
-//            });
-//
-//            player.setDataSource("/system/sounds/test.mid");
-//            player.prepare();
-//            player.start();
-//            Thread.sleep(20000);
-//            assertFalse("Player must be stopped", player.isPlaying());
-//            assertTrue("Completion event must have been received", eventReceived);
-//
-//        } catch (Exception ex) {
-//            throw new RuntimeException(ex);
-//        }
-//    }
-  
-    // Regression test for #872614: General javax.sound weirdness.
-    public void testMidiSupport() {
-        try {
-            Sequencer sequencer = MidiSystem.getSequencer();
-            Assert.assertTrue("AndroidSequencer must exist", sequencer instanceof AndroidSequencer);
-            
-            MidiDevice.Info info = sequencer.getDeviceInfo();
-            Assert.assertNotNull("Device info must exist", info);
-    
-            Sequence sequence = MidiSystem.getSequence(new File("/system/sounds/test.mid"));
-            Assert.assertNotNull("Sequence must exist", sequence);
-    
-            Assert.assertFalse("Sequencer must not be open", sequencer.isOpen());
-            sequencer.open();
-            Assert.assertTrue("Sequencer must be open", sequencer.isOpen());
-            
-            Assert.assertNull("Sequencer must not have Sequence", sequencer.getSequence());
-            sequencer.setSequence(sequence);
-            Assert.assertNotNull("Sequencer must have Sequence", sequencer.getSequence());
-            
-            Assert.assertFalse("Sequencer must not be running", sequencer.isRunning());
-            sequencer.start();
-            Thread.sleep(1000);
-            Assert.assertTrue("Sequencer must be running (after 1 second)", sequencer.isRunning());
-    
-            Thread.sleep(3000);
-            
-            Assert.assertTrue("Sequencer must be running", sequencer.isRunning());
-            sequencer.stop();
-            Thread.sleep(1000);
-            Assert.assertFalse("Sequencer must not be running (after 1 second)", sequencer.isRunning());
-            
-            sequencer.close();
-            Assert.assertFalse("Sequencer must not be open", sequencer.isOpen());
-        } catch (Exception ex) {
-            throw new RuntimeException(ex);
-        }
-    } 
-
-    // Regression test for #872614: General javax.sound weirdness.
-    public void testSampledSupport() {
-        try {
-            Clip clip = AudioSystem.getClip();
-            Assert.assertTrue("AndroidClip must exist", clip instanceof AndroidClip);
-            
-            Line.Info info = clip.getLineInfo();
-            Assert.assertNotNull("Line info must exist", info);
-    
-            AudioInputStream stream = AudioSystem.getAudioInputStream(new File("/system/media/audio/ringtones/ringer.ogg"));
-            Assert.assertNotNull("AudioInputStream must exist", stream);
-    
-            Assert.assertFalse("Clip must not be open", clip.isOpen());
-            clip.open(stream);
-            Assert.assertTrue("Clip must be open", clip.isOpen());
-            
-            Assert.assertFalse("Clip must not be running", clip.isRunning());
-            clip.start();
-            Thread.sleep(1000);
-            Assert.assertTrue("Clip must be running (after 1 second)", clip.isRunning());
-    
-            Thread.sleep(2000);
-            
-            Assert.assertTrue("Clip must be running", clip.isRunning());
-            clip.stop();
-            Thread.sleep(1000);
-            Assert.assertFalse("Clip must not be running (after 1 second)", clip.isRunning());
-            
-            clip.close();
-            Assert.assertFalse("Clip must not be open", clip.isOpen());
-        } catch (Exception ex) {
-            throw new RuntimeException(ex);
-        }
-    } 
-    
-}
diff --git a/libcore/luni/src/main/java/java/net/InetAddress.java b/libcore/luni/src/main/java/java/net/InetAddress.java
index ad96ed6..4827e70 100644
--- a/libcore/luni/src/main/java/java/net/InetAddress.java
+++ b/libcore/luni/src/main/java/java/net/InetAddress.java
@@ -27,8 +27,10 @@
 import java.security.AccessController;
 import java.util.Arrays;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Comparator;
 import java.util.Enumeration;
+import java.util.List;
 import java.util.StringTokenizer;
 
 import org.apache.harmony.luni.net.NetUtil;
@@ -114,40 +116,12 @@
         super();
     }
 
-    // BEGIN android-removed
-    /**
-     * Constructs an {@code InetAddress}, representing the {@code address} and
-     * {@code hostName}.
-     *
-     * @param address
-     *            the network address.
-     */
-    // InetAddress(byte[] address) {
-    //     super();
-    //     this.ipaddress = address;
-    // }
+    // BEGIN android-removed: use Inet4Address/Inet6Address instead, as appropriate.
+    // InetAddress(byte[] address) { ... }
     // END android-removed
 
-    // BEGIN android-removed
-    /**
-     * Constructs an {@code InetAddress}, representing the {@code address} and
-     * {@code hostName}.
-     *
-     * @param address
-     *            the network address.
-     *
-     */
-    // InetAddress(byte[] address, String hostName) {
-    //     super();
-    //     this.ipaddress = address;
-    //     this.hostName = hostName;
-    // }
-    // END android-removed
-
-    // BEGIN android-removed
-    // CacheElement cacheElement() {
-    //     return new CacheElement();
-    // }
+    // BEGIN android-removed: use Inet4Address/Inet6Address instead, as appropriate.
+    // InetAddress(byte[] address, String hostName) { ... }
     // END android-removed
 
     /**
@@ -744,7 +718,7 @@
      * ICMP <i>(ICMP ECHO REQUEST)</i>. When first step fails, a TCP connection
      * on port 7 (Echo) of the remote host is established.
      *
-     * @param netif
+     * @param networkInterface
      *            the network interface on which to connection should be
      *            established.
      * @param ttl
@@ -759,36 +733,16 @@
      * @throws IllegalArgumentException
      *             if ttl or timeout is less than zero.
      */
-    public boolean isReachable(NetworkInterface netif, final int ttl,
+    public boolean isReachable(NetworkInterface networkInterface, final int ttl,
             final int timeout) throws IOException {
-        if (0 > ttl || 0 > timeout) {
+        if (ttl < 0 || timeout < 0) {
             throw new IllegalArgumentException(Msg.getString("K0051")); //$NON-NLS-1$
         }
-        boolean reachable = false;
-        if (null == netif) {
-            // network interface is null, binds to no address
-            // BEGIN android-changed
-            // reachable = NETIMPL.isReachableByICMP(this, null, ttl, timeout);
-            // if (!reachable) {
-                reachable = isReachableByTCP(this, null, timeout);
-            // }
-            // END android-changed
+        if (networkInterface == null) {
+            return isReachableByTCP(this, null, timeout);
         } else {
-            // Not Bind to any address
-            if (null == netif.addresses) {
-                return false;
-            }
-            // binds to all address on this NetworkInterface, tries ICMP ping
-            // first
-            // BEGIN android-changed
-            // reachable = isReachableByICMPUseMultiThread(netif, ttl, timeout);
-            // if (!reachable) {
-                // tries TCP echo if ICMP ping fails
-                reachable = isReachableByMultiThread(netif, ttl, timeout);
-            // }
-            // END adnroid-changed
+            return isReachableByMultiThread(networkInterface, ttl, timeout);
         }
-        return reachable;
     }
 
     /*
@@ -800,16 +754,14 @@
             final int ttl, final int timeout)
     // END android-changed
             throws IOException {
-        if (null == netif.addresses) {
+        List<InetAddress> addresses = Collections.list(netif.getInetAddresses());
+        if (addresses.isEmpty()) {
             return false;
         }
-        Enumeration<InetAddress> addresses = netif.getInetAddresses();
         reached = false;
-        addrCount = netif.addresses.length;
+        addrCount = addresses.size();
         boolean needWait = false;
-        while (addresses.hasMoreElements()) {
-            final InetAddress addr = addresses.nextElement();
-
+        for (final InetAddress addr : addresses) {
             // loopback interface can only reach to local addresses
             if (addr.isLoopbackAddress()) {
                 Enumeration<NetworkInterface> NetworkInterfaces = NetworkInterface
diff --git a/libcore/luni/src/main/java/java/net/InterfaceAddress.java b/libcore/luni/src/main/java/java/net/InterfaceAddress.java
index 7bc3936..2fa99f7 100644
--- a/libcore/luni/src/main/java/java/net/InterfaceAddress.java
+++ b/libcore/luni/src/main/java/java/net/InterfaceAddress.java
@@ -20,22 +20,131 @@
  * Identifies one of a network interface's addresses.
  * These are passed back from the JNI behind NetworkInterface.getNetworkInterfaces.
  * Multiple addresses for the same interface are collected together on the Java side.
+ *
+ * @hide
+ * @since 1.6
  */
-class InterfaceAddress {
-    // An IPv4 or IPv6 address.
-    final InetAddress address;
-
-    // The kernel's interface index for the network interface this address
-    // is currently assigned to. Values start at 1, because 0 means "unknown"
-    // or "any", depending on context.
+public class InterfaceAddress {
+    /**
+     * The kernel's interface index for the network interface this address
+     * is currently assigned to. Values start at 1, because 0 means "unknown"
+     * or "any", depending on context.
+     */
     final int index;
 
-    // The network interface's name. "lo" or "eth0", for example.
+    /**
+     * The network interface's name. "lo" or "eth0", for example.
+     */
     final String name;
 
-    InterfaceAddress(int index, String name, InetAddress address) {
+    /**
+     * An IPv4 or IPv6 address.
+     */
+    final InetAddress address;
+
+    /**
+     * The IPv4 broadcast address, or null for IPv6.
+     */
+    private final InetAddress broadcastAddress;
+
+    private final short prefixLength;
+
+    InterfaceAddress(int index, String name, InetAddress address, InetAddress mask) {
+        assert ((address instanceof Inet4Address) == (mask instanceof Inet4Address));
         this.index = index;
         this.name = name;
         this.address = address;
+        this.broadcastAddress = makeBroadcastAddress(address, mask);
+        this.prefixLength = countPrefixLength(mask);
+    }
+
+    private static InetAddress makeBroadcastAddress(InetAddress address, InetAddress mask) {
+        if (!(address instanceof Inet4Address)) {
+            return null;
+        }
+        byte[] broadcast = new byte[4];
+        byte[] maskBytes = mask.ipaddress;
+        byte[] addrBytes = address.ipaddress;
+        if (maskBytes[0] != 0) {
+            for (int i = 0; i < broadcast.length; ++i) {
+                broadcast[i] = (byte) (addrBytes[i] | ~maskBytes[i]);
+            }
+        }
+        return new Inet4Address(broadcast);
+    }
+
+    private static short countPrefixLength(InetAddress mask) {
+        short count = 0;
+        for (byte b : mask.ipaddress) {
+            for (int i = 0; i < 8; ++i) {
+                if ((b & (1 << i)) != 0) {
+                    ++count;
+                }
+            }
+        }
+        return count;
+    }
+
+    /**
+     * Tests whether this object is equal to another one. Returns true if
+     * the address, broadcast address and prefix length are all equal.
+     *
+     * @param obj the object to be compared.
+     * @return true if 'obj' is equal to this InterfaceAddress, false otherwise.
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this){
+            return true;
+        }
+        if (!(obj instanceof InterfaceAddress)) {
+            return false;
+        }
+        InterfaceAddress rhs = (InterfaceAddress) obj;
+        return ((address == null) ? rhs.address == null : address.equals(rhs.address)) &&
+                (rhs.prefixLength == prefixLength) &&
+                ((broadcastAddress == null) ? rhs.broadcastAddress == null : broadcastAddress.equals(rhs.broadcastAddress));
+    }
+
+    @Override
+    public int hashCode() {
+        int hashCode = address == null ? 0 : -address.hashCode();
+        hashCode += broadcastAddress == null ? 0 : broadcastAddress.hashCode();
+        hashCode += prefixLength;
+        return hashCode;
+    }
+
+    /**
+     * Returns a string representation for this interface address.
+     * The string is of the form: InetAddress / prefix length [ broadcast address ].
+     *
+     * @return a string representation of this interface address.
+     */
+    @Override
+    public String toString() {
+        return address + "/" + prefixLength + " [" + broadcastAddress + "]";
+    }
+
+    /**
+     * Returns the InetAddress for this address.
+     */
+    public InetAddress getAddress() {
+        return address;
+    }
+
+    /**
+     * Returns the subnet-directed broadcast address if this is an IPv4 interface, null otherwise.
+     */
+    public InetAddress getBroadcast() {
+        return broadcastAddress;
+    }
+
+    /**
+     * Returns the network prefix length in bits.
+     * (In IPv4 parlance, this is known as the subnet mask,
+     * but this method applies to IPv6 addresses too.)
+     */
+    public short getNetworkPrefixLength() {
+        return prefixLength;
     }
 }
diff --git a/libcore/luni/src/main/java/java/net/NetworkInterface.java b/libcore/luni/src/main/java/java/net/NetworkInterface.java
index 93a30cb..b3e242e 100644
--- a/libcore/luni/src/main/java/java/net/NetworkInterface.java
+++ b/libcore/luni/src/main/java/java/net/NetworkInterface.java
@@ -17,9 +17,12 @@
 
 package java.net;
 
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.LinkedHashMap;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Vector;
@@ -37,49 +40,45 @@
     private static final int CHECK_CONNECT_NO_PORT = -1;
 
     static final int NO_INTERFACE_INDEX = 0;
-
     static final int UNSET_INTERFACE_INDEX = -1;
 
-    private String name;
+    private final String name;
+    private final String displayName;
+    private final List<InterfaceAddress> interfaceAddresses = new LinkedList<InterfaceAddress>();
 
-    private String displayName;
-
-    InetAddress addresses[];
+    private final List<InetAddress> addresses = new LinkedList<InetAddress>();
 
     // The interface index is a positive integer which is non-negative. Where
     // value is zero then we do not have an index for the interface (which
     // occurs in systems which only support IPV4)
     private int interfaceIndex;
 
-    private int hashCode;
+    private NetworkInterface parent = null;
+
+    private final List<NetworkInterface> children = new LinkedList<NetworkInterface>();
 
     // BEGIN android-changed: we pay this extra complexity on the Java side
     // in return for vastly simpler native code.
-    private static native InterfaceAddress[] getInterfaceAddresses() throws SocketException;
+    private static native InterfaceAddress[] getAllInterfaceAddressesImpl() throws SocketException;
 
     private static NetworkInterface[] getNetworkInterfacesImpl() throws SocketException {
         Map<String, NetworkInterface> networkInterfaces = new LinkedHashMap<String, NetworkInterface>();
-        for (InterfaceAddress ia : getInterfaceAddresses()) {
+        for (InterfaceAddress ia : getAllInterfaceAddressesImpl()) {
             if (ia != null) { // The array may contain harmless null elements.
                 String name = ia.name;
                 NetworkInterface ni = networkInterfaces.get(name);
                 if (ni == null) {
                     ni = new NetworkInterface(name, name, new InetAddress[] { ia.address }, ia.index);
+                    ni.interfaceAddresses.add(ia);
                     networkInterfaces.put(name, ni);
                 } else {
-                    ni.addInterfaceAddress(ia.address);
+                    ni.addresses.add(ia.address);
+                    ni.interfaceAddresses.add(ia);
                 }
             }
         }
         return networkInterfaces.values().toArray(new NetworkInterface[networkInterfaces.size()]);
     }
-
-    private void addInterfaceAddress(InetAddress address) {
-        InetAddress[] newAddresses = new InetAddress[addresses.length + 1];
-        System.arraycopy(addresses, 0, newAddresses, 0, addresses.length);
-        newAddresses[addresses.length] = address;
-        addresses = newAddresses;
-    }
     // END android-changed
 
     /**
@@ -96,12 +95,16 @@
      *            an index for the interface. Only set for platforms that
      *            support IPV6.
      */
-    NetworkInterface(String name, String displayName, InetAddress addresses[],
+    NetworkInterface(String name, String displayName, InetAddress[] addresses,
             int interfaceIndex) {
         this.name = name;
         this.displayName = displayName;
-        this.addresses = addresses;
         this.interfaceIndex = interfaceIndex;
+        if (addresses != null) {
+            for (InetAddress address : addresses) {
+                this.addresses.add(address);
+            }
+        }
     }
 
     /**
@@ -122,8 +125,8 @@
      * @return the first address if one exists, otherwise null.
      */
     InetAddress getFirstAddress() {
-        if ((addresses != null) && (addresses.length >= 1)) {
-            return addresses[0];
+        if (addresses.size() >= 1) {
+            return addresses.get(0);
         }
         return null;
     }
@@ -143,63 +146,21 @@
      * @return the address list of the represented network interface.
      */
     public Enumeration<InetAddress> getInetAddresses() {
-        /*
-         * create new vector from which Enumeration to be returned can be
-         * generated set the initial capacity to be the number of addresses for
-         * the network interface which is the maximum required size
-         */
-
-        /*
-         * return an empty enumeration if there are no addresses associated with
-         * the interface
-         */
-        if (addresses == null) {
-            return new Vector<InetAddress>(0).elements();
+        SecurityManager sm = System.getSecurityManager();
+        if (sm == null || addresses.isEmpty()) {
+            return Collections.enumeration(addresses);
         }
-
-        /*
-         * for those configuration that support the security manager we only
-         * return addresses for which checkConnect returns true
-         */
-        Vector<InetAddress> accessibleAddresses = new Vector<InetAddress>(
-                addresses.length);
-
-        /*
-         * get the security manager. If one does not exist just return the full
-         * list
-         */
-        SecurityManager security = System.getSecurityManager();
-        if (security == null) {
-            return (new Vector<InetAddress>(Arrays.asList(addresses)))
-                    .elements();
-        }
-
-        /*
-         * ok security manager exists so check each address and return those
-         * that pass
-         */
-        for (InetAddress element : addresses) {
-            if (security != null) {
-                try {
-                    /*
-                     * since we don't have a port in this case we pass in
-                     * NO_PORT
-                     */
-                    security.checkConnect(element.getHostName(),
-                            CHECK_CONNECT_NO_PORT);
-                    accessibleAddresses.add(element);
-                } catch (SecurityException e) {
-                }
+        // TODO: Android should ditch SecurityManager and the associated pollution.
+        List<InetAddress> result = new ArrayList<InetAddress>(addresses.size());
+        for (InetAddress address : addresses) {
+            try {
+                sm.checkConnect(address.getHostName(), CHECK_CONNECT_NO_PORT);
+            } catch (SecurityException e) {
+                continue;
             }
+            result.add(address);
         }
-
-        Enumeration<InetAddress> theAccessibleElements = accessibleAddresses
-                .elements();
-        if (theAccessibleElements.hasMoreElements()) {
-            return accessibleAddresses.elements();
-        }
-
-        return new Vector<InetAddress>(0).elements();
+        return Collections.enumeration(result);
     }
 
     /**
@@ -232,24 +193,13 @@
      * @throws NullPointerException
      *             if the given interface's name is {@code null}.
      */
-    public static NetworkInterface getByName(String interfaceName)
-            throws SocketException {
-
+    public static NetworkInterface getByName(String interfaceName) throws SocketException {
         if (interfaceName == null) {
             throw new NullPointerException(Msg.getString("K0330")); //$NON-NLS-1$
         }
-
-        /*
-         * get the list of interfaces, and then loop through the list to look
-         * for one with a matching name
-         */
-        Enumeration<NetworkInterface> interfaces = getNetworkInterfaces();
-        if (interfaces != null) {
-            while (interfaces.hasMoreElements()) {
-                NetworkInterface netif = interfaces.nextElement();
-                if (netif.getName().equals(interfaceName)) {
-                    return netif;
-                }
+        for (NetworkInterface networkInterface : getNetworkInterfacesList()) {
+            if (networkInterface.name.equals(interfaceName)) {
+                return networkInterface;
             }
         }
         return null;
@@ -268,38 +218,13 @@
      * @throws NullPointerException
      *             if the given interface address is invalid.
      */
-    public static NetworkInterface getByInetAddress(InetAddress address)
-            throws SocketException {
-
+    public static NetworkInterface getByInetAddress(InetAddress address) throws SocketException {
         if (address == null) {
             throw new NullPointerException(Msg.getString("K0331")); //$NON-NLS-1$
         }
-
-        /*
-         * get the list of interfaces, and then loop through the list. For each
-         * interface loop through the associated set of internet addresses and
-         * see if one matches. If so return that network interface
-         */
-        Enumeration<NetworkInterface> interfaces = getNetworkInterfaces();
-        if (interfaces != null) {
-            while (interfaces.hasMoreElements()) {
-                NetworkInterface netif = interfaces.nextElement();
-                /*
-                 * to be compatible use the raw addresses without any security
-                 * filtering
-                 */
-                // Enumeration netifAddresses = netif.getInetAddresses();
-                if ((netif.addresses != null) && (netif.addresses.length != 0)) {
-                    Enumeration<InetAddress> netifAddresses = (new Vector<InetAddress>(
-                            Arrays.asList(netif.addresses))).elements();
-                    if (netifAddresses != null) {
-                        while (netifAddresses.hasMoreElements()) {
-                            if (address.equals(netifAddresses.nextElement())) {
-                                return netif;
-                            }
-                        }
-                    }
-                }
+        for (NetworkInterface networkInterface : getNetworkInterfacesList()) {
+            if (networkInterface.addresses.contains(address)) {
+                return networkInterface;
             }
         }
         return null;
@@ -315,32 +240,53 @@
      *             if an error occurs while getting the network interface
      *             information.
      */
-    public static Enumeration<NetworkInterface> getNetworkInterfaces()
-            throws SocketException {
+    public static Enumeration<NetworkInterface> getNetworkInterfaces() throws SocketException {
+        return Collections.enumeration(getNetworkInterfacesList());
+    }
+
+    private static List<NetworkInterface> getNetworkInterfacesList() throws SocketException {
         NetworkInterface[] interfaces = getNetworkInterfacesImpl();
-        if (interfaces == null) {
-            return null;
-        }
 
         for (NetworkInterface netif : interfaces) {
             // Ensure that current NetworkInterface is bound to at least
             // one InetAddress before processing
-            if (netif.addresses != null) {
-                for (InetAddress addr : netif.addresses) {
-                    if (16 == addr.ipaddress.length) {
-                        if (addr.isLinkLocalAddress()
-                                || addr.isSiteLocalAddress()) {
-                            ((Inet6Address) addr).scopedIf = netif;
-                            ((Inet6Address) addr).ifname = netif.name;
-                            ((Inet6Address) addr).scope_ifname_set = true;
-                        }
+            for (InetAddress addr : netif.addresses) {
+                if (addr.ipaddress.length == 16) {
+                    if (addr.isLinkLocalAddress() || addr.isSiteLocalAddress()) {
+                        ((Inet6Address) addr).scopedIf = netif;
+                        ((Inet6Address) addr).ifname = netif.name;
+                        ((Inet6Address) addr).scope_ifname_set = true;
                     }
                 }
             }
         }
 
-        return (new Vector<NetworkInterface>(Arrays.asList(interfaces)))
-                .elements();
+        List<NetworkInterface> result = new ArrayList<NetworkInterface>();
+        boolean[] peeked = new boolean[interfaces.length];
+        for (int counter = 0; counter < interfaces.length; counter++) {
+            // If this interface has been touched, continue.
+            if (peeked[counter]) {
+                continue;
+            }
+            int counter2 = counter;
+            // Checks whether the following interfaces are children.
+            for (; counter2 < interfaces.length; counter2++) {
+                if (peeked[counter2]) {
+                    continue;
+                }
+                if (interfaces[counter2].name.startsWith(interfaces[counter].name + ":")) {
+                    // Tagged as peeked
+                    peeked[counter2] = true;
+                    interfaces[counter].children.add(interfaces[counter2]);
+                    interfaces[counter2].parent = interfaces[counter];
+                    interfaces[counter].addresses.addAll(interfaces[counter2].addresses);
+                }
+            }
+            // Tagged as peeked
+            result.add(interfaces[counter]);
+            peeked[counter] = true;
+        }
+        return result;
     }
 
     /**
@@ -357,77 +303,27 @@
      */
     @Override
     public boolean equals(Object obj) {
-        // Return true if it is the exact same object.
         if (obj == this) {
             return true;
         }
-
-        // Ensure it is the right type.
         if (!(obj instanceof NetworkInterface)) {
             return false;
         }
-
-        /*
-         * Make sure that some simple checks pass. If the name is not the same
-         * then we are sure it is not the same one. We don't check the hashcode
-         * as it is generated from the name which we check
-         */
-        NetworkInterface netif = (NetworkInterface) obj;
-
-        if (netif.getIndex() != interfaceIndex) {
-            return false;
-        }
-
-        if (!(name.equals("")) && (!netif.getName().equals(name))) { //$NON-NLS-1$
-            return false;
-        }
-
-        if ((name.equals("")) && (!netif.getName().equals(displayName))) { //$NON-NLS-1$
-            return false;
-        }
-
-        // Now check that the collection of internet addresses are equal.
-        Enumeration<InetAddress> netifAddresses = netif.getInetAddresses();
-        Enumeration<InetAddress> localifAddresses = getInetAddresses();
-
-        // Check for both null (same), or one null (not same).
-        if (netifAddresses == null) {
-            return localifAddresses == null;
-        }
-        if (localifAddresses == null) {
-            return false;
-        }
-
-        // Both are not null, check InetAddress elements.
-        while (netifAddresses.hasMoreElements()
-                && localifAddresses.hasMoreElements()) {
-            if (!(localifAddresses.nextElement()).equals(
-                    netifAddresses.nextElement())) {
-                return false;
-            }
-        }
-
-        /*
-         * Now make sure that they had the same number of addresses, if not they
-         * are not the same interface.
-         */
-        return !netifAddresses.hasMoreElements()
-                && !localifAddresses.hasMoreElements();
+        NetworkInterface rhs = (NetworkInterface) obj;
+        // TODO: should the order of the addresses matter (we use List.equals)?
+        return interfaceIndex == rhs.interfaceIndex &&
+                name.equals(rhs.name) && displayName.equals(rhs.displayName) &&
+                addresses.equals(rhs.addresses);
     }
 
     /**
-     * Gets the hashcode for this {@code NetworkInterface} instance. Since the
-     * name should be unique for each network interface the hashcode is
+     * Returns the hash code for this {@code NetworkInterface}. Since the
+     * name should be unique for each network interface the hash code is
      * generated using this name.
-     * 
-     * @return the hashcode value for this {@code NetworkInterface} instance.
      */
     @Override
     public int hashCode() {
-        if (hashCode == 0) {
-            hashCode = name.hashCode();
-        }
-        return hashCode;
+        return name.hashCode();
     }
 
     /**
@@ -464,4 +360,174 @@
         }
         return string.toString();
     }
+
+    /**
+     * Returns a List the InterfaceAddresses for this network interface.
+     * <p>
+     * If there is a security manager, its checkConnect method is called with
+     * the InetAddress for each InterfaceAddress. Only InterfaceAddresses where
+     * the checkConnect doesn't throw a SecurityException will be returned.
+     * 
+     * @return a List of the InterfaceAddresses for this network interface.
+     * @since 1.6
+     * @hide
+     */
+    public List<InterfaceAddress> getInterfaceAddresses() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm == null) {
+            return Collections.unmodifiableList(interfaceAddresses);
+        }
+        // TODO: Android should ditch SecurityManager and the associated pollution.
+        List<InterfaceAddress> result = new ArrayList<InterfaceAddress>(interfaceAddresses.size());
+        for (InterfaceAddress ia : interfaceAddresses) {
+            try {
+                sm.checkConnect(ia.getAddress().getHostName(), CHECK_CONNECT_NO_PORT);
+            } catch (SecurityException e) {
+                continue;
+            }
+            result.add(ia);
+        }
+        return result;
+    }
+
+    /**
+     * Returns an {@code Enumeration} of all the sub-interfaces of this network interface.
+     * Sub-interfaces are also known as virtual interfaces.
+     * <p>
+     * For example, {@code eth0:1} would be a sub-interface of {@code eth0}.
+     * 
+     * @return an Enumeration of all the sub-interfaces of this network interface
+     * @since 1.6
+     * @hide
+     */
+    public Enumeration<NetworkInterface> getSubInterfaces() {
+        return Collections.enumeration(children);
+    }
+
+    /**
+     * Returns the parent NetworkInterface of this interface if this is a
+     * sub-interface, or null if it's a physical (non virtual) interface.
+     * 
+     * @return the NetworkInterface this interface is attached to.
+     * @since 1.6
+     * @hide
+     */
+    public NetworkInterface getParent() {
+        return parent;
+    }
+
+    /**
+     * Returns true if this network interface is up.
+     * 
+     * @return true if the interface is up.
+     * @throws SocketException if an I/O error occurs.
+     * @since 1.6
+     * @hide
+     */
+    public boolean isUp() throws SocketException {
+        if (addresses.isEmpty()) {
+            return false;
+        }
+        return isUpImpl(name, interfaceIndex);
+    }
+    private static native boolean isUpImpl(String n, int index) throws SocketException;
+
+    /**
+     * Returns true if this network interface is a loopback interface.
+     * 
+     * @return true if the interface is a loopback interface.
+     * @throws SocketException if an I/O error occurs.
+     * @since 1.6
+     * @hide
+     */
+    public boolean isLoopback() throws SocketException {
+        if (addresses.isEmpty()) {
+            return false;
+        }
+        return isLoopbackImpl(name, interfaceIndex);
+    }
+    private static native boolean isLoopbackImpl(String n, int index) throws SocketException;
+
+    /**
+     * Returns true if this network interface is a point-to-point interface.
+     * (For example, a PPP connection using a modem.)
+     * 
+     * @return true if the interface is point-to-point.
+     * @throws SocketException if an I/O error occurs.
+     * @since 1.6
+     * @hide
+     */
+    public boolean isPointToPoint() throws SocketException {
+        if (addresses.isEmpty()) {
+            return false;
+        }
+        return isPointToPointImpl(name, interfaceIndex);
+    }
+    private static native boolean isPointToPointImpl(String n, int index) throws SocketException;
+
+    /**
+     * Returns true if this network interface supports multicast.
+     * 
+     * @throws SocketException if an I/O error occurs.
+     * @since 1.6
+     * @hide
+     */
+    public boolean supportsMulticast() throws SocketException {
+        if (addresses.isEmpty()) {
+            return false;
+        }
+        return supportsMulticastImpl(name, interfaceIndex);
+    }
+    private static native boolean supportsMulticastImpl(String n, int index) throws SocketException;
+
+    /**
+     * Returns the hardware address of the interface, if it has one, and the
+     * user has the necessary privileges to access the address.
+     * 
+     * @return a byte array containing the address or null if the address
+     *         doesn't exist or is not accessible.
+     * @throws SocketException if an I/O error occurs.
+     * @since 1.6
+     * @hide
+     */
+    public byte[] getHardwareAddress() throws SocketException {
+        if (addresses.isEmpty()) {
+            return new byte[0];
+        }
+        return getHardwareAddressImpl(name, interfaceIndex);
+    }
+    private static native byte[] getHardwareAddressImpl(String n, int index) throws SocketException;
+
+    /**
+     * Returns the Maximum Transmission Unit (MTU) of this interface.
+     * 
+     * @return the value of the MTU for the interface.
+     * @throws SocketException if an I/O error occurs.
+     * @since 1.6
+     * @hide
+     */
+    public int getMTU() throws SocketException {
+        if (addresses.isEmpty()) {
+            return 0;
+        }
+        return getMTUImpl(name, interfaceIndex);
+    }
+    private static native int getMTUImpl(String n, int index) throws SocketException;
+
+    /**
+     * Returns true if this interface is a virtual interface (also called
+     * a sub-interface). Virtual interfaces are, on some systems, interfaces
+     * created as a child of a physical interface and given different settings
+     * (like address or MTU). Usually the name of the interface will the name of
+     * the parent followed by a colon (:) and a number identifying the child,
+     * since there can be several virtual interfaces attached to a single
+     * physical interface.
+     * 
+     * @return true if this interface is a virtual interface.
+     * @since 1.6
+     * @hide
+     */
+    public boolean isVirtual() {
+        return parent != null;
+    }
 }
diff --git a/libcore/luni/src/main/java/java/net/ServerSocket.java b/libcore/luni/src/main/java/java/net/ServerSocket.java
index 2fe6b5c..ce7b84f 100644
--- a/libcore/luni/src/main/java/java/net/ServerSocket.java
+++ b/libcore/luni/src/main/java/java/net/ServerSocket.java
@@ -61,13 +61,7 @@
     }
 
     /**
-     * Unspecified constructor.
-     *
-     * Warning: this function is technically part of API#1.
-     * Hiding it for API#2 broke source compatibility.
-     * Removing it entirely would theoretically break binary compatibility,
-     *     and would be better done with some visibility over the extent
-     *     of the compatibility breakage (expected to be non-existent).
+     * Unspecified constructor needed by ServerSocketChannelImpl.ServerSocketAdapter.
      *
      * @hide
      */
diff --git a/libcore/luni/src/main/native/ifaddrs-android.h b/libcore/luni/src/main/native/ifaddrs-android.h
index 0c3d203..de87b02 100644
--- a/libcore/luni/src/main/native/ifaddrs-android.h
+++ b/libcore/luni/src/main/native/ifaddrs-android.h
@@ -17,8 +17,13 @@
 #ifndef IFADDRS_ANDROID_H_included
 #define IFADDRS_ANDROID_H_included
 
+#include <arpa/inet.h>
 #include <cstring>
+#include <errno.h>
+#include <net/if.h>
+#include <netinet/in.h>
 #include <new>
+#include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <stdio.h>
@@ -43,11 +48,14 @@
     // Interface flags.
     unsigned int ifa_flags;
 
-    // Interface address.
+    // Interface network address.
     sockaddr* ifa_addr;
 
+    // Interface netmask.
+    sockaddr* ifa_netmask;
+
     ifaddrs(ifaddrs* next)
-    : ifa_next(next), ifa_name(NULL), ifa_flags(0), ifa_addr(NULL)
+    : ifa_next(next), ifa_name(NULL), ifa_flags(0), ifa_addr(NULL), ifa_netmask(NULL)
     {
     }
 
@@ -55,6 +63,7 @@
         delete ifa_next;
         delete[] ifa_name;
         delete ifa_addr;
+        delete ifa_netmask;
     }
 
     // Sadly, we can't keep the interface index for portability with BSD.
@@ -91,16 +100,41 @@
     // stitch the two bits together into the sockaddr that's part of
     // our portable interface.
     void setAddress(int family, void* data, size_t byteCount) {
+        // Set the address proper...
         sockaddr_storage* ss = new sockaddr_storage;
-        ss->ss_family = family;
-        if (family == AF_INET) {
-            void* dst = &reinterpret_cast<sockaddr_in*>(ss)->sin_addr;
-            memcpy(dst, data, byteCount);
-        } else if (family == AF_INET6) {
-            void* dst = &reinterpret_cast<sockaddr_in6*>(ss)->sin6_addr;
-            memcpy(dst, data, byteCount);
-        }
+        memset(ss, 0, sizeof(*ss));
         ifa_addr = reinterpret_cast<sockaddr*>(ss);
+        ss->ss_family = family;
+        uint8_t* dst = sockaddrBytes(family, ss);
+        memcpy(dst, data, byteCount);
+    }
+
+    // Netlink gives us the prefix length as a bit count. We need to turn
+    // that into a BSD-compatible netmask represented by a sockaddr*.
+    void setNetmask(int family, size_t prefixLength) {
+        // ...and work out the netmask from the prefix length.
+        sockaddr_storage* ss = new sockaddr_storage;
+        memset(ss, 0, sizeof(*ss));
+        ifa_netmask = reinterpret_cast<sockaddr*>(ss);
+        ss->ss_family = family;
+        uint8_t* dst = sockaddrBytes(family, ss);
+        memset(dst, 0xff, prefixLength / 8);
+        if ((prefixLength % 8) != 0) {
+            dst[prefixLength/8] = (0xff << (8 - (prefixLength % 8)));
+        }
+    }
+
+    // Returns a pointer to the first byte in the address data (which is
+    // stored in network byte order).
+    uint8_t* sockaddrBytes(int family, sockaddr_storage* ss) {
+        if (family == AF_INET) {
+            sockaddr_in* ss4 = reinterpret_cast<sockaddr_in*>(ss);
+            return reinterpret_cast<uint8_t*>(&ss4->sin_addr);
+        } else if (family == AF_INET6) {
+            sockaddr_in6* ss6 = reinterpret_cast<sockaddr_in6*>(ss);
+            return reinterpret_cast<uint8_t*>(&ss6->sin6_addr);
+        }
+        return NULL;
     }
 };
 
@@ -167,6 +201,7 @@
                                     return -1;
                                 }
                                 (*result)->setAddress(family, RTA_DATA(rta), RTA_PAYLOAD(rta));
+                                (*result)->setNetmask(family, address->ifa_prefixlen);
                             }
                         }
                         rta = RTA_NEXT(rta, ifaPayloadLength);
diff --git a/libcore/luni/src/main/native/java_net_NetworkInterface.cpp b/libcore/luni/src/main/native/java_net_NetworkInterface.cpp
index 1a72710..724e988 100644
--- a/libcore/luni/src/main/native/java_net_NetworkInterface.cpp
+++ b/libcore/luni/src/main/native/java_net_NetworkInterface.cpp
@@ -18,6 +18,7 @@
 #include "AndroidSystemNatives.h"
 #include "JNIHelp.h"
 #include "jni.h"
+#include "ScopedFd.h"
 
 #include <errno.h>
 #include <netinet/in.h>
@@ -64,27 +65,34 @@
             jniStrError(errno, buf, sizeof(buf)));
 }
 
-static jobject makeInterfaceAddress(JNIEnv* env, jint interfaceIndex, const char* name, sockaddr_storage* ss) {
+static jobject makeInterfaceAddress(JNIEnv* env, jint interfaceIndex, ifaddrs* ifa) {
     jclass clazz = env->FindClass("java/net/InterfaceAddress");
     if (clazz == NULL) {
         return NULL;
     }
-    jmethodID constructor = env->GetMethodID(clazz, "<init>", "(ILjava/lang/String;Ljava/net/InetAddress;)V");
+    jmethodID constructor = env->GetMethodID(clazz, "<init>",
+            "(ILjava/lang/String;Ljava/net/InetAddress;Ljava/net/InetAddress;)V");
     if (constructor == NULL) {
         return NULL;
     }
-    jobject javaName = env->NewStringUTF(name);
+    jobject javaName = env->NewStringUTF(ifa->ifa_name);
     if (javaName == NULL) {
         return NULL;
     }
-    jobject javaAddress = socketAddressToInetAddress(env, ss);
+    sockaddr_storage* addr = reinterpret_cast<sockaddr_storage*>(ifa->ifa_addr);
+    jobject javaAddress = socketAddressToInetAddress(env, addr);
     if (javaAddress == NULL) {
         return NULL;
     }
-    return env->NewObject(clazz, constructor, interfaceIndex, javaName, javaAddress);
+    sockaddr_storage* mask = reinterpret_cast<sockaddr_storage*>(ifa->ifa_netmask);
+    jobject javaMask = socketAddressToInetAddress(env, mask);
+    if (javaMask == NULL) {
+        return NULL;
+    }
+    return env->NewObject(clazz, constructor, interfaceIndex, javaName, javaAddress, javaMask);
 }
 
-static jobjectArray getInterfaceAddresses(JNIEnv* env, jclass) {
+static jobjectArray getAllInterfaceAddressesImpl(JNIEnv* env, jclass) {
     // Get the list of interface addresses.
     ScopedInterfaceAddresses addresses;
     if (!addresses.init()) {
@@ -128,8 +136,7 @@
             continue;
         }
         // Make a new InterfaceAddress, and insert it into the array.
-        sockaddr_storage* ss = reinterpret_cast<sockaddr_storage*>(ifa->ifa_addr);
-        jobject element = makeInterfaceAddress(env, interfaceIndex, ifa->ifa_name, ss);
+        jobject element = makeInterfaceAddress(env, interfaceIndex, ifa);
         if (element == NULL) {
             return NULL;
         }
@@ -142,9 +149,89 @@
     return result;
 }
 
+static bool doIoctl(JNIEnv* env, jstring name, int request, ifreq& ifr) {
+    // Copy the name into the ifreq structure, if there's room...
+    jsize nameLength = env->GetStringLength(name);
+    if (nameLength >= IFNAMSIZ) {
+        errno = ENAMETOOLONG;
+        jniThrowSocketException(env);
+        return false;
+    }
+    memset(&ifr, 0, sizeof(ifr));
+    env->GetStringUTFRegion(name, 0, nameLength, ifr.ifr_name);
+
+    // ...and do the ioctl.
+    ScopedFd fd(socket(AF_INET, SOCK_DGRAM, 0));
+    if (fd.get() == -1) {
+        jniThrowSocketException(env);
+        return false;
+    }
+    int rc = ioctl(fd.get(), request, &ifr);
+    if (rc == -1) {
+        jniThrowSocketException(env);
+        return false;
+    }
+    return true;
+}
+
+static jboolean hasFlag(JNIEnv* env, jstring name, int flag) {
+    ifreq ifr;
+    doIoctl(env, name, SIOCGIFFLAGS, ifr); // May throw.
+    return (ifr.ifr_flags & flag) != 0;
+}
+
+static jbyteArray getHardwareAddressImpl(JNIEnv* env, jclass, jstring name, jint index) {
+    ifreq ifr;
+    if (!doIoctl(env, name, SIOCGIFHWADDR, ifr)) {
+        return NULL;
+    }
+    jbyte bytes[IFHWADDRLEN];
+    bool isEmpty = true;
+    for (int i = 0; i < IFHWADDRLEN; ++i) {
+        bytes[i] = ifr.ifr_hwaddr.sa_data[i];
+        if (bytes[i] != 0) {
+            isEmpty = false;
+        }
+    }
+    if (isEmpty) {
+        return NULL;
+    }
+    jbyteArray result = env->NewByteArray(IFHWADDRLEN);
+    env->SetByteArrayRegion(result, 0, IFHWADDRLEN, bytes);
+    return result;
+}
+
+static jint getMTUImpl(JNIEnv* env, jclass, jstring name, jint index) {
+    ifreq ifr;
+    doIoctl(env, name, SIOCGIFMTU, ifr); // May throw.
+    return ifr.ifr_mtu;
+}
+
+static jboolean isLoopbackImpl(JNIEnv* env, jclass, jstring name, jint index) {
+    return hasFlag(env, name, IFF_LOOPBACK);
+}
+
+static jboolean isPointToPointImpl(JNIEnv* env, jclass, jstring name, jint index) {
+    return hasFlag(env, name, IFF_POINTOPOINT); // Unix API typo!
+}
+
+static jboolean isUpImpl(JNIEnv* env, jclass, jstring name, jint index) {
+    return hasFlag(env, name, IFF_UP);
+}
+
+static jboolean supportsMulticastImpl(JNIEnv* env, jclass, jstring name, jint index) {
+    return hasFlag(env, name, IFF_MULTICAST);
+}
+
 static JNINativeMethod gMethods[] = {
     /* name, signature, funcPtr */
-    { "getInterfaceAddresses", "()[Ljava/net/InterfaceAddress;", (void*) getInterfaceAddresses },
+    { "getAllInterfaceAddressesImpl", "()[Ljava/net/InterfaceAddress;", (void*) getAllInterfaceAddressesImpl },
+    { "getHardwareAddressImpl", "(Ljava/lang/String;I)[B", (void*) getHardwareAddressImpl },
+    { "getMTUImpl", "(Ljava/lang/String;I)I", (void*) getMTUImpl },
+    { "isLoopbackImpl", "(Ljava/lang/String;I)Z", (void*) isLoopbackImpl },
+    { "isPointToPointImpl", "(Ljava/lang/String;I)Z", (void*) isPointToPointImpl },
+    { "isUpImpl", "(Ljava/lang/String;I)Z", (void*) isUpImpl },
+    { "supportsMulticastImpl", "(Ljava/lang/String;I)Z", (void*) supportsMulticastImpl },
 };
 int register_java_net_NetworkInterface(JNIEnv* env) {
     return jniRegisterNativeMethods(env, "java/net/NetworkInterface",
diff --git a/libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp b/libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
index 12c3dd9..1a8f3a4 100644
--- a/libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
+++ b/libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
@@ -331,38 +331,70 @@
     return byteArrayToInetAddress(env, byteArray);
 }
 
-/**
- * Converts an IPv4 address to an IPv4-mapped IPv6 address if fd is an IPv6
- * socket.
- * @param fd the socket.
- * @param sin_ss the address.
- * @param sin6_ss scratch space where we can store the mapped address if necessary.
- * @param mapUnspecified if true, convert 0.0.0.0 to ::ffff:0:0; if false, to ::
- * @return either sin_ss or sin6_ss, depending on which the caller should use.
- */
-static const sockaddr* convertIpv4ToMapped(int fd,
-        const sockaddr_storage* sin_ss, sockaddr_storage* sin6_ss, bool mapUnspecified) {
-    // We need to map if we have an IPv4 address but an IPv6 socket.
-    bool needsMapping = (sin_ss->ss_family == AF_INET && getSocketAddressFamily(fd) == AF_INET6);
-    if (!needsMapping) {
-        return reinterpret_cast<const sockaddr*>(sin_ss);
+// Handles translating between IPv4 and IPv6 addresses so -- where possible --
+// we can use either class of address with either an IPv4 or IPv6 socket.
+class CompatibleSocketAddress {
+public:
+    // Constructs an address corresponding to 'ss' that's compatible with 'fd'.
+    CompatibleSocketAddress(int fd, const sockaddr_storage& ss, bool mapUnspecified) {
+        const int desiredFamily = getSocketAddressFamily(fd);
+        if (ss.ss_family == AF_INET6) {
+            if (desiredFamily == AF_INET6) {
+                // Nothing to do.
+                mCompatibleAddress = reinterpret_cast<const sockaddr*>(&ss);
+            } else {
+                sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(&mTmp);
+                const sockaddr_in6* sin6 = reinterpret_cast<const sockaddr_in6*>(&ss);
+                memset(sin, 0, sizeof(*sin));
+                sin->sin_family = AF_INET;
+                sin->sin_port = sin6->sin6_port;
+                if (IN6_IS_ADDR_V4COMPAT(&sin6->sin6_addr)) {
+                    // We have an IPv6-mapped IPv4 address, but need plain old IPv4.
+                    // Unmap the mapped address in ss into an IPv6 address in mTmp.
+                    memcpy(&sin->sin_addr.s_addr, &sin6->sin6_addr.s6_addr[12], 4);
+                    mCompatibleAddress = reinterpret_cast<const sockaddr*>(&mTmp);
+                } else if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr)) {
+                    // Translate the IPv6 loopback address to the IPv4 one.
+                    sin->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+                    mCompatibleAddress = reinterpret_cast<const sockaddr*>(&mTmp);
+                } else {
+                    // We can't help you. We return what you gave us, and assume you'll
+                    // get a sensible error when you use the address.
+                    mCompatibleAddress = reinterpret_cast<const sockaddr*>(&ss);
+                }
+            }
+        } else /* ss.ss_family == AF_INET */ {
+            if (desiredFamily == AF_INET) {
+                // Nothing to do.
+                mCompatibleAddress = reinterpret_cast<const sockaddr*>(&ss);
+            } else {
+                // We have IPv4 and need IPv6.
+                // Map the IPv4 address in ss into an IPv6 address in mTmp.
+                const sockaddr_in* sin = reinterpret_cast<const sockaddr_in*>(&ss);
+                sockaddr_in6* sin6 = reinterpret_cast<sockaddr_in6*>(&mTmp);
+                memset(sin6, 0, sizeof(*sin6));
+                sin6->sin6_family = AF_INET6;
+                sin6->sin6_port = sin->sin_port;
+                // TODO: mapUnspecified was introduced because kernels < 2.6.31 don't allow
+                // you to bind to ::ffff:0.0.0.0. When we move to something >= 2.6.31, we
+                // should make the code behave as if mapUnspecified were always true, and
+                // remove the parameter.
+                if (sin->sin_addr.s_addr != 0 || mapUnspecified) {
+                    memset(&(sin6->sin6_addr.s6_addr[10]), 0xff, 2);
+                }
+                memcpy(&sin6->sin6_addr.s6_addr[12], &sin->sin_addr.s_addr, 4);
+                mCompatibleAddress = reinterpret_cast<const sockaddr*>(&mTmp);
+            }
+        }
     }
-    // Map the IPv4 address in sin_ss into an IPv6 address in sin6_ss.
-    const sockaddr_in* sin = reinterpret_cast<const sockaddr_in*>(sin_ss);
-    sockaddr_in6* sin6 = reinterpret_cast<sockaddr_in6*>(sin6_ss);
-    memset(sin6, 0, sizeof(*sin6));
-    sin6->sin6_family = AF_INET6;
-    sin6->sin6_port = sin->sin_port;
-    // TODO: mapUnspecified was introduced because kernels < 2.6.31 don't allow
-    // you to bind to ::ffff:0.0.0.0. When we move to something >= 2.6.31, we
-    // should make the code behave as if mapUnspecified were always true, and
-    // remove the parameter.
-    if (sin->sin_addr.s_addr != 0 || mapUnspecified) {
-        memset(&(sin6->sin6_addr.s6_addr[10]), 0xff, 2);
+    // Returns a pointer to an address compatible with the socket.
+    const sockaddr* get() const {
+        return mCompatibleAddress;
     }
-    memcpy(&sin6->sin6_addr.s6_addr[12], &sin->sin_addr.s_addr, 4);
-    return reinterpret_cast<const sockaddr*>(sin6_ss);
-}
+private:
+    const sockaddr* mCompatibleAddress;
+    sockaddr_storage mTmp;
+};
 
 /**
  * Converts an InetAddress object and port number to a native address structure.
@@ -926,9 +958,8 @@
  * @param socketAddress the address to connect to
  */
 static int doConnect(int fd, const sockaddr_storage* socketAddress) {
-    sockaddr_storage tmp;
-    const sockaddr* realAddress = convertIpv4ToMapped(fd, socketAddress, &tmp, true);
-    return TEMP_FAILURE_RETRY(connect(fd, realAddress, sizeof(sockaddr_storage)));
+    const CompatibleSocketAddress compatibleAddress(fd, *socketAddress, true);
+    return TEMP_FAILURE_RETRY(connect(fd, compatibleAddress.get(), sizeof(sockaddr_storage)));
 }
 
 /**
@@ -1442,12 +1473,12 @@
         return -1;
     }
 
-    int sock;
-    sock = socket(PF_INET6, type, 0);
-    if (sock < 0 && errno == EAFNOSUPPORT) {
+    // Try IPv6 but fall back to IPv4...
+    int sock = socket(PF_INET6, type, 0);
+    if (sock == -1 && errno == EAFNOSUPPORT) {
         sock = socket(PF_INET, type, 0);
     }
-    if (sock < 0) {
+    if (sock == -1) {
         jniThrowSocketException(env, errno);
         return sock;
     }
@@ -1774,9 +1805,8 @@
         return;
     }
 
-    sockaddr_storage tmp;
-    const sockaddr* realAddress = convertIpv4ToMapped(fd, &socketAddress, &tmp, false);
-    int rc = TEMP_FAILURE_RETRY(bind(fd, realAddress, sizeof(sockaddr_storage)));
+    const CompatibleSocketAddress compatibleAddress(fd, socketAddress, false);
+    int rc = TEMP_FAILURE_RETRY(bind(fd, compatibleAddress.get(), sizeof(sockaddr_storage)));
     if (rc == -1) {
         jniThrowBindException(env, errno);
     }
@@ -1936,12 +1966,14 @@
         return;
     }
 
-    sockaddr_storage sockAddr;
-    memset(&sockAddr, 0, sizeof(sockAddr));
-    sockAddr.ss_family = AF_UNSPEC;
-
-    int result = doConnect(fd, &sockAddr);
-    if (result < 0) {
+    // To disconnect a datagram socket, we connect to a bogus address with
+    // the family AF_UNSPEC.
+    sockaddr_storage ss;
+    memset(&ss, 0, sizeof(ss));
+    ss.ss_family = AF_UNSPEC;
+    const sockaddr* sa = reinterpret_cast<const sockaddr*>(&ss);
+    int rc = TEMP_FAILURE_RETRY(connect(fd, sa, sizeof(ss)));
+    if (rc == -1) {
         jniThrowSocketException(env, errno);
     }
 }
diff --git a/libcore/luni/src/test/java/tests/api/java/net/NetworkInterfaceTest.java b/libcore/luni/src/test/java/tests/api/java/net/NetworkInterfaceTest.java
index 0272af1..26960c4 100644
--- a/libcore/luni/src/test/java/tests/api/java/net/NetworkInterfaceTest.java
+++ b/libcore/luni/src/test/java/tests/api/java/net/NetworkInterfaceTest.java
@@ -17,597 +17,545 @@
 
 package tests.api.java.net;
 
-import dalvik.annotation.TestTargetClass; 
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-
 import java.net.InetAddress;
+import java.net.InterfaceAddress;
 import java.net.NetworkInterface;
 import java.net.SocketException;
-import java.security.Permission;
 import java.util.ArrayList;
 import java.util.Enumeration;
+import java.util.List;
 
-@TestTargetClass(NetworkInterface.class) 
 public class NetworkInterfaceTest extends junit.framework.TestCase {
 
-    // private member variables used for tests
-    boolean atLeastOneInterface = false;
+	// private member variables used for tests
+    Enumeration<NetworkInterface> theInterfaces = null;
 
-    boolean atLeastTwoInterfaces = false;
+	boolean atLeastOneInterface = false;
 
-    private NetworkInterface networkInterface1 = null;
+	boolean atLeastTwoInterfaces = false;
 
-    private NetworkInterface sameAsNetworkInterface1 = null;
+	private NetworkInterface networkInterface1 = null;
 
-    private NetworkInterface networkInterface2 = null;
+	private NetworkInterface sameAsNetworkInterface1 = null;
 
-    /**
-     * @tests java.net.NetworkInterface#getName()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getName",
-        args = {}
-    )
-    public void test_getName() {
-        if (atLeastOneInterface) {
-            assertNotNull("validate that non null name is returned",
-                    networkInterface1.getName());
-            assertFalse("validate that non-zero length name is generated",
-                    networkInterface1.getName().equals(""));
-        }
-        if (atLeastTwoInterfaces) {
-            assertFalse(
-                    "Validate strings are different for different interfaces",
-                    networkInterface1.getName().equals(
-                            networkInterface2.getName()));
-        }
-    }
+	private NetworkInterface networkInterface2 = null;
 
-    /**
-     * @tests java.net.NetworkInterface#getInetAddresses()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getInetAddresses",
-        args = {}
-    )
-    public void test_getInetAddresses() {
+	/**
+	 * @tests java.net.NetworkInterface#getName()
+	 */
+	public void test_getName() {
+		if (atLeastOneInterface) {
+			assertNotNull("validate that non null name is returned",
+					networkInterface1.getName());
+			assertFalse("validate that non-zero length name is generated",
+					networkInterface1.getName().equals(""));
+		}
+		if (atLeastTwoInterfaces) {
+			assertFalse(
+					"Validate strings are different for different interfaces",
+					networkInterface1.getName().equals(
+							networkInterface2.getName()));
+		}
+	}
 
-        // security manager that allows us to check that we only return the
-        // addresses that we should
-        class mySecurityManager extends SecurityManager {
+	/**
+	 * @tests java.net.NetworkInterface#getInetAddresses()
+	 */
+	public void test_getInetAddresses() throws Exception {
 
-            ArrayList disallowedNames = null;
+		// security manager that allows us to check that we only return the
+		// addresses that we should
+		class mySecurityManager extends SecurityManager {
 
-            public mySecurityManager(ArrayList addresses) {
-                disallowedNames = new ArrayList();
-                for (int i = 0; i < addresses.size(); i++) {
-                    disallowedNames.add(((InetAddress) addresses.get(i))
-                            .getHostName());
-                    disallowedNames.add(((InetAddress) addresses.get(i))
-                            .getHostAddress());
-                }
-            }
+			ArrayList disallowedNames = null;
 
-            public void checkConnect(String host, int port) {
+			public mySecurityManager(ArrayList addresses) {
+				disallowedNames = new ArrayList();
+				for (int i = 0; i < addresses.size(); i++) {
+					disallowedNames.add(((InetAddress) addresses.get(i))
+							.getHostName());
+					disallowedNames.add(((InetAddress) addresses.get(i))
+							.getHostAddress());
+				}
+			}
 
-                if (host == null) {
-                    throw new NullPointerException("host was null)");
-                }
+			public void checkConnect(String host, int port) {
 
-                for (int i = 0; i < disallowedNames.size(); i++) {
-                    if (((String) disallowedNames.get(i)).equals(host)) {
-                        throw new SecurityException("not allowed");
-                    }
-                }
-            }
+				if (host == null) {
+					throw new NullPointerException("host was null)");
+				}
 
-            public void checkPermission(Permission perm) {
-                // allow everything
-            }
-        }
+				for (int i = 0; i < disallowedNames.size(); i++) {
+					if (((String) disallowedNames.get(i)).equals(host)) {
+						throw new SecurityException("not allowed");
+					}
+				}
+			}
 
-        if (atLeastOneInterface) {
+		}
+
+		if (atLeastOneInterface) {
             Enumeration theAddresses = networkInterface1.getInetAddresses();
-            if (theAddresses != null) {
-                while (theAddresses.hasMoreElements()) {
-                    InetAddress theAddress = (InetAddress) theAddresses
-                            .nextElement();
-                    assertTrue("validate that address is not null",
-                            null != theAddress);
-                }
+            while (theAddresses.hasMoreElements()) {
+                InetAddress theAddress = (InetAddress) theAddresses
+                        .nextElement();
+                assertNotNull("validate that address is not null", theAddress);
             }
         }
 
-        if (atLeastTwoInterfaces) {
-            Enumeration theAddresses = networkInterface2.getInetAddresses();
-            if (theAddresses != null) {
-                while (theAddresses.hasMoreElements()) {
-                    InetAddress theAddress = (InetAddress) theAddresses
+		if (atLeastTwoInterfaces) {
+			Enumeration theAddresses = networkInterface2.getInetAddresses();
+			while (theAddresses.hasMoreElements()) {
+                InetAddress theAddress = (InetAddress) theAddresses
+                        .nextElement();
+                assertNotNull("validate that address is not null", theAddress);
+            }
+		}
+
+		// create the list of ok and not ok addresses to return
+		if (atLeastOneInterface) {
+			ArrayList okAddresses = new ArrayList();
+			Enumeration addresses = networkInterface1.getInetAddresses();
+			int index = 0;
+			ArrayList notOkAddresses = new ArrayList();
+			while (addresses.hasMoreElements()) {
+                InetAddress theAddress = (InetAddress) addresses.nextElement();
+                if (index != 0) {
+                    okAddresses.add(theAddress);
+                } else {
+                    notOkAddresses.add(theAddress);
+                }
+                index++;
+            }
+
+			// do the same for network interface 2 if it exists
+			if (atLeastTwoInterfaces) {
+				addresses = networkInterface2.getInetAddresses();
+				index = 0;
+				while (addresses.hasMoreElements()) {
+					InetAddress theAddress = (InetAddress) addresses
+							.nextElement();
+					if (index != 0) {
+						okAddresses.add(theAddress);
+					} else {
+						notOkAddresses.add(theAddress);
+					}
+					index++;
+				}
+			}
+
+			// set the security manager that will make the first address not
+			// visible
+			System.setSecurityManager(new mySecurityManager(notOkAddresses));
+
+			// validate not ok addresses are not returned
+			for (int i = 0; i < notOkAddresses.size(); i++) {
+				Enumeration reducedAddresses = networkInterface1
+						.getInetAddresses();
+				while (reducedAddresses.hasMoreElements()) {
+                    InetAddress nextAddress = (InetAddress) reducedAddresses
                             .nextElement();
-                    assertTrue("validate that address is not null",
-                            null != theAddress);
+                    assertTrue(
+                            "validate that address without permission is not returned",
+                            !nextAddress.equals(notOkAddresses.get(i)));
                 }
-            }
-        }
-
-        // create the list of ok and not ok addresses to return
-        if (atLeastOneInterface) {
-            ArrayList okAddresses = new ArrayList();
-            Enumeration addresses = networkInterface1.getInetAddresses();
-            int index = 0;
-            ArrayList notOkAddresses = new ArrayList();
-            if (addresses != null) {
-                while (addresses.hasMoreElements()) {
-                    InetAddress theAddress = (InetAddress) addresses
-                            .nextElement();
-                    if (index != 0) {
-                        okAddresses.add(theAddress);
-                    } else {
-                        notOkAddresses.add(theAddress);
-                    }
-                    index++;
-                }
-            }
-
-            // do the same for network interface 2 it it exists
-            if (atLeastTwoInterfaces) {
-                addresses = networkInterface2.getInetAddresses();
-                index = 0;
-                if (addresses != null) {
-                    while (addresses.hasMoreElements()) {
-                        InetAddress theAddress = (InetAddress) addresses
-                                .nextElement();
-                        if (index != 0) {
-                            okAddresses.add(theAddress);
-                        } else {
-                            notOkAddresses.add(theAddress);
-                        }
-                        index++;
-                    }
-                }
-            }
-
-            // set the security manager that will make the first address not
-            // visible
-            System.setSecurityManager(new mySecurityManager(notOkAddresses));
-
-            // validate not ok addresses are not returned
-            for (int i = 0; i < notOkAddresses.size(); i++) {
-                Enumeration reducedAddresses = networkInterface1
-                        .getInetAddresses();
-                if (reducedAddresses != null) {
-                    while (reducedAddresses.hasMoreElements()) {
-                        InetAddress nextAddress = (InetAddress) reducedAddresses
-                                .nextElement();
-                        assertTrue(
-                                "validate that address without permission is not returned",
-                                !nextAddress.equals(notOkAddresses.get(i)));
-                    }
-                }
-                if (atLeastTwoInterfaces) {
+				if (atLeastTwoInterfaces) {
                     reducedAddresses = networkInterface2.getInetAddresses();
-                    if (reducedAddresses != null) {
-                        while (reducedAddresses.hasMoreElements()) {
-                            InetAddress nextAddress = (InetAddress) reducedAddresses
-                                    .nextElement();
-                            assertTrue(
-                                    "validate that address without permission is not returned",
-                                    !nextAddress.equals(notOkAddresses.get(i)));
-                        }
+					while (reducedAddresses.hasMoreElements()) {
+						InetAddress nextAddress = (InetAddress) reducedAddresses
+								.nextElement();
+						assertTrue(
+								"validate that address without permission is not returned",
+								!nextAddress.equals(notOkAddresses.get(i)));
+					}
+				}
+			}
+
+			// validate that ok addresses are returned
+			for (int i = 0; i < okAddresses.size(); i++) {
+				boolean addressReturned = false;
+				Enumeration reducedAddresses = networkInterface1
+						.getInetAddresses();
+				while (reducedAddresses.hasMoreElements()) {
+                    InetAddress nextAddress = (InetAddress) reducedAddresses
+                            .nextElement();
+                    if (nextAddress.equals(okAddresses.get(i))) {
+                        addressReturned = true;
                     }
                 }
+				if (atLeastTwoInterfaces) {
+					reducedAddresses = networkInterface2.getInetAddresses();
+					while (reducedAddresses.hasMoreElements()) {
+						InetAddress nextAddress = (InetAddress) reducedAddresses
+								.nextElement();
+						if (nextAddress.equals(okAddresses.get(i))) {
+							addressReturned = true;
+						}
+					}
+				}
+				assertTrue("validate that address with permission is returned",
+						addressReturned);
+			}
+
+			// validate that we can get the interface by specifying the address.
+			// This is to be compatible
+			for (int i = 0; i < notOkAddresses.size(); i++) {
+                assertNotNull(
+                        "validate we cannot get the NetworkInterface with an address for which we have no privs",
+                        NetworkInterface
+                                .getByInetAddress((InetAddress) notOkAddresses
+                                        .get(i)));
             }
 
-            // validate that ok addresses are returned
-            for (int i = 0; i < okAddresses.size(); i++) {
-                boolean addressReturned = false;
-                Enumeration reducedAddresses = networkInterface1
-                        .getInetAddresses();
-                if (reducedAddresses != null) {
-                    while (reducedAddresses.hasMoreElements()) {
-                        InetAddress nextAddress = (InetAddress) reducedAddresses
-                                .nextElement();
-                        if (nextAddress.equals(okAddresses.get(i))) {
-                            addressReturned = true;
-                        }
-                    }
-                }
-                if (atLeastTwoInterfaces) {
-                    reducedAddresses = networkInterface2.getInetAddresses();
-                    if (reducedAddresses != null) {
-                        while (reducedAddresses.hasMoreElements()) {
-                            InetAddress nextAddress = (InetAddress) reducedAddresses
-                                    .nextElement();
-                            if (nextAddress.equals(okAddresses.get(i))) {
-                                addressReturned = true;
-                            }
-                        }
-                    }
-                }
-                assertTrue("validate that address with permission is returned",
-                        addressReturned);
+			// validate that we can get the network interface for the good
+			// addresses
+			for (int i = 0; i < okAddresses.size(); i++) {
+                assertNotNull(
+                        "validate we cannot get the NetworkInterface with an address fro which we have no privs",
+                        NetworkInterface
+                                .getByInetAddress((InetAddress) okAddresses
+                                        .get(i)));
             }
 
-            // validate that we can get the interface by specifying the address.
-            // This is to be compatible
-            for (int i = 0; i < notOkAddresses.size(); i++) {
-                try {
-                    assertNotNull(
-                            "validate we cannot get the NetworkInterface with an address for which we have no privs",
-                            NetworkInterface
-                                    .getByInetAddress((InetAddress) notOkAddresses
-                                            .get(i)));
-                } catch (Exception e) {
-                    fail("get NetworkInterface for address with no perm - exception");
-                }
-            }
+			System.setSecurityManager(null);
+		}
+	}
 
-            // validate that we can get the network interface for the good
-            // addresses
-            try {
-                for (int i = 0; i < okAddresses.size(); i++) {
-                    assertNotNull(
-                            "validate we cannot get the NetworkInterface with an address fro which we have no privs",
-                            NetworkInterface
-                                    .getByInetAddress((InetAddress) okAddresses
-                                            .get(i)));
-                }
-            } catch (Exception e) {
-                fail("get NetworkInterface for address with perm - exception");
-            }
+	/**
+	 * @tests java.net.NetworkInterface#getDisplayName()
+	 */
+	public void test_getDisplayName() {
+		if (atLeastOneInterface) {
+			assertNotNull("validate that non null display name is returned",
+					networkInterface1.getDisplayName());
+			assertFalse(
+					"validate that non-zero length display name is generated",
+					networkInterface1.getDisplayName().equals(""));
+		}
+		if (atLeastTwoInterfaces) {
+			assertFalse(
+					"Validate strings are different for different interfaces",
+					networkInterface1.getDisplayName().equals(
+							networkInterface2.getDisplayName()));
+		}
+	}
 
-            System.setSecurityManager(null);
-        }
-    }
-
-    /**
-     * @tests java.net.NetworkInterface#getDisplayName()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getDisplayName",
-        args = {}
-    )
-    public void test_getDisplayName() {
-        if (atLeastOneInterface) {
-            assertNotNull("validate that non null display name is returned",
-                    networkInterface1.getDisplayName());
-            assertFalse(
-                    "validate that non-zero lengtj display name is generated",
-                    networkInterface1.getDisplayName().equals(""));
-        }
-        if (atLeastTwoInterfaces) {
-            assertFalse(
-                    "Validate strings are different for different interfaces",
-                    networkInterface1.getDisplayName().equals(
-                            networkInterface2.getDisplayName()));
-        }
-    }
-
-    /**
-     * @tests java.net.NetworkInterface#getByName(java.lang.String)
-     */
-    @TestTargetNew(
-        level = TestLevel.SUFFICIENT,
-        notes = "SocketException checking missed.",
-        method = "getByName",
-        args = {java.lang.String.class}
-    )
-    public void test_getByNameLjava_lang_String() {
-        try {
-            assertNull("validate null handled ok",
+	/**
+	 * @tests java.net.NetworkInterface#getByName(java.lang.String)
+	 */
+	public void test_getByNameLjava_lang_String() throws Exception {
+		try {
+			assertNull("validate null handled ok",
                                    NetworkInterface.getByName(null));
-            fail("getByName did not throw NullPointerException for null argument");
-        } catch (NullPointerException e) {
-        } catch (Exception e) {
-            fail("getByName, null inetAddress - raised exception : "
-                    + e.getMessage());
-        }
+			fail("getByName did not throw NullPointerException for null argument");
+		} catch (NullPointerException e) {
+		} 
 
-        try {
-            assertNull("validate handled ok if we ask for name not associated with any interface",
-                                   NetworkInterface.getByName("8not a name4"));
-        } catch (Exception e) {
-            fail("getByName, unknown inetAddress - raised exception : "
-                    + e.getMessage());
-        }
+		assertNull("validate handled ok if we ask for name not associated with any interface",
+                                  NetworkInterface.getByName("8not a name4"));
 
-        // for each address in an interface validate that we get the right
-        // interface for that name
-        if (atLeastOneInterface) {
-            String theName = networkInterface1.getName();
-            if (theName != null) {
-                try {
-                    assertTrue(
-                            "validate that Interface can be obtained with its name",
-                            NetworkInterface.getByName(theName).equals(
-                                    networkInterface1));
-                } catch (Exception e) {
-                    fail("validate to get network interface using name - socket exception");
-                }
+		// for each address in an interface validate that we get the right
+		// interface for that name
+		if (atLeastOneInterface) {
+			String theName = networkInterface1.getName();
+			if (theName != null) {
+                assertEquals(
+                        "validate that Interface can be obtained with its name",
+                        networkInterface1, NetworkInterface.getByName(theName));
             }
-            try {
-                NetworkInterface.getByName(null);
-                fail("NullPointerException was not thrown.");
-            } catch(NullPointerException npe) {
-                //expected
-            } catch (SocketException e) {
-                fail("SocketException was thrown.");
+		}
+
+		// validate that we get the right interface with the second interface as
+		// well (ie we just don't always get the first interface
+		if (atLeastTwoInterfaces) {
+			String theName = networkInterface2.getName();
+			if (theName != null) {
+                assertEquals(
+                        "validate that Interface can be obtained with its name",
+                        networkInterface2, NetworkInterface.getByName(theName));
             }
-        }
+		}
+	}
 
-        // validate that we get the right interface with the second interface as
-        // well (ie we just don't always get the first interface
-        if (atLeastTwoInterfaces) {
-            String theName = networkInterface2.getName();
-            if (theName != null) {
-                try {
-                    assertTrue(
-                            "validate that Interface can be obtained with its name",
-                            NetworkInterface.getByName(theName).equals(
-                                    networkInterface2));
-                } catch (Exception e) {
-                    fail("validate to get network interface using name - socket exception");
-                }
-            }
-        }
-    }
+	/**
+	 * @tests java.net.NetworkInterface#getByInetAddress(java.net.InetAddress)
+	 */
+	public void test_getByInetAddressLjava_net_InetAddress() throws Exception {
 
-    /**
-     * @tests java.net.NetworkInterface#getByInetAddress(java.net.InetAddress)
-     */
-    @TestTargetNew(
-        level = TestLevel.SUFFICIENT,
-        notes = "SocketException checking missed.",
-        method = "getByInetAddress",
-        args = {java.net.InetAddress.class}
-    )
-    public void test_getByInetAddressLjava_net_InetAddress() {
+		byte addressBytes[] = new byte[4];
+		addressBytes[0] = 0;
+		addressBytes[1] = 0;
+		addressBytes[2] = 0;
+		addressBytes[3] = 0;
 
-        byte addressBytes[] = new byte[4];
-        addressBytes[0] = 0;
-        addressBytes[1] = 0;
-        addressBytes[2] = 0;
-        addressBytes[3] = 0;
-
-        try {
-            assertNull("validate null handled ok",
+		try {
+			assertNull("validate null handled ok",
                                    NetworkInterface.getByInetAddress(null));
-            fail("should not get here if getByInetAddress throws "
-                    + "NullPointerException if null passed in");
-        } catch (NullPointerException e) {
-        } catch (Exception e) {
-            fail("getByInetAddress, null inetAddress should have raised NPE"
-                    + " but instead threw a : " + e.getMessage());
-        }
+			fail("should not get here if getByInetAddress throws "
+					+ "NullPointerException if null passed in");
+		} catch (NullPointerException e) {
+		}
 
-        try {
-            assertNull("validate handled ok if we ask for address not associated with any interface",
-                                   NetworkInterface.getByInetAddress(InetAddress
-                            .getByAddress(addressBytes)));
-        } catch (Exception e) {
-            fail("getByInetAddress, unknown inetAddress threw exception : " + e);
-        }
+                assertNull("validate handled ok if we ask for address not associated with any interface",
+                           NetworkInterface.getByInetAddress(InetAddress
+                                                .getByAddress(addressBytes)));
 
-        // for each address in an interface validate that we get the right
-        // interface for that address
-        if (atLeastOneInterface) {
-            Enumeration addresses = networkInterface1.getInetAddresses();
-            if (addresses != null) {
-                while (addresses.hasMoreElements()) {
-                    InetAddress theAddress = (InetAddress) addresses
-                            .nextElement();
-                    try {
-                        assertTrue(
-                                "validate that Interface can be obtained with any one of its addresses",
-                                NetworkInterface.getByInetAddress(theAddress)
-                                        .equals(networkInterface1));
-                    } catch (Exception e) {
-                        fail("validate to get address using inetAddress " +
-                                "threw exception : " + e);
-                    }
-                }
+		// for each address in an interface validate that we get the right
+		// interface for that address
+		if (atLeastOneInterface) {
+			Enumeration addresses = networkInterface1.getInetAddresses();
+			while (addresses.hasMoreElements()) {
+                InetAddress theAddress = (InetAddress) addresses.nextElement();
+                assertEquals(
+                        "validate that Interface can be obtained with any one of its addresses",
+                        networkInterface1, NetworkInterface
+                                .getByInetAddress(theAddress));
             }
+		}
+
+		// validate that we get the right interface with the second interface as
+		// well (ie we just don't always get the first interface
+		if (atLeastTwoInterfaces) {
+			Enumeration addresses = networkInterface2.getInetAddresses();
+			while (addresses.hasMoreElements()) {
+                InetAddress theAddress = (InetAddress) addresses.nextElement();
+                assertEquals(
+                        "validate that Interface can be obtained with any one of its addresses",
+                        networkInterface2, NetworkInterface
+                                .getByInetAddress(theAddress));
+            }
+		}
+	}
+
+	/**
+	 * @tests java.net.NetworkInterface#getNetworkInterfaces()
+	 */
+	public void test_getNetworkInterfaces() throws Exception {
+
+		// really this is tested by all of the other calls but just make sure we
+		// can call it and get a list of interfaces if they exist
+		Enumeration theInterfaces = NetworkInterface.getNetworkInterfaces();
+	}
+
+	/**
+	 * @tests java.net.NetworkInterface#equals(java.lang.Object)
+	 */
+	public void test_equalsLjava_lang_Object() {
+		// Test for method boolean
+		// java.net.SocketPermission.equals(java.lang.Object)
+		if (atLeastOneInterface) {
+            assertEquals("If objects are the same true is returned",
+                    sameAsNetworkInterface1, networkInterface1);
+            assertNotNull("Validate Null handled ok", networkInterface1);
+        }
+		if (atLeastTwoInterfaces) {
+			assertFalse("If objects are different false is returned",
+					networkInterface1.equals(networkInterface2));
+		}
+	}
+
+	/**
+	 * @tests java.net.NetworkInterface#hashCode()
+	 */
+	public void test_hashCode() {
+
+		if (atLeastOneInterface) {
+			assertTrue(
+					"validate that hash codes are the same for two calls on the same object",
+					networkInterface1.hashCode() == networkInterface1
+							.hashCode());
+			assertTrue(
+					"validate that hash codes are the same for two objects for which equals is true",
+					networkInterface1.hashCode() == sameAsNetworkInterface1
+							.hashCode());
+		}
+	}
+
+	/**
+	 * @tests java.net.NetworkInterface#toString()
+	 */
+	public void test_toString() {
+		if (atLeastOneInterface) {
+			assertNotNull("validate that non null string is generated",
+					networkInterface1.toString());
+			assertFalse("validate that non-zero length string is generated",
+					networkInterface1.toString().equals(""));
+		}
+		if (atLeastTwoInterfaces) {
+			assertFalse(
+					"Validate strings are different for different interfaces",
+					networkInterface1.toString().equals(
+							networkInterface2.toString()));
+		}
+	}
+
+    private class MockSecurityManager extends SecurityManager {
+        @Override
+        public void checkConnect(String host, int port) {
+            throw new SecurityException();
+        }
+    }
+
+    /**
+     * 
+     * @tests java.net.NetworkInterface#getInterfaceAddresses()
+     * 
+     * @since 1.6
+     */
+    public void test_getInterfaceAddresses() throws SocketException {
+        if (theInterfaces != null) {
+            SecurityManager oldSM = System.getSecurityManager();
+            System.setSecurityManager(new MockSecurityManager());
             
-            try {
-                NetworkInterface.getByInetAddress(null);
-                fail("NullPointerException should be thrown.");
-            } catch(NullPointerException npe) {
-                //expected
-            } catch (SocketException e) {
-                fail("SocketException was thrown.");
+            while (theInterfaces.hasMoreElements()) {
+                NetworkInterface netif = theInterfaces.nextElement();
+                assertEquals(netif.getName()
+                        + " getInterfaceAddresses should contain no element", 0,
+                        netif.getInterfaceAddresses().size());
             }
-        }
-
-        // validate that we get the right interface with the second interface as
-        // well (ie we just don't always get the first interface
-        if (atLeastTwoInterfaces) {
-            Enumeration addresses = networkInterface2.getInetAddresses();
-            if (addresses != null) {
-                while (addresses.hasMoreElements()) {
-                    InetAddress theAddress = (InetAddress) addresses
-                            .nextElement();
-                    try {
-                        assertTrue(
-                                "validate that Interface can be obtained with any one of its addresses",
-                                NetworkInterface.getByInetAddress(theAddress)
-                                        .equals(networkInterface2));
-                    } catch (Exception e) {
-                        fail("validate to get address using inetAddress "
-                                + "threw exception : " + e);
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * @tests java.net.NetworkInterface#getNetworkInterfaces()
-     */
-    @TestTargetNew(
-        level = TestLevel.SUFFICIENT,
-        notes = "SocketException checking missed.",
-        method = "getNetworkInterfaces",
-        args = {}
-    )
-    public void test_getNetworkInterfaces() {
-
-        // really this is tested by all of the other calls but just make sure we
-        // can call it and get a list of interfaces if they exist
-        try {
-            Enumeration theInterfaces = NetworkInterface.getNetworkInterfaces();
-        } catch (Exception e) {
-            fail("get Network Interfaces - raised exception : "
-                    + e.getMessage());
-        }
-    }
-
-    /**
-     * @tests java.net.NetworkInterface#equals(java.lang.Object)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "equals",
-        args = {java.lang.Object.class}
-    )
-    public void test_equalsLjava_lang_Object() {
-        // Test for method boolean
-        // java.net.SocketPermission.equals(java.lang.Object)
-        if (atLeastOneInterface) {
-            assertTrue("If objects are the same true is returned",
-                    networkInterface1.equals(sameAsNetworkInterface1));
-            assertFalse("Validate Null handled ok", networkInterface1
-                    .equals(null));
-        }
-        if (atLeastTwoInterfaces) {
-            assertFalse("If objects are different false is returned",
-                    networkInterface1.equals(networkInterface2));
-        }
-    }
-
-    /**
-     * @tests java.net.NetworkInterface#hashCode()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "hashCode",
-        args = {}
-    )
-    public void test_hashCode() {
-
-        if (atLeastOneInterface) {
-            assertTrue(
-                    "validate that hash codes are the same for two calls on the same object",
-                    networkInterface1.hashCode() == networkInterface1
-                            .hashCode());
-            assertTrue(
-                    "validate that hash codes are the same for two objects for which equals is true",
-                    networkInterface1.hashCode() == sameAsNetworkInterface1
-                            .hashCode());
-        }
-    }
-
-    /**
-     * @tests java.net.NetworkInterface#toString()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toString",
-        args = {}
-    )
-    public void test_toString() {
-        if (atLeastOneInterface) {
-            assertNotNull("validate that non null string is generated",
-                    networkInterface1.toString());
-            assertFalse("validate that non-zero length string is generated",
-                    networkInterface1.toString().equals(""));
-        }
-        if (atLeastTwoInterfaces) {
-            assertFalse(
-                    "Validate strings are different for different interfaces",
-                    networkInterface1.toString().equals(
-                            networkInterface2.toString()));
-        }
-    }
-
-    protected void setUp() {
-
-        Enumeration theInterfaces = null;
-        try {
+            System.setSecurityManager(oldSM);
+            
             theInterfaces = NetworkInterface.getNetworkInterfaces();
-        } catch (Exception e) {
-            fail("Exception occurred getting network interfaces : " + e);
+            while (theInterfaces.hasMoreElements()) {
+                NetworkInterface netif = theInterfaces.nextElement();
+                List<InterfaceAddress> interfaceAddrs = netif.getInterfaceAddresses();
+                assertTrue(interfaceAddrs instanceof ArrayList);
+                for (InterfaceAddress addr : interfaceAddrs) {
+                    assertNotNull(addr);                    
+                }
+                
+                List<InterfaceAddress> interfaceAddrs2 = netif.getInterfaceAddresses();
+                // RI fails on this since it cannot tolerate null broadcast address. 
+                assertEquals(interfaceAddrs, interfaceAddrs2);              
+            }
         }
-        
-        // Set up NetworkInterface instance members. Note that because the call
-        // to NetworkInterface.getNetworkInterfaces() returns *all* of the 
-        // interfaces on the test machine it is possible that one or more of 
-        // them will not currently be bound to an InetAddress. e.g. a laptop
-        // running connected by a wire to the local network may also have a 
-        // wireless interface that is not active and so has no InetAddress 
-        // bound to it. For these tests only work with NetworkInterface objects 
-        // that are bound to an InetAddress.   
-        if ((theInterfaces != null) && (theInterfaces.hasMoreElements())) {
-            while ((theInterfaces.hasMoreElements())
-                    && (atLeastOneInterface == false)) {
-                NetworkInterface theInterface = (NetworkInterface) theInterfaces
-                        .nextElement();
-                if (theInterface.getInetAddresses() != null) {
-                    // Ensure that the current NetworkInterface has at least
-                    // one InetAddress bound to it.  
-                    Enumeration addrs = theInterface.getInetAddresses();
-                    if ((addrs != null) && (addrs.hasMoreElements())) {
-                        atLeastOneInterface = true;
-                        networkInterface1 = theInterface;
-                    }// end if 
-                }
-            }
-
-            while ((theInterfaces.hasMoreElements())
-                    && (atLeastTwoInterfaces == false)) {
-                NetworkInterface theInterface = (NetworkInterface) theInterfaces
-                        .nextElement();
-                if (theInterface.getInetAddresses() != null) {
-                    // Ensure that the current NetworkInterface has at least
-                    // one InetAddress bound to it.  
-                    Enumeration addrs = theInterface.getInetAddresses();
-                    if ((addrs != null) && (addrs.hasMoreElements())) {
-                        atLeastTwoInterfaces = true;
-                        networkInterface2 = theInterface;
-                    }// end if 
-                }
-            }
-
-            // Only set sameAsNetworkInterface1 if we succeeded in finding 
-            // at least one good NetworkInterface
-            if (atLeastOneInterface) {
-                Enumeration addresses = networkInterface1.getInetAddresses();
-                if (addresses != null) {
-                    try {
-                        if (addresses.hasMoreElements()) {
-                            sameAsNetworkInterface1 = NetworkInterface
-                            .getByInetAddress((InetAddress) addresses
-                                    .nextElement());
-                        }
-                    } catch (SocketException e) {
-                        fail("SocketException occurred : " + e);
+    }   
+    
+    /**
+     * @tests java.net.NetworkInterface#isLoopback()
+     * 
+     * @since 1.6
+     */
+    public void test_isLoopback() throws SocketException {  
+        if (theInterfaces != null) {
+            while (theInterfaces.hasMoreElements()) {
+                NetworkInterface netif = theInterfaces.nextElement();
+                boolean loopback = false;
+                Enumeration<InetAddress> addrs = netif.getInetAddresses();
+                while(addrs != null && addrs.hasMoreElements()){
+                    if(addrs.nextElement().isLoopbackAddress()){
+                        loopback = true;
+                        break;
                     }
                 }
-            }// end if atLeastOneInterface
+                assertEquals(loopback, netif.isLoopback());
+            }
         }
     }
-
-    protected void tearDown() {
-        System.setSecurityManager(null);
+    
+    /**
+     * @tests java.net.NetworkInterface#getHardwareAddress()
+     * 
+     * @since 1.6
+     */
+    public void test_getHardwareAddress() throws SocketException {
+        if (theInterfaces != null) {
+            while (theInterfaces.hasMoreElements()) {
+                NetworkInterface netif = theInterfaces.nextElement();
+                byte[] hwAddr = netif.getHardwareAddress();
+                if (netif.isLoopback()) {
+                    assertTrue(hwAddr == null || hwAddr.length == 0);
+                } else {
+                    assertTrue(hwAddr.length >= 0);
+                }
+            }
+        }
     }
+    
+    /**
+     * 
+     * @tests java.net.NetworkInterface#getHardwareAddress()
+     * 
+     * @since 1.6
+     */
+    public void test_getMTU() throws SocketException {      
+        if (theInterfaces != null) {
+            while (theInterfaces.hasMoreElements()) {
+                NetworkInterface netif = theInterfaces.nextElement();
+                assertTrue(netif.getName() + "has non-positive MTU", netif.getMTU() >= 0);
+            }           
+        }
+    }
+    
+	protected void setUp() throws SocketException {
+
+		Enumeration theInterfaces = null;
+		try {
+			theInterfaces = NetworkInterface.getNetworkInterfaces();
+		} catch (Exception e) {
+			fail("Exception occurred getting network interfaces : " + e);
+		}
+		
+		// Set up NetworkInterface instance members. Note that because the call
+		// to NetworkInterface.getNetworkInterfaces() returns *all* of the 
+		// interfaces on the test machine it is possible that one or more of 
+		// them will not currently be bound to an InetAddress. e.g. a laptop
+		// running connected by a wire to the local network may also have a 
+		// wireless interface that is not active and so has no InetAddress 
+		// bound to it. For these tests only work with NetworkInterface objects 
+		// that are bound to an InetAddress.   
+		if ((theInterfaces != null) && (theInterfaces.hasMoreElements())) {
+			while ((theInterfaces.hasMoreElements())
+					&& (atLeastOneInterface == false)) {
+				NetworkInterface theInterface = (NetworkInterface) theInterfaces
+						.nextElement();
+				if (theInterface.getInetAddresses().hasMoreElements()) {
+					// Ensure that the current NetworkInterface has at least
+					// one InetAddress bound to it.  
+					Enumeration addrs = theInterface.getInetAddresses();
+					if ((addrs != null) && (addrs.hasMoreElements())) {
+						atLeastOneInterface = true;
+						networkInterface1 = theInterface;
+					}// end if 
+				}
+			}
+
+			while ((theInterfaces.hasMoreElements())
+					&& (atLeastTwoInterfaces == false)) {
+				NetworkInterface theInterface = (NetworkInterface) theInterfaces
+						.nextElement();
+				if (theInterface.getInetAddresses().hasMoreElements()) {
+					// Ensure that the current NetworkInterface has at least
+					// one InetAddress bound to it.  
+					Enumeration addrs = theInterface.getInetAddresses();
+					if ((addrs != null) && (addrs.hasMoreElements())) {
+						atLeastTwoInterfaces = true;
+						networkInterface2 = theInterface;
+					}// end if 
+				}
+			}
+
+			// Only set sameAsNetworkInterface1 if we succeeded in finding 
+			// at least one good NetworkInterface
+			if (atLeastOneInterface) {
+				Enumeration addresses = networkInterface1.getInetAddresses();
+				if (addresses.hasMoreElements()) {
+					try {
+						if (addresses.hasMoreElements()) {
+							sameAsNetworkInterface1 = NetworkInterface
+							.getByInetAddress((InetAddress) addresses
+									.nextElement());
+						}
+					} catch (SocketException e) {
+						fail("SocketException occurred : " + e);
+					}
+				}
+			}// end if atLeastOneInterface
+		}
+        theInterfaces = NetworkInterface.getNetworkInterfaces();
+	}
+
+	protected void tearDown() {
+		System.setSecurityManager(null);
+	}
 }
diff --git a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/DOMImplementationImpl.java b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/DOMImplementationImpl.java
index 991a707..b662a13 100644
--- a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/DOMImplementationImpl.java
+++ b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/DOMImplementationImpl.java
@@ -46,7 +46,7 @@
 
     public DocumentType createDocumentType(String qualifiedName,
             String publicId, String systemId) throws DOMException {
-        return new DocumentTypeImpl(this, qualifiedName, publicId, systemId);
+        return new DocumentTypeImpl(null, qualifiedName, publicId, systemId);
     }
 
     public boolean hasFeature(String feature, String version) {
diff --git a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java
index b009128..b1802a6 100644
--- a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java
+++ b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java
@@ -33,6 +33,12 @@
 import org.w3c.dom.NodeList;
 import org.w3c.dom.ProcessingInstruction;
 import org.w3c.dom.Text;
+import org.w3c.dom.UserDataHandler;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.WeakHashMap;
 
 /**
  * Provides a straightforward implementation of the corresponding W3C DOM
@@ -60,14 +66,26 @@
     private boolean xmlStandalone = false;
     private boolean strictErrorChecking = true;
 
+    /**
+     * A lazily initialized map of user data values for this document's own
+     * nodes. The map is weak because the document may live longer than its
+     * nodes.
+     *
+     * <p>Attaching user data directly to the corresponding node would cost a
+     * field per node. Under the assumption that user data is rarely needed, we
+     * attach user data to the document to save those fields. Xerces also takes
+     * this approach.
+     */
+    private WeakHashMap<Node, Map<String, UserData>> nodeToUserData;
+
     public DocumentImpl(DOMImplementationImpl impl, String namespaceURI,
             String qualifiedName, DocumentType doctype, String inputEncoding) {
         super(null);
 
         this.domImplementation = impl;
         this.inputEncoding = inputEncoding;
-        // this.document = this;
-        
+        this.document = this;
+
         if (doctype != null) {
             appendChild(doctype);
         }
@@ -113,8 +131,6 @@
      * @return The new node.
      */
     Node cloneNode(Node node, boolean deep) throws DOMException {
-        // TODO: callback the UserDataHandler with a NODE_CLONED event
-
         Node target;
         
         switch (node.getNodeType()) {
@@ -191,10 +207,12 @@
                 target.appendChild(child);
             }
         }
-        
+
+        notifyUserDataHandlers(UserDataHandler.NODE_CLONED, node, target);
+
         return target;
     }
-    
+
     public AttrImpl createAttribute(String name) throws DOMException {
         return new AttrImpl(this, name);
     }
@@ -382,4 +400,48 @@
         // TODO: callback the UserDataHandler with a NODE_RENAMED event
         throw new UnsupportedOperationException(); // TODO
     }
+
+    /**
+     * Returns a map with the user data objects attached to the specified node.
+     * This map is readable and writable.
+     */
+    Map<String, UserData> getUserDataMap(Node node) {
+        if (nodeToUserData == null) {
+            nodeToUserData = new WeakHashMap<Node, Map<String, UserData>>();
+        }
+        Map<String, UserData> userDataMap = nodeToUserData.get(node);
+        if (userDataMap == null) {
+            userDataMap = new HashMap<String, UserData>();
+            nodeToUserData.put(node, userDataMap);
+        }
+        return userDataMap;
+    }
+
+    /**
+     * Returns a map with the user data objects attached to the specified node.
+     * The returned map may be read-only.
+     */
+    Map<String, UserData> getUserDataMapForRead(Node node) {
+        if (nodeToUserData == null) {
+            return Collections.emptyMap();
+        }
+        Map<String, UserData> userDataMap = nodeToUserData.get(node);
+        return userDataMap == null
+                ? Collections.<String, UserData>emptyMap()
+                : userDataMap;
+    }
+
+    /**
+     * Calls {@link UserDataHandler#handle} on each of the source node's
+     * value/handler pairs.
+     */
+    private void notifyUserDataHandlers(short operation, Node src, Node dst) {
+        for (Map.Entry<String, UserData> entry : getUserDataMapForRead(src).entrySet()) {
+            UserData userData = entry.getValue();
+            if (userData.handler != null) {
+                userData.handler.handle(
+                        operation, entry.getKey(), userData.value, src, dst);
+            }
+        }
+    }
 }
diff --git a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/DocumentTypeImpl.java b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/DocumentTypeImpl.java
index 67947b7..b0e8eda 100644
--- a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/DocumentTypeImpl.java
+++ b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/DocumentTypeImpl.java
@@ -31,7 +31,7 @@
  * the DOM implementation can easily access them while maintaining the DOM tree
  * structure.
  */
-public class DocumentTypeImpl extends LeafNodeImpl implements DocumentType {
+public final class DocumentTypeImpl extends LeafNodeImpl implements DocumentType {
 
     private String qualifiedName;
 
@@ -39,9 +39,9 @@
 
     private String systemId;
 
-    DocumentTypeImpl(DOMImplementationImpl impl, String qualifiedName,
+    public DocumentTypeImpl(DocumentImpl document, String qualifiedName,
             String publicId, String systemId) {
-        super(null);
+        super(document);
 
         if (qualifiedName == null || "".equals(qualifiedName)) {
             throw new DOMException(DOMException.NAMESPACE_ERR, qualifiedName);
diff --git a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/ElementImpl.java b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/ElementImpl.java
index df1383d..e272a3e 100644
--- a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/ElementImpl.java
+++ b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/ElementImpl.java
@@ -315,7 +315,7 @@
     public Attr setAttributeNode(Attr newAttr) throws DOMException {
         AttrImpl newAttrImpl = (AttrImpl) newAttr;
         
-        if (newAttrImpl.document != this.getOwnerDocument()) {
+        if (newAttrImpl.document != this.document) {
             throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null);
         }
 
@@ -340,7 +340,7 @@
     public Attr setAttributeNodeNS(Attr newAttr) throws DOMException {
         AttrImpl newAttrImpl = (AttrImpl) newAttr;
 
-        if (newAttrImpl.document != this.getOwnerDocument()) {
+        if (newAttrImpl.document != this.document) {
             throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null);
         }
 
diff --git a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/InnerNodeImpl.java b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/InnerNodeImpl.java
index fa75e21..bd4affb 100644
--- a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/InnerNodeImpl.java
+++ b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/InnerNodeImpl.java
@@ -43,7 +43,7 @@
     // Maintained by LeafNodeImpl and ElementImpl.
     List<LeafNodeImpl> children = new ArrayList<LeafNodeImpl>();
 
-    public InnerNodeImpl(DocumentImpl document) {
+    protected InnerNodeImpl(DocumentImpl document) {
         super(document);
     }
 
diff --git a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/NamedNodeMapImpl.java b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/NamedNodeMapImpl.java
index 0952d83..6eb8efa 100644
--- a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/NamedNodeMapImpl.java
+++ b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/NamedNodeMapImpl.java
@@ -121,7 +121,7 @@
         
         // All nodes in the map must belong to the same document.
         if (list.size() != 0) {
-            Document document = list.get(0).getOwnerDocument();
+            Document document = list.get(0).document;
 
             if (document != null && arg.getOwnerDocument() != document) {
                 throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null);
@@ -151,7 +151,7 @@
         
         // All nodes in the map must belong to the same document.
         if (list.size() != 0) {
-            Document document = list.get(0).getOwnerDocument();
+            Document document = list.get(0).document;
 
             if (document != null && arg.getOwnerDocument() != document) {
                 throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null);
diff --git a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java
index 24ed102..8376689 100644
--- a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java
+++ b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java
@@ -29,6 +29,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * A straightforward implementation of the corresponding W3C DOM node.
@@ -45,7 +46,6 @@
 
     private static final NodeList EMPTY_LIST = new NodeListImpl();
     
-    // Maintained by InnerNodeImpl and ElementImpl.
     DocumentImpl document;
 
     NodeImpl(DocumentImpl document) {
@@ -98,8 +98,8 @@
         return null;
     }
 
-    public Document getOwnerDocument() {
-        return document;
+    public final Document getOwnerDocument() {
+        return document == this ? null : document;
     }
 
     public Node getParentNode() {
@@ -308,7 +308,7 @@
                 }
                 // create a text node to hold the given content
                 if (textContent != null && textContent.length() != 0) {
-                    appendChild(getOwnerDocument().createTextNode(textContent));
+                    appendChild(document.createTextNode(textContent));
                 }
                 return;
 
@@ -585,12 +585,32 @@
         return isSupported(feature, version) ? this : null;
     }
 
-    public Object setUserData(String key, Object data,
-            UserDataHandler handler) {
-        throw new UnsupportedOperationException(); // TODO
+    public final Object setUserData(String key, Object data, UserDataHandler handler) {
+        if (key == null) {
+            throw new NullPointerException();
+        }
+        Map<String, UserData> map = document.getUserDataMap(this);
+        UserData previous = data == null
+                ? map.remove(key)
+                : map.put(key, new UserData(data, handler));
+        return previous != null ? previous.value : null;
     }
 
-    public Object getUserData(String key) {
-        throw new UnsupportedOperationException(); // TODO
+    public final Object getUserData(String key) {
+        if (key == null) {
+            throw new NullPointerException();
+        }
+        Map<String, UserData> map = document.getUserDataMapForRead(this);
+        UserData userData = map.get(key);
+        return userData != null ? userData.value : null;
+    }
+
+    static class UserData {
+        final Object value;
+        final UserDataHandler handler;
+        UserData(Object value, UserDataHandler handler) {
+            this.value = value;
+            this.handler = handler;
+        }
     }
 }
diff --git a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/TextImpl.java b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/TextImpl.java
index d39dff2..7b61b02 100644
--- a/libcore/xml/src/main/java/org/apache/harmony/xml/dom/TextImpl.java
+++ b/libcore/xml/src/main/java/org/apache/harmony/xml/dom/TextImpl.java
@@ -47,7 +47,7 @@
     }
 
     public final Text splitText(int offset) throws DOMException {
-        Text newText = getOwnerDocument().createTextNode(
+        Text newText = document.createTextNode(
                 substringData(offset, getLength() - offset));
         deleteData(0, offset);
 
diff --git a/libcore/xml/src/main/java/org/apache/harmony/xml/parsers/DocumentBuilderImpl.java b/libcore/xml/src/main/java/org/apache/harmony/xml/parsers/DocumentBuilderImpl.java
index 4b273fe..f3956f8 100644
--- a/libcore/xml/src/main/java/org/apache/harmony/xml/parsers/DocumentBuilderImpl.java
+++ b/libcore/xml/src/main/java/org/apache/harmony/xml/parsers/DocumentBuilderImpl.java
@@ -25,6 +25,7 @@
 
 import org.apache.harmony.xml.dom.CDATASectionImpl;
 import org.apache.harmony.xml.dom.DocumentImpl;
+import org.apache.harmony.xml.dom.DocumentTypeImpl;
 import org.apache.harmony.xml.dom.TextImpl;
 import org.kxml2.io.KXmlParser;
 import org.w3c.dom.Attr;
@@ -242,8 +243,8 @@
                     if (sysid != null && sysid.length() >= 2 && sysid.startsWith("\"") && sysid.endsWith("\"")) {
                         sysid = sysid.substring(1, sysid.length() - 1);
                     }
-                    
-                    document.appendChild(dom.createDocumentType(name, pubid, sysid));
+
+                    document.appendChild(new DocumentTypeImpl(document, name, pubid, sysid));
                 }
                 
             } else if (token == XmlPullParser.COMMENT) {
diff --git a/libcore/xml/src/test/java/tests/xml/DomTest.java b/libcore/xml/src/test/java/tests/xml/DomTest.java
index 69e8b37..0bb27dc 100644
--- a/libcore/xml/src/test/java/tests/xml/DomTest.java
+++ b/libcore/xml/src/test/java/tests/xml/DomTest.java
@@ -31,6 +31,7 @@
 import org.w3c.dom.Notation;
 import org.w3c.dom.ProcessingInstruction;
 import org.w3c.dom.Text;
+import org.w3c.dom.UserDataHandler;
 import org.xml.sax.InputSource;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -44,7 +45,11 @@
 import java.io.StringWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
+
+import static org.w3c.dom.UserDataHandler.NODE_CLONED;
 
 /**
  * Construct a DOM and then interrogate it.
@@ -87,6 +92,7 @@
     private Element name;
     private Attr standard;
     private Attr deluxe;
+    private Text waffles;
     private Element description;
     private Text descriptionText1;
     private CDATASection descriptionText2;
@@ -128,6 +134,7 @@
         name = (Element) item.getChildNodes().item(1);
         standard = name.getAttributeNode("a:standard");
         deluxe = name.getAttributeNode("deluxe");
+        waffles = (Text) name.getChildNodes().item(0);
         description = (Element) item.getChildNodes().item(3);
         descriptionText1 = (Text) description.getChildNodes().item(0);
         descriptionText2 = (CDATASection) description.getChildNodes().item(1);
@@ -153,7 +160,7 @@
         }
 
         allNodes.addAll(Arrays.asList(document, doctype, menu, item, itemXmlns,
-                itemXmlnsA, name, standard, deluxe, description,
+                itemXmlnsA, name, standard, deluxe, waffles, description,
                 descriptionText1, descriptionText2, descriptionText3, option1,
                 option2, option2Reference, wafflemaker, nutrition, vitamins,
                 vitaminsXmlnsA, comment, vitaminc, vitamincText));
@@ -740,6 +747,87 @@
         assertEquals(expected, domToString(document));
     }
 
+    public void testUserDataAttachments() {
+        Object a = new Object();
+        Object b = new Object();
+        for (Node node : allNodes) {
+            node.setUserData("a", a, null);
+            node.setUserData("b", b, null);
+        }
+        for (Node node : allNodes) {
+            assertSame(a, node.getUserData("a"));
+            assertSame(b, node.getUserData("b"));
+            assertEquals(null, node.getUserData("c"));
+            assertEquals(null, node.getUserData("A"));
+        }
+    }
+
+    public void testUserDataRejectsNullKey() {
+        try {
+            menu.setUserData(null, "apple", null);
+            fail();
+        } catch (NullPointerException e) {
+        }
+        try {
+            menu.getUserData(null);
+            fail();
+        } catch (NullPointerException e) {
+        }
+    }
+
+    /**
+     * A shallow clone requires cloning the attributes but not the child nodes.
+     */
+    public void testUserDataHandlerNotifiedOfShallowClones() {
+        RecordingHandler handler = new RecordingHandler();
+        name.setUserData("a", "apple", handler);
+        name.setUserData("b", "banana", handler);
+        standard.setUserData("c", "cat", handler);
+        waffles.setUserData("d", "dog", handler);
+
+        Element clonedName = (Element) name.cloneNode(false);
+        Attr clonedStandard = clonedName.getAttributeNode("a:standard");
+
+        Set<String> expected = new HashSet<String>();
+        expected.add(notification(NODE_CLONED, "a", "apple", name, clonedName));
+        expected.add(notification(NODE_CLONED, "b", "banana", name, clonedName));
+        expected.add(notification(NODE_CLONED, "c", "cat", standard, clonedStandard));
+        assertEquals(expected, handler.calls);
+    }
+
+    /**
+     * A deep clone requires cloning both the attributes and the child nodes.
+     */
+    public void testUserDataHandlerNotifiedOfDeepClones() {
+        RecordingHandler handler = new RecordingHandler();
+        name.setUserData("a", "apple", handler);
+        name.setUserData("b", "banana", handler);
+        standard.setUserData("c", "cat", handler);
+        waffles.setUserData("d", "dog", handler);
+
+        Element clonedName = (Element) name.cloneNode(true);
+        Attr clonedStandard = clonedName.getAttributeNode("a:standard");
+        Text clonedWaffles = (Text) clonedName.getChildNodes().item(0);
+
+        Set<String> expected = new HashSet<String>();
+        expected.add(notification(NODE_CLONED, "a", "apple", name, clonedName));
+        expected.add(notification(NODE_CLONED, "b", "banana", name, clonedName));
+        expected.add(notification(NODE_CLONED, "c", "cat", standard, clonedStandard));
+        expected.add(notification(NODE_CLONED, "d", "dog", waffles, clonedWaffles));
+        assertEquals(expected, handler.calls);
+    }
+
+    private class RecordingHandler implements UserDataHandler {
+        final Set<String> calls = new HashSet<String>();
+        public void handle(short operation, String key, Object data, Node src, Node dst) {
+            calls.add(notification(operation, key, data, src, dst));
+        }
+    }
+
+    private String notification(short operation, String key, Object data, Node src, Node dst) {
+        return "op:" + operation + " key:" + key + " data:" + data + " src:" + src + " dst:" + dst;
+    }
+
     private String domToString(Document document) throws TransformerException {
         StringWriter writer = new StringWriter();
         transformer.transform(new DOMSource(document), new StreamResult(writer));
diff --git a/vm/Thread.c b/vm/Thread.c
index 338c8b9..b2d5776 100644
--- a/vm/Thread.c
+++ b/vm/Thread.c
@@ -720,7 +720,6 @@
                     complained = true;
                     LOGD("threadid=%d: waiting briefly for daemon suspension\n",
                         threadId);
-                    // TODO: JIT can get stuck, dvmJitUnchainAll doesn't help?
                 }
             }
 
diff --git a/vm/compiler/Compiler.c b/vm/compiler/Compiler.c
index 597fbb2..e9b30de 100644
--- a/vm/compiler/Compiler.c
+++ b/vm/compiler/Compiler.c
@@ -544,6 +544,10 @@
 {
     void *threadReturn;
 
+    /* Disable new translation requests */
+    gDvmJit.pProfTable = NULL;
+    gDvmJit.pProfTableCopy = NULL;
+
     if (gDvm.verboseShutdown) {
         dvmCompilerDumpStats();
         while (gDvmJit.compilerQueueLength)
@@ -564,20 +568,16 @@
             LOGD("Compiler thread has shut down\n");
     }
 
-    dvmDestroyMutex(&gDvmJit.tableLock);
-    dvmDestroyMutex(&gDvmJit.compilerLock);
-    dvmDestroyMutex(&gDvmJit.compilerICPatchLock);
+    /* Break loops within the translation cache */
+    dvmJitUnchainAll();
 
-    if (gDvmJit.pJitEntryTable) {
-        free(gDvmJit.pJitEntryTable);
-        gDvmJit.pJitEntryTable = NULL;
-    }
-
-    if (gDvmJit.pProfTable) {
-        free(gDvmJit.pProfTable);
-        gDvmJit.pProfTable = NULL;
-    }
-
+    /*
+     * NOTE: our current implementatation doesn't allow for the compiler
+     * thread to be restarted after it exits here.  We aren't freeing
+     * the JitTable or the ProfTable because threads which still may be
+     * running or in the process of shutting down may hold references to
+     * them.
+     */
 }
 
 void dvmCompilerStateRefresh()